Class DefaultModuleDefinition
- java.lang.Object
-
- com.sun.enterprise.module.common_impl.DefaultModuleDefinition
-
- All Implemented Interfaces:
ModuleDefinition
- Direct Known Subclasses:
CookedModuleDefinition
public class DefaultModuleDefinition extends java.lang.Object implements ModuleDefinition
ModuleDefinitionimplementation that picks up most of the module properties from the manifest file of the jar, as baked in by the hk2-maven-plugin.
-
-
Field Summary
Fields Modifier and Type Field Description protected java.util.List<java.net.URI>classPathprotected java.util.List<ModuleDependency>dependenciesprivate static java.util.jar.ManifestEMPTY_MANIFESTprivate java.lang.StringimportPolicyprivate java.lang.StringlifecyclePolicyprivate static java.util.logging.LoggerLOGGERprotected java.util.jar.AttributesmainAttributesMain attributes section of the manifest.private java.util.jar.Manifestmanifestprivate ModuleMetadatametadataMetadata that works like index.private java.lang.Stringnameprivate java.lang.String[]publicPkgsprivate java.lang.Stringversion
-
Constructor Summary
Constructors Constructor Description DefaultModuleDefinition(java.io.File location)TO DO need to support a URI constructorDefaultModuleDefinition(java.io.File location, java.util.jar.Attributes attr)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringdecorateClassPath(java.lang.String classpathElement)Extension point to manipulate the classpath element before it's parsed.ModuleDependency[]getDependencies()Returns the list of module dependenciesjava.lang.StringgetImportPolicyClassName()Returns the class name implementing theImportPolicyinterface for this module or null if there is no such implementationjava.lang.StringgetLifecyclePolicyClassName()Returns the class name implementing theLifecyclePolicyinterface for this module or null if there is no such implementationjava.net.URI[]getLocations()Returns the list of URI locations forming the classpath for this module.java.util.jar.ManifestgetManifest()Returns the manifest file from the module's implementation jar fileModuleMetadatagetMetadata()Gets the metadata that describes various components and services in this module.java.lang.StringgetName()Returns the name of the modulejava.lang.String[]getPublicInterfaces()Returns the list of classes and packages that have been designated as public interfaces of this module.java.lang.StringgetVersion()Returns the module's versionprotected voidparseAttributes(java.util.jar.Attributes attr)Extensibility point to parse more information from Manifest attributes.protected voidparseClassPath(java.util.jar.Attributes attr, java.net.URI baseURI)Parses "Class-Path" from manifest attributes and updates URI list.private booleantestClassPath(java.net.URI uri)Optional error diagnostics performed during the development time to check if the URL pointed by the path actually exists.java.lang.StringtoString()Assists debugging.
-
-
-
Field Detail
-
name
private final java.lang.String name
-
version
private final java.lang.String version
-
publicPkgs
private final java.lang.String[] publicPkgs
-
dependencies
protected final java.util.List<ModuleDependency> dependencies
-
classPath
protected final java.util.List<java.net.URI> classPath
-
importPolicy
private final java.lang.String importPolicy
-
lifecyclePolicy
private final java.lang.String lifecyclePolicy
-
manifest
private final java.util.jar.Manifest manifest
-
mainAttributes
protected final java.util.jar.Attributes mainAttributes
Main attributes section of the manifest. Always non-null.
-
metadata
private final ModuleMetadata metadata
Metadata that works like index.
-
EMPTY_MANIFEST
private static final java.util.jar.Manifest EMPTY_MANIFEST
-
LOGGER
private static final java.util.logging.Logger LOGGER
-
-
Constructor Detail
-
DefaultModuleDefinition
public DefaultModuleDefinition(java.io.File location) throws java.io.IOExceptionTO DO need to support a URI constructor- Throws:
java.io.IOException
-
DefaultModuleDefinition
public DefaultModuleDefinition(java.io.File location, java.util.jar.Attributes attr) throws java.io.IOException- Throws:
java.io.IOException
-
-
Method Detail
-
parseClassPath
protected void parseClassPath(java.util.jar.Attributes attr, java.net.URI baseURI) throws java.io.IOExceptionParses "Class-Path" from manifest attributes and updates URI list.- Throws:
java.io.IOException
-
testClassPath
private boolean testClassPath(java.net.URI uri)
Optional error diagnostics performed during the development time to check if the URL pointed by the path actually exists.
-
decorateClassPath
protected java.lang.String decorateClassPath(java.lang.String classpathElement)
Extension point to manipulate the classpath element before it's parsed.- See Also:
parseClassPath(Attributes,URI)
-
parseAttributes
protected void parseAttributes(java.util.jar.Attributes attr)
Extensibility point to parse more information from Manifest attributes.- Parameters:
attr- Main attributes of the manifest. Always non-null.
-
getName
public java.lang.String getName()
Returns the name of the module- Specified by:
getNamein interfaceModuleDefinition- Returns:
- the name
-
getPublicInterfaces
public java.lang.String[] getPublicInterfaces()
Returns the list of classes and packages that have been designated as public interfaces of this module.- Specified by:
getPublicInterfacesin interfaceModuleDefinition- Returns:
- the list of public packages or classes
-
getDependencies
public ModuleDependency[] getDependencies()
Returns the list of module dependencies- Specified by:
getDependenciesin interfaceModuleDefinition- Returns:
- the ModuleDependency
-
getLocations
public java.net.URI[] getLocations()
Returns the list of URI locations forming the classpath for this module.- Specified by:
getLocationsin interfaceModuleDefinition- Returns:
- the list of URI locations for this module
-
getVersion
public java.lang.String getVersion()
Returns the module's version- Specified by:
getVersionin interfaceModuleDefinition- Returns:
- the module's version
-
getImportPolicyClassName
public java.lang.String getImportPolicyClassName()
Returns the class name implementing theImportPolicyinterface for this module or null if there is no such implementation- Specified by:
getImportPolicyClassNamein interfaceModuleDefinition- Returns:
- the
ImportPolicyimplementation class name
-
getLifecyclePolicyClassName
public java.lang.String getLifecyclePolicyClassName()
Returns the class name implementing theLifecyclePolicyinterface for this module or null if there is no such implementation- Specified by:
getLifecyclePolicyClassNamein interfaceModuleDefinition- Returns:
- the
LifecyclePolicyimplementation class name
-
getManifest
public java.util.jar.Manifest getManifest()
Returns the manifest file from the module's implementation jar file- Specified by:
getManifestin interfaceModuleDefinition- Returns:
- never null.
-
getMetadata
public ModuleMetadata getMetadata()
Description copied from interface:ModuleDefinitionGets the metadata that describes various components and services in this module.- Specified by:
getMetadatain interfaceModuleDefinition- Returns:
- Always non-null.
-
toString
public java.lang.String toString()
Assists debugging.- Overrides:
toStringin classjava.lang.Object
-
-