Class DeploymentContextImpl

    • Field Detail

      • deplLogger

        public static final Logger deplLogger
    • Method Detail

      • getSource

        public ReadableArchive getSource()
        Description copied from interface: DeploymentContext
        Application bits, at the raw level. Deployer's should avoid using such low level access as it binds the deployer to a particular directory layout. Instead Deployers should use the class loader obtained via the getClassLoader() API
        Specified by:
        getSource in interface DeploymentContext
        Returns:
        Abstraction to the application's source archive.
      • getCommandParameters

        public <U extends OpsParams> U getCommandParameters​(Class<U> commandParametersType)
        Description copied from interface: DeploymentContext
        Returns the DeployCommand parameters
        Specified by:
        getCommandParameters in interface DeploymentContext
        Parameters:
        commandParametersType - expected deployment operation parameters type.
        Returns:
        the command parameters
      • getLogger

        public Logger getLogger()
        Description copied from interface: ExecutionContext
        Returns the logger services implementation should use to log useful information about their execution.
        Specified by:
        getLogger in interface ExecutionContext
        Returns:
        the services logger
      • preDestroy

        public void preDestroy()
        Specified by:
        preDestroy in interface org.glassfish.hk2.api.PreDestroy
      • getFinalClassLoader

        public ClassLoader getFinalClassLoader()
        Returns the class loader associated to this deployment request. ClassLoader instances are usually obtained by the getClassLoader API on the associated ArchiveHandler for the archive type being deployed.

        This can return null and the container should allocate a ClassLoader while loading the application.

        Specified by:
        getFinalClassLoader in interface DeploymentContext
        Returns:
        a class loader capable of loading classes and resources from the source
      • getClassLoader

        public ClassLoader getClassLoader()
        Returns the class loader associated to this deployment request. ClassLoader instances are usually obtained by the getClassLoader API on the associated ArchiveHandler for the archive type being deployed.

        This can return null and the container should allocate a ClassLoader while loading the application.

        Specified by:
        getClassLoader in interface ApplicationContext
        Returns:
        a class loader capable of loading classes and resources from the source
      • getClassLoader

        public ClassLoader getClassLoader​(boolean sharable)
      • getScratchDir

        public File getScratchDir​(String subDirName)
        Returns a scratch directory that can be used to store things in. The scratch directory will be persisted across server restart but not across redeployment of the same application
        Specified by:
        getScratchDir in interface DeploymentContext
        Parameters:
        subDirName - the sub directory name of the scratch dir
        Returns:
        the scratch directory for this application based on passed in subDirName. Returns the root scratch dir if the passed in value is null.
      • getSourceDir

        public File getSourceDir()
        Returns the directory where the original applications bits should be stored. This is useful when users deploy an archive file that need to be unzipped somewhere for the container to work with.
        Specified by:
        getSourceDir in interface DeploymentContext
        Returns:
        the source directory for this application
      • addModuleMetaData

        public void addModuleMetaData​(Object metaData)
        Description copied from interface: DeploymentContext
        Stores a descriptor for the module in the context so other deployer's can have access to it. Module meta-data is usual not persistent which mean that any modification to it will not be available at the next server restart and will need to be reset.
        Specified by:
        addModuleMetaData in interface DeploymentContext
        Parameters:
        metaData - the meta data itself
      • getModuleMetaData

        public <T> T getModuleMetaData​(Class<T> metadataType)
        Description copied from interface: DeploymentContext
        Returns the meta data associated with a module type.
        Specified by:
        getModuleMetaData in interface DeploymentContext
        Parameters:
        metadataType - type of the meta date.
        Returns:
        instance of T or null
      • addTransientAppMetaData

        public void addTransientAppMetaData​(String metaDataKey,
                                            Object metaData)
        Description copied from interface: DeploymentContext
        Stores application level metadata in the context so other deployer's can have access to it. The transient meta-data is not persistent which mean that any modification to it will not be available at the next server restart and will need to be reset.
        Specified by:
        addTransientAppMetaData in interface DeploymentContext
        Parameters:
        metaDataKey - key of the meta date.
        metaData - the meta data itself
      • removeTransientAppMetaData

        public void removeTransientAppMetaData​(String metaDataKey)
        Description copied from interface: DeploymentContext
        Removes application level metadata of input key from the context.
        Specified by:
        removeTransientAppMetaData in interface DeploymentContext
        Parameters:
        metaDataKey - key of the meta date.
      • getTransientAppMetaData

        public <T> T getTransientAppMetaData​(String key,
                                             Class<T> metadataType)
        Description copied from interface: DeploymentContext
        Returns the meta data for the given key
        Specified by:
        getTransientAppMetaData in interface DeploymentContext
        Parameters:
        key - key of the meta date.
        metadataType - type of the meta date.
        Returns:
        instance of T or null
      • getAppProps

        public Properties getAppProps()
        Returns the application level properties that will be persisted as a key value pair at then end of deployment. That allows individual Deployers implementation to store some information at the application level that should be available upon server restart. Application level properties are shared by all the modules.
        Specified by:
        getAppProps in interface ApplicationContext
        Returns:
        the application's properties.
      • getModuleProps

        public Properties getModuleProps()
        Returns the module level properties that will be persisted as a key value pair at then end of deployment. That allows individual Deployers implementation to store some information at the module level that should be available upon server restart. Module level properties are only visible to the current module.
        Specified by:
        getModuleProps in interface ApplicationContext
        Returns:
        the module's properties.
      • addTransformer

        public void addTransformer​(ClassFileTransformer transformer)
        Add a new ClassFileTransformer to the context
        Specified by:
        addTransformer in interface DeploymentContext
        Parameters:
        transformer - the new class file transformer to register to the new application class loader
        Throws:
        UnsupportedOperationException - if the class loader we use does not support the registration of a ClassFileTransformer. In such case, the deployer should either fail deployment or revert to a mode without the bytecode enhancement feature.
      • getOriginalSource

        public ReadableArchive getOriginalSource()
        Description copied from interface: DeploymentContext
        Gets the original source archive In case of archive deployment, this will return the archive before expanding. In case of directory deployment, this will return the same thing as getSource()
        Specified by:
        getOriginalSource in interface DeploymentContext
        Returns:
        the original source archive
      • getAppInternalDir

        public File getAppInternalDir()
        Description copied from interface: ExtendedDeploymentContext
        Returns the internal directory for the application (used for holding the uploaded archive, for example).
        Specified by:
        getAppInternalDir in interface ExtendedDeploymentContext
        Returns:
        location of the internal directory for the application
      • getAppAltDDDir

        public File getAppAltDDDir()
        Description copied from interface: ExtendedDeploymentContext
        Returns the alternate deployment descriptor directory for the application (used for holding the external alternate deployment descriptors).
        Specified by:
        getAppAltDDDir in interface ExtendedDeploymentContext
        Returns:
        location of the alternate deployment descriptor directory for the application
      • setTenant

        public void setTenant​(String tenant,
                              String appName)
        Description copied from interface: ExtendedDeploymentContext
        Sets the tenant to which this deployment context applies. Also initializes the tenant directory.
        Specified by:
        setTenant in interface ExtendedDeploymentContext
        Parameters:
        tenant - the name of the tenant
        appName - the name of the application
      • getTenantDir

        public File getTenantDir()
        Description copied from interface: ExtendedDeploymentContext
        Returns the directory containing the expanded tenant customization archive, if this DC is for a tenant and if a customization archive was specified when the tenant was provisioned.
        Specified by:
        getTenantDir in interface ExtendedDeploymentContext
        Returns:
        directory containing the expanded customization archive; null if none
      • postDeployClean

        public void postDeployClean​(boolean isFinalClean)
        Description copied from interface: ExtendedDeploymentContext
        Performs any clean-up of the deployment context after deployment has finished.

        This method can be invoked either with "true", meaning that this is the final clean-up for the DC, or with "false," meaning that the DC implementation should be selective. (Some data is used, for instance, in the DeployCommand logic after ApplicationLifeCycle.deploy has completed.)

        Specified by:
        postDeployClean in interface ExtendedDeploymentContext
        Parameters:
        isFinalClean - whether this clean is the final clean or a selective one.