com.sun.enterprise.deployment.archivist
Class Archivist<T extends RootDeploymentDescriptor>

java.lang.Object
  extended by com.sun.enterprise.deployment.archivist.Archivist<T>
Direct Known Subclasses:
AppClientArchivist, ApplicationArchivist, ConnectorArchivist, EjbArchivist, WebArchivist

@Contract
public abstract class Archivist<T extends RootDeploymentDescriptor>
extends java.lang.Object

This abstract class contains all common behaviour for Achivisits. Archivists classes are responsible for reading and writing correct J2EE Archives

Author:
Jerome Dochez

Field Summary
protected  boolean annotationProcessingRequested
           
protected static java.lang.String APPCLIENT_EXTENSION
           
protected static java.lang.String APPLICATION_EXTENSION
           
protected  java.lang.ClassLoader classLoader
           
protected static java.lang.String CONNECTOR_EXTENSION
           
protected  T descriptor
           
protected static java.lang.String EJB_EXTENSION
           
protected  boolean handleRuntimeInfo
           
protected static java.util.logging.Logger logger
           
protected  java.util.jar.Manifest manifest
           
static java.lang.String MANIFEST_VERSION_VALUE
           
protected  java.lang.String path
           
protected static java.lang.String UPLOAD_EXTENSION
           
protected static java.lang.String WEB_EXTENSION
           
protected static java.lang.String WEB_FRAGMENT_EXTENSION
           
 
Constructor Summary
Archivist()
          Creates new Archivist
 
Method Summary
protected static void addFileToArchive(WritableArchive archive, java.lang.String filePath, java.lang.String entryName)
          add a file to an output abstract archive
 void applyRuntimeInfo(java.io.File runtimeDD, java.io.File output)
          apply runtimne info to this archive descriptors and saves it
 boolean containsRuntimeDeploymentDescriptors(Archive in)
           
 void copyAnEntry(ReadableArchive in, WritableArchive out, java.lang.String entryName)
           
 void copyExtraElements(ReadableArchive in, WritableArchive out)
           
 void copyInto(ReadableArchive source, WritableArchive target)
          Copy source archivist to a target abstract archive.
 void copyInto(ReadableArchive source, WritableArchive target, boolean overwriteManifest)
          Copy source archivist to a target abstract archive.
 void copyInto(ReadableArchive source, WritableArchive target, java.util.Vector entriesToSkip)
          Copy source archivist to a target abstract archive.
 void copyInto(ReadableArchive source, WritableArchive target, java.util.Vector entriesToSkip, boolean overwriteManifest)
          Copy this archivist to a new abstract archive
 void copyInto(WritableArchive target)
          Copy this archivist to a new abstract archive
protected  void copyJarElements(ReadableArchive in, WritableArchive out, java.util.Vector ignoreList)
          copy all contents of a jar file to a new jar file except for all the deployment descriptors files
 void copyStandardDeploymentDescriptors(ReadableArchive in, WritableArchive out)
           
 ModuleDescriptor createModuleDescriptor(T descriptor)
          creates a new module descriptor for this archivist
 void extractEntry(java.lang.String entryName, java.io.File out)
          extract a entry of this archive to a file
 ErrorHandler getAnnotationErrorHandler()
           
protected abstract  java.lang.String getArchiveExtension()
           
 java.lang.ClassLoader getClassLoader()
          Gets the classloader for this archivist
 java.lang.String getClassPath()
           
abstract  DeploymentDescriptorFile getConfigurationDDFile()
           
abstract  T getDefaultBundleDescriptor()
           
 java.lang.String getDeploymentDescriptorPath()
           
 T getDescriptor()
           
 java.util.Vector getLibraries(Archive archive)
           
 java.util.Vector getListOfFilesToSkip()
           
 java.util.jar.Manifest getManifest()
           
abstract  XModuleType getModuleType()
           
 java.lang.String getPath()
           
 java.lang.String getRuntimeDeploymentDescriptorPath()
           
 boolean getRuntimeXMLValidation()
           
 java.lang.String getRuntimeXMLValidationLevel()
           
 ModuleScanner getScanner()
          Returns the scanner for this archivist, usually it is the scanner regitered with the same module type as this archivist, but subclasses can return a different version
abstract  DeploymentDescriptorFile<T> getStandardDDFile()
           
 DeploymentDescriptorFile getSunConfigurationDDFile()
           
protected static java.io.File getTempFile(java.io.File fileOrDir)
          utility method to get a tmp file in the current user directory of the provided directory
protected static java.io.File getTempFile(java.lang.String fileOrDirPath)
          utility method to get a tmp file in the current user directory of the provided directory
protected  java.lang.String getUniqueEntryFilenameFor(Archive archive, java.lang.String trialName)
           
 DeploymentDescriptorFile getWebServicesDDFile(RootDeploymentDescriptor desc)
           
 java.lang.String getWebServicesDeploymentDescriptorPath()
           
 DeploymentDescriptorFile getWLConfigurationDDFile()
           
 boolean getXMLValidation()
           
 java.lang.String getXMLValidationLevel()
           
 boolean handles(ReadableArchive archive)
          Returns true if this archivist is capable of handling the archive type
 boolean hasRuntimeDeploymentDescriptor(ReadableArchive archive)
           
 boolean hasStandardDeploymentDescriptor(ReadableArchive archive)
           
protected  void initializeContext(Archivist other)
          initializes this instance from another archivist, this is used to transfer contextual information between archivists, for example whether we should handle runtime information and such
 boolean isAnnotationProcessingRequested()
           
 boolean isHandlingRuntimeInfo()
           
protected  boolean isProcessAnnotation(T descriptor)
           
 T open(java.io.File file)
          open a new archive file using a file descriptor
 T open(ReadableArchive archive)
          Open a new archive file, read the XML descriptor and set the constructed DOL descriptor instance
 T open(ReadableArchive archive, Application app)
           
 T open(ReadableArchive descriptorArchive, ReadableArchive contentArchive)
           
 T open(ReadableArchive descriptorArchive, ReadableArchive contentArchive, Application app)
          Creates the DOL object graph for an app for which the descriptor(s) reside in one archive and the content resides in another.
 T open(java.lang.String path)
          Open a new archive file, read the XML descriptor and set the constructed DOL descriptor instance
 Application openWith(Application app, ReadableArchive archive)
           
 boolean performOptionalPkgDependenciesCheck(ReadableArchive archive)
          Perform Optional packages dependencies checking on an archive
protected  void postAnnotationProcess(T descriptor, ReadableArchive archive)
          perform any action after annotation processed
protected abstract  boolean postHandles(ReadableArchive archive)
           
protected  void postOpen(T descriptor, ReadableArchive archive)
          perform any post deployment descriptor reading action
protected  void postRuntimeDDsRead(T descriptor, ReadableArchive archive)
          perform any action after all runtime DDs read
protected  void postStandardDDsRead(T descriptor, ReadableArchive archive, java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions)
          perform any action after all standard DDs is read
 void printDescriptor()
          print the current descriptor associated with this archivist
protected  ProcessingResult processAnnotations(RootDeploymentDescriptor bundleDesc, ModuleScanner scanner, ReadableArchive archive)
          Process annotations in a bundle descriptor, the annoation processing is dependent on the type of descriptor being passed.
 ProcessingResult processAnnotations(T bundleDesc, ReadableArchive archive)
          Process annotations in a bundle descriptor, the annoation processing is dependent on the type of descriptor being passed.
protected  void readAnnotations(ReadableArchive archive, T descriptor, java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions)
           
protected  void readAnnotations(ReadableArchive archive, T descriptor, java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions, ModuleScanner scanner)
           
 java.lang.Object readMetaInfo(ReadableArchive archive)
           
 void readRuntimeDDFromDeploymentPlan(ReadableArchive planArchive, T descriptor)
          Read the runtime deployment descriptors (can contained in one or many file) from a deployment plan archive, set the corresponding information in the passed descriptor.
protected  void readRuntimeDDFromDeploymentPlan(java.lang.String entry, ReadableArchive planArchive, T descriptor)
          Read the runtime deployment descriptors (can contained in one or many file) from a deployment plan archive, set the corresponding information in the passed descriptor.
 void readRuntimeDeploymentDescriptor(ReadableArchive archive, T descriptor)
          Read the runtime deployment descriptors (can contained in one or many file) set the corresponding information in the passed descriptor.
 void readRuntimeDeploymentDescriptor(ReadableArchive archive, T descriptor, boolean warnIfMultipleDDs)
          Read the runtime deployment descriptors (can contained in one or many file) set the corresponding information in the passed descriptor.
 T readStandardDeploymentDescriptor(ReadableArchive archive)
          Read the standard deployment descriptors (can contained in one or many file) and return the corresponding initialized descriptor instance.
protected  boolean renameTmp(java.lang.String from, java.lang.String to)
          rename a tmp file
 void saveRuntimeInfo(java.io.File output)
           
 void setAnnotationErrorHandler(ErrorHandler annotationErrorHandler)
          sets annotation ErrorHandler for this archivist
 void setAnnotationProcessingRequested(boolean annotationProcessingRequested)
          sets if this archivist process annotation
 void setArchiveUri(java.lang.String path)
          Sets the path for this archivist's archive file
 void setClassLoader(java.lang.ClassLoader classLoader)
          Sets the classloader for this archivist
 void setClassPath(java.lang.String newClassPath)
          Sets the class-path for this archive
 void setDescriptor(T descriptor)
          Archivist read XML deployment descriptors and keep the parsed result in the DOL descriptor instances.
 void setHandleRuntimeInfo(boolean handleRuntimeInfo)
          sets if this archivist saves the runtime info
 void setManifest(java.util.jar.Manifest m)
          sets the manifest file for this archive
 void setModuleDescriptor(ModuleDescriptor<T> module)
          Archivists can be associated with a module descriptor once the XML deployment descriptors have been read and the DOL tree is initialized.
 void setRuntimeXMLValidation(boolean validate)
          Turn on or off the XML Validation for runtime deployment descriptors loading
 void setRuntimeXMLValidationLevel(java.lang.String level)
          Sets the runtime xml validation error reporting/recovering level.
 void setXMLValidation(boolean validate)
          Turn on or off the XML Validation for all standard deployment descriptors loading
 void setXMLValidationLevel(java.lang.String level)
          Sets the xml validation error reporting/recovering level.
 boolean supportsModuleType(XModuleType moduleType)
           
 void validate(java.lang.ClassLoader aClassLoader)
          validates the DOL Objects associated with this archivist, usually it requires that a class loader being set on this archivist or passed as a parameter
 void write()
           
 void write(ReadableArchive in, java.lang.String outPath)
          save the archive
 void write(ReadableArchive in, WritableArchive out)
           
 void write(java.lang.String outPath)
          saves the archive
protected  void writeContents(ReadableArchive in, WritableArchive out)
          writes the content of an archive to another archive
protected  void writeContents(ReadableArchive in, WritableArchive out, java.util.Vector entriesToSkip)
          writes the content of an archive to a JarFile
protected  void writeContents(WritableArchive out)
          writes the content of an archive to a JarFile
 void writeDeploymentDescriptors(WritableArchive out)
          writes the deployment descriptors (standard and runtime) to a JarFile using the right deployment descriptor path
protected  void writeExtraDeploymentDescriptors(WritableArchive out)
          write all extra deployment descriptors (like cmp related and runtime dds)
 void writeRuntimeDeploymentDescriptors(java.io.OutputStream os)
          writes de configuration deployment descriptor to a new XML file
 void writeRuntimeDeploymentDescriptors(WritableArchive out)
          writes the runtime deployment descriptors to an abstract archive
 void writeStandardDeploymentDescriptors(java.io.OutputStream os)
          writes the standard deployment descriptor to an output stream
 void writeStandardDeploymentDescriptors(WritableArchive out)
          writes the standard deployment descriptors to an abstract archive
protected  void writeWebServicesDescriptors(BundleDescriptor desc, WritableArchive out)
          Write web services related descriptors
 void writeWLRuntimeDeploymentDescriptors(WritableArchive out)
          writes the WL runtime deployment descriptors to an abstract archive
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected static final java.util.logging.Logger logger

MANIFEST_VERSION_VALUE

public static final java.lang.String MANIFEST_VERSION_VALUE
See Also:
Constant Field Values

path

protected java.lang.String path

handleRuntimeInfo

protected boolean handleRuntimeInfo

annotationProcessingRequested

protected boolean annotationProcessingRequested

manifest

protected java.util.jar.Manifest manifest

classLoader

protected java.lang.ClassLoader classLoader

APPLICATION_EXTENSION

protected static final java.lang.String APPLICATION_EXTENSION
See Also:
Constant Field Values

APPCLIENT_EXTENSION

protected static final java.lang.String APPCLIENT_EXTENSION
See Also:
Constant Field Values

WEB_EXTENSION

protected static final java.lang.String WEB_EXTENSION
See Also:
Constant Field Values

WEB_FRAGMENT_EXTENSION

protected static final java.lang.String WEB_FRAGMENT_EXTENSION
See Also:
Constant Field Values

EJB_EXTENSION

protected static final java.lang.String EJB_EXTENSION
See Also:
Constant Field Values

CONNECTOR_EXTENSION

protected static final java.lang.String CONNECTOR_EXTENSION
See Also:
Constant Field Values

UPLOAD_EXTENSION

protected static final java.lang.String UPLOAD_EXTENSION
See Also:
Constant Field Values

descriptor

protected T extends RootDeploymentDescriptor descriptor
Constructor Detail

Archivist

public Archivist()
Creates new Archivist

Method Detail

initializeContext

protected void initializeContext(Archivist other)
initializes this instance from another archivist, this is used to transfer contextual information between archivists, for example whether we should handle runtime information and such


setDescriptor

public void setDescriptor(T descriptor)
Archivist read XML deployment descriptors and keep the parsed result in the DOL descriptor instances. Sets the descriptor for a particular Archivist type


getDescriptor

public T getDescriptor()
Returns:
the Descriptor for this archvist

open

public T open(ReadableArchive archive)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Open a new archive file, read the XML descriptor and set the constructed DOL descriptor instance

Parameters:
archive - the archive file path
Returns:
the deployment descriptor for this archive
Throws:
java.io.IOException
org.xml.sax.SAXParseException

open

public T open(ReadableArchive descriptorArchive,
              ReadableArchive contentArchive)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Throws:
java.io.IOException
org.xml.sax.SAXParseException

open

public T open(ReadableArchive descriptorArchive,
              ReadableArchive contentArchive,
              Application app)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Creates the DOL object graph for an app for which the descriptor(s) reside in one archive and the content resides in another.

This allows the app client container to use both the generated JAR which contains the descriptors that are filled in during deployment and also the developer's original JAR which contains the classes that might be subject to annotation processing.

Parameters:
descriptorArchive - archive containing the descriptor(s)
contentArchive - archive containing the classes, etc.
app - owning DOL application (if any)
Returns:
DOL object graph for the application
Throws:
java.io.IOException
org.xml.sax.SAXParseException

open

public T open(ReadableArchive archive,
              Application app)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Throws:
java.io.IOException
org.xml.sax.SAXParseException

openWith

public Application openWith(Application app,
                            ReadableArchive archive)
                     throws java.io.IOException,
                            org.xml.sax.SAXParseException
Throws:
java.io.IOException
org.xml.sax.SAXParseException

open

public T open(java.lang.String path)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Open a new archive file, read the XML descriptor and set the constructed DOL descriptor instance

Parameters:
path - the archive file path
Returns:
the deployment descriptor for this archive
Throws:
java.io.IOException
org.xml.sax.SAXParseException

open

public T open(java.io.File file)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
open a new archive file using a file descriptor

Parameters:
file - the archive to open
Throws:
java.io.IOException
org.xml.sax.SAXParseException

postStandardDDsRead

protected void postStandardDDsRead(T descriptor,
                                   ReadableArchive archive,
                                   java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions)
                            throws java.io.IOException
perform any action after all standard DDs is read

Parameters:
descriptor - the deployment descriptor for the module
archive - the module archive
extensions - map of extension archivists
Throws:
java.io.IOException

postAnnotationProcess

protected void postAnnotationProcess(T descriptor,
                                     ReadableArchive archive)
                              throws java.io.IOException
perform any action after annotation processed

Parameters:
descriptor - the deployment descriptor for the module
archive - the module archive
Throws:
java.io.IOException

postRuntimeDDsRead

protected void postRuntimeDDsRead(T descriptor,
                                  ReadableArchive archive)
                           throws java.io.IOException
perform any action after all runtime DDs read

Parameters:
descriptor - the deployment descriptor for the module
archive - the module archive
Throws:
java.io.IOException

postOpen

protected void postOpen(T descriptor,
                        ReadableArchive archive)
                 throws java.io.IOException
perform any post deployment descriptor reading action

Parameters:
descriptor - the deployment descriptor for the module
archive - the module archive
Throws:
java.io.IOException

readAnnotations

protected void readAnnotations(ReadableArchive archive,
                               T descriptor,
                               java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions)
                        throws java.io.IOException
Throws:
java.io.IOException

readAnnotations

protected void readAnnotations(ReadableArchive archive,
                               T descriptor,
                               java.util.Map<ExtensionsArchivist,RootDeploymentDescriptor> extensions,
                               ModuleScanner scanner)
                        throws java.io.IOException
Throws:
java.io.IOException

getScanner

public ModuleScanner getScanner()
Returns the scanner for this archivist, usually it is the scanner regitered with the same module type as this archivist, but subclasses can return a different version


processAnnotations

public ProcessingResult processAnnotations(T bundleDesc,
                                           ReadableArchive archive)
                                    throws AnnotationProcessorException,
                                           java.io.IOException
Process annotations in a bundle descriptor, the annoation processing is dependent on the type of descriptor being passed.

Throws:
AnnotationProcessorException
java.io.IOException

processAnnotations

protected ProcessingResult processAnnotations(RootDeploymentDescriptor bundleDesc,
                                              ModuleScanner scanner,
                                              ReadableArchive archive)
                                       throws AnnotationProcessorException,
                                              java.io.IOException
Process annotations in a bundle descriptor, the annoation processing is dependent on the type of descriptor being passed.

Throws:
AnnotationProcessorException
java.io.IOException

readStandardDeploymentDescriptor

public T readStandardDeploymentDescriptor(ReadableArchive archive)
                                                                    throws java.io.IOException,
                                                                           org.xml.sax.SAXParseException
Read the standard deployment descriptors (can contained in one or many file) and return the corresponding initialized descriptor instance. By default, the standard deployment descriptors are all contained in the xml file characterized with the path returned by

Returns:
the initialized descriptor
Throws:
java.io.IOException
org.xml.sax.SAXParseException

readRuntimeDeploymentDescriptor

public void readRuntimeDeploymentDescriptor(ReadableArchive archive,
                                            T descriptor)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXParseException
Read the runtime deployment descriptors (can contained in one or many file) set the corresponding information in the passed descriptor. By default, the runtime deployment descriptors are all contained in the xml file characterized with the path returned by

Parameters:
archive - the archive
descriptor - the initialized deployment descriptor
Throws:
java.io.IOException
org.xml.sax.SAXParseException

readRuntimeDeploymentDescriptor

public void readRuntimeDeploymentDescriptor(ReadableArchive archive,
                                            T descriptor,
                                            boolean warnIfMultipleDDs)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXParseException
Read the runtime deployment descriptors (can contained in one or many file) set the corresponding information in the passed descriptor. By default, the runtime deployment descriptors are all contained in the xml file characterized with the path returned by

Parameters:
archive - the archive
descriptor - the initialized deployment descriptor
warnIfMultipleDDs - whether to log warnings if both the GlassFish and the legacy Sun descriptors are present
Throws:
java.io.IOException
org.xml.sax.SAXParseException

readRuntimeDDFromDeploymentPlan

public void readRuntimeDDFromDeploymentPlan(ReadableArchive planArchive,
                                            T descriptor)
                                     throws java.io.IOException,
                                            org.xml.sax.SAXParseException
Read the runtime deployment descriptors (can contained in one or many file) from a deployment plan archive, set the corresponding information in the passed descriptor.

Throws:
java.io.IOException
org.xml.sax.SAXParseException

readRuntimeDDFromDeploymentPlan

protected void readRuntimeDDFromDeploymentPlan(java.lang.String entry,
                                               ReadableArchive planArchive,
                                               T descriptor)
                                        throws java.io.IOException,
                                               org.xml.sax.SAXParseException
Read the runtime deployment descriptors (can contained in one or many file) from a deployment plan archive, set the corresponding information in the passed descriptor.

Throws:
java.io.IOException
org.xml.sax.SAXParseException

write

public void write()
           throws java.io.IOException
Throws:
java.io.IOException

write

public void write(java.lang.String outPath)
           throws java.io.IOException
saves the archive

Parameters:
outPath - the file to use
Throws:
java.io.IOException

write

public void write(ReadableArchive in,
                  java.lang.String outPath)
           throws java.io.IOException
save the archive

Parameters:
in - archive to copy old elements from
outPath - the file to use
Throws:
java.io.IOException

write

public void write(ReadableArchive in,
                  WritableArchive out)
           throws java.io.IOException
Throws:
java.io.IOException

writeContents

protected void writeContents(WritableArchive out)
                      throws java.io.IOException
writes the content of an archive to a JarFile

Parameters:
out - jar output stream to write to
Throws:
java.io.IOException

writeContents

protected void writeContents(ReadableArchive in,
                             WritableArchive out)
                      throws java.io.IOException
writes the content of an archive to another archive

Parameters:
in - input archive
out - output archive
Throws:
java.io.IOException

writeContents

protected void writeContents(ReadableArchive in,
                             WritableArchive out,
                             java.util.Vector entriesToSkip)
                      throws java.io.IOException
writes the content of an archive to a JarFile

Parameters:
in - input archive
out - archive output stream to write to
entriesToSkip - files to not write from the original archive
Throws:
java.io.IOException

writeDeploymentDescriptors

public void writeDeploymentDescriptors(WritableArchive out)
                                throws java.io.IOException
writes the deployment descriptors (standard and runtime) to a JarFile using the right deployment descriptor path

Throws:
java.io.IOException

writeStandardDeploymentDescriptors

public void writeStandardDeploymentDescriptors(WritableArchive out)
                                        throws java.io.IOException
writes the standard deployment descriptors to an abstract archive

Parameters:
out - archive to write to
Throws:
java.io.IOException

writeRuntimeDeploymentDescriptors

public void writeRuntimeDeploymentDescriptors(WritableArchive out)
                                       throws java.io.IOException
writes the runtime deployment descriptors to an abstract archive

Parameters:
out - output archive
Throws:
java.io.IOException

writeWLRuntimeDeploymentDescriptors

public void writeWLRuntimeDeploymentDescriptors(WritableArchive out)
                                         throws java.io.IOException
writes the WL runtime deployment descriptors to an abstract archive

Parameters:
out - output archive
Throws:
java.io.IOException

writeExtraDeploymentDescriptors

protected void writeExtraDeploymentDescriptors(WritableArchive out)
                                        throws java.io.IOException
write all extra deployment descriptors (like cmp related and runtime dds)

Throws:
java.io.IOException

writeStandardDeploymentDescriptors

public void writeStandardDeploymentDescriptors(java.io.OutputStream os)
                                        throws java.io.IOException
writes the standard deployment descriptor to an output stream

Parameters:
os - stream to write out the descriptors
Throws:
java.io.IOException

writeRuntimeDeploymentDescriptors

public void writeRuntimeDeploymentDescriptors(java.io.OutputStream os)
                                       throws java.io.IOException
writes de configuration deployment descriptor to a new XML file

Parameters:
os - stream to write the configuration deployment descriptors
Throws:
java.io.IOException

writeWebServicesDescriptors

protected void writeWebServicesDescriptors(BundleDescriptor desc,
                                           WritableArchive out)
                                    throws java.io.IOException
Write web services related descriptors

Parameters:
desc - the module descriptor
out - the output archive
Throws:
java.io.IOException

getDeploymentDescriptorPath

public java.lang.String getDeploymentDescriptorPath()
Returns:
the location of the DeploymentDescriptor file for a particular type of J2EE Archive

getWebServicesDeploymentDescriptorPath

public java.lang.String getWebServicesDeploymentDescriptorPath()
Returns:
the location of the web services related deployment descriptor file inside this archive or null if this archive does not support webservices implementation.

getRuntimeDeploymentDescriptorPath

public java.lang.String getRuntimeDeploymentDescriptorPath()
Returns:
the location of the runtime deployment descriptor file for a particular type of J2EE Archive

containsRuntimeDeploymentDescriptors

public boolean containsRuntimeDeploymentDescriptors(Archive in)
Returns:
true if the passed Archive contains runtime deployment descriptors information

setModuleDescriptor

public void setModuleDescriptor(ModuleDescriptor<T> module)
Archivists can be associated with a module descriptor once the XML deployment descriptors have been read and the DOL tree is initialized.


performOptionalPkgDependenciesCheck

public boolean performOptionalPkgDependenciesCheck(ReadableArchive archive)
                                            throws java.io.IOException
Perform Optional packages dependencies checking on an archive

Throws:
java.io.IOException

supportsModuleType

public boolean supportsModuleType(XModuleType moduleType)

getModuleType

public abstract XModuleType getModuleType()
Returns:
the module type handled by this archivist as defined in the application DTD

getStandardDDFile

public abstract DeploymentDescriptorFile<T> getStandardDDFile()
Returns:
the DeploymentDescriptorFile responsible for handling standard deployment descriptor

getConfigurationDDFile

public abstract DeploymentDescriptorFile getConfigurationDDFile()
Returns:
if exists the DeploymentDescriptorFile responsible for handling the configuration deployment descriptors

getWLConfigurationDDFile

public DeploymentDescriptorFile getWLConfigurationDDFile()
Returns:
if exists the DeploymentDescriptorFile responsible for handling the WL configuration deployment descriptors

getSunConfigurationDDFile

public DeploymentDescriptorFile getSunConfigurationDDFile()
Returns:
if exists the DeploymentDescriptorFile responsible for handling the Sun configuration deployment descriptors

getDefaultBundleDescriptor

public abstract T getDefaultBundleDescriptor()
Returns:
a default BundleDescriptor for this archivist

getWebServicesDDFile

public DeploymentDescriptorFile getWebServicesDDFile(RootDeploymentDescriptor desc)
Parameters:
desc - the bundle descriptor
Returns:
the DeploymentDescriptorFile responsible for handling the web services deployment descriptors

getArchiveExtension

protected abstract java.lang.String getArchiveExtension()
Returns:
The archive extension handled by a specific archivist

postHandles

protected abstract boolean postHandles(ReadableArchive archive)
                                throws java.io.IOException
Returns:
true if the archivist is handling the provided archive
Throws:
java.io.IOException

hasStandardDeploymentDescriptor

public boolean hasStandardDeploymentDescriptor(ReadableArchive archive)
                                        throws java.io.IOException
Throws:
java.io.IOException

hasRuntimeDeploymentDescriptor

public boolean hasRuntimeDeploymentDescriptor(ReadableArchive archive)
                                       throws java.io.IOException
Throws:
java.io.IOException

handles

public boolean handles(ReadableArchive archive)
Returns true if this archivist is capable of handling the archive type

Parameters:
archive - the input archive
Returns:
true if this archivist can handle this archive

createModuleDescriptor

public ModuleDescriptor createModuleDescriptor(T descriptor)
creates a new module descriptor for this archivist

Returns:
the new module descriptor

printDescriptor

public void printDescriptor()
print the current descriptor associated with this archivist


setHandleRuntimeInfo

public void setHandleRuntimeInfo(boolean handleRuntimeInfo)
sets if this archivist saves the runtime info

Parameters:
handleRuntimeInfo - to true to save the runtime info

isHandlingRuntimeInfo

public boolean isHandlingRuntimeInfo()
Returns:
true if this archivist will save the runtime info

setAnnotationProcessingRequested

public void setAnnotationProcessingRequested(boolean annotationProcessingRequested)
sets if this archivist process annotation

Parameters:
annotationProcessingRequested - to true to process annotation

isAnnotationProcessingRequested

public boolean isAnnotationProcessingRequested()
Returns:
true if this archivist will process annotation

setAnnotationErrorHandler

public void setAnnotationErrorHandler(ErrorHandler annotationErrorHandler)
sets annotation ErrorHandler for this archivist

Parameters:
annotationErrorHandler -

getAnnotationErrorHandler

public ErrorHandler getAnnotationErrorHandler()
Returns:
annotation ErrorHandler of this archivist

setManifest

public void setManifest(java.util.jar.Manifest m)
sets the manifest file for this archive

Parameters:
m - manifest to use at saving time

getManifest

public java.util.jar.Manifest getManifest()
Returns:
the manifest file for this archive

setClassPath

public void setClassPath(java.lang.String newClassPath)
Sets the class-path for this archive

Parameters:
newClassPath - the new class-path

getClassPath

public java.lang.String getClassPath()
Returns:
the class-path as set in the manifest associated with the archive

getLibraries

public java.util.Vector getLibraries(Archive archive)
Returns:
a list of libraries included in the archivist

getUniqueEntryFilenameFor

protected java.lang.String getUniqueEntryFilenameFor(Archive archive,
                                                     java.lang.String trialName)
                                              throws java.io.IOException
Throws:
java.io.IOException

saveRuntimeInfo

public void saveRuntimeInfo(java.io.File output)
                     throws java.io.IOException
Throws:
java.io.IOException

applyRuntimeInfo

public void applyRuntimeInfo(java.io.File runtimeDD,
                             java.io.File output)
                      throws java.io.IOException,
                             org.xml.sax.SAXParseException
apply runtimne info to this archive descriptors and saves it

Throws:
java.io.IOException
org.xml.sax.SAXParseException

getTempFile

protected static java.io.File getTempFile(java.lang.String fileOrDirPath)
                                   throws java.io.IOException
utility method to get a tmp file in the current user directory of the provided directory

Parameters:
fileOrDirPath - path to a file or directory to use as temp location (use parent directory if a file is provided)
Throws:
java.io.IOException

getListOfFilesToSkip

public java.util.Vector getListOfFilesToSkip()
Returns:
the list of files that should not be copied from the old archive when a save is performed.

getTempFile

protected static java.io.File getTempFile(java.io.File fileOrDir)
                                   throws java.io.IOException
utility method to get a tmp file in the current user directory of the provided directory

Parameters:
fileOrDir - file or directory to use as temp location (use parent directory if a file is provided)
Throws:
java.io.IOException

addFileToArchive

protected static void addFileToArchive(WritableArchive archive,
                                       java.lang.String filePath,
                                       java.lang.String entryName)
                                throws java.io.IOException
add a file to an output abstract archive

Parameters:
archive - abstraction to use when adding the file
filePath - to the file to add
entryName - the entry name in the archive
Throws:
java.io.IOException

copyJarElements

protected void copyJarElements(ReadableArchive in,
                               WritableArchive out,
                               java.util.Vector ignoreList)
                        throws java.io.IOException
copy all contents of a jar file to a new jar file except for all the deployment descriptors files

Parameters:
in - jar file
out - jar file
ignoreList - vector of entry name to not copy from to source jar file
Throws:
java.io.IOException

renameTmp

protected boolean renameTmp(java.lang.String from,
                            java.lang.String to)
                     throws java.io.IOException
rename a tmp file

Parameters:
from - name
to - name
Throws:
java.io.IOException

setArchiveUri

public void setArchiveUri(java.lang.String path)
Sets the path for this archivist's archive file


getPath

public java.lang.String getPath()
Returns:
the path for this archivist's archive file

setClassLoader

public void setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader for this archivist

Parameters:
classLoader - classLoader

getClassLoader

public java.lang.ClassLoader getClassLoader()
Gets the classloader for this archivist

Returns:
classLoader

setXMLValidation

public void setXMLValidation(boolean validate)
Turn on or off the XML Validation for all standard deployment descriptors loading

Parameters:
validate - set to true to turn on XML validation

getXMLValidation

public boolean getXMLValidation()
Returns:
true if the Deployment Descriptors XML will be validated while reading.

setRuntimeXMLValidation

public void setRuntimeXMLValidation(boolean validate)
Turn on or off the XML Validation for runtime deployment descriptors loading

Parameters:
validate - set to true to turn on XML validation

getRuntimeXMLValidation

public boolean getRuntimeXMLValidation()
Returns:
true if the runtime XML will be validated while reading.

setXMLValidationLevel

public void setXMLValidationLevel(java.lang.String level)
Sets the xml validation error reporting/recovering level. The reporting level is active only when xml validation is turned on @see setXMLValidation. so far, two values can be passed, medium which reports the xml validation and continue and full which reports the xml validation and stop the xml parsing.


getXMLValidationLevel

public java.lang.String getXMLValidationLevel()
Returns:
the xml validation reporting level

setRuntimeXMLValidationLevel

public void setRuntimeXMLValidationLevel(java.lang.String level)
Sets the runtime xml validation error reporting/recovering level. The reporting level is active only when xml validation is turned on @see setXMLValidation. so far, two values can be passed, medium which reports the xml validation and continue and full which reports the xml validation and stop the xml parsing.


getRuntimeXMLValidationLevel

public java.lang.String getRuntimeXMLValidationLevel()
Returns:
the runtime xml validation reporting level

validate

public void validate(java.lang.ClassLoader aClassLoader)
validates the DOL Objects associated with this archivist, usually it requires that a class loader being set on this archivist or passed as a parameter


copyInto

public void copyInto(WritableArchive target)
              throws java.io.IOException
Copy this archivist to a new abstract archive

Parameters:
target - the new archive to use to copy our contents into
Throws:
java.io.IOException

copyInto

public void copyInto(ReadableArchive source,
                     WritableArchive target)
              throws java.io.IOException
Copy source archivist to a target abstract archive. By default, every entry in source archive will be copied to the target archive, including the manifest of the source archive.

Parameters:
source - the source archive to copy from
target - the target archive to copy to
Throws:
java.io.IOException

copyInto

public void copyInto(ReadableArchive source,
                     WritableArchive target,
                     boolean overwriteManifest)
              throws java.io.IOException
Copy source archivist to a target abstract archive. By default, every entry in source archive will be copied to the target archive.

Parameters:
source - the source archive to copy from
target - the target archive to copy to
overwriteManifest - if true, the manifest in source archive overwrites the one in target archive
Throws:
java.io.IOException

copyInto

public void copyInto(ReadableArchive source,
                     WritableArchive target,
                     java.util.Vector entriesToSkip)
              throws java.io.IOException
Copy source archivist to a target abstract archive. By default, the manifest in source archive overwrites the one in target archive.

Parameters:
source - the source archive to copy from
target - the target archive to copy to
entriesToSkip - the entries that will be skipped by target archive
Throws:
java.io.IOException

copyInto

public void copyInto(ReadableArchive source,
                     WritableArchive target,
                     java.util.Vector entriesToSkip,
                     boolean overwriteManifest)
              throws java.io.IOException
Copy this archivist to a new abstract archive

Parameters:
source - the source archive to copy from
target - the target archive to copy to
entriesToSkip - the entries that will be skipped by target archive
overwriteManifest - if true, the manifest in source archive overwrites the one in target archive
Throws:
java.io.IOException

extractEntry

public void extractEntry(java.lang.String entryName,
                         java.io.File out)
                  throws java.io.IOException
extract a entry of this archive to a file

Parameters:
entryName - entry name
out - file to copy the entry into
Throws:
java.io.IOException

copyAnEntry

public void copyAnEntry(ReadableArchive in,
                        WritableArchive out,
                        java.lang.String entryName)
                 throws java.io.IOException
Throws:
java.io.IOException

copyStandardDeploymentDescriptors

public void copyStandardDeploymentDescriptors(ReadableArchive in,
                                              WritableArchive out)
                                       throws java.io.IOException
Throws:
java.io.IOException

copyExtraElements

public void copyExtraElements(ReadableArchive in,
                              WritableArchive out)
                       throws java.io.IOException
Throws:
java.io.IOException

readMetaInfo

public java.lang.Object readMetaInfo(ReadableArchive archive)

isProcessAnnotation

protected boolean isProcessAnnotation(T descriptor)


Copyright © 2012 GlassFish Community. All Rights Reserved.