Package com.sun.enterprise.deployment
Class BundleDescriptor
- java.lang.Object
-
- java.util.Observable
-
- org.glassfish.deployment.common.DynamicAttributesDescriptor
-
- org.glassfish.deployment.common.Descriptor
-
- org.glassfish.deployment.common.RootDeploymentDescriptor
-
- com.sun.enterprise.deployment.BundleDescriptor
-
- All Implemented Interfaces:
Roles
,Serializable
- Direct Known Subclasses:
CommonResourceBundleDescriptor
public abstract class BundleDescriptor extends RootDeploymentDescriptor implements Roles
I am an abstract class representing all the deployment information common to all component container structures held by an application.- Author:
- Danny Coward
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected HashMap<String,RootXMLNode>
rootNodes
-
Fields inherited from class org.glassfish.deployment.common.RootDeploymentDescriptor
classLoader, deplLogger, extensions, moduleDescriptor, moduleID
-
Fields inherited from class org.glassfish.deployment.common.Descriptor
DESCRIPTION_CHANGED, DESCRIPTOR_CHANGED, docType, LARGE_ICON_CHANGED, NAME_CHANGED, SMALL_ICON_CHANGED
-
-
Constructor Summary
Constructors Constructor Description BundleDescriptor()
Construct a new BundleDescriptorBundleDescriptor(String name, String description)
Construct a new BundleDescriptor with a name and description
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
addBundleDescriptor(BundleDescriptor bundleDescriptor)
void
addEntityManagerFactory(String unitName, jakarta.persistence.EntityManagerFactory emf)
Set the physical entity manager factory for a persistence unit within this module.void
addManagedBean(ManagedBeanDescriptor desc)
void
addMessageDestination(MessageDestinationDescriptor messageDestination)
Add a message destination to me.void
addRole(SecurityRoleDescriptor descriptor)
Adds a Role object based on the supplied SecurityRoleDescriptor.void
addRole(Role role)
Adds a role object to me.void
addRootNode(String ddPath, RootXMLNode rootNode)
PersistenceUnitDescriptor
findDefaultPU()
This method is responsible for finding default persistence unit for a bundle descriptor.PersistenceUnitDescriptor
findReferencedPU(String unitName)
It accepts both a quailified (e.g.) "lib/a.jar#FooPU" as well as unqualified name (e.g.) "FooPU".Collection<? extends PersistenceUnitDescriptor>
findReferencedPUs()
This method returns all the persistence units that are referenced by this module.protected static Collection<? extends PersistenceUnitDescriptor>
findReferencedPUsViaPCRefs(JndiNameEnvironment component)
helper method: find all PUs referenced via @PersistenceContext orprotected static Collection<? extends PersistenceUnitDescriptor>
findReferencedPUsViaPURefs(JndiNameEnvironment component)
helper method: find all PUs referenced via @PersistenceUnit orprotected static PersistenceUnitDescriptor
findReferencedPUViaEMFRef(EntityManagerFactoryReference emfRef)
protected static PersistenceUnitDescriptor
findReferencedPUViaEMRef(EntityManagerReference emRef)
Application
getApplication()
The application to which I belong, or none if I am standalone.ComponentVisitor
getBundleVisitor()
ClassLoader
getClassLoader()
String
getCompatibility()
String
getDeploymentDescriptorDir()
Set<jakarta.persistence.EntityManagerFactory>
getEntityManagerFactories()
Returns the set of physical entity manager factories associated with persistence units in this module.jakarta.persistence.EntityManagerFactory
getEntityManagerFactory(String unitName)
Retrieve the physical entity manager factory associated with the unitName of a persistence unit within this module.List<InjectionCapable>
getInjectableResources(JndiNameEnvironment jndiNameEnv)
protected List<InjectionCapable>
getInjectableResourcesByClass(String className, JndiNameEnvironment jndiNameEnv)
Define implementation of getInjectableResourceByClass here so it isn't replicated across appclient, web, ejb descriptors.InjectionInfo
getInjectionInfoByClass(Class clazz, JndiNameEnvironment jndiNameEnv)
boolean
getKeepState()
ManagedBeanDescriptor
getManagedBeanByBeanClass(String beanClassName)
Set<ManagedBeanDescriptor>
getManagedBeans()
MessageDestinationDescriptor
getMessageDestinationByName(String name)
Returns a message destination descriptor that I have by the same name, or throws an IllegalArgumentExceptionSet<MessageDestinationDescriptor>
getMessageDestinations()
Return the Set of message destinations I haveString
getModuleID()
String
getModuleName()
abstract ArchiveType
getModuleType()
protected Collection<NamedDescriptor>
getNamedDescriptorsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of named descriptors in the supplied nameEnvironmentprotected Vector<NamedReferencePair>
getNamedReferencePairsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of NameReference pairs in the supplied nameEnvironmentLifecycleCallbackDescriptor
getPostConstructDescriptorByClass(String className, JndiNameEnvironment jndiNameEnv)
LifecycleCallbackDescriptor
getPreDestroyDescriptorByClass(String className, JndiNameEnvironment jndiNameEnv)
String
getRawModuleID()
Set<Role>
getRoles()
Return the set of com.sun.enterprise.deployment.Role objects I have plus the ones from applicationRootXMLNode
getRootNode(String ddPath)
String
getUniqueFriendlyId()
Map<String,PersistenceUnitDescriptor>
getVisiblePUs()
This method returns all the PUs that are defined in this bundle as well as the PUs defined in the ear level.WebServiceEndpoint
getWebServiceEndpointByName(String name)
WebServicesDescriptor
getWebServices()
Return web services defined for this module.String
getWsdlDir()
boolean
hasManagedBeanByBeanClass(String beanClassName)
boolean
hasMessageDestinationByName(String name)
Returns true if I have an message destiation by that name.boolean
hasWebServiceClients()
boolean
hasWebServices()
boolean
isApplication()
boolean
isDDWithNoAnnotationAllowed()
boolean
isDefaultGroupPrincipalMapping()
boolean
isFullAttribute()
Get the full attribute of the deployment descriptorboolean
isFullFlag()
boolean
isPackagedAsSingleModule(BundleDescriptor other)
Return true if the other bundle descriptor comes from the same moduleboolean
isPolicyModified()
boolean
isStandalone()
void
print(StringBuilder toStringBuilder)
Prints a formatted string representing my state.void
removeMessageDestination(MessageDestinationDescriptor msgDest)
Remove the given message destination descriptor from my (by equality).void
removeRole(Role role)
Removes a role object from me.void
setApplication(Application a)
Sets the application to which I belong.void
setCompatibility(String compatValue)
void
setDefaultGroupPrincipalMapping(boolean defaultGroupPrincipalMapping)
void
setFullAttribute(String value)
Sets the full attribute of the deployment descriptorvoid
setFullFlag(boolean flag)
Sets the full flag of the bundle descriptor.void
setKeepState(String keepStateVal)
void
setPolicyModified(boolean policyModified)
void
visit(ComponentVisitor aVisitor)
visitor API implementation-
Methods inherited from class org.glassfish.deployment.common.RootDeploymentDescriptor
addExtensionDescriptor, getDefaultSpecVersion, getDisplayName, getExtensionsDescriptors, getExtensionsDescriptors, getExtensionsDescriptors, getMainDescriptor, getModuleDescriptor, getName, getSchemaLocation, getSpecVersion, getTracerVisitor, isEmpty, isExtensionDescriptor, setClassLoader, setDisplayName, setModuleDescriptor, setModuleID, setName, setSchemaLocation, setSpecVersion
-
Methods inherited from class org.glassfish.deployment.common.Descriptor
addDescriptorExtension, addPrefixMapping, createUniqueFilenameAmongst, createUniqueNameAmongst, createUniqueNameAmongstNamedDescriptors, fillDocType, getDeploymentExtensions, getDescription, getDescriptorExtension, getDescriptorExtensions, getDocType, getLargeIconUri, getLocalizedDescription, getLocalizedDescriptions, getLocalizedDisplayName, getLocalizedDisplayNames, getLocalizedLargeIconUri, getLocalizedLargeIconUris, getLocalizedSmallIconUri, getLocalizedSmallIconUris, getPrefixMapping, getSmallIconUri, isBoundsChecking, setBoundsChecking, setDescription, setLargeIconUri, setLocalizedDescription, setLocalizedDisplayName, setLocalizedLargeIconUri, setLocalizedSmallIconUri, setSmallIconUri, visit
-
Methods inherited from class org.glassfish.deployment.common.DynamicAttributesDescriptor
addExtraAttribute, getExtraAttribute, getExtraAttributes, removeExtraAttribute, toString
-
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
-
-
-
-
Field Detail
-
rootNodes
protected HashMap<String,RootXMLNode> rootNodes
-
-
Method Detail
-
setApplication
public void setApplication(Application a)
Sets the application to which I belong.
-
addBundleDescriptor
public void addBundleDescriptor(BundleDescriptor bundleDescriptor)
-
isPackagedAsSingleModule
public boolean isPackagedAsSingleModule(BundleDescriptor other)
Return true if the other bundle descriptor comes from the same module- Parameters:
other
- the other bundle descriptor- Returns:
- true if co-packaged in the same module
-
isApplication
public boolean isApplication()
- Specified by:
isApplication
in classRootDeploymentDescriptor
- Returns:
- true if this module is an application object
-
isStandalone
public boolean isStandalone()
- Returns:
- true if this module is a standalone deployment unit
-
getApplication
public Application getApplication()
The application to which I belong, or none if I am standalone.
-
addRootNode
public void addRootNode(String ddPath, RootXMLNode rootNode)
-
getRootNode
public RootXMLNode getRootNode(String ddPath)
-
addEntityManagerFactory
public void addEntityManagerFactory(String unitName, jakarta.persistence.EntityManagerFactory emf)
Set the physical entity manager factory for a persistence unit within this module.
-
getEntityManagerFactory
public jakarta.persistence.EntityManagerFactory getEntityManagerFactory(String unitName)
Retrieve the physical entity manager factory associated with the unitName of a persistence unit within this module. Returns null if no matching entry is found.
-
getEntityManagerFactories
public Set<jakarta.persistence.EntityManagerFactory> getEntityManagerFactories()
Returns the set of physical entity manager factories associated with persistence units in this module.
-
addManagedBean
public void addManagedBean(ManagedBeanDescriptor desc)
-
hasManagedBeanByBeanClass
public boolean hasManagedBeanByBeanClass(String beanClassName)
-
getManagedBeanByBeanClass
public ManagedBeanDescriptor getManagedBeanByBeanClass(String beanClassName)
-
getManagedBeans
public Set<ManagedBeanDescriptor> getManagedBeans()
-
getWebServices
public WebServicesDescriptor getWebServices()
Return web services defined for this module. Not applicable for application clients.
-
getWebServiceEndpointByName
public WebServiceEndpoint getWebServiceEndpointByName(String name)
-
hasWebServiceClients
public boolean hasWebServiceClients()
- Returns:
- true if this bundle descriptor defines web service clients
-
hasWebServices
public boolean hasWebServices()
- Returns:
- true if this bundle descriptor defines web services
-
getMessageDestinations
public Set<MessageDestinationDescriptor> getMessageDestinations()
Return the Set of message destinations I have
-
hasMessageDestinationByName
public boolean hasMessageDestinationByName(String name)
Returns true if I have an message destiation by that name.
-
getMessageDestinationByName
public MessageDestinationDescriptor getMessageDestinationByName(String name)
Returns a message destination descriptor that I have by the same name, or throws an IllegalArgumentException
-
addMessageDestination
public void addMessageDestination(MessageDestinationDescriptor messageDestination)
Add a message destination to me.
-
removeMessageDestination
public void removeMessageDestination(MessageDestinationDescriptor msgDest)
Remove the given message destination descriptor from my (by equality).
-
getRoles
public Set<Role> getRoles()
Return the set of com.sun.enterprise.deployment.Role objects I have plus the ones from application
-
addRole
public void addRole(Role role)
Adds a role object to me.
-
addRole
public void addRole(SecurityRoleDescriptor descriptor)
Adds a Role object based on the supplied SecurityRoleDescriptor. A change in SecurityRoleNode to fix bug 4933385 causes the DOL to use SecurityRoleDescriptor, rather than Role, to contain information about security roles. To minimize the impact on BundleDescriptor, this method has been added for use by the DOL as it processes security-role elements. This method creates a new Role object based on the characteristics of the SecurityRoleDescriptor and then delegates to addRole(Role) to preserve the rest of the behavior of this class.- Parameters:
descriptor
- SecurityRoleDescriptor that describes the username and description of the role
-
removeRole
public void removeRole(Role role)
Removes a role object from me.- Specified by:
removeRole
in interfaceRoles
-
getNamedDescriptorsFrom
protected Collection<NamedDescriptor> getNamedDescriptorsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of named descriptors in the supplied nameEnvironment
-
getNamedReferencePairsFrom
protected Vector<NamedReferencePair> getNamedReferencePairsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of NameReference pairs in the supplied nameEnvironment
-
getInjectionInfoByClass
public InjectionInfo getInjectionInfoByClass(Class clazz, JndiNameEnvironment jndiNameEnv)
-
getPostConstructDescriptorByClass
public LifecycleCallbackDescriptor getPostConstructDescriptorByClass(String className, JndiNameEnvironment jndiNameEnv)
-
getPreDestroyDescriptorByClass
public LifecycleCallbackDescriptor getPreDestroyDescriptorByClass(String className, JndiNameEnvironment jndiNameEnv)
-
getInjectableResources
public List<InjectionCapable> getInjectableResources(JndiNameEnvironment jndiNameEnv)
-
getInjectableResourcesByClass
protected List<InjectionCapable> getInjectableResourcesByClass(String className, JndiNameEnvironment jndiNameEnv)
Define implementation of getInjectableResourceByClass here so it isn't replicated across appclient, web, ejb descriptors.
-
getClassLoader
public ClassLoader getClassLoader()
- Specified by:
getClassLoader
in classRootDeploymentDescriptor
- Returns:
- the class loader associated with this module
-
print
public void print(StringBuilder toStringBuilder)
Prints a formatted string representing my state.- Overrides:
print
in classRootDeploymentDescriptor
-
getModuleType
public abstract ArchiveType getModuleType()
- Specified by:
getModuleType
in classRootDeploymentDescriptor
- Returns:
- the type of this bundle descriptor
-
getBundleVisitor
public ComponentVisitor getBundleVisitor()
- Returns:
- the visitor for this bundle descriptor
-
visit
public void visit(ComponentVisitor aVisitor)
visitor API implementation
-
getModuleID
public String getModuleID()
- Specified by:
getModuleID
in classRootDeploymentDescriptor
- Returns:
- the module ID for this module descriptor
-
getDeploymentDescriptorDir
public String getDeploymentDescriptorDir()
- Returns:
- the deployment descriptor directory location inside the archive file
-
getRawModuleID
public String getRawModuleID()
-
getWsdlDir
public String getWsdlDir()
- Returns:
- the wsdl directory location inside the archive file
-
findReferencedPUs
public Collection<? extends PersistenceUnitDescriptor> findReferencedPUs()
This method returns all the persistence units that are referenced by this module. Depending on the type of component, a PU can be referenced by one of the four following ways:, @PersistenceContext, and @PersistenceUnit Only EjbBundleDescriptor, ApplicationClientDescriptor and WebBundleDescriptor have useful implementation of this method. - Returns:
- persistence units that are referenced by this module
-
findReferencedPUsViaPURefs
protected static Collection<? extends PersistenceUnitDescriptor> findReferencedPUsViaPURefs(JndiNameEnvironment component)
helper method: find all PUs referenced via @PersistenceUnit or
-
findReferencedPUViaEMFRef
protected static PersistenceUnitDescriptor findReferencedPUViaEMFRef(EntityManagerFactoryReference emfRef)
-
findReferencedPUsViaPCRefs
protected static Collection<? extends PersistenceUnitDescriptor> findReferencedPUsViaPCRefs(JndiNameEnvironment component)
helper method: find all PUs referenced via @PersistenceContext or
-
findReferencedPUViaEMRef
protected static PersistenceUnitDescriptor findReferencedPUViaEMRef(EntityManagerReference emRef)
-
findReferencedPU
public PersistenceUnitDescriptor findReferencedPU(String unitName)
It accepts both a quailified (e.g.) "lib/a.jar#FooPU" as well as unqualified name (e.g.) "FooPU". It then searched all the PersistenceUnits that are defined in the scope of this bundle descriptor to see which one matches the give name.- Parameters:
unitName
- as used in @PersistenceUnit, @PersistenceContextor . If null, this method returns the default PU, if available. The reason it accepts null for default PU is because "" gets converted to null in EntityManagerReferenceHandler.processNewEmRefAnnotation. - Returns:
- PersistenceUnitDescriptor that this unitName resolves to. Returns null, if unitName could not be resolved.
-
findDefaultPU
public PersistenceUnitDescriptor findDefaultPU()
This method is responsible for finding default persistence unit for a bundle descriptor.- Returns:
- the default persistence unit for this bundle. returns null, if there isno PU defined or default can not be calculated because there are more than 1 PUs defined.
-
getVisiblePUs
public Map<String,PersistenceUnitDescriptor> getVisiblePUs()
This method returns all the PUs that are defined in this bundle as well as the PUs defined in the ear level. e.g. for the following ear: ear/lib/a.jar#defines FooPU /lib/b.jar#defines FooPU ejb.jar#defines FooPU for the EjbBundleDescriptor (ejb.jar), the map will contain {(lib/a.jar#FooPU, PU1), (lib/b.jar#FooPU, PU2), (FooPU, PU3)}.- Returns:
- a map of names to PUDescriptors that are visbible to this bundle descriptor. The name is a qualified name for ear scoped PUs where as it is in unqualified form for local PUs.
-
getModuleName
public String getModuleName()
-
getUniqueFriendlyId
public String getUniqueFriendlyId()
-
isPolicyModified
public boolean isPolicyModified()
-
setPolicyModified
public void setPolicyModified(boolean policyModified)
-
getCompatibility
public String getCompatibility()
-
setCompatibility
public void setCompatibility(String compatValue)
-
getKeepState
public boolean getKeepState()
-
setKeepState
public void setKeepState(String keepStateVal)
-
isDefaultGroupPrincipalMapping
public boolean isDefaultGroupPrincipalMapping()
-
setDefaultGroupPrincipalMapping
public void setDefaultGroupPrincipalMapping(boolean defaultGroupPrincipalMapping)
-
setFullFlag
public void setFullFlag(boolean flag)
Sets the full flag of the bundle descriptor. Once set, the annotations of the classes contained in the archive described by this bundle descriptor will be ignored.- Parameters:
flag
- a boolean to set or unset the flag
-
setFullAttribute
public void setFullAttribute(String value)
Sets the full attribute of the deployment descriptor- Parameters:
value
- the full attribute
-
isFullAttribute
public boolean isFullAttribute()
Get the full attribute of the deployment descriptor- Returns:
- the full attribute
-
isFullFlag
public boolean isFullFlag()
-
isDDWithNoAnnotationAllowed
public boolean isDDWithNoAnnotationAllowed()
-
-