Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.mobicents.slee.container.management
Class DeployableUnitDeployer  view DeployableUnitDeployer download DeployableUnitDeployer.java

java.lang.Object
  extended byorg.mobicents.slee.container.management.DeployableUnitDeployer

public class DeployableUnitDeployer
extends java.lang.Object

An instance of this class is created for every deployable unit that is installed in the slee. Use of this class goes through the static deploy. It then creates a UnitDeployer instance that corresponds the jar file passed to deploy.


Field Summary
private  org.jboss.mx.loading.UnifiedClassLoader classLoader
          The unique class loader associated with the given DU This should not be static else you will run into trouble when deploying multiple units.
private  ClassPath classPath
           
private  java.io.File classpathDirectory
           
private static ClassPool classPool
          shared Javassist pool for all DUs
private  ComponentContainer componentContainer
           
private static int deployableUnitCounter
           
private  DeployableUnitIDImpl deployableUnitID
           
private static org.jboss.logging.Logger logger
           
private  java.net.URL sourceUrl
           
private  java.io.File tempClassDeploymentDir
           
private  java.io.File tempDeploymentFile
           
private  java.io.File tempDUJarsDeploymentDirectory
           
private  java.util.jar.JarFile unitJarFile
           
 
Constructor Summary
(package private) DeployableUnitDeployer()
           
 
Method Summary
private  AbstractComponentDeployer createComponentDeployer(java.util.jar.JarFile componentJarFile)
          Verifies what kind of a deployment descriptor does the component jar file contain, constructs the corresponding ComponentDeployer accordingly, initilizes it and returns it ready for deployment or throws an exception if problems occur.
protected  org.jboss.mx.loading.UnifiedClassLoader createDUClassLoader()
           
private  void createTempDeploymentDir()
          Sets the directory that will be used for deployment of the DU.
static DeployableUnitIDImpl deploy(java.net.URL sourceUrl, java.io.File deployableUnitJarFile, java.io.File deploymentDirectory, ComponentContainer container)
          Analyses the specified jar file, extracts and deploys the components that it contains.
private  void deployUnitContent()
          Extract and deploy all components contained by the unit jar file.
private static java.util.jar.JarFile extractJar(java.lang.String fileName, java.util.jar.JarFile containingJar, java.io.File dstDir)
          Extracts the file with name fileName out of the containingJar archive and stores it in dstDir.
 java.lang.ClassLoader getClassLoader()
           
 java.io.File getClasspathDirectory()
          Returns the directory where component contents should be stored.
 ClassPool getClassPool()
           
 ComponentContainer getComponentContainer()
          Returns a reference to the Container where services should be installed.
 java.net.URL getSourceURL()
           
 java.io.File getTempClassDeploymentDir()
           
 java.io.File getTempDUJarsDeploymentDirectory()
          Returns the SLEE directory where deployable units are stored.
(package private)  java.util.jar.JarFile getUnitJarFile()
          Returns the jar file that this unit deployer has been created for.
private  void init()
          Prepare for deployment sequence
private  void loadDeployedComponents(java.util.HashSet jarFiles, java.util.List serviceNodes, java.util.List jarNames, java.util.HashSet extractedJars)
          Iterate over deployed components and register them with SLEE runtime
private  void loadDeployment(java.util.HashSet simpleCompJarFiles, java.util.HashSet complexCompJarFiles, java.util.List serviceNodes, java.util.List jarNames, java.util.HashSet extractedJars)
          Provided that all DU classes are extracted in a local dir, proceed with loading them up and registering with SLEE runtime
private  void prepareDeploy(java.util.HashSet compJarFiles)
          Unjars a list of jar files in the DU's deployment dir
 void setComponentContainer(ComponentContainer componentContainer)
          The Container where components should be installed.
private  void setDescriptor(DeployableUnitDescriptorImpl descriptor)
          Set the descriptor.
private  void setSourceURL(java.net.URL sourceUrl)
          set the source Url where the DU was read originally
private  void setTempDUJarsDeploymentDirectory(java.io.File deploymentDirectory)
          Sets the SLEE directory where deployable units are stored.
(package private)  void setUnitJarFile(java.util.jar.JarFile duJar)
          Sets the jar file that this unit deployer has been created for.
 void undeploy()
          Undeploy sequence for the DU that this deployer is responsible for
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitJarFile

private java.util.jar.JarFile unitJarFile

tempDUJarsDeploymentDirectory

private java.io.File tempDUJarsDeploymentDirectory

classpathDirectory

private java.io.File classpathDirectory

componentContainer

private ComponentContainer componentContainer

deployableUnitID

private DeployableUnitIDImpl deployableUnitID

deployableUnitCounter

private static int deployableUnitCounter

tempClassDeploymentDir

private java.io.File tempClassDeploymentDir

sourceUrl

private java.net.URL sourceUrl

logger

private static org.jboss.logging.Logger logger

classPath

private ClassPath classPath

classLoader

private org.jboss.mx.loading.UnifiedClassLoader classLoader
The unique class loader associated with the given DU This should not be static else you will run into trouble when deploying multiple units.


classPool

private static ClassPool classPool
shared Javassist pool for all DUs


tempDeploymentFile

private java.io.File tempDeploymentFile
Constructor Detail

DeployableUnitDeployer

DeployableUnitDeployer()
Method Detail

setDescriptor

private void setDescriptor(DeployableUnitDescriptorImpl descriptor)
Set the descriptor.


deploy

public static DeployableUnitIDImpl deploy(java.net.URL sourceUrl,
                                          java.io.File deployableUnitJarFile,
                                          java.io.File deploymentDirectory,
                                          ComponentContainer container)
                                   throws DeploymentException
Analyses the specified jar file, extracts and deploys the components that it contains.


setSourceURL

private void setSourceURL(java.net.URL sourceUrl)
set the source Url where the DU was read originally


getSourceURL

public java.net.URL getSourceURL()

setUnitJarFile

void setUnitJarFile(java.util.jar.JarFile duJar)
Sets the jar file that this unit deployer has been created for.


setTempDUJarsDeploymentDirectory

private void setTempDUJarsDeploymentDirectory(java.io.File deploymentDirectory)
Sets the SLEE directory where deployable units are stored. The directory where DU jar files are stored.


setComponentContainer

public void setComponentContainer(ComponentContainer componentContainer)
The Container where components should be installed.


getUnitJarFile

java.util.jar.JarFile getUnitJarFile()
Returns the jar file that this unit deployer has been created for.


getTempDUJarsDeploymentDirectory

public java.io.File getTempDUJarsDeploymentDirectory()
Returns the SLEE directory where deployable units are stored.


getComponentContainer

public ComponentContainer getComponentContainer()
Returns a reference to the Container where services should be installed.


getClasspathDirectory

public java.io.File getClasspathDirectory()
Returns the directory where component contents should be stored. The directory should be part of the classpath.


deployUnitContent

private void deployUnitContent()
                        throws DeploymentException
Extract and deploy all components contained by the unit jar file.


loadDeployment

private void loadDeployment(java.util.HashSet simpleCompJarFiles,
                            java.util.HashSet complexCompJarFiles,
                            java.util.List serviceNodes,
                            java.util.List jarNames,
                            java.util.HashSet extractedJars)
                     throws DeploymentException
Provided that all DU classes are extracted in a local dir, proceed with loading them up and registering with SLEE runtime


loadDeployedComponents

private void loadDeployedComponents(java.util.HashSet jarFiles,
                                    java.util.List serviceNodes,
                                    java.util.List jarNames,
                                    java.util.HashSet extractedJars)
                             throws DeploymentException
Iterate over deployed components and register them with SLEE runtime


prepareDeploy

private void prepareDeploy(java.util.HashSet compJarFiles)
                    throws DeploymentException
Unjars a list of jar files in the DU's deployment dir


createDUClassLoader

protected org.jboss.mx.loading.UnifiedClassLoader createDUClassLoader()
                                                               throws DeploymentException

extractJar

private static java.util.jar.JarFile extractJar(java.lang.String fileName,
                                                java.util.jar.JarFile containingJar,
                                                java.io.File dstDir)
                                         throws java.io.IOException
Extracts the file with name fileName out of the containingJar archive and stores it in dstDir.


createComponentDeployer

private AbstractComponentDeployer createComponentDeployer(java.util.jar.JarFile componentJarFile)
                                                   throws DeploymentException
Verifies what kind of a deployment descriptor does the component jar file contain, constructs the corresponding ComponentDeployer accordingly, initilizes it and returns it ready for deployment or throws an exception if problems occur.


createTempDeploymentDir

private void createTempDeploymentDir()
Sets the directory that will be used for deployment of the DU. Logic borrowed from JBoss deployment mechanism. Note: at some point we need to explore in-memory deployment to avoid IO overhead


getTempClassDeploymentDir

public java.io.File getTempClassDeploymentDir()

getClassLoader

public java.lang.ClassLoader getClassLoader()

getClassPool

public ClassPool getClassPool()

init

private void init()
Prepare for deployment sequence


undeploy

public void undeploy()
Undeploy sequence for the DU that this deployer is responsible for