001    /**
002     *
003     * Copyright 2003-2004 The Apache Software Foundation
004     *
005     *  Licensed under the Apache License, Version 2.0 (the "License");
006     *  you may not use this file except in compliance with the License.
007     *  You may obtain a copy of the License at
008     *
009     *     http://www.apache.org/licenses/LICENSE-2.0
010     *
011     *  Unless required by applicable law or agreed to in writing, software
012     *  distributed under the License is distributed on an "AS IS" BASIS,
013     *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014     *  See the License for the specific language governing permissions and
015     *  limitations under the License.
016     */
017    
018    //
019    // This source code implements specifications defined by the Java
020    // Community Process. In order to remain compliant with the specification
021    // DO NOT add / change / or delete method signatures!
022    //
023    
024    package javax.enterprise.deploy.spi.status;
025    
026    import javax.enterprise.deploy.spi.TargetModuleID;
027    import javax.enterprise.deploy.spi.exceptions.OperationUnsupportedException;
028    
029    /**
030     * The ProgressObject interface tracks and reports the progress of the
031     * deployment activities: distribute, start, stop, undeploy.
032     *
033     * This class has an <i>optional</i> cancel method.  The support of the cancel
034     * function can be tested by the isCancelSupported method.
035     *
036     * The ProgressObject structure allows the user the option of polling for
037     * status or to provide a callback.
038     *
039     * @version $Rev: 46019 $ $Date: 2004-09-14 02:56:06 -0700 (Tue, 14 Sep 2004) $
040     */
041    public interface ProgressObject {
042        /**
043         * Retrieve the status of this activity.
044         *
045         * @return An object containing the status information.
046         */
047        public DeploymentStatus getDeploymentStatus();
048    
049        /**
050         * Retrieve the list of TargetModuleIDs successfully processed or created
051         * by the associated DeploymentManager operation.
052         *
053         * @return a list of TargetModuleIDs.
054         */
055        public TargetModuleID[] getResultTargetModuleIDs();
056    
057        /**
058         * Return the ClientConfiguration object associated with the
059         * TargetModuleID.
060         *
061         * @return ClientConfiguration for a given TargetModuleID or <tt>null</tt>
062         *         if none exists.
063         */
064        public ClientConfiguration getClientConfiguration(TargetModuleID id);
065    
066        /**
067         * Tests whether the vendor supports a cancel operation for this
068         * deployment action.
069         *
070         * @return <tt>true</tt> if this platform allows this action to be
071         *         canceled.
072         */
073        public boolean isCancelSupported();
074    
075        /**
076         * (optional) A cancel request on an in-process operation stops all further
077         * processing of the operation and returns the environment to it original
078         * state before the operation was executed.  An operation that has run to
079         * completion cannot be cancelled.
080         *
081         * @throws OperationUnsupportedException occurs when this optional command
082         *         is not supported by this implementation.
083         */
084        public void cancel() throws OperationUnsupportedException;
085    
086        /**
087         * Tests whether the vendor supports a stop operation for the deployment
088         * action.
089         *
090         * @return <tt>true</tt> if this platform allows this action to be
091         *         stopped.
092         */
093        public boolean isStopSupported();
094    
095        /**
096         * (optional) A stop request on an in-process operation allows the
097         * operation on the current TargetModuleID to run to completion but does
098         * not process any of the remaining unprocessed TargetModuleID objects.
099         * The processed TargetModuleIDs must be returned by the method
100         * getResultTargetModuleIDs.
101         *
102         * @throws OperationUnsupportedException occurs when this optional command
103         *         is not supported by this implementation.
104         */
105        public void stop() throws OperationUnsupportedException;
106    
107        /**
108         * Add a listener to receive progress events on deployment actions.
109         *
110         * @param pol the listener to receive events
111         */
112        public void addProgressListener(ProgressListener pol);
113    
114        /**
115         * Remove a progress listener.
116         *
117         * @param pol the listener to remove
118         */
119        public void removeProgressListener(ProgressListener pol);
120    }