Class AbstractDeploymentFacility

    • Constructor Detail

      • AbstractDeploymentFacility

        public AbstractDeploymentFacility()
    • Method Detail

      • changeState

        protected DFProgressObject changeState​(javax.enterprise.deploy.spi.Target[] targets,
                                               String moduleID,
                                               String commandName,
                                               String action)
        Changes the state of an application.

        Used for enable and disable.

        Parameters:
        targets - targets on which the change should occur
        moduleID - name of the module affected
        commandName - enable or disable
        action - name enabling or disabling
        Returns:
        DFProgressObject the caller can use to monitor progress and query final status
      • doConnect

        protected abstract boolean doConnect()
        Performs any local- or remote-specific work related to connecting to the DAS.
        Returns:
        true if the connection was made successfully; false otherwise
      • connect

        public boolean connect​(ServerConnectionIdentifier targetDAS)
        Connects the deployment facility to the DAS.
        Specified by:
        connect in interface DeploymentFacility
        Parameters:
        targetDAS - the DAS to contact
        Returns:
        true if the connection was made successfully; false otherwise
      • doDisconnect

        protected abstract boolean doDisconnect()
        Performs any local- or remote-specific work to end the connection to the DAS.
        Returns:
        true if the disconnection succeeded; false otherwise
      • disconnect

        public boolean disconnect()
        Disconnects the deployment facility from the DAS.
        Specified by:
        disconnect in interface DeploymentFacility
        Returns:
        true if the disconnection was successful; false otherwise
      • createTarget

        public javax.enterprise.deploy.spi.Target createTarget​(String name)
        Description copied from interface: TargetOwner
        Creates a single Target with the given name.
        Specified by:
        createTarget in interface TargetOwner
        Parameters:
        name - the name of the Target to be returned
        Returns:
        a new Target
      • createTargets

        public javax.enterprise.deploy.spi.Target[] createTargets​(String[] targets)
        Description copied from interface: DeploymentFacility
        Creates an array of Target objects corresponding to the list of target names.
        Specified by:
        createTargets in interface DeploymentFacility
        Specified by:
        createTargets in interface TargetOwner
        Parameters:
        targets - the names of the targets of interest
        Returns:
        an array of Target objects for the selected target names
      • deploy

        public DFProgressObject deploy​(javax.enterprise.deploy.spi.Target[] targets,
                                       URI source,
                                       URI deploymentPlan,
                                       Map origOptions)
        Description copied from interface: DeploymentFacility
        Initiates a deployment operation on the server, using a source archive abstraction and an optional deployment plan if the server specific information is not embedded in the source archive. The deploymentOptions is a key-value pair map of deployment options for this operation.

        Once the deployment is successful, the TargetModuleID objects representing where the application now resides are available using the ProgressObject.getResultTargetModuleIDs() method.

        Specified by:
        deploy in interface DeploymentFacility
        Parameters:
        targets - the Target objects to which to deploy the application - an empty array indicates a request to deploy to the default server
        source - URI to the Java EE module abstraction (with or without the server specific artifacts).
        deploymentPlan - URI to the optional deployment plan if the source archive is portable.
        origOptions - deployment options
        Returns:
        a DFProgressObject to receive deployment events and status
      • disable

        public DFProgressObject disable​(javax.enterprise.deploy.spi.Target[] targets,
                                        String moduleID)
        Disables an app on the specified targets.
        Specified by:
        disable in interface DeploymentFacility
        Parameters:
        targets - the targets on which to disable the app
        moduleID - the app
        Returns:
        DFProgressObject for monitoring progress and querying status
      • downloadFile

        public String downloadFile​(File location,
                                   String moduleID,
                                   String moduleURI)
                            throws IOException
        Description copied from interface: DeploymentFacility
        Downloads a particular file from the server repository. The filePath is a relative path from the root directory of the deployed component identified with the moduleID parameter. The resulting downloaded file should be placed in the location directory keeping the relative path constraint.
        Specified by:
        downloadFile in interface DeploymentFacility
        Parameters:
        location - is the root directory where to place the downloaded file
        moduleID - is the moduleID of the deployed component to download the file from
        moduleURI - is the relative path to the file in the repository or STUBS_JARFILENAME to download the appclient jar file.
        Returns:
        the downloaded local file absolute path.
        Throws:
        IOException
      • enable

        public DFProgressObject enable​(javax.enterprise.deploy.spi.Target[] targets,
                                       String moduleID)
        Enables an app on the specified targets.
        Specified by:
        enable in interface DeploymentFacility
        Parameters:
        targets - the targets on which to enable the app
        moduleID - the app
        Returns:
        DFProgressObject for monitoring progress and querying status
      • isConnected

        public boolean isConnected()
        Reports whether the deployment facility is connected.
        Specified by:
        isConnected in interface DeploymentFacility
        Returns:
        true if connected, false otherwise
      • getClientStubs

        public void getClientStubs​(String location,
                                   String moduleID)
                            throws IOException
        Description copied from interface: DeploymentFacility
        Downloads the client stubs from the server repository.
        Specified by:
        getClientStubs in interface DeploymentFacility
        Parameters:
        location - is the root path where to place the downloaded stubs
        moduleID - is the moduleID of the deployed component to download the stubs for
        Throws:
        IOException
      • _listAppRefs

        public javax.enterprise.deploy.spi.TargetModuleID[] _listAppRefs​(javax.enterprise.deploy.spi.Target[] targets,
                                                                         String state,
                                                                         String type)
                                                                  throws IOException
        Description copied from interface: DeploymentFacility
        list all application refs that are present in the provided list of targets with the specified state and specified type
        Specified by:
        _listAppRefs in interface DeploymentFacility
        Throws:
        IOException
      • undeploy

        public DFProgressObject undeploy​(javax.enterprise.deploy.spi.Target[] targets,
                                         String moduleID)
        Undeploys an application from specified targets.
        Specified by:
        undeploy in interface DeploymentFacility
        Parameters:
        targets - the targets from which to undeploy the app
        moduleID - the app
        Returns:
        DFProgressObject for monitoring progress and querying status
      • undeploy

        public DFProgressObject undeploy​(javax.enterprise.deploy.spi.Target[] origTargets,
                                         String moduleID,
                                         Map origOptions)
        Undeploys an application from specified targets.
        Specified by:
        undeploy in interface DeploymentFacility
        Parameters:
        origTargets - the targets from which to undeploy the app
        moduleID - the app
        origOptions - options to control the undeployment
        Returns:
        DFProgressObject for monitoring progress and querying status
      • exportClientStubs

        public String exportClientStubs​(String appName,
                                        String destDir)
                                 throws IOException
        Exports the Client stub jars to the given location.
        Specified by:
        exportClientStubs in interface TargetOwner
        Parameters:
        appName - The name of the application or module.
        destDir - The directory into which the stub jar file should be exported.
        Returns:
        the absolute location to the main jar file.
        Throws:
        IOException
      • waitFor

        public DFDeploymentStatus waitFor​(DFProgressObject po)
        Convenient method to wait for the operation monitored by the progress object to complete, returning the final operation status.
        Specified by:
        waitFor in interface DeploymentFacility
        Parameters:
        po - DFProgressObject for the operation of interestt
        Returns:
        DFDeploymentStatus final status for the operation
      • getWebURL

        public String getWebURL​(javax.enterprise.deploy.spi.TargetModuleID tmid)
        Description copied from interface: TargetOwner
        Returns the Web URL for the specified module on the Target implied by the TargetModuleID.
        Specified by:
        getWebURL in interface TargetOwner
        Returns:
        web url
      • setWebURL

        public void setWebURL​(javax.enterprise.deploy.spi.TargetModuleID tmid,
                              String webURL)
        Description copied from interface: TargetOwner
        Sets the Web URL for the specified module on the Target implied by the TargetModuleID. represents a Web module or submodule on a Target.
        Specified by:
        setWebURL in interface TargetOwner