Class CargoContainerAdapter

java.lang.Object
hudson.plugins.deploy.ContainerAdapter
hudson.plugins.deploy.CargoContainerAdapter
All Implemented Interfaces:
ExtensionPoint, Describable<ContainerAdapter>, Serializable
Direct Known Subclasses:
DefaultCargoContainerAdapterImpl

public abstract class CargoContainerAdapter extends ContainerAdapter implements Serializable
Provides container-specific glue code.

To support remote operations as an inner class, marking the class as serializable.

Author:
Kohsuke Kawaguchi
See Also:
  • Constructor Details

    • CargoContainerAdapter

      public CargoContainerAdapter()
  • Method Details

    • getContainerId

      protected abstract String getContainerId()
      Returns the container ID used by Cargo.
      Returns:
      the id of the container
    • configure

      protected abstract void configure(org.codehaus.cargo.container.configuration.Configuration config, EnvVars envVars, VariableResolver<String> resolver)
      Fills in the Configuration object.
      Parameters:
      config - the configuration of the adapter
      envVars - the environmental variables of the build
      resolver - the variable resolver
    • getContainer

      protected org.codehaus.cargo.container.Container getContainer(org.codehaus.cargo.generic.configuration.ConfigurationFactory configFactory, org.codehaus.cargo.generic.ContainerFactory containerFactory, String id, EnvVars envVars, VariableResolver<String> resolver)
    • deploy

      protected void deploy(org.codehaus.cargo.generic.deployer.DeployerFactory deployerFactory, TaskListener listener, org.codehaus.cargo.container.Container container, File f, String contextPath)
    • createWAR

      protected org.codehaus.cargo.container.deployable.WAR createWAR(File deployableFile)
      Creates a Deployable object WAR from the given file object.
      Parameters:
      deployableFile - The deployable file to create the Deployable from.
      Returns:
      A Deployable object.
    • expandVariable

      protected String expandVariable(EnvVars envVars, VariableResolver<String> resolver, String variable)
      Expands an encoded environment variable. Ex. if HOME=/user/alex, expands '${HOME}' to '/user/alex'
      Parameters:
      envVars - the environment variables of the build
      resolver - unused
      variable - the variable to expand
      Returns:
      the value of the expanded variable
    • createEAR

      protected org.codehaus.cargo.container.deployable.EAR createEAR(File deployableFile)
      Creates a Deployable object EAR from the given file object.
      Parameters:
      deployableFile - The deployable file to create the Deployable from.
      Returns:
      A deployable object.
    • redeployFile

      public void redeployFile(FilePath war, String contextPath, Run<?,?> run, Launcher launcher, TaskListener listener) throws IOException, InterruptedException
      Perform redeployment. If failed, return false. Implementations should override me and make ContainerAdapter.redeploy(FilePath, String, AbstractBuild, Launcher, BuildListener) delegate to that implementation to be usable within Pipeline projects
      Overrides:
      redeployFile in class ContainerAdapter
      Parameters:
      war - the path of the war/ear file to deploy
      contextPath - the context path for the war to be deployed
      run - the build that is being deployed
      launcher - the launcher of the build
      listener - the BuildListener of the build to deploy
      Throws:
      IOException - if there is an error locating the war file
      InterruptedException - if there is an error deploying to the server