View Javadoc

1   /**
2    *
3    * Copyright 2005 The Apache Software Foundation
4    *
5    *  Licensed under the Apache License, Version 2.0 (the "License");
6    *  you may not use this file except in compliance with the License.
7    *  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   *  Unless required by applicable law or agreed to in writing, software
12   *  distributed under the License is distributed on an "AS IS" BASIS,
13   *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   *  See the License for the specific language governing permissions and
15   *  limitations under the License.
16   */
17  package org.apache.geronimo.system.plugin;
18  
19  import org.apache.geronimo.kernel.repository.Artifact;
20  
21  /**
22   * An interface for callers who want to monitor the progress of an installation.
23   * These are all callbacks sent by the server.
24   *
25   * @see PluginInstaller
26   *
27   * @version $Rev: 410741 $ $Date: 2006-05-31 21:35:48 -0700 (Wed, 31 May 2006) $
28   */
29  public interface DownloadPoller {
30      /**
31       * Notes a configuration that was removed because it was obsoleted by a
32       * newly-installed configuration.
33       */
34      void addRemovedConfigID(Artifact obsolete);
35  
36      /**
37       * Notes that a configuration passed as an argument to the install
38       * operation was successfully installed.  This will only be called on
39       * the original arguments to the install command, not on anything
40       * installed because it was a dependency.
41       */
42      void addInstalledConfigID(Artifact target);
43  
44      /**
45       * Notes that a configuration was restarted as a result of the
46       * current operation.  This usually means that it depended on a
47       * configuration that was obsoleted (removed), so it shut down when
48       * the remove happened, and was started up again after the replacement
49       * was installed.
50       */
51      void addRestartedConfigID(Artifact target);
52  
53      /**
54       * Notes that the current install operation found a dependency, and that
55       * dependency was satisfied by an artifact already available in the
56       * current server environment.
57       */
58      void addDependencyPresent(Artifact dep);
59  
60      /**
61       * Notes that the current install operation found a dependency, and that
62       * dependency was downloaded from a remote repository and installed into
63       * the local server environment.
64       */
65      void addDependencyInstalled(Artifact dep);
66  
67      /**
68       * Indicates which file the configuration installer is working on at the
69       * moment.  Mainly for purposes of user feedback during asynchronous
70       * requests.
71       */
72      void setCurrentFile(String currentFile);
73  
74      /**
75       * Describes the current operation status as a text message.  Mainly for
76       * purposes of user feedback during asynchronous requests.
77       */
78      void setCurrentMessage(String currentMessage);
79  
80      /**
81       * Gives the percent complete for a file currently being downloaded.
82       * Mainly for purposes of user feedback during asynchronous requests.
83       * This may be -1 if the download server does not supply the file size in
84       * advance.
85       */
86      void setCurrentFilePercent(int currentFileProgress);
87  
88      /**
89       * Called at the end of a file download with the number of bytes downloaded
90       * in the current operation.  This can be used to calculate a rough
91       * transfer rate (the time between setCurrentFile and setDownloadBytes) as
92       * well as if the caller wants to total the size of all downloads for the
93       * current installation.
94       */
95      void addDownloadBytes(long bytes);
96  
97      /**
98       * Indicates that a failure was encountered during the installation
99       * operation.  Any failure is currently treated as fatal -- the installer
100      * will not attempt to complete additional tasks after a failure.
101      */
102     void setFailure(Exception failure);
103 
104     /**
105      * Always called when the operation is complete, regardless of whether
106      * there was a failure or not.
107      */
108     void setFinished();
109 }