001 /**
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. 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 package org.apache.geronimo.system.plugin;
018
019 import org.apache.geronimo.kernel.repository.Artifact;
020
021 /**
022 * An interface for callers who want to monitor the progress of an installation.
023 * These are all callbacks sent by the server.
024 *
025 * @see PluginInstaller
026 *
027 * @version $Rev: 476049 $ $Date: 2006-11-16 23:35:17 -0500 (Thu, 16 Nov 2006) $
028 */
029 public interface DownloadPoller {
030 /**
031 * Notes a configuration that was removed because it was obsoleted by a
032 * newly-installed configuration.
033 */
034 void addRemovedConfigID(Artifact obsolete);
035
036 /**
037 * Notes that a configuration passed as an argument to the install
038 * operation was successfully installed. This will only be called on
039 * the original arguments to the install command, not on anything
040 * installed because it was a dependency.
041 */
042 void addInstalledConfigID(Artifact target);
043
044 /**
045 * Notes that a configuration was restarted as a result of the
046 * current operation. This usually means that it depended on a
047 * configuration that was obsoleted (removed), so it shut down when
048 * the remove happened, and was started up again after the replacement
049 * was installed.
050 */
051 void addRestartedConfigID(Artifact target);
052
053 /**
054 * Notes that the current install operation found a dependency, and that
055 * dependency was satisfied by an artifact already available in the
056 * current server environment.
057 */
058 void addDependencyPresent(Artifact dep);
059
060 /**
061 * Notes that the current install operation found a dependency, and that
062 * dependency was downloaded from a remote repository and installed into
063 * the local server environment.
064 */
065 void addDependencyInstalled(Artifact dep);
066
067 /**
068 * Indicates which file the configuration installer is working on at the
069 * moment. Mainly for purposes of user feedback during asynchronous
070 * requests.
071 */
072 void setCurrentFile(String currentFile);
073
074 /**
075 * Describes the current operation status as a text message. Mainly for
076 * purposes of user feedback during asynchronous requests.
077 */
078 void setCurrentMessage(String currentMessage);
079
080 /**
081 * Gives the percent complete for a file currently being downloaded.
082 * Mainly for purposes of user feedback during asynchronous requests.
083 * This may be -1 if the download server does not supply the file size in
084 * advance.
085 */
086 void setCurrentFilePercent(int currentFileProgress);
087
088 /**
089 * Called at the end of a file download with the number of bytes downloaded
090 * in the current operation. This can be used to calculate a rough
091 * transfer rate (the time between setCurrentFile and setDownloadBytes) as
092 * well as if the caller wants to total the size of all downloads for the
093 * current installation.
094 */
095 void addDownloadBytes(long bytes);
096
097 /**
098 * Indicates that a failure was encountered during the installation
099 * 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 }