Class DOLUtils
- java.lang.Object
-
- com.sun.enterprise.deployment.util.DOLUtils
-
public class DOLUtils extends Object
Utility class for convenience methods for deployment- Version:
- Author:
- Jerome Dochez
-
-
Field Summary
Fields Modifier and Type Field Description static Logger
deplLogger
static String
INVALID_DESC_MAPPING
static String
SCHEMA_LOCATION_TAG
static String
W3C_XML_SCHEMA
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static ArchiveType
carType()
static ArchiveType
earType()
static ArchiveType
ejbType()
static boolean
equals(Object a, Object b)
Returns true if both objects are equal tonull
ora.equals(b)
static Application
getApplicationFromEnv(JndiNameEnvironment env)
static String
getApplicationName(JndiNameEnvironment env)
static String
getComponentEnvId(JndiNameEnvironment env)
Generate a unique id name for each J2EE component.static List<ConfigurationDeploymentDescriptorFile>
getConfigurationDeploymentDescriptorFiles(org.glassfish.hk2.api.ServiceLocator habitat, String containerType)
Gets all classes for handling the XML configurationstatic BundleDescriptor
getCurrentBundleForContext(DeploymentContext context)
Gets the associated descriptor with the contextstatic Logger
getDefaultLogger()
static List<URI>
getLibraryJarURIs(Application app, ReadableArchive archive)
static List<URI>
getLibraryJarURIs(BundleDescriptor bundleDesc, ReadableArchive archive)
static String
getModuleName(JndiNameEnvironment env)
static ArchiveType
getModuleType(String moduleType)
Utility method to retrieve aArchiveType
from a stringified module type.static List<String>
getProprietaryDTDStart()
Returns a list of the proprietary dtd system IDsstatic List<String>
getProprietarySchemaNamespaces()
Returns a list of the proprietary schema namespacesstatic boolean
getTreatComponentAsModule(JndiNameEnvironment env)
Returns true if the environment or its parent is aWebBundleDescriptor
, false otherwisestatic boolean
isEarApplication(JndiNameEnvironment env)
static boolean
isGFDDOverWLSDD()
returns true if GF DD should have higher precedence over WLS DD when both present in the same archivestatic boolean
isIgnoreWLSDD()
returns true if we should ignore WLS DD in the archivestatic boolean
isRAConnectionFactory(org.glassfish.hk2.api.ServiceLocator habitat, String type, Application thisApp)
Returns true if there is a resource connection definition of the type with the applicationstatic boolean
isScanningAllowed(Application app, String entryName)
Returns true if entry not excluded from scanning or specifically included in appstatic boolean
isWhiteListed(Application application, String className)
Supports extreme classloading isolationstatic List<ConfigurationDeploymentDescriptorFile>
processConfigurationDDFiles(List<ConfigurationDeploymentDescriptorFile> ddFiles, ReadableArchive archive, ArchiveType archiveType)
process the list of the configuration files, and return the sorted configuration file with precedence from high to low this list takes consideration of what runtime files are present in the current archivestatic ArchiveType
rarType()
static void
readAlternativeRuntimeDescriptor(ReadableArchive appArchive, ReadableArchive embeddedArchive, Archivist archivist, BundleDescriptor descriptor, String altDDPath)
read alternative runtime descriptor if there is an alternative runtime DD packaged inside the archivestatic void
readRuntimeDeploymentDescriptor(List<ConfigurationDeploymentDescriptorFile> confDDFiles, ReadableArchive archive, RootDeploymentDescriptor descriptor, Archivist main, boolean warnIfMultipleDDs)
Read the runtime deployment descriptors (can contained in one or many file) set the corresponding information in the passed descriptor.static boolean
setElementValue(XMLElement element, String value, Object o)
receives notification of the value for a particular tagstatic void
setExtensionArchivistForSubArchivist(org.glassfish.hk2.api.ServiceLocator habitat, ReadableArchive archive, ModuleDescriptor md, Application app, Archivist subArchivist)
Sets the class for processing an archive on a subarchivestatic String
toEarComponentId(String appName)
static void
validateRuntimeAltDDPath(String runtimeAltDDPath)
If the path does not contain "glassfish-" this method throws an IllegalArgumentExceptionstatic ArchiveType
warType()
-
-
-
Field Detail
-
W3C_XML_SCHEMA
public static final String W3C_XML_SCHEMA
- See Also:
- Constant Field Values
-
SCHEMA_LOCATION_TAG
public static final String SCHEMA_LOCATION_TAG
- See Also:
- Constant Field Values
-
deplLogger
public static final Logger deplLogger
-
INVALID_DESC_MAPPING
public static final String INVALID_DESC_MAPPING
- See Also:
- Constant Field Values
-
-
Method Detail
-
getDefaultLogger
public static Logger getDefaultLogger()
- Returns:
- a logger to use in the DOL implementation classes
-
equals
public static boolean equals(Object a, Object b)
Returns true if both objects are equal tonull
ora.equals(b)
- Parameters:
a
-b
-- Returns:
- See Also:
Object.equals(Object)
-
getLibraryJarURIs
public static List<URI> getLibraryJarURIs(BundleDescriptor bundleDesc, ReadableArchive archive) throws Exception
- Parameters:
bundleDesc
-archive
-- Returns:
- an empty list if bundleDesc is null
- Throws:
Exception
-
isScanningAllowed
public static boolean isScanningAllowed(Application app, String entryName)
Returns true if entry not excluded from scanning or specifically included in app- Parameters:
app
-entryName
-- Returns:
-
getLibraryJarURIs
public static List<URI> getLibraryJarURIs(Application app, ReadableArchive archive) throws Exception
- Parameters:
app
-archive
-- Returns:
- an empty list if the archive does not have a parent
- Throws:
Exception
-
getCurrentBundleForContext
public static BundleDescriptor getCurrentBundleForContext(DeploymentContext context)
Gets the associated descriptor with the context- Parameters:
context
-- Returns:
- null if there is no associated application
-
isRAConnectionFactory
public static boolean isRAConnectionFactory(org.glassfish.hk2.api.ServiceLocator habitat, String type, Application thisApp)
Returns true if there is a resource connection definition of the type with the application- Parameters:
habitat
-type
-thisApp
-- Returns:
-
earType
public static ArchiveType earType()
-
ejbType
public static ArchiveType ejbType()
-
carType
public static ArchiveType carType()
-
warType
public static ArchiveType warType()
-
rarType
public static ArchiveType rarType()
-
getModuleType
public static ArchiveType getModuleType(String moduleType)
Utility method to retrieve aArchiveType
from a stringified module type. SinceArchiveType
is an extensible abstraction and implementations are plugged in via HK2 service registry, this method returns null if HK2 service registry is not setup. If null is passed to this method, it returns null instead of returning an arbitrary ArchiveType or throwing an exception.- Parameters:
moduleType
- String equivalent of the module type being looked up. null is allowed.- Returns:
- the corresponding ArchiveType, null if no such module type exists or HK2 Service registry is not set up
-
isGFDDOverWLSDD
public static boolean isGFDDOverWLSDD()
returns true if GF DD should have higher precedence over WLS DD when both present in the same archive- Returns:
-
isIgnoreWLSDD
public static boolean isIgnoreWLSDD()
returns true if we should ignore WLS DD in the archive- Returns:
-
validateRuntimeAltDDPath
public static void validateRuntimeAltDDPath(String runtimeAltDDPath)
If the path does not contain "glassfish-" this method throws an IllegalArgumentException- Parameters:
runtimeAltDDPath
-
-
processConfigurationDDFiles
public static List<ConfigurationDeploymentDescriptorFile> processConfigurationDDFiles(List<ConfigurationDeploymentDescriptorFile> ddFiles, ReadableArchive archive, ArchiveType archiveType) throws IOException
process the list of the configuration files, and return the sorted configuration file with precedence from high to low this list takes consideration of what runtime files are present in the current archive- Parameters:
ddFiles
-archive
-archiveType
-- Returns:
- Throws:
IOException
-
readAlternativeRuntimeDescriptor
public static void readAlternativeRuntimeDescriptor(ReadableArchive appArchive, ReadableArchive embeddedArchive, Archivist archivist, BundleDescriptor descriptor, String altDDPath) throws IOException, SAXParseException
read alternative runtime descriptor if there is an alternative runtime DD packaged inside the archive- Parameters:
appArchive
-embeddedArchive
-archivist
-descriptor
-altDDPath
-- Throws:
IOException
SAXParseException
-
readRuntimeDeploymentDescriptor
public static void readRuntimeDeploymentDescriptor(List<ConfigurationDeploymentDescriptorFile> confDDFiles, ReadableArchive archive, RootDeploymentDescriptor descriptor, Archivist main, boolean warnIfMultipleDDs) throws IOException, 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:
confDDFiles
- the sorted configuration files for this archivearchive
- the archivedescriptor
- the initialized deployment descriptormain
- the main archivistwarnIfMultipleDDs
- whether to log warnings if both the GlassFish and the legacy Sun descriptors are present- Throws:
IOException
SAXParseException
-
setExtensionArchivistForSubArchivist
public static void setExtensionArchivistForSubArchivist(org.glassfish.hk2.api.ServiceLocator habitat, ReadableArchive archive, ModuleDescriptor md, Application app, Archivist subArchivist)
Sets the class for processing an archive on a subarchiveIf there an exception occurs in this method it will be caught and logged as a warning
- Parameters:
habitat
-archive
-md
-app
-subArchivist
-
-
getConfigurationDeploymentDescriptorFiles
public static List<ConfigurationDeploymentDescriptorFile> getConfigurationDeploymentDescriptorFiles(org.glassfish.hk2.api.ServiceLocator habitat, String containerType)
Gets all classes for handling the XML configuration- Parameters:
habitat
- habitat to search for classescontainerType
- they type of container they must work on- Returns:
-
setElementValue
public static boolean setElementValue(XMLElement element, String value, Object o)
receives notification of the value for a particular tag- Parameters:
element
- the xml elementvalue
- it's associated valueo
-- Returns:
-
getProprietarySchemaNamespaces
public static List<String> getProprietarySchemaNamespaces()
Returns a list of the proprietary schema namespaces- Returns:
-
getProprietaryDTDStart
public static List<String> getProprietaryDTDStart()
Returns a list of the proprietary dtd system IDs- Returns:
-
isEarApplication
public static boolean isEarApplication(JndiNameEnvironment env)
-
getApplicationFromEnv
public static Application getApplicationFromEnv(JndiNameEnvironment env)
- Parameters:
env
-- Returns:
-
getApplicationName
public static String getApplicationName(JndiNameEnvironment env)
- Parameters:
env
-- Returns:
-
getModuleName
public static String getModuleName(JndiNameEnvironment env)
-
getTreatComponentAsModule
public static boolean getTreatComponentAsModule(JndiNameEnvironment env)
Returns true if the environment or its parent is aWebBundleDescriptor
, false otherwise- Parameters:
env
-- Returns:
-
getComponentEnvId
public static String getComponentEnvId(JndiNameEnvironment env)
Generate a unique id name for each J2EE component.- Parameters:
env
-- Returns:
-
isWhiteListed
public static boolean isWhiteListed(Application application, String className)
Supports extreme classloading isolation- Parameters:
application
-className
-- Returns:
- true if the class is white-listed
-
-