aravind's webstudy
About Me
- aravind gaani page
- ఏదైనా సబ్జెక్టు లో కి డీప్ గా దిగకుంటే నాకు నిద్ర పట్టదు
Sunday, September 30, 2007
All_in_one_table
Understanding each row is very important
Note : A few errors might have crept in.. If there are any ,they would be corrected so please always check the newest page ....
| Stateless | Stateful | Entity |
Pool Creation (pool of beans is always non-dedicated beans) | Yes 1.call setSessionContext(<..>), Followed by ejbCreate(). If pooling is supported every bean must be taken from pool | No | Yes 1.call setEntityContext(<..>) *does not call ejbCreate(<..>) because parameterized create invocation makes a bean dedicated If pooling is supported every bean must be taken from pool for even getting dedicated bean .. if not passivate some other bean |
Dedicated Beans? | No
as session beans don’t need dedicated bean | Yes
or
______________________ Methods on dedicated : 1.all service methods 2.ejbPassivate();(container calls, not client) | Yes 1. picks one bean from pool ,invokes ejbCreate(<..>) , Makes bean dedicated Or 2.There is no free bean in pool , so , passivate an inactive dedicated bean , reset and reinitialize for the present client. ______________________ Methods on dedicated : 1.all service methods 2.ejbStore() and ejbPassivate(();(container calls ,not client) |
Methods on dedicated : None | |||
Non- Dedicated beans | Yes 1.picks one bean from pool ,invokes service method sends back to pool * as session beans don’t need dedicated bean **Methods on Non-dedicated : all service methods SentBack to Pool ? Yes | No .. For a small period of time, a non-dedicated bean exists .. Some passive bean was passivated ,becomes non dedicated but immediately becomes dedicated by swapping a client specific data from persistent storage Into bean ** there is a diff between entity bean persistence and stateful bean persistence.. Swapping means cut and paste , cut from persistent storage And paste it to your stateful bean .. So when remove() is called on stateful , bean ,bean instance is destroyed, session data is lost.., (cant be retrieved again) | Yes 1.picks one bean from pool ,invokes finder /home service/ejbRemove method sends back to pool *Home service method is a special method which operates on entire table of DB rather than specific row.. If it executes ejbCreate(<..>) bean become dedicated SentBack to Pool ? Yes and No **Methods on Non-dedicated which send bean back to pool : 1.finder methods 2.Home Service method,ejbHome..(..) 3.ejbRemove() **Methods on Non-dedicated which don’t send bean back to pool : 1.ejbCreate(<..>) |
ejbStore() | NA | NA | 1.to synchronize data b/w bean and DB or 2.called before passivation Called on : Dedicated |
ejbLoad() | NA | NA | 1.to synchronize data b/w bean and DB or 2.after activation : In this case , the bean is for a brief period in non-dedicated state so use ctx.getPrimaryKey(); |
ejbRemove() | Destroys bean Object is GCed as container nullifies the reference to bean **can be Called by container to reduce pool size Or when client calls remove() on home or EJBObjects, The container may/may not call ejbRemove(); as it may be pooled for reusing | Bean will be destroyed so session data is destroyed *client can call remove() on home or EJBObjects To logout his session Strictly speaking container has to call ejbRemove() in this case, but due to container crashes ,may not be called Or *container may call when session expires | ** takes a non-dedicated beansideNotes1 from Pool , Removes DB record Goes back to pool *only client can call remove() on home or EJBObjects ** as a non-dedicated bean services this, use ctx.getPrimaryKey(); |
ejbPostCreate(<..>) | NA | NA | Called after ejbCreate(<..>) |
ejbPassivate() | NA | close resources ** don’t write persistence logic here Container may use java serialization to persist | close resources ** Don’t write persistence logic here Use ejbStore() ejbStore() call precedes ejbPassivate() |
ejbActivate() | NA | open resources ** don’t write persistence logic here Container may use java serialization to persist | open resources ** Don’t write persistence logic here Use ejbLoad() ejbActivate() precedes ejbLoad(); |
Finder methods | NA | NA | Go-back bean from pool taken ,returns single PK/Collection of PKs, goes back to pool *Container constructs new dedicated beans(takes beans from pool) ,associates them EJBObjects, Sends back Collection of EJBObject references /single EJBObject references *Please don’t initialize bean’s state in finder method.., Finder method should not make a bean dedicated |
Learn_easy_EJB
Novice Users need something more to start with rather than diving to this section..
------------------------------>
Let us start.. To simplify the understanding i have used my own terminology to explain the concepts. Please Note that these terms are not part of specifications from Sun..
------------------------------->
For the simplicity of explanation of EJBs let us categorize beans as
Dedicated EJBean and Random EJBean..
B.1.Dedicated EJBean is one which gives services to a specific client,It means that the dedicated EJBean must be a specific one to the client..,
Dedicated are required only for stateful session and entity beans
So They can be taken from pool and initialized or new bean may be created & initialized on demand or something else is passivated and reinitialized to become dedicated to the present client
Examples:
Entity :
a) beans can be taken from pool and initialized (entity beans) to make them dedicated
Stateful :
A)if it’s a new request for the first time and If the limit for the number of stateful beans is not reached yet new stateful bean is instantiated and initialized with client session data
b) not a new request but the dedicated object for that client is not found (might have been passivated) ,one of the in-memory dedicated beans(for diff clients) is passivated and its reused to initialize a new dedicated bean ( stateful session beans)
B.2. Random(non dedicated) EJBean is one which is picked up on demand from a BEAN POOL to service a client request , and sent back to pool againimp .. that means there are certain type of requests for which Dedicate EJBean is not necessary …
Section C :
Which Beans are necessary in different conditions??
a) Stateless Session Beans ???
Methods of stateless session beans don’t depend on client state data Nor need client data to provide service..
So Any Random EJBean(Stateless Session Beans) can provide a service
Thus solution for this ?
Pick up a random bean from POOL , execute method(providng service)
The random bean goes back to pool .(may be picked up to service another client request)
b) Stateful Session Beans ???
There Is no concept of pooling at all.. (virtual Pooling)
No question of Random picking..
Each service method must be executed on a dedicated stateful bean
Check section A.
Do they require any random beans? No
c) Entity Beans ???
Pooling concept is present ..
Because there are certain methods which can be executed on non-dedicated beans.
Eg:
-- findByPrimaryKey(<..>) Is called on a homeobject.
--Container picks a random(non dedicated) bean from pool , executes
--ejbFindByPrimaryKey(<..>) , the method gives back PK class and
--The random bean goes back to pool
--container based on PK , creates a new dedicated bean(picks a random one from pool ), creates EJBObject ,gives back to client
Dedicate beans are needed ? yes
--To service business methods on data like getting setting manipulating etc.,
Section A :
For simplicity let us categorize methods as create,find and service methods
A.1.Create method à for initializing a bean with either a specific client session data/specific business data or none of them
Note : create methods don’t create or instantiate bean instances, they are for initializing an already instantiated bean
ü Whenever a parameterized create is called , then that bean will become dedicated..
ü ejbCreate() doesn’t make a bean dedicated as it has no parameters
ü ejbCreate(<..>) makes the bean dedicated
A.2,Service Method : these methods give services like setting/getting or other business process logic
Note : service methods of stateless session Beans are not specific to any client ,so they don’t depend on client data/session data
A.3.Find methods :
They are not for initializing with the help of parameters ,
They are just for finding ..
You can consider these methods are like service methods of stateless session beans .
After Find methods bean is not dedicated it can be sent back to pool
Tuesday, June 26, 2007
J2EE-self-study
1.client tier
2.webtier
3.business tier
4.EIS tier (enterprise information system) like DB ,ERP., etc.,
The client tier comprosises of programs executed on the client side.
The html pages, xml pages,applets etc are executed on the cleint browser..
web clients(html xml etc) are generally markup language based pages.
application clients are applets( small application clients embedded
in a markup page like html ) and other GUI based..
The application clients directly communicate withthe business tieror
via web tier(http connections)
coming to web clients and applets,
who gives the browser the required programs?
none other than web tier components..
web components are jsp,servlets .. (J2ee specification defines these as
j2ee components)
But the components executed in the client side
are given by the web components..s
so the webcomponents' code has embedded code for giving the client
the required client components like html ,applet etc.,
the embedded client components are not treated as j2ee components..
eg:
You open a website home page from your browser,
the displayed html page or applet is actually delivered by a web component
and executed by the browser..,
application client:
eg: Toad is a tool which requires oracle client..,
and the tool is meant to directly connect with EIS and
manipulate the data bases..
which means the application cleints are basically used
by the application developers or testers or mainteners..
the web clients are generally used by the end-user (customer)..
Monday, June 25, 2007
XML-points
2.the declaration tag is not an xml element
and it doesnt have a close tag
3.all xml elements must have a close tag..
4,xml attributes' values must be quoted
5.
In Windows applications, a new line is normally stored as a pair of characters: carriage return (CR) and line feed (LF). The character pair bears some resemblance to the typewriter actions of setting a new line. In Unix applications, a new line is normally stored as a LF character. Macintosh applications use only a CR character to store a new line.
With XML, a new line is always stored as LF.
With XML, CR / LF is Converted to LF
XML Elements Must be Properly Nested
XML Documents Must Have a Root Element
With XML, White Space is Preserved
Thursday, June 21, 2007
UnixExplained
***********************************************
There are two kinds of Pattern Matching.
1.File Name matching pattern
2.File content Matching pattern(Regular expressions)
File matching patterns are different from
regular expression patterns.
while the former is interpreted by shell to search for specific files
the latter is interpreted by the command to search for the lines inside
a file.,
When you press the enter button after typing the command with the arguments etc.,
the shell has something to do before calling the command finally..
That is it has to do Shell interpreting & expansion
Shell interpeting & expansion:
The power of shell lies in interpreting certain meta characters.
When the shell starts parsing the command line,
and if it encounters any meta characters ,it searches for the files
with the specific patterns in the pwd, and if any files are found
then the list of matched files(space separated) is substitued
in the command line..
Now Shell will call the final command..
---------------------------------
Now not only shell there are certain built in commands
which can do special character interpretation..
This is the power of unix, but this is the foundation stone for confusion..
We have to pass the special characters via arguments to the command..
and the special characters to be interpreted by shell also should be
passed to the shell via the command line..
Whats the confusion here?
the shell and command may have the same meta characters...
for eg: * is interpreted differently by shell and command?
Then wats the problem?
if you intended for a meta character like * to be interpreted by
the command ,there is a chance that it might be interpreted by shell
and substituted by the shell if any matches occur.
Why?
because shell interpretation precedes the command interpretation.,
that is the regular expression pattern that you type on the command line
is parsed by the shell
so there is a danger because the regular expression meta
characters are interpreted by shell to do its file matching..
So we have to be extra cautious for such things?
Solution:
Escaping the meta characters,ie., instruct the shell not to interpret
such characters..
Way1: back slash
way2: double quotes
way3:single quotes