org.ow2.jonas.deployment.client.lib
Class ClientDeploymentDescManager

java.lang.Object
  extended by org.ow2.jonas.deployment.common.lib.AbsDeploymentDescManager
      extended by org.ow2.jonas.deployment.client.lib.ClientDeploymentDescManager
All Implemented Interfaces:
DeploymentDescManager

public class ClientDeploymentDescManager
extends AbsDeploymentDescManager

This class provide a way for managing the ClientContainerDeploymentDesc.

Author:
Florent Benoit

Field Summary
static String CLIENT_FILE_NAME
          The path to the application-client.xml file.
static String JONAS_CLIENT_FILE_NAME
          The path to the jonas-client.xml file.
 
Fields inherited from class org.ow2.jonas.deployment.common.lib.AbsDeploymentDescManager
LINK_SEPARATOR
 
Method Summary
static org.ow2.util.ee.metadata.common.api.enc.IENCBindingHolder completeClient(org.ow2.util.ee.metadata.car.api.ICarDeployableMetadata carDeployableMetadata, ApplicationClient applicationClient, JonasClient jonasClient, ClassLoader classLoader)
          Complete the given applicationClient object and jonasClient by reading annotations.
 int getCacheSize()
          Get the size of the cache (number of entries in the cache).
static org.ow2.util.ee.metadata.car.api.ICarDeployableMetadata getCarMetadata(String clientFileName, ClassLoader classLoader)
          Extract all the metadatas from the application client.
 ClientContainerDeploymentDesc getDeploymentDesc(URL url, ClassLoader loaderForCls, ClassLoader earLoader)
          Get the specified client deployment descriptor.
static ClientDeploymentDescManager getInstance()
          Get an instance of the ClientDeploymentDescManager.
static ClientContainerDeploymentDesc getInstance(String clientFileName, ClassLoader classLoaderForCls)
          Get an instance of a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.
static ClientContainerDeploymentDesc getInstance(String clientFileName, ClassLoader classLoaderForCls, String altClientXmlFilename)
          Get an instance of a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.
static boolean getParsingWithValidation()
          Controls whether the parser is reporting all validity errors.
static ApplicationClient loadApplicationClient(Reader reader, String fileName)
          Load the application-client.xml file.
static JonasClient loadJonasClient(Reader reader, String fileName)
          Load the jonas-client.xml file.
 void removeCache(ClassLoader earClassLoader)
          Make a cleanup of the cache of deployment descriptor.
 void setAltDD(ClassLoader earClassLoader, URL[] urls, URL[] altDDs)
          Set the alt deployment desc which are used instead of the web.xml file which is in the war file.
static void setParsingWithValidation(boolean validation)
          Controls whether the parser is reporting all validity errors.
 
Methods inherited from class org.ow2.jonas.deployment.common.lib.AbsDeploymentDescManager
containsResource, findJonasServiceRef, mergeWebServiceRef, xmlContent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CLIENT_FILE_NAME

public static final String CLIENT_FILE_NAME
The path to the application-client.xml file.

See Also:
Constant Field Values

JONAS_CLIENT_FILE_NAME

public static final String JONAS_CLIENT_FILE_NAME
The path to the jonas-client.xml file.

See Also:
Constant Field Values
Method Detail

getInstance

public static ClientDeploymentDescManager getInstance()
Get an instance of the ClientDeploymentDescManager.

Returns:
the instance of the ClientDeploymentDescManager.

getDeploymentDesc

public ClientContainerDeploymentDesc getDeploymentDesc(URL url,
                                                       ClassLoader loaderForCls,
                                                       ClassLoader earLoader)
                                                throws DeploymentDescException
Get the specified client deployment descriptor.

Parameters:
url - the url where to load xml deployment descriptors.
loaderForCls - classloader used to load client classes.
earLoader - the ear classloader.
Returns:
ClientContainerDeploymentDesc the client deployment descriptor.
Throws:
DeploymentDescException - when ClientContainerDeploymentDesc cannot be created with the given files.

getInstance

public static ClientContainerDeploymentDesc getInstance(String clientFileName,
                                                        ClassLoader classLoaderForCls)
                                                 throws DeploymentDescException
Get an instance of a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.

Parameters:
clientFileName - the fileName of the client file for the deployment descriptors.
classLoaderForCls - the classloader for the classes.
Returns:
a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.
Throws:
DeploymentDescException - if the deployment descriptors are corrupted.

getInstance

public static ClientContainerDeploymentDesc getInstance(String clientFileName,
                                                        ClassLoader classLoaderForCls,
                                                        String altClientXmlFilename)
                                                 throws DeploymentDescException
Get an instance of a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.

Parameters:
clientFileName - the fileName of the client file for the deployment descriptors.
classLoaderForCls - the classloader for the classes.
altClientXmlFilename - the fileName to the application-client.xml for the alt-dd tag in the Ear Case. This is used for specify an alternate DDesc file.
Returns:
a Client deployment descriptor by parsing the application-client.xml and jonas-client.xml deployment descriptors.
Throws:
DeploymentDescException - if the deployment descriptors are corrupted.

getCarMetadata

public static org.ow2.util.ee.metadata.car.api.ICarDeployableMetadata getCarMetadata(String clientFileName,
                                                                                     ClassLoader classLoader)
                                                                              throws ClientContainerDeploymentDescException
Extract all the metadatas from the application client.

Parameters:
clientFileName - the client
classLoader - the classloader used for the client
Returns:
the metadata structure associated to this client
Throws:
ClientContainerDeploymentDescException - if an error occured during annotation/XML parsing

completeClient

public static org.ow2.util.ee.metadata.common.api.enc.IENCBindingHolder completeClient(org.ow2.util.ee.metadata.car.api.ICarDeployableMetadata carDeployableMetadata,
                                                                                       ApplicationClient applicationClient,
                                                                                       JonasClient jonasClient,
                                                                                       ClassLoader classLoader)
                                                                                throws ClientContainerDeploymentDescException
Complete the given applicationClient object and jonasClient by reading annotations.

Parameters:
carDeployableMetadata - given war file to analyze
applicationClient - the web app struct
jonasClient - the jonas webapp struct
classLoader - the classloader used to get the classes
Returns:
the binding holder
Throws:
ClientContainerDeploymentDescException - if complete is not done

loadApplicationClient

public static ApplicationClient loadApplicationClient(Reader reader,
                                                      String fileName)
                                               throws DeploymentDescException
Load the application-client.xml file.

Parameters:
reader - the reader of the XML file.
fileName - the name of the file (application-client.xml).
Returns:
a structure containing the result of the application-client.xml parsing.
Throws:
DeploymentDescException - if the deployment descriptor is corrupted.

loadJonasClient

public static JonasClient loadJonasClient(Reader reader,
                                          String fileName)
                                   throws DeploymentDescException
Load the jonas-client.xml file.

Parameters:
reader - the stream of the XML file.
fileName - the name of the file (jonas-client.xml).
Returns:
a structure containing the result of the jonas-client.xml parsing.
Throws:
DeploymentDescException - if the deployment descriptor is corrupted.

removeCache

public void removeCache(ClassLoader earClassLoader)
Make a cleanup of the cache of deployment descriptor. This method must be invoked after the ear deployment by the EAR service.

Parameters:
earClassLoader - the ClassLoader of the ear application to remove from the cache.

setAltDD

public void setAltDD(ClassLoader earClassLoader,
                     URL[] urls,
                     URL[] altDDs)
Set the alt deployment desc which are used instead of the web.xml file which is in the war file. The alt-dd tag is in the application.xml file of the ear files and is used ony in the EAR case. ie : deployment of wars packaged into EAR applications. alt-dd tag is optionnal

Parameters:
earClassLoader - the ear classloader which is used for mapped the URLs of the wars to the Alt dd.
urls - the urls of the wars
altDDs - the alt-dd name for the specified war URLs

getCacheSize

public int getCacheSize()
Get the size of the cache (number of entries in the cache). This method is used only for the tests.

Returns:
the size of the cache (number of entries in the cache).

getParsingWithValidation

public static boolean getParsingWithValidation()
Controls whether the parser is reporting all validity errors.

Returns:
if true, all external entities will be read.

setParsingWithValidation

public static void setParsingWithValidation(boolean validation)
Controls whether the parser is reporting all validity errors.

Parameters:
validation - if true, all external entities will be read.


Copyright © 2010 OW2 Consortium. All Rights Reserved.