org.apache.geronimo.deployment
Class DeploymentContext

java.lang.Object
  extended by org.apache.geronimo.deployment.DeploymentContext
Direct Known Subclasses:
EARContext

public class DeploymentContext
extends Object


Field Summary
protected  AbstractName moduleName
           
 
Constructor Summary
DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, AbstractName moduleName, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager)
           
DeploymentContext(File baseDir, File inPlaceConfigurationDir, Environment environment, AbstractName moduleName, ConfigurationModuleType moduleType, Naming naming, ConfigurationManager configurationManager, Collection repositories)
           
 
Method Summary
 void addAdditionalDeployment(ConfigurationData configurationData)
           
 void addChildConfiguration(String moduleName, ConfigurationData configurationData)
           
 void addClass(URI targetPath, String fqcn, byte[] bytes)
           
 void addFile(URI targetPath, File source)
           
 void addFile(URI targetPath, String source)
           
 void addFile(URI targetPath, URL source)
           
 void addFile(URI targetPath, ZipFile zipFile, ZipEntry zipEntry)
           
 void addGBean(GBeanData gbean)
           
 GBeanData addGBean(String name, GBeanInfo gbeanInfo)
           
 void addInclude(URI targetPath, File source)
          Add a file into the deployment context and place it into the path specified in the target path.
 void addInclude(URI targetPath, URL source)
          Add a file into the deployment context and place it into the path specified in the target path.
 void addInclude(URI targetPath, ZipFile zipFile, ZipEntry zipEntry)
          Add a ZIP file entry into the deployment context and place it into the path specified in the target path.
 void addIncludeAsPackedJar(URI targetPath, JarFile jarFile)
          Add a packed jar file into the deployment context and place it into the path specified in the target path.
 void addManifestClassPath(JarFile moduleFile, URI moduleBaseUri)
          Import the classpath from a jar file's manifest.
 void close()
           
 AbstractName findGBean(AbstractNameQuery pattern)
           
 AbstractName findGBean(Set<AbstractNameQuery> patterns)
           
 LinkedHashSet<GBeanData> findGBeanDatas(Configuration configuration, AbstractNameQuery pattern)
           
 LinkedHashSet<AbstractName> findGBeans(AbstractNameQuery pattern)
           
 LinkedHashSet<AbstractName> findGBeans(Set<AbstractNameQuery> patterns)
           
 void flush()
           
 List getAdditionalDeployment()
           
 File getBaseDir()
           
 ClassLoader getClassLoader()
           
 void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions)
           
 void getCompleteManifestClassPath(JarFile moduleFile, URI moduleBaseUri, URI resolutionUri, ClassPathList classpath, ModuleList exclusions, org.apache.geronimo.deployment.DeploymentContext.JarFileFactory factory, List<DeploymentException> problems)
          Recursively construct the complete set of paths in the ear for the manifest classpath of the supplied modulefile.
 Artifact getConfigID()
           
 Configuration getConfiguration()
           
 ConfigurationData getConfigurationData()
           
 ConfigurationManager getConfigurationManager()
           
 GBeanData getGBeanInstance(AbstractName name)
           
 Set<AbstractName> getGBeanNames()
           
 File getInPlaceConfigurationDir()
           
 AbstractName getModuleName()
           
 Naming getNaming()
           
 File getTargetFile(URI targetPath)
           
 Set<AbstractName> listGBeans(AbstractNameQuery pattern)
          Deprecated. use findGBeans(pattern)
 void removeGBean(AbstractName name)
           
 List<String> verify(Configuration configuration)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

moduleName

protected final AbstractName moduleName
Constructor Detail

DeploymentContext

public DeploymentContext(File baseDir,
                         File inPlaceConfigurationDir,
                         Environment environment,
                         AbstractName moduleName,
                         ConfigurationModuleType moduleType,
                         Naming naming,
                         ConfigurationManager configurationManager,
                         Collection repositories)
                  throws DeploymentException
Throws:
DeploymentException

DeploymentContext

public DeploymentContext(File baseDir,
                         File inPlaceConfigurationDir,
                         Environment environment,
                         AbstractName moduleName,
                         ConfigurationModuleType moduleType,
                         Naming naming,
                         ConfigurationManager configurationManager)
                  throws DeploymentException
Throws:
DeploymentException
Method Detail

getConfigurationManager

public ConfigurationManager getConfigurationManager()

getConfigID

public Artifact getConfigID()

getBaseDir

public File getBaseDir()

getInPlaceConfigurationDir

public File getInPlaceConfigurationDir()

getNaming

public Naming getNaming()

addGBean

public GBeanData addGBean(String name,
                          GBeanInfo gbeanInfo)
                   throws GBeanAlreadyExistsException
Throws:
GBeanAlreadyExistsException

addGBean

public void addGBean(GBeanData gbean)
              throws GBeanAlreadyExistsException
Throws:
GBeanAlreadyExistsException

removeGBean

public void removeGBean(AbstractName name)
                 throws GBeanNotFoundException
Throws:
GBeanNotFoundException

getGBeanNames

public Set<AbstractName> getGBeanNames()

listGBeans

public Set<AbstractName> listGBeans(AbstractNameQuery pattern)
Deprecated. use findGBeans(pattern)

Parameters:
pattern - Search for gbeans whose name matches pattern.
Returns:
the set of gbeans whose name matches the pattern.

findGBean

public AbstractName findGBean(AbstractNameQuery pattern)
                       throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBean

public AbstractName findGBean(Set<AbstractNameQuery> patterns)
                       throws GBeanNotFoundException
Throws:
GBeanNotFoundException

findGBeans

public LinkedHashSet<AbstractName> findGBeans(AbstractNameQuery pattern)

findGBeanDatas

public LinkedHashSet<GBeanData> findGBeanDatas(Configuration configuration,
                                               AbstractNameQuery pattern)

findGBeans

public LinkedHashSet<AbstractName> findGBeans(Set<AbstractNameQuery> patterns)

getGBeanInstance

public GBeanData getGBeanInstance(AbstractName name)
                           throws GBeanNotFoundException
Throws:
GBeanNotFoundException

addIncludeAsPackedJar

public void addIncludeAsPackedJar(URI targetPath,
                                  JarFile jarFile)
                           throws IOException
Add a packed jar file into the deployment context and place it into the path specified in the target path. The newly added packed jar is added to the classpath of the configuration.

Parameters:
targetPath - where the packed jar file should be placed
jarFile - the jar file to copy
Throws:
IOException - if there's a problem copying the jar file

addInclude

public void addInclude(URI targetPath,
                       ZipFile zipFile,
                       ZipEntry zipEntry)
                throws IOException
Add a ZIP file entry into the deployment context and place it into the path specified in the target path. The newly added entry is added to the classpath of the configuration.

Parameters:
targetPath - where the ZIP file entry should be placed
zipFile - the ZIP file
zipEntry - the ZIP file entry
Throws:
IOException - if there's a problem copying the ZIP entry

addInclude

public void addInclude(URI targetPath,
                       URL source)
                throws IOException
Add a file into the deployment context and place it into the path specified in the target path. The newly added file is added to the classpath of the configuration.

Parameters:
targetPath - where the file should be placed
source - the URL of file to be copied
Throws:
IOException - if there's a problem copying the ZIP entry

addInclude

public void addInclude(URI targetPath,
                       File source)
                throws IOException
Add a file into the deployment context and place it into the path specified in the target path. The newly added file is added to the classpath of the configuration.

Parameters:
targetPath - where the file should be placed
source - the file to be copied
Throws:
IOException - if there's a problem copying the ZIP entry

getCompleteManifestClassPath

public void getCompleteManifestClassPath(JarFile moduleFile,
                                         URI moduleBaseUri,
                                         URI resolutionUri,
                                         ClassPathList classpath,
                                         ModuleList exclusions)
                                  throws DeploymentException
Throws:
DeploymentException

getCompleteManifestClassPath

public void getCompleteManifestClassPath(JarFile moduleFile,
                                         URI moduleBaseUri,
                                         URI resolutionUri,
                                         ClassPathList classpath,
                                         ModuleList exclusions,
                                         org.apache.geronimo.deployment.DeploymentContext.JarFileFactory factory,
                                         List<DeploymentException> problems)
                                  throws DeploymentException
Recursively construct the complete set of paths in the ear for the manifest classpath of the supplied modulefile. Used only in PersistenceUnitBuilder to figure out if a persistence.xml relates to the starting module. Having a classloader for each ejb module would eliminate the need for this and be more elegant.

Parameters:
moduleFile - the module that we start looking at classpaths at, in the car.
moduleBaseUri - where the moduleFile is inside the car file. For an (unpacked) war this ends with / which means we also need:
resolutionUri - the uri to resolve all entries against. For a module such as an ejb jar that is part of the root ear car it is ".". For a sub-configuration such as a war it is the "reverse" of the path to the war file in the car. For instance, if the war file is foo/bar/myweb.war, the resolutionUri is "../../..".
classpath - the classpath list we are constructing.
exclusions - the paths to not investigate. These are typically the other modules in the ear/car file: they will have their contents processed for themselves.
factory - the factory for constructing JarFiles and the way to extract the manifest classpath from a JarFile. Introduced to make testing plausible, but may be useful for in-IDE deployment.
problems - List to save all the problems we encounter.
Throws:
DeploymentException - if something goes wrong.

addManifestClassPath

public void addManifestClassPath(JarFile moduleFile,
                                 URI moduleBaseUri)
                          throws DeploymentException
Import the classpath from a jar file's manifest. The imported classpath is crafted relative to moduleBaseUri.

Parameters:
moduleFile - the jar file from which the manifest is obtained.
moduleBaseUri - the base for the imported classpath
Throws:
DeploymentException - if there is a problem with the classpath in the manifest

addClass

public void addClass(URI targetPath,
                     String fqcn,
                     byte[] bytes)
              throws IOException,
                     URISyntaxException
Throws:
IOException
URISyntaxException

addFile

public void addFile(URI targetPath,
                    ZipFile zipFile,
                    ZipEntry zipEntry)
             throws IOException
Throws:
IOException

addFile

public void addFile(URI targetPath,
                    URL source)
             throws IOException
Throws:
IOException

addFile

public void addFile(URI targetPath,
                    File source)
             throws IOException
Throws:
IOException

addFile

public void addFile(URI targetPath,
                    String source)
             throws IOException
Throws:
IOException

getTargetFile

public File getTargetFile(URI targetPath)

getClassLoader

public ClassLoader getClassLoader()
                           throws DeploymentException
Throws:
DeploymentException

getConfiguration

public Configuration getConfiguration()

flush

public void flush()
           throws IOException
Throws:
IOException

close

public void close()
           throws IOException,
                  DeploymentException
Throws:
IOException
DeploymentException

addChildConfiguration

public void addChildConfiguration(String moduleName,
                                  ConfigurationData configurationData)

getConfigurationData

public ConfigurationData getConfigurationData()
                                       throws DeploymentException
Throws:
DeploymentException

addAdditionalDeployment

public void addAdditionalDeployment(ConfigurationData configurationData)

getAdditionalDeployment

public List getAdditionalDeployment()

getModuleName

public AbstractName getModuleName()

verify

public List<String> verify(Configuration configuration)
                    throws DeploymentException
Throws:
DeploymentException


Copyright © 2003-2007 Apache Software Foundation. All Rights Reserved.