org.jboss.ejb
Class Container

java.lang.Object
  |
  +--org.jboss.ejb.Container
Direct Known Subclasses:
EntityContainer, MessageDrivenContainer, StatefulSessionContainer, StatelessSessionContainer

public abstract class Container
extends java.lang.Object

This is the base class for all EJB-containers in JBoss. A Container functions as the central hub of all metadata and plugins. Through this the container plugins can get hold of the other plugins and any metadata they need. The ContainerFactory creates instances of subclasses of this class and calls the appropriate initialization methods. A Container does not perform any significant work, but instead delegates to the plugins to provide for all kinds of algorithmic functionality.

Version:
$Revision: 1.37.2.1 $
Author:
Rickard Öberg (rickard.oberg@telkel.com), Marc Fleury
See Also:
ContainerFactory

Field Summary
protected  Application application
           
protected  java.lang.Class beanClass
           
protected  java.lang.ClassLoader classLoader
           
protected  java.lang.ClassLoader localClassLoader
           
protected  BeanMetaData metaData
           
protected  org.jboss.security.RealmMapping rm
           
protected  java.lang.Object securityProxy
          The custom security proxy used by the SecurityInterceptor
protected  org.jboss.security.EJBSecurityManager sm
           
protected  javax.transaction.TransactionManager tm
           
 
Constructor Summary
Container()
           
 
Method Summary
abstract  void addInterceptor(Interceptor in)
           
 void destroy()
          A default implementation of destroying the container service (no-op).
 Application getApplication()
          Returns the application for this container.
 java.lang.Class getBeanClass()
          Returns the bean class instance of this container.
 BeanMetaData getBeanMetaData()
          Returns the metadata of this container.
 java.lang.ClassLoader getClassLoader()
          Returns the classloader for this container.
 java.lang.ClassLoader getLocalClassLoader()
          Returns the local classloader for this container.
 java.util.Set getMethodPermissions(java.lang.reflect.Method m, boolean home)
          Returns the permissions for a method.
 org.jboss.security.RealmMapping getRealmMapping()
           
 org.jboss.security.EJBSecurityManager getSecurityManager()
           
 java.lang.Object getSecurityProxy()
           
 javax.transaction.TransactionManager getTransactionManager()
          Returns this container's transaction manager.
 void init()
          The ContainerFactory calls this method.
abstract  java.lang.Object invoke(MethodInvocation mi)
          This method is called by the ContainerInvoker when a method call comes in on an EJBObject.
abstract  java.lang.Object invokeHome(MethodInvocation mi)
          This method is called by the ContainerInvoker when a method call comes in on the Home object.
 void setApplication(Application app)
          Sets the application deployment unit for this container.
 void setBeanMetaData(BeanMetaData metaData)
          Sets the meta data for this container.
 void setClassLoader(java.lang.ClassLoader cl)
          Sets the class loader for this container.
 void setLocalClassLoader(java.lang.ClassLoader cl)
          Sets the local class loader for this container.
 void setRealmMapping(org.jboss.security.RealmMapping rm)
           
 void setSecurityManager(org.jboss.security.EJBSecurityManager sm)
           
 void setSecurityProxy(java.lang.Object proxy)
           
 void setTransactionManager(javax.transaction.TransactionManager tm)
          Sets a transaction manager for this container.
 void start()
          A default implementation of starting the container service (no-op).
 void stop()
          A default implementation of stopping the container service (no-op).
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

application

protected Application application

localClassLoader

protected java.lang.ClassLoader localClassLoader

classLoader

protected java.lang.ClassLoader classLoader

metaData

protected BeanMetaData metaData

beanClass

protected java.lang.Class beanClass

tm

protected javax.transaction.TransactionManager tm

sm

protected org.jboss.security.EJBSecurityManager sm

rm

protected org.jboss.security.RealmMapping rm

securityProxy

protected java.lang.Object securityProxy
The custom security proxy used by the SecurityInterceptor
Constructor Detail

Container

public Container()
Method Detail

setTransactionManager

public void setTransactionManager(javax.transaction.TransactionManager tm)
Sets a transaction manager for this container.
Parameters:
tm -  
See Also:
TransactionManager

getTransactionManager

public javax.transaction.TransactionManager getTransactionManager()
Returns this container's transaction manager.
Returns:
a concrete instance of javax.transaction.TransactionManager

setSecurityManager

public void setSecurityManager(org.jboss.security.EJBSecurityManager sm)

getSecurityManager

public org.jboss.security.EJBSecurityManager getSecurityManager()

setRealmMapping

public void setRealmMapping(org.jboss.security.RealmMapping rm)

getRealmMapping

public org.jboss.security.RealmMapping getRealmMapping()

setSecurityProxy

public void setSecurityProxy(java.lang.Object proxy)

getSecurityProxy

public java.lang.Object getSecurityProxy()

setApplication

public void setApplication(Application app)
Sets the application deployment unit for this container. All the bean containers within the same application unit share the same instance.
Parameters:
app - application for this container

getApplication

public Application getApplication()
Returns the application for this container.
Returns:
 

setLocalClassLoader

public void setLocalClassLoader(java.lang.ClassLoader cl)
Sets the local class loader for this container. Used for loading resources from the local jar file for this container. NOT for loading classes!
Parameters:
cl -  

getLocalClassLoader

public java.lang.ClassLoader getLocalClassLoader()
Returns the local classloader for this container.
Returns:
 

setClassLoader

public void setClassLoader(java.lang.ClassLoader cl)
Sets the class loader for this container. All the classes and resources used by the bean in this container will use this classloader.
Parameters:
cl -  

getClassLoader

public java.lang.ClassLoader getClassLoader()
Returns the classloader for this container.
Returns:
 

setBeanMetaData

public void setBeanMetaData(BeanMetaData metaData)
Sets the meta data for this container. The meta data consists of the properties found in the XML descriptors.
Parameters:
metaData -  

getBeanMetaData

public BeanMetaData getBeanMetaData()
Returns the metadata of this container.
Returns:
metaData;

getMethodPermissions

public java.util.Set getMethodPermissions(java.lang.reflect.Method m,
                                          boolean home)
Returns the permissions for a method. (a set of roles)
Returns:
assemblyDescriptor;

getBeanClass

public java.lang.Class getBeanClass()
Returns the bean class instance of this container.
Returns:
instance of the Enterprise bean class

init

public void init()
          throws java.lang.Exception
The ContainerFactory calls this method. The ContainerFactory has set all the plugins and interceptors that this bean requires and now proceeds to initialize the chain. The method looks for the standard classes in the URL, sets up the naming environment of the bean. The concrete container classes should override this method to introduce implementation specific initialization behaviour.
Throws:
java.lang.Exception - if loading the bean class failed (ClassNotFoundException) or setting up "java:" naming environment failed (DeploymentException)

start

public void start()
           throws java.lang.Exception
A default implementation of starting the container service (no-op). The concrete container classes should override this method to introduce implementation specific start behaviour.
Throws:
java.lang.Exception - an exception that occured during start

stop

public void stop()
A default implementation of stopping the container service (no-op). The concrete container classes should override this method to introduce implementation specific stop behaviour.

destroy

public void destroy()
A default implementation of destroying the container service (no-op). The concrete container classes should override this method to introduce implementation specific destroy behaviour.

invokeHome

public abstract java.lang.Object invokeHome(MethodInvocation mi)
                                     throws java.lang.Exception
This method is called by the ContainerInvoker when a method call comes in on the Home object. The Container forwards this call to the interceptor chain for further processing.
Parameters:
mi - the object holding all info about this invocation
Returns:
the result of the home invocation
Throws:
java.lang.Exception -  

invoke

public abstract java.lang.Object invoke(MethodInvocation mi)
                                 throws java.lang.Exception
This method is called by the ContainerInvoker when a method call comes in on an EJBObject. The Container forwards this call to the interceptor chain for further processing.
Parameters:
id - the id of the object being invoked. May be null if stateless
method - the method being invoked
args - the parameters
Returns:
the result of the invocation
Throws:
java.lang.Exception -  

addInterceptor

public abstract void addInterceptor(Interceptor in)


Copyright © 2000 The JBoss Organization. All Rights Reserved.