Class DeploymentEngine

java.lang.Object
org.apache.axis2.deployment.DeploymentEngine
All Implemented Interfaces:
DeploymentConstants
Direct Known Subclasses:
FileSystemConfigurator, URLBasedAxisConfigurator, WarBasedAxisConfigurator

public abstract class DeploymentEngine extends Object implements DeploymentConstants
  • Field Details

    • DEPLOYMENT_TASK_RUNNING

      public static final String DEPLOYMENT_TASK_RUNNING
      Indicates that the deployment task is running
      See Also:
    • webLocationString

      protected static String webLocationString
    • scheduler

      protected Scheduler scheduler
    • hotUpdate

      protected boolean hotUpdate
      Support for hot update is controlled by this flag
    • hotDeployment

      protected boolean hotDeployment
      Support for hot deployment is controlled by this flag
    • wsToDeploy

      protected List<DeploymentFileData> wsToDeploy
      Stores all the web Services to deploy.
    • wsToUnDeploy

      protected List<WSInfo> wsToUnDeploy
      Stores all the web Services to undeploy.
    • axisConfig

      protected AxisConfiguration axisConfig
      to keep a ref to engine register this ref will pass to engine when it call start() method
    • configContext

      protected ConfigurationContext configContext
    • repoListener

      protected RepositoryListener repoListener
    • servicesPath

      protected String servicesPath
    • servicesDir

      protected File servicesDir
    • modulesPath

      protected String modulesPath
    • modulesDir

      protected File modulesDir
    • serviceDeployer

      protected ServiceDeployer serviceDeployer
    • moduleDeployer

      protected ModuleDeployer moduleDeployer
  • Constructor Details

    • DeploymentEngine

      public DeploymentEngine()
  • Method Details

    • setWebLocationString

      public static void setWebLocationString(String webLocationString)
    • loadServices

      public void loadServices()
    • loadRepository

      public void loadRepository(String repoDir) throws DeploymentException
      Throws:
      DeploymentException
    • loadFromClassPath

      public void loadFromClassPath() throws DeploymentException
      Throws:
      DeploymentException
    • loadServicesFromUrl

      public void loadServicesFromUrl(URL repoURL)
    • loadRepositoryFromURL

      public void loadRepositoryFromURL(URL repoURL) throws DeploymentException
      Throws:
      DeploymentException
    • addNewModule

      public static void addNewModule(AxisModule modulemetadata, AxisConfiguration axisConfiguration) throws AxisFault
      Throws:
      AxisFault
    • addServiceGroup

      public static void addServiceGroup(AxisServiceGroup serviceGroup, ArrayList<AxisService> serviceList, URL serviceLocation, DeploymentFileData currentDeploymentFile, AxisConfiguration axisConfiguration) throws AxisFault
      Throws:
      AxisFault
    • isServiceGroupReadyToDeploy

      protected static boolean isServiceGroupReadyToDeploy(AxisServiceGroup serviceGroup, ArrayList<AxisService> serviceList, URL serviceLocation, DeploymentFileData currentDeploymentFile, AxisConfiguration axisConfig) throws AxisFault
      Performs a check routine, in order to identify whether all the serviceGroup, service and operation level modules are available. If a referenced module is not deployed yet, the serviceGroup is added as a faulty service.
      Parameters:
      serviceGroup - the AxisServiceGroup we're checking
      serviceList - a List of AxisServices to check
      serviceLocation - the URL of the service (only used if there's a problem)
      currentDeploymentFile - the current DeploymentFileData object (only used if there's a problem)
      axisConfig - the active AxisConfiguration
      Returns:
      boolean
      Throws:
      AxisFault
    • fillServiceGroup

      protected static void fillServiceGroup(AxisServiceGroup serviceGroup, ArrayList<AxisService> serviceList, URL serviceLocation, AxisConfiguration axisConfig) throws AxisFault
      Throws:
      AxisFault
    • addWSToDeploy

      public void addWSToDeploy(DeploymentFileData file)
      Parameters:
      file - ArchiveFileData
    • addWSToUndeploy

      public void addWSToUndeploy(WSInfo file)
      Parameters:
      file - WSInfo
    • doDeploy

      public void doDeploy()
    • engageModules

      public void engageModules() throws AxisFault
      Checks if the modules, referred by server.xml, exist or that they are deployed.
      Throws:
      AxisFault - : If smt goes wrong
    • populateAxisConfiguration

      public AxisConfiguration populateAxisConfiguration(InputStream in) throws DeploymentException
      To get AxisConfiguration for a given inputStream this method can be used. The inputstream should be a valid axis2.xml , else you will be getting DeploymentExceptions.

      First creat a AxisConfiguration using given inputSream , and then it will try to find the repository location parameter from AxisConfiguration, so if user has add a parameter with the name "repository" , then the value specified by that parameter will be the repository and system will try to load modules and services from that repository location if it a valid location. hot deployment and hot update will work as usual in this case.

      You will be getting AxisConfiguration corresponding to given inputstream if it is valid , if something goes wrong you will be getting DeploymentException

      Parameters:
      in - : InputStream to axis2.xml
      Returns:
      a populated AxisConfiguration
      Throws:
      DeploymentException - : If something goes wrong
    • startSearch

      protected void startSearch(RepositoryListener listener)
      Starts the Deployment engine to perform Hot deployment and so on.
      Parameters:
      listener - : RepositoryListener
    • isDeploymentTaskRunning

      public boolean isDeploymentTaskRunning()
      Method to check whether the deployment task is currently running. Will be used is graceful shutdown & restart scenarios.
      Returns:
      true - if the deployment task is running, false - otherwise
    • unDeploy

      public void unDeploy()
    • getAxisConfig

      public AxisConfiguration getAxisConfig()
      Gets AxisConfiguration.
      Returns:
      AxisConfiguration AxisConfiguration
    • getAxisServiceName

      public static String getAxisServiceName(String fileName)
      Retrieves service name from the archive file name. If the archive file name is service1.aar , then axis2 service name would be service1
      Parameters:
      fileName - the archive file name
      Returns:
      Returns String.
    • getModule

      public AxisModule getModule(String moduleName) throws AxisFault
      Throws:
      AxisFault
    • isHotUpdate

      public boolean isHotUpdate()
    • getWebLocationString

      public static String getWebLocationString()
    • setClassLoaders

      protected void setClassLoaders(String axis2repoURI) throws DeploymentException
      To set the all the classLoader hierarchy this method can be used , the top most parent is CCL then SCL(system Class Loader) CCL : SCL : : MCCL SCCL : : MCL SCL

      MCCL : module common class loader SCCL : Service common class loader MCL : module class loader SCL : Service class loader

      Parameters:
      axis2repoURI - : The repository folder of Axis2
      Throws:
      DeploymentException - if there's a problem
    • setDeploymentFeatures

      protected void setDeploymentFeatures()
      Sets hotDeployment and hot update.
    • prepareRepository

      protected void prepareRepository(String repositoryName)
      Creates directories for modules/services, copies configuration xml from class loader if necessary
      Parameters:
      repositoryName - the pathname of the repository
    • getRepositoryPath

      protected String getRepositoryPath(File repository)
    • getFileList

      protected ArrayList<String> getFileList(URL fileListUrl)
    • setConfigContext

      public void setConfigContext(ConfigurationContext configContext)
    • buildModule

      public static AxisModule buildModule(File modulearchive, AxisConfiguration config) throws DeploymentException
      Builds an AxisModule for a given module archive file. This does not called the init method since there is no reference to configuration context so who ever create module using this has to called module.init if it is required
      Parameters:
      modulearchive - : Actual module archive file
      config - : AxisConfiguration : for get classloaders etc..
      Returns:
      a complete AxisModule read from the file.
      Throws:
      DeploymentException - if there's a problem
    • buildService

      public static AxisService buildService(InputStream serviceInputStream, ConfigurationContext configCtx) throws DeploymentException
      Fills an axisservice object using services.xml. First creates an axisservice object using WSDL and then fills it using the given services.xml. Loads all the required class and builds the chains, finally adds the servicecontext to EngineContext and axisservice into EngineConfiguration.
      Parameters:
      serviceInputStream - InputStream containing configuration data
      configCtx - the ConfigurationContext in which we're deploying
      Returns:
      Returns AxisService.
      Throws:
      DeploymentException - if there's a problem
    • buildServiceGroup

      public static AxisServiceGroup buildServiceGroup(InputStream servicesxml, ClassLoader classLoader, String serviceGroupName, ConfigurationContext configCtx, ArchiveReader archiveReader, HashMap<String,AxisService> wsdlServices) throws AxisFault
      To build a AxisServiceGroup for a given services.xml You have to add the created group into AxisConfig
      Parameters:
      servicesxml - InputStream created from services.xml or equivalent
      classLoader - ClassLoader to use
      serviceGroupName - name of the service group
      configCtx - the ConfigurationContext in which we're deploying
      archiveReader - the ArchiveReader we're working with
      wsdlServices - Map of existing WSDL services
      Returns:
      a fleshed-out AxisServiceGroup
      Throws:
      AxisFault - if there's a problem
    • loadServiceGroup

      public static AxisServiceGroup loadServiceGroup(File serviceFile, ConfigurationContext configCtx) throws AxisFault
      Throws:
      AxisFault
    • getServicesDir

      public File getServicesDir()
    • getModulesDir

      public File getModulesDir()
    • getRepositoryDir

      public File getRepositoryDir()
    • setDeployers

      public void setDeployers(Map<String,Map<String,Deployer>> deployerMap)
    • getDeployers

      public Map<String,Map<String,Deployer>> getDeployers()
    • getRepoListener

      public RepositoryListener getRepoListener()
    • getServiceDeployer

      public ServiceDeployer getServiceDeployer()
    • getModuleDeployer

      public ModuleDeployer getModuleDeployer()
    • getDeployer

      public Deployer getDeployer(String directory, String extension)
    • cleanup

      public void cleanup()
      Clean up the mess
    • addDeployer

      public void addDeployer(Deployer deployer, String directory, String extension)
      Add and initialize a new Deployer.
      Parameters:
      deployer - Deployer object to be registered
      directory - the directory which will be scanned for deployable artifacts
      extension - the extension of the deployable artifacts for this Deployer
    • removeDeployer

      public void removeDeployer(String directory, String extension)
      Remove any Deployer mapped for the given directory and extension
      Parameters:
      directory - the directory of deployables
      extension - the extension of deployables