org.jboss.ejb3.embedded
Class EJB3StandaloneDeployer

java.lang.Object
  extended by org.jboss.ejb3.embedded.EJB3StandaloneDeployer

public class EJB3StandaloneDeployer
extends java.lang.Object

When initialized properly, this class will search for annotated classes and archives in your classpath and try to create EJB containers and EntityManagers automatically.

All classes and jars must already be in your classpath for this deployer to work.

Version:
$Revision: 1.15 $
Author:
Bill Burke

Field Summary
protected  java.util.Set<java.net.URL> archives
           
protected  java.util.Set<java.lang.String> archivesByResource
           
protected  java.lang.ClassLoader classLoader
           
protected  java.util.Set<java.net.URL> deployDirs
           
protected  java.util.Set<java.lang.String> deployDirsByResource
           
protected static org.jboss.logging.Logger log
           
 
Constructor Summary
EJB3StandaloneDeployer()
           
 
Method Summary
 void create()
           
 void destroy()
           
 java.util.Set<java.net.URL> getArchives()
          A set of URLs of jar archives to search for annotated EJB classes
 java.util.Set<java.lang.String> getArchivesByResource()
          All strings in this set will be used with ClassLoader.getResources() All URLs returned will be used to search for annotated classes.
 java.lang.ClassLoader getClassLoader()
           
static java.net.URL getContainingUrlFromResource(java.net.URL url, java.lang.String resource)
           
 java.util.Map getDefaultPersistenceProperties()
           
static java.net.URL getDeployDirFromResource(java.net.URL url, java.lang.String resource)
           
 java.util.Set<java.net.URL> getDeployDirs()
          Set of directories where there are jar files and directories The deployer will search through all archives and directories for annotated classes
 java.util.Set<java.lang.String> getDeployDirsByResource()
          All strings in this set will be used with ClassLoader.getResources().
 java.util.List<EJB3StandaloneDeployment> getDeployments()
          Returns a list of deployments found in this
 java.util.Hashtable getJndiProperties()
           
 org.jboss.kernel.Kernel getKernel()
           
 javax.management.MBeanServer getMbeanServer()
          This is used by deployer for @Service beans that have @Management interfaces
 void setArchives(java.util.Set archives)
           
 void setArchivesByResource(java.util.Set archivesByResource)
           
 void setClassLoader(java.lang.ClassLoader classLoader)
          You can set the classloader that will be used
 void setDefaultPersistenceProperties(java.util.Map defaultPersistenceProperties)
          If you do not specifiy the default persistence properties, the resource "default.persistence.properties" will be search for in your classpath
 void setDeployDirs(java.util.Set deployDirs)
           
 void setDeployDirsByResource(java.util.Set deployDirsByResource)
           
 void setDeployments(java.util.List<EJB3StandaloneDeployment> deployments)
           
 void setJndiProperties(java.util.Hashtable jndiProperties)
           
 void setKernel(org.jboss.kernel.Kernel kernel)
           
 void setMbeanServer(javax.management.MBeanServer mbeanServer)
           
 void start()
           
 void stop()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static final org.jboss.logging.Logger log

archives

protected java.util.Set<java.net.URL> archives

deployDirs

protected java.util.Set<java.net.URL> deployDirs

archivesByResource

protected java.util.Set<java.lang.String> archivesByResource

deployDirsByResource

protected java.util.Set<java.lang.String> deployDirsByResource

classLoader

protected java.lang.ClassLoader classLoader
Constructor Detail

EJB3StandaloneDeployer

public EJB3StandaloneDeployer()
Method Detail

getKernel

public org.jboss.kernel.Kernel getKernel()

setKernel

public void setKernel(org.jboss.kernel.Kernel kernel)

getMbeanServer

public javax.management.MBeanServer getMbeanServer()
This is used by deployer for @Service beans that have @Management interfaces

Returns:

setMbeanServer

public void setMbeanServer(javax.management.MBeanServer mbeanServer)

getArchives

public java.util.Set<java.net.URL> getArchives()
A set of URLs of jar archives to search for annotated EJB classes

Returns:
this will not return null.

setArchives

public void setArchives(java.util.Set archives)

getDeployDirs

public java.util.Set<java.net.URL> getDeployDirs()
Set of directories where there are jar files and directories The deployer will search through all archives and directories for annotated classes

Returns:
this will not return null.

setDeployDirs

public void setDeployDirs(java.util.Set deployDirs)

getArchivesByResource

public java.util.Set<java.lang.String> getArchivesByResource()
All strings in this set will be used with ClassLoader.getResources() All URLs returned will be used to search for annotated classes.

Returns:

setArchivesByResource

public void setArchivesByResource(java.util.Set archivesByResource)

getDeployDirsByResource

public java.util.Set<java.lang.String> getDeployDirsByResource()
All strings in this set will be used with ClassLoader.getResources(). All URLs returned will be create a set of deploy directories that will be used to find archives and directories that will be searched for annotated classes

Returns:

setDeployDirsByResource

public void setDeployDirsByResource(java.util.Set deployDirsByResource)

getClassLoader

public java.lang.ClassLoader getClassLoader()

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
You can set the classloader that will be used

Parameters:
classLoader -

getDefaultPersistenceProperties

public java.util.Map getDefaultPersistenceProperties()

setDefaultPersistenceProperties

public void setDefaultPersistenceProperties(java.util.Map defaultPersistenceProperties)
If you do not specifiy the default persistence properties, the resource "default.persistence.properties" will be search for in your classpath

Parameters:
defaultPersistenceProperties -

getJndiProperties

public java.util.Hashtable getJndiProperties()

setJndiProperties

public void setJndiProperties(java.util.Hashtable jndiProperties)

getDeployments

public java.util.List<EJB3StandaloneDeployment> getDeployments()
Returns a list of deployments found in this

Returns:

setDeployments

public void setDeployments(java.util.List<EJB3StandaloneDeployment> deployments)

getContainingUrlFromResource

public static java.net.URL getContainingUrlFromResource(java.net.URL url,
                                                        java.lang.String resource)
                                                 throws java.lang.Exception
Throws:
java.lang.Exception

getDeployDirFromResource

public static java.net.URL getDeployDirFromResource(java.net.URL url,
                                                    java.lang.String resource)
                                             throws java.lang.Exception
Throws:
java.lang.Exception

create

public void create()
            throws java.lang.Exception
Throws:
java.lang.Exception

start

public void start()
           throws java.lang.Exception
Throws:
java.lang.Exception

stop

public void stop()
          throws java.lang.Exception
Throws:
java.lang.Exception

destroy

public void destroy()
             throws java.lang.Exception
Throws:
java.lang.Exception