Unformatted text preview:

Session Beans and Business Logic Presented By Sethu Ram Kettimuthu 1 For Starters 2 A look at the Forest What is a middle ware Middleware is a layer of software between the network and the applications that provides services such as identification authentication authorization directories and security By promoting standardization and interoperability middleware will make advanced network applications much easier to use 3 Trees of the Forest CORBA 4 Corba Contd The CORBA specification only defines a set of conventions and protocols that must be followed by CORBA implementations CORBA does not make any restrictions on language or underlying operating system Because of CORBA s heterogeneous nature a neutral language was needed to perform the task of defining the interfaces to ORB based objects You can implement IDL interfaces using any programming language for which an IDL mapping is available 5 E Speak Fundamentally e speak is a distributed development environment just like Java RMI just like CORBA just like the Web itself To access a service a client Creates a connection to the e Speak engine Identifies a contract and vocabulary to use when searching for services Locates the service using ESServiceFinder Invokes the methods specified by the service interface 6 7 8 Net Com With NET Microsoft s new Web services platform your applications services and devices work together to provide access to the information you need at anytime and any place net is MS equivalent of J2EE Com is MS equivalent of EJB C is MS equivalent of Java 9 Now to EJB at last Why EJB EJB enables rapid development of mission critical application that are versatile reusable and portable across middleware while protecting IT investment and preventing vendor lock in What is EJB Enterprise beans are server components written in the Java programming language Enterprise beans contain the business logic for your application For example a checkbook client might invoke the debit and credit methods of an account enterprise bean 10 Feature All COM All Java unclear future Windows 2000 30 RMI JNI CORBA Connectors future Any future IIOP Microsoft COM TI MSMQ OLE DB DCOM Stateless components Yes Yes Stateful components Yes No Persistent components Yes No Queued components No Yes Middleware comes with OS Cluster wide processors Development tools No Yes Theoretically unlimited Theoretically unlimited Choice of many Microsoft Dev Studio Component Language Platforms Middleware Vendors Legacy Integration Protocol EJB Java only 11 key features of the EJB technology EJB components are server side components written entirely in the Java programming language EJB components contain business logic only System level services are automatically managed for the EJB component by the EJB server EJB components are fully portable across any EJB server and any OS 12 Types of enterprise beans Session Beans More on Session Beans rest of the seminar Entity Beans An entity bean represents a business object in a persistent storage mechanism such as a database May be shared by multiple clients Persistent even when the EJB container terminates the entity state remains in a database 13 Session Beans Purpose Performs a task for a client Shared Access May have one client Persistence Not persistent When the client terminates its session bean is no longer available 14 Session Beans Contd The client accesses remote services by invoking the session bean s methods The session bean performs work for its client shielding the client from complexity by executing business tasks inside the server It is similar to an interactive session The Session Beans Terminates with the client Session beans are powerful because they extend the reach of your clients into remote servers yet they re easy to build 15 How to Write Session Beans To write a session enterprise bean class the class must implement the javax ejb SessionBean interface The javax ejb SessionBean interface extends the more generic javax ejb Enterprise Bean interface So does the javax ejb EntityBean 16 Methods in SessionBean Interface Javax ejb SessionBean Interface Public interface javax ejb SessionBean extends javax ejb EnterpriseBean public abstract void setSessionContext SessionContext ctx throws java rmi RemoteException public abstract void ejbPassivate throws java rmi RemoteException public abstract void ejbActivate throws java rmi RemoteException public abstract void ejbRemove throws java rmi RemoteException 17 A look at each method setSessionContext SessionContext ctx Container calls this method to associate the bean with a session context A session context is the bean s gateway to interact with the container The bean can use the session contexts to query the container about the current transactional state security state etc 18 A look at each method ejbCreate Initializes the session bean Can define one or more ejbCreate methods and each can take different arguments Can perform any initialization the bean needs ie public class MyBean implements SessionBean private int memberVar public void ejbCreate int init val this memberVar initval 19 A look at each method ejbPassivate If too many beans are instantiated the EJB container can passivate some of them by writing the beans to a temp storage like a DB or File The container can then release the Resources the beans had claimed Immediately before the Beans are passivated the container calls the ejbPassivate method NOTE Remember that passivation doesn t apply to stateless bean as it cannot hold the state 20 A look at each method ejbActivate When a client needs to use the passivated bean then the container kicks the bean back into memory This is activation Once the bean is back in the memory again the beans implementation acquires any resource the bean needs NOTE Activation doesn t apply to stateless session beans as it cannot hold state and can simply be created destroyed rather than passivated activated 21 Guess who spoke this You ve heard Al Gore say he invented the internet Well if he was so smart why do all the addresses begin with W Any body 22 A look at each method ejbRemove When the container is about to remove your session bean instance it calls the bean s ejbRemove method ejbRemove is a clean up method alerting the bean that it is about to destroyed ejbRemove is a required method of all beans and takes no parametrs There is only one ejbRemove method per bean 23 A look at each method Business Methods There can be zero or more Business methods in your bean


View Full Document

WVU CS 486 - Session Beans and Business Logic

Course: Cs 486-
Pages: 56
Loading Unlocking...
Login

Join to view Session Beans and Business Logic and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Session Beans and Business Logic and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?