Interface DeploymentContext

All Superinterfaces:
ApplicationContext, ExecutionContext

public interface DeploymentContext extends ApplicationContext, ExecutionContext
Useful services for Deployer service implementation
Author:
Jerome Dochez
  • Method Details

    • getSource

      ReadableArchive getSource()
      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
      Returns:
      Abstraction to the application's source archive.
    • getFinalClassLoader

      ClassLoader getFinalClassLoader()
      During the prepare phase, when a deployer need to have access to the class loader that will be used to load the application in the runtime container, it can call this API during the prepare phase. Otherswise, deployers should use the getClassLoader API. If a deployers needs to have access to the classloader during the prepare phase
      Returns:
      the final class loader
    • getCommandParameters

      <U extends OpsParams> U getCommandParameters(Class<U> opsParamsType)
      Returns the DeployCommand parameters
      Parameters:
      opsParamsType - expected deployment operation parameters type.
      Returns:
      the command parameters
    • getScratchDir

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

      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.
      Returns:
      the source directory for this application
    • addModuleMetaData

      void addModuleMetaData(Object metaData)
      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.
      Parameters:
      metaData - the meta data itself
    • getModuleMetaData

      <T> T getModuleMetaData(Class<T> metadataType)
      Returns the meta data associated with a module type.
      Parameters:
      metadataType - type of the meta date.
      Returns:
      instance of T or null
    • getModuleArchiveHandlers

      Map<String,ArchiveHandler> getModuleArchiveHandlers()
      Gets the archive handlers for modules
      Returns:
      a map containing module archive handlers
    • addTransientAppMetaData

      void addTransientAppMetaData(String metaDataKey, Object metaData)
      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.
      Parameters:
      metaDataKey - key of the meta date.
      metaData - the meta data itself
    • getTransientAppMetaData

      <T> T getTransientAppMetaData(String metaDataKey, Class<T> metadataType)
      Returns the meta data for the given key
      Parameters:
      metaDataKey - key of the meta date.
      metadataType - type of the meta date.
      Returns:
      instance of T or null
    • addTransformer

      void addTransformer(ClassFileTransformer transformer)
      Add a new ClassFileTransformer to the context. Once all the deployers potentially invalidating the application class loader (as indicated by the
    • getModuleMetadata

      Collection<Object> getModuleMetadata()
      Returns all the metadata associated with this deployment
      Returns:
      collection of metadata added to the context
    • getTransientAppMetadata

      Map<String,Object> getTransientAppMetadata()
      Returns all the transient app metadata associated with this deployment
      Returns:
      collection of metadata added to the context
    • getArchiveHandler

      ArchiveHandler getArchiveHandler()
      Returns the archive handler that's associated with this context
      Returns:
      archive handler
    • getOriginalSource

      ReadableArchive getOriginalSource()
      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()
      Returns:
      the original source archive
    • getModulePropsMap

      Map<String,Properties> getModulePropsMap()
      Gets the module properties for modules
      Returns:
      a map containing module properties
    • getActionReport

      ActionReport getActionReport()
      Gets the action report for this context
      Returns:
      an action report
    • getAppLibs

      List<URI> getAppLibs() throws URISyntaxException
      gets the app-libs specified for this archive
      This list includes --libraries as well EXTENSION_LIST specified in the manifest entries
      Returns:
      list of library URIs
      Throws:
      URISyntaxException - when unable to get the library URIs