Skip to content

Learnings – 13th May

May 13, 2007

Today is Mother’s Day πŸ™‚

I have realized today that what I lack in life the most is “Strict Discipline”. I have often attempted to align my activities in life – but not in the most serious way – but I think it is now the right time to do it with complete dedication.

I shall be posting my EJB 3.0 learnings on this site. I shall be ready (~~ in a skeleton way ) to give exam on 12th of June. Would be cementing my learnings from there on.

13th May 2007

=>>> I have finished with a quick reading of Persistence and Entities and now need to run a good sample applic. Almost forgotten the first ejb app I made. Sequence of activities to do is as follows:
1. Mastering ejb sample app – today
2. Redo – Orielly sample app – today
3. Read apress = persistence – 3 chaps – today
4. Read Orielly – EJB Designing application chapter. – today

5. Build my own – Competency Management sample application – very simple
with one – custom grid control. [ this is the biggest activity]
**Should take 7 days time minimum

========>> { Phew – I must be tired now πŸ˜‰ }
6. Read chapters of Transaction,Security,Exception,TimerServices and Web Services
** 3 days
7. Makes notes on intro – ejb – basic role definition ** 2 days
8. Make a sample app for Timer and Web Services ** 3 days
===>> Now are you ready for going through the specifications.? ( ** 7 days)

=====================
……………………….25th April 2007……………………………………….

First i created a local/remote interface with create and find methods…..javax.ejb.Stateless,Remote;
then created bean that implemented that methods and had a EntityManager reference in it….
then created the data class – @Id is mandatory so put that…..

Entitymanager.find method uses generics to return object of that class type πŸ™‚
Oye wah – they have separated the API docs for EJB and Persistence package….

@Column and @Id have to be kept at the level of Getters and not – at the level of bean variable declaration….

the annotations are mostly title upper cased – \
QQQQQ////
1. is the column name case sensitive – as it does it have to be put in caps?
2. does find work with Object as a parameter?? – check persistence aPI.
3. jta-data-source – what does this mean?

hmm didnt declare exceptions anywhere?
3 classes are done with the coding – need to look up persistence API.
now would create the config files….

ok created the persistence.xml file in META-INF folder – having persistence and persistence unit tag with property for DS.
ok now i create the build.xml in which okay i need to learn things over here….
ok how does one do “ECHO” in ant file??? no idea – wd need to google!! πŸ˜€

then clean the directory – create build directory
put compiled classes and META INF folder in it
then create the JAR file

after build.xml is done
Create the client config folder and client class and all config files needed for client to work…

QQQQQ////what does one mean by forking?? – and creating a new JVM?

done….that reminds me – do u know a lot abt classloader? πŸ˜‰ – see how LG works !!
Classloader – has bootstrap – loading self classes, then extension loading(which looks in ext folder) and then system(which looks in classpath)
If you put the file in the endorsed folder (You can override the JAXP or the corba classes. But cannot override the system classes. Endorsed Standards Override Mechanism.

With customized classloader – SecureClassLoader/ URLClassLoader —>
❑ Search a database instead of a file system for classes.
❑ Load different classes with the same fully qualified name.
❑ Swap your classes with new versions at run-time.
❑ Load classes before you need them.

CORE Class Loading Restriction
– Only bootstrapper can load the core java classes
– All classloaders are having their own namespaces – so the com.ea.sh for classloader A is difft from com.ea.sh for classloaderB. No classes in same package across two difft classloaders can see each other.

it’s not possible for any class loader written in Java to instantiate a core Java class. The
ClassLoader abstract class (from which all class loaders must descend) blocks the creation of any class whose fully qualified name begins with java. Thus, no false java.* classes can be caught hanging around. Because the bootstrap class loader is not written in Java and does not descend from ClassLoader, it is not itself subject to this restriction.
By implication, this restriction indicates that all class loaders must at least delegate to the bootstrap class loader. Otherwise, when the class is loaded, there is no way for its class loader to load java.lang.Object,
from which all objects must descend.

With a Security Manager and its associated policy files, you can disallow (or allow) a large number of
tasks. For example, a program can be prevented from opening a socket to some network host, or be prevented
from opening files on the local file system. In addition, of course, an application can be prevented
from loading a class loader. Developers have the following options for preventing class loader-related
operations:
❑ Prevent the loading of any class loader.
❑ Prevent a reference to any class loader being obtained (including the system class loader).
❑ Prevent the context class loader of any thread being changed.
Only two steps are required:
1. Configure a policy file with the permissions you want for a given application.
2. Turn on the application’s Security Manager.

JDBC = set of interfaces – implemented by the Vendor specific JDBC drivers….
I remember RF talked of 4 drivers – can u please list them over here???

JDBC – Classloader loads the driver and then the DriverManager connects to the database – specifying the protocol.
However, can use DataSource – object – that has pooling mgmt in built and container uses JNDI to store implementation of the DataSource objects.
PreparedStatement, CallableStatement classes. rs.getInt(1) ; starts from 1 and not 0….

QQQQQ////okay now what abt JNDI – need to read up on that one? how does LX implement datasource – need to read up on that one as well.

compilation – imports problem and persistenceContext needs () not {}
also – Column annotation has name to be used for specifying db column name.
Hurray!!!! sTravel.jar has been finally deployed in jboss 4.05 πŸ™‚ Cool!

okay now I need to know how does the hypersonics database that comes with jboss work?
Let me try opening its interface and see the room table structure.
After doint that I create a table called room in the database and then –
configure in persistence.xml to talk to oracle. Download the oracle sql developer package and then access the db. View the record inserted….. by the client.

1. hypersonics db –>Done…. who owns rights for this database???
2. oracle db –> let us point titan to oracle db?
3. create client….
========================================================
………………………….Ant Learnings…………………………………………..

OK Wow – I made my first build.xml file and no probs – just did echo in each of the targets.
then started with the target named “clean” – used delete task for that….
then – problem is – need to understand fileset implications

echo message=”da:${line.separator}”
wow – okay i ll move this to ant.learning.txt file. πŸ™‚
ok.

now – properties – can name,value or file . Best to put in file in greater than 3/4
i can see some system properties can also be accessed
java/os/user etc…

can jar the file – destfile,basedir and excludes…

zipfilesets – has prefix, fullpath….

javac srcdir,destdir,classpath,debug,source(java version), includes,
excludes

fileset – grp of files, matched by pattern sets and selectors
include,exclude – OR–> filename name= “da” // negate

java classname arg value
classpath………>>> pathelement location/path….
fork = true

copy todir ,
from fileSet (with above rules) and
globmapper from=”*” to=”*.bak” – all files
copied with back up extension .bak πŸ˜€ cool nah…

delete – file = or dir = or fileset (with its rules above).

tsttmp DSTAMP, TSTAMP, TODAY – ???

java

mail – mailhost mailport subject
from address
replyto address
message

exec – sets path or open file in browser…
dependset – removes target if src files are new than target
even i love the mail tag – this will ensure that
whenever a build is run then mail is sent to the builder…
good..good.

path has attributes – location,path,refid and elements are pathelement , fileset and path
how does one echo the classpath in ant?? OR how does one echo the environment variables like classpath or path in ant?

property environment=”env” ;;;;;what else can be set as this??

Advertisements
No comments yet

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: