KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > geronimo > system > plugin > DownloadPoller


1 /**
2  * Licensed to the Apache Software Foundation (ASF) under one or more
3  * contributor license agreements. See the NOTICE file distributed with
4  * this work for additional information regarding copyright ownership.
5  * The ASF licenses this file to You under the Apache License, Version 2.0
6  * (the "License"); you may not use this file except in compliance with
7  * the License. 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: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 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 JavaDoc 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 JavaDoc 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 JavaDoc 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 }
110
Popular Tags