com.sun.enterprise.deployment
Class BundleDescriptor

java.lang.Object
  extended by java.util.Observable
      extended by com.sun.enterprise.deployment.DynamicAttributesDescriptor
          extended by com.sun.enterprise.deployment.Descriptor
              extended by com.sun.enterprise.deployment.RootDeploymentDescriptor
                  extended by com.sun.enterprise.deployment.BundleDescriptor
All Implemented Interfaces:
Roles, java.io.Serializable
Direct Known Subclasses:
Application, ApplicationClientDescriptor, ConnectorDescriptor, EjbBundleDescriptor, WebBundleDescriptor

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 inherited from class com.sun.enterprise.deployment.RootDeploymentDescriptor
classLoader, extensions, moduleDescriptor, moduleID
 
Fields inherited from class com.sun.enterprise.deployment.Descriptor
DESCRIPTION_CHANGED, DESCRIPTOR_CHANGED, docType, LARGE_ICON_CHANGED, NAME_CHANGED, SMALL_ICON_CHANGED
 
Constructor Summary
BundleDescriptor()
          Construct a new BundleDescriptor
BundleDescriptor(java.lang.String name, java.lang.String description)
          Construct a new BundleDescriptor with a name and description
 
Method Summary
 void addEntityManagerFactory(java.lang.String unitName, javax.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(Role role)
          Adds a role object to me.
 void addRole(SecurityRoleDescriptor descriptor)
          Adds a Role object based on the supplied SecurityRoleDescriptor.
 PersistenceUnitDescriptor findDefaultPU()
          This method is responsible for finding default persistence unit for a bundle descriptor.
 PersistenceUnitDescriptor findReferencedPU(java.lang.String unitName)
          It accepts both a quailified (e.g.) "lib/a.jar#FooPU" as well as unqualified name (e.g.) "FooPU".
 java.util.Collection<? extends PersistenceUnitDescriptor> findReferencedPUs()
          This method returns all the persistence units that are referenced by this module.
protected static java.util.Collection<? extends PersistenceUnitDescriptor> findReferencedPUsViaPCRefs(JndiNameEnvironment component)
          helper method: find all PUs referenced via @PersistenceContext or
protected static java.util.Collection<? extends PersistenceUnitDescriptor> findReferencedPUsViaPURefs(JndiNameEnvironment component)
          helper method: find all PUs referenced via @PersistenceUnit or
protected 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.
 java.lang.ClassLoader getClassLoader()
           
 java.lang.String getCompatibility()
           
 java.lang.String getDeploymentDescriptorDir()
           
 java.util.Set<javax.persistence.EntityManagerFactory> getEntityManagerFactories()
          Returns the set of physical entity manager factories associated with persistence units in this module.
 javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.String unitName)
          Retrieve the physical entity manager factory associated with the unitName of a persistence unit within this module.
protected  java.util.List<InjectionCapable> getInjectableResources(JndiNameEnvironment jndiNameEnv)
           
protected  java.util.List<InjectionCapable> getInjectableResourcesByClass(java.lang.String className, JndiNameEnvironment jndiNameEnv)
          Define implementation of getInjectableResourceByClass here so it isn't replicated across appclient, web, ejb descriptors.
 InjectionInfo getInjectionInfoByClass(java.lang.Class clazz, JndiNameEnvironment jndiNameEnv)
           
 boolean getKeepState()
           
 ManagedBeanDescriptor getManagedBeanByBeanClass(java.lang.String beanClassName)
           
 java.util.Set<ManagedBeanDescriptor> getManagedBeans()
           
 MessageDestinationDescriptor getMessageDestinationByName(java.lang.String name)
          Returns a message destination descriptor that I have by the same name, or throws an IllegalArgumentException
 java.util.Set<MessageDestinationDescriptor> getMessageDestinations()
          Return the Set of message destinations I have
 java.lang.String getModuleID()
           
 java.lang.String getModuleName()
           
abstract  XModuleType getModuleType()
           
protected  java.util.Collection getNamedDescriptorsFrom(JndiNameEnvironment nameEnvironment)
          Utility method for iterating the set of named descriptors in the supplied nameEnvironment
protected  java.util.Vector<NamedReferencePair> getNamedReferencePairsFrom(JndiNameEnvironment nameEnvironment)
          Utility method for iterating the set of NameReference pairs in the supplied nameEnvironment
 LifecycleCallbackDescriptor getPostConstructDescriptorByClass(java.lang.String className, JndiNameEnvironment jndiNameEnv)
           
 LifecycleCallbackDescriptor getPreDestroyDescriptorByClass(java.lang.String className, JndiNameEnvironment jndiNameEnv)
           
 java.util.Set<Role> getRoles()
          Return the set of com.sun.enterprise.deployment.Role objects I have plus the ones from application
abstract  java.util.Set getServiceReferenceDescriptors()
           
 java.lang.String getUniqueFriendlyId()
           
 java.util.Map<java.lang.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(java.lang.String name)
           
 WebServicesDescriptor getWebServices()
          Return web services defined for this module.
 java.lang.String getWsdlDir()
           
 boolean hasManagedBeanByBeanClass(java.lang.String beanClassName)
           
 boolean hasMessageDestinationByName(java.lang.String name)
          Returns true if I have an message destiation by that name.
 boolean hasWebServiceClients()
           
 boolean hasWebServices()
           
 boolean isApplication()
           
 boolean isPackagedAsSingleModule(BundleDescriptor other)
          Return true if the other bundle descriptor comes from the same module
 boolean isPolicyModified()
           
 boolean isStandalone()
           
 void print(java.lang.StringBuffer toStringBuffer)
          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(java.lang.String compatValue)
           
 void setKeepState(java.lang.String keepStateVal)
           
 void setPolicyModified(boolean policyModified)
           
 
Methods inherited from class com.sun.enterprise.deployment.RootDeploymentDescriptor
addExtensionDescriptor, getDefaultSpecVersion, getDisplayName, getExtensionsDescriptors, getExtensionsDescriptors, getExtensionsDescriptors, getMainDescriptor, getModuleDescriptor, getName, getSchemaLocation, getSpecVersion, isDDWithNoAnnotationAllowed, isEmpty, isExtensionDescriptor, isFullAttribute, isFullFlag, setClassLoader, setDisplayName, setFullAttribute, setFullFlag, setModuleDescriptor, setModuleID, setName, setSchemaLocation, setSpecVersion
 
Methods inherited from class com.sun.enterprise.deployment.Descriptor
addDeploymentExtension, addPrefixMapping, createUniqueFilenameAmongst, createUniqueNameAmongst, createUniqueNameAmongstNamedDescriptors, fillDocType, getDeploymentExtensions, getDescription, 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 com.sun.enterprise.deployment.DynamicAttributesDescriptor
addExtraAttribute, getExtraAttribute, getExtraAttributes, removeExtraAttribute, toString
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BundleDescriptor

public BundleDescriptor()
Construct a new BundleDescriptor


BundleDescriptor

public BundleDescriptor(java.lang.String name,
                        java.lang.String description)
Construct a new BundleDescriptor with a name and description

Method Detail

setApplication

public void setApplication(Application a)
Sets the application to which I belong.


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 class RootDeploymentDescriptor
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.


addEntityManagerFactory

public void addEntityManagerFactory(java.lang.String unitName,
                                    javax.persistence.EntityManagerFactory emf)
Set the physical entity manager factory for a persistence unit within this module.


getEntityManagerFactory

public javax.persistence.EntityManagerFactory getEntityManagerFactory(java.lang.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 java.util.Set<javax.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(java.lang.String beanClassName)

getManagedBeanByBeanClass

public ManagedBeanDescriptor getManagedBeanByBeanClass(java.lang.String beanClassName)

getManagedBeans

public java.util.Set<ManagedBeanDescriptor> getManagedBeans()

getServiceReferenceDescriptors

public abstract java.util.Set getServiceReferenceDescriptors()
Returns:
a set of service-ref from this bundle or an empty set if none

getWebServices

public WebServicesDescriptor getWebServices()
Return web services defined for this module. Not applicable for application clients.


getWebServiceEndpointByName

public WebServiceEndpoint getWebServiceEndpointByName(java.lang.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 java.util.Set<MessageDestinationDescriptor> getMessageDestinations()
Return the Set of message destinations I have


hasMessageDestinationByName

public boolean hasMessageDestinationByName(java.lang.String name)
Returns true if I have an message destiation by that name.


getMessageDestinationByName

public MessageDestinationDescriptor getMessageDestinationByName(java.lang.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 java.util.Set<Role> getRoles()
Return the set of com.sun.enterprise.deployment.Role objects I have plus the ones from application

Specified by:
getRoles in interface Roles
Returns:
the set of roles.

addRole

public void addRole(Role role)
Adds a role object to me.

Specified by:
addRole in interface Roles

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 interface Roles

getNamedDescriptorsFrom

protected java.util.Collection getNamedDescriptorsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of named descriptors in the supplied nameEnvironment


getNamedReferencePairsFrom

protected java.util.Vector<NamedReferencePair> getNamedReferencePairsFrom(JndiNameEnvironment nameEnvironment)
Utility method for iterating the set of NameReference pairs in the supplied nameEnvironment


getInjectionInfoByClass

public InjectionInfo getInjectionInfoByClass(java.lang.Class clazz,
                                             JndiNameEnvironment jndiNameEnv)

getPostConstructDescriptorByClass

public LifecycleCallbackDescriptor getPostConstructDescriptorByClass(java.lang.String className,
                                                                     JndiNameEnvironment jndiNameEnv)

getPreDestroyDescriptorByClass

public LifecycleCallbackDescriptor getPreDestroyDescriptorByClass(java.lang.String className,
                                                                  JndiNameEnvironment jndiNameEnv)

getInjectableResources

protected java.util.List<InjectionCapable> getInjectableResources(JndiNameEnvironment jndiNameEnv)

getInjectableResourcesByClass

protected java.util.List<InjectionCapable> getInjectableResourcesByClass(java.lang.String className,
                                                                         JndiNameEnvironment jndiNameEnv)
Define implementation of getInjectableResourceByClass here so it isn't replicated across appclient, web, ejb descriptors.


getClassLoader

public java.lang.ClassLoader getClassLoader()
Specified by:
getClassLoader in class RootDeploymentDescriptor
Returns:
the class loader associated with this module

print

public void print(java.lang.StringBuffer toStringBuffer)
Prints a formatted string representing my state.

Overrides:
print in class RootDeploymentDescriptor

getModuleType

public abstract XModuleType getModuleType()
Specified by:
getModuleType in class RootDeploymentDescriptor
Returns:
the type of this bundle descriptor

getModuleID

public java.lang.String getModuleID()
Specified by:
getModuleID in class RootDeploymentDescriptor
Returns:
the module ID for this module descriptor

getDeploymentDescriptorDir

public java.lang.String getDeploymentDescriptorDir()
Returns:
the deployment descriptor directory location inside the archive file

getWsdlDir

public java.lang.String getWsdlDir()
Returns:
the wsdl directory location inside the archive file

findReferencedPUs

public java.util.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 java.util.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 java.util.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(java.lang.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, @PersistenceContext or . 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 java.util.Map<java.lang.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 java.lang.String getModuleName()

getUniqueFriendlyId

public java.lang.String getUniqueFriendlyId()

isPolicyModified

public boolean isPolicyModified()

setPolicyModified

public void setPolicyModified(boolean policyModified)

getCompatibility

public java.lang.String getCompatibility()

setCompatibility

public void setCompatibility(java.lang.String compatValue)

getKeepState

public boolean getKeepState()

setKeepState

public void setKeepState(java.lang.String keepStateVal)


Copyright © 2012 GlassFish Community. All Rights Reserved.