Class Application

    • Method Detail

      • createVirtualApplication

        public static Application createVirtualApplication​(String name,
                                                           ModuleDescriptor<BundleDescriptor> newModule)
        Creates a new application to hold a standalone module
        Parameters:
        name - the application name
        newModule - the standalone module descriptor
        Returns:
        the application
      • createApplication

        public static Application createApplication()
      • getEjbReferenceByName

        public EjbReference getEjbReferenceByName​(String name)
        Return a reference to another ejb by the same name or throw an IllegalArgumentException.
        Parameters:
        name -
        Returns:
      • getEnvironmentPropertyByName

        public EnvironmentProperty getEnvironmentPropertyByName​(String name)
        Returns the environment property object searching on the supplied key. throws an illegal argument exception if no such environment property exists.
        Specified by:
        getEnvironmentPropertyByName in interface JndiNameEnvironment
        Parameters:
        name -
        Returns:
        EnvironmentProperty descriptor
      • setGeneratedXMLDirectory

        public void setGeneratedXMLDirectory​(String xmlDir)
      • getGeneratedXMLDirectory

        public String getGeneratedXMLDirectory()
        Returns:
      • setRegistrationName

        public void setRegistrationName​(String appId)
        Sets the registration name for this application. This name is used while deploying the application. The deployment process gurantees that this name is unique.
        Parameters:
        appId - the registration name used for this application
      • getRegistrationName

        public String getRegistrationName()
        Returns the registration name of this application.
        Returns:
        the registration name of this application
      • getAppName

        public String getAppName()
        Returns the value of the app-name element in the application.xml if it's defined. The default EE app name is the unqualified name of the .ear or stand-alone module, minus the file extension.
        Returns:
        the EE app name of this application
      • setAppName

        public void setAppName​(String appName)
        Sets the EE app name
        Parameters:
        appName - the EE app name of this application
      • getArchiveName

        public String getArchiveName()
        Returns the value of the archive-name element in the sun-application.xml When the app-name is not present in application.xml and archive-name is present in sun-application.xml, the value of archive-name minus file extension will be used as the default name of the app-name.
        Returns:
        the EE app name of this application
      • setArchiveName

        public void setArchiveName​(String archiveName)
        Sets the archive name using the archive-name element defined in sun-application.xml
        Parameters:
        archiveName - archiveName to calculate default EE6 app-name
      • getClassLoadingDelegate

        public String getClassLoadingDelegate()
      • setClassLoadingDelegate

        public void setClassLoadingDelegate​(String classLoadingDelegate)
      • getScanningExclusions

        public List<Pattern> getScanningExclusions()
      • getScanningInclusions

        public List<Pattern> getScanningInclusions()
      • addScanningInclusions

        public void addScanningInclusions​(List<String> inclusions)
      • addScanningInclusions

        public void addScanningInclusions​(List<String> inclusions,
                                          String libDir)
      • addScanningExclusions

        public void addScanningExclusions​(List<String> exclusions)
      • addScanningExclusions

        public void addScanningExclusions​(List<String> exclusions,
                                          String libDir)
      • isWhitelistEnabled

        public boolean isWhitelistEnabled()
      • getWhitelistPackages

        public Set<String> getWhitelistPackages()
      • addWhitelistPackage

        public void addWhitelistPackage​(String aPackage)
      • isInitializeInOrder

        public boolean isInitializeInOrder()
        Returns:
        the initializeInOrder flag when the return value is true, the modules inside ear will be loaded by their declaration order in application.xml
      • setInitializeInOrder

        public void setInitializeInOrder​(boolean initializeInOrder)
        Sets the initializeInOrder flag
        Parameters:
        initializeInOrder -
      • addEntityManagerFactory

        public void addEntityManagerFactory​(String unitName,
                                            String persistenceRootUri,
                                            jakarta.persistence.EntityManagerFactory emf)
        Set the physical entity manager factory for a persistence unit within this application. This method takes a parameter called persistenceRootUri to support for fully-qualified persistence-unit-name syntax within persistence-unit-refs and persistence-context-refs. The syntax is similar to ejb-link and messge-destination-link. See (EJB 3 core spec: 15.10.2)
        Parameters:
        unitName - : Name of the persistence-unit
        persistenceRootUri - : uri of the root of the persistence.xml (excluding META-INF) in which the persistence unit was defined. This uri is relative to the top of the .ear.
        emf - : an entity manager factory.
      • getEntityManagerFactory

        public jakarta.persistence.EntityManagerFactory getEntityManagerFactory​(String unitName,
                                                                                BundleDescriptor declaringModule)
        Retrieve the physical entity manager factory associated with the unitName of an application-level persistence unit. Returns null if no matching entry is found.
        Parameters:
        unitName -
        declaringModule -
        Returns:
      • getEntityManagerFactories

        public Set<jakarta.persistence.EntityManagerFactory> getEntityManagerFactories()
        Returns the set of physical entity manager factories associated with persistence units in this application.
        Overrides:
        getEntityManagerFactories in class BundleDescriptor
        Returns:
      • getRoles

        public Set<Role> getRoles()
        Return the set of roles used in this application. Currently, for release 1.0, it is an * aggregation of all the roles in the sub-modules of the application.
        Specified by:
        getRoles in interface Roles
        Overrides:
        getRoles in class BundleDescriptor
        Returns:
        the Set of roles in the application.
      • getAppRoles

        public Set<Role> getAppRoles()
        Return the set of Role objects I have (the ones defined in application xml).
        Returns:
      • addAppRole

        public void addAppRole​(SecurityRoleDescriptor descriptor)
        Adds a new Role to the application based on the descriptor
        Parameters:
        descriptor -
      • setName

        public void setName​(String name)
        Reset the display name of this application.
        Overrides:
        setName in class RootDeploymentDescriptor
        Parameters:
        name - the display name of the application.
      • setLibraryDirectory

        public void setLibraryDirectory​(String value)
      • getLibraryDirectory

        public String getLibraryDirectory()
        Returns an "intelligent" value for the library directory setting, meaning the current value if it has been set to a non-null, non-empty value; the default value if the value has never been set, and null if the value has been set to empty.
        Returns:
        String value of the library directory setting
      • getLibraryDirectoryRawValue

        public String getLibraryDirectoryRawValue()
      • getTargetUri

        public String getTargetUri​(BundleDescriptor origin,
                                   String relativeTargetUri)
        Get the uri of a target based on a source module and a a relative uri from the perspective of that source module.
        Parameters:
        origin - bundle descriptor within this application
        relativeTargetUri - relative uri from the given bundle descriptor
        Returns:
        target uri
      • getRelativeBundle

        public BundleDescriptor getRelativeBundle​(BundleDescriptor origin,
                                                  String relativeTargetUri)
        Get a target bundle descriptor based on an input bundle descriptor and a relative uri from the perspective of the input bundle descriptor.
        Parameters:
        origin - bundle descriptor within this application
        relativeTargetUri - relative uri from the given bundle descriptor to another bundle within the application.
        Returns:
        target BundleDescriptor or null if not found.
      • getRelativeUri

        public String getRelativeUri​(BundleDescriptor origin,
                                     BundleDescriptor target)
        Return the relative uri between two modules, from the perspective of the first bundle.
        Parameters:
        origin -
        target -
        Returns:
        relative uri or empty string if the two bundles are the same
      • getModuleDescriptorByUri

        public ModuleDescriptor<BundleDescriptor> getModuleDescriptorByUri​(String uri)
        Lookup module by uri.
        Parameters:
        uri - the module path in the application archive
        Returns:
        a bundle descriptor in this application identified by uri or null if not found.
      • getModuleByUri

        public BundleDescriptor getModuleByUri​(String uri)
        Lookup module by uri.
        Parameters:
        uri - the module path in the application archive
        Returns:
        a bundle descriptor in this application identified by uri or null if not found.
      • getModuleByTypeAndUri

        public <T extends BundleDescriptor> T getModuleByTypeAndUri​(Class<T> type,
                                                                    String uri)
        Parameters:
        type - the module type
        uri - the module path in the application archive
        Returns:
        a bundle descriptor in this application identified by its type and uri
      • getEjbByName

        public EjbDescriptor getEjbByName​(String ejbName)
        Obtain the EJB in this application of the given display name. If the EJB is not present, throw an IllegalArgumentException.
        Parameters:
        ejbName - the name of the bean
        Returns:
        the EjbDescriptor object with the given display name
      • hasEjbByName

        public boolean hasEjbByName​(String ejbName)
        Return whether the application contains the given ejb by name..
        Parameters:
        ejbName - the name of the bean
        Returns:
        true if there is a bean matching the given name
      • getStandaloneBundleDescriptor

        public BundleDescriptor getStandaloneBundleDescriptor()
        if this application object is virtual, return the standalone bundle descriptor it is wrapping otherwise return null
        Returns:
        the wrapped standalone bundle descriptor
      • getBundleDescriptors

        public <T extends BundleDescriptorSet<T> getBundleDescriptors​(Class<T> type)
        Obtain a full set of bundle descriptors for a particular type
        Parameters:
        type - the bundle descriptor type requested
        Returns:
        the set of bundle descriptors
      • getBundleDescriptorsOfType

        public Set<BundleDescriptor> getBundleDescriptorsOfType​(ArchiveType bundleType)
        Obtain a full set of bundle descriptors for a particular type
        Parameters:
        bundleType - the bundle descriptor type requested
        Returns:
        the set of bundle descriptors
      • getBundleDescriptors

        public Set<BundleDescriptor> getBundleDescriptors()
        Obtain a set of all bundle descriptors, regardless of type
        Returns:
        the set of bundle descriptors
      • addBundleDescriptor

        public void addBundleDescriptor​(BundleDescriptor bundleDescriptor)
        Add a bundle descriptor to this application.
        Overrides:
        addBundleDescriptor in class BundleDescriptor
        Parameters:
        bundleDescriptor - the bundle descriptor to add
      • removeBundleDescriptor

        public void removeBundleDescriptor​(BundleDescriptor bundleDescriptor)
        Remove a web bundle descriptor from this application.
        Parameters:
        bundleDescriptor - the web bundle descriptor to remove
      • getEjbDescriptors

        public Vector<EjbDescriptor> getEjbDescriptors()
        Return the Vector of ejb deployment objects.
      • getSortedEjbDescriptors

        public EjbDescriptor[] getSortedEjbDescriptors()
        Returns all the ejb descriptor in this application in ordered form. The comparison is done based on the descriptor's name.
        Returns:
        all ejb descriptors in ordered form
      • setVirtual

        public void setVirtual​(boolean virtual)
        Sets the virtual status of this application. If this application object represents a stand alone module, virtaul status should be true; else false.
        Parameters:
        virtual - new value of this application's virtaul status
      • isVirtual

        public boolean isVirtual()
        Returns the virtual status of this application.
        Returns:
        true if this application obj represents a stand alone module
      • isUniqueIdSet

        public boolean isUniqueIdSet()
      • setUniqueId

        public void setUniqueId​(long id)
        Sets the unique id for this application. It traverses through all the ejbs in the application and sets the unique id for each of them. The traversal is done in ascending element order. NOTE : assumption is that the id has already been left shifted 16 bits to allow space for the component ids.
        Parameters:
        id - unique id for this application
      • getUniqueId

        public long getUniqueId()
        Returns the unique id used for this application.
        Returns:
        unique id used for this application
      • setPassByReference

        public void setPassByReference​(boolean passByReference)
        Sets the pass-by-reference property for this application. EJB spec requires pass-by-value (false) which is the default. This can be set to true for non-compliant operation and possibly higher performance. For a stand-alone server, this can be used. By setting pass-by-reference in sun-application.xml, it can apply to all the enclosed ejb modules.
        Parameters:
        passByReference - boolean true or false - pass-by-reference property of application. true - application is pass-by-reference false - application is pass-by-value
      • getPassByReference

        public boolean getPassByReference()
        Gets the value of pass-by-reference property for this application Checks to see if the pass-by-reference property is defined. If this application's pass-by-reference property is defined, this method returns the value of the application's pass-by-reference property. Otherwise, if the application's pass-by-reference property is undefined, this method returns a default value of false.
        Returns:
        boolean pass-by-reference property for this application
      • isPassByReferenceDefined

        public boolean isPassByReferenceDefined()
      • addApplication

        public void addApplication​(Application application)
        Add all the deployment information about the given application to me.
        Parameters:
        application -
      • getArchivableDescriptors

        public Set<BundleDescriptor> getArchivableDescriptors()
        Return all my subcomponents that have a file format (EJB, WAR and AppCLient JAR).
        Returns:
      • setRoleMapper

        public void setRoleMapper​(SecurityRoleMapper roleMapper)
        Sets the mapping of rolename to users and groups on a particular server.
        Parameters:
        roleMapper -
      • hasRuntimeInformation

        public boolean hasRuntimeInformation()
        Return true if I have information to do with deployment on a particular operational environment.
        Returns:
      • setRealm

        public void setRealm​(String realm)
        Sets the realm for this application
        Parameters:
        realm -
      • getRealm

        public String getRealm()
        Returns:
        the realm for this application
      • isDirty

        public boolean isDirty()
        A flag to indicate that my data has changed since the last save.
        Returns:
      • visit

        public void visit​(DescriptorVisitor aVisitor)
        visit the descriptor and all sub descriptors with a DOL visitor implementation
        Overrides:
        visit in class Descriptor
        Parameters:
        aVisitor - visitor to traverse the descriptors
      • isApplication

        public boolean isApplication()
        Overrides:
        isApplication in class BundleDescriptor
        Returns:
        true if this module is an application object
      • addSecurityRoleMapping

        public void addSecurityRoleMapping​(SecurityRoleMapping roleMapping)
      • setLoadedFromApplicationXml

        public void setLoadedFromApplicationXml​(boolean bool)
        This method records how this Application object is constructed. We keep this information to avoid additional disk access in DescriptorArchivist.write() when deciding if the application.xml should be copied or written to the generated/xml directory.
        Parameters:
        bool -
      • isLoadedFromApplicationXml

        public boolean isLoadedFromApplicationXml()
        Returns:
        true if this Application is from reading application.xml from disk; false if this Application object is derived from the content of the ear file.
      • addResourceAdapter

        public void addResourceAdapter​(String raName)
        add a resource-adapter to referred resource-adapters list
        Parameters:
        raName - resource-adapter name
      • getResourceAdapters

        public Set<String> getResourceAdapters()
        get the list of resource-adapters referred by the application
        Returns:
        resource-adapters list
      • getApplicationParams

        public Set<ApplicationParam> getApplicationParams()
        Returns:
        the Set of application paramaters.
      • addApplicationParam

        public void addApplicationParam​(ApplicationParam appParam)
        Adds a new context parameter to my list.
        Parameters:
        appParam -
      • getKeepStateResolved

        public boolean getKeepStateResolved()
        Returns the resolved keepstate value.
        Returns:
        keepStateResolved
      • setKeepStateResolved

        public void setKeepStateResolved​(String keepStateResolved)
        Sets the resolved keepstate value.
        Parameters:
        keepStateResolved -