Class DOLUtils


  • public class DOLUtils
    extends Object
    Utility class for convenience methods for deployment
    Version:
    Author:
    Jerome Dochez
    • 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 to null or a.equals(b)
        Parameters:
        a -
        b -
        Returns:
        See Also:
        Object.equals(Object)
      • 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:
      • 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:
      • getModuleType

        public static ArchiveType getModuleType​(String moduleType)
        Utility method to retrieve a ArchiveType from a stringified module type. Since ArchiveType 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 -
      • 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 archive
        archive - the archive
        descriptor - the initialized deployment descriptor
        main - the main archivist
        warnIfMultipleDDs - 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 subarchive

        If 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 classes
        containerType - 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 element
        value - it's associated value
        o -
        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:
      • toEarComponentId

        public static String toEarComponentId​(String appName)
      • getTreatComponentAsModule

        public static boolean getTreatComponentAsModule​(JndiNameEnvironment env)
        Returns true if the environment or its parent is a WebBundleDescriptor, 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