KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > update > core > BaseInstallHandler


1 /*******************************************************************************
2  * Copyright (c) 2000, 2006 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.update.core;
12
13 import org.eclipse.core.runtime.CoreException;
14
15 /**
16  * Base implementation of an install handler.
17  * This is a convenience implementation of an install handler with
18  * null implementation of its methods. It allows subclasses to selectively
19  * implement only the methods required for their installation tasks.
20  * <p>
21  * This class should be subclassed by clients.
22  * </p>
23  * <p>
24  * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
25  * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
26  * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
27  * (repeatedly) as the API evolves.
28  * </p>
29  * @see org.eclipse.update.core.IInstallHandler
30  * @since 2.0
31  */

32
33 public class BaseInstallHandler implements IInstallHandler {
34
35     /**
36      * Update action type
37      *
38      * @see IInstallHandler#HANDLER_ACTION_INSTALL
39      * @see IInstallHandler#HANDLER_ACTION_CONFIGURE
40      * @see IInstallHandler#HANDLER_ACTION_UNCONFIGURE
41      * @see IInstallHandler#HANDLER_ACTION_UNINSTALL
42      * @since 2.0
43      */

44     protected int type;
45
46     /**
47      * The target of the action
48      * @since 2.0
49      */

50     protected IFeature feature;
51
52     /**
53      * Model entry that defines this handler
54      *
55      * @since 2.0
56      */

57     protected IInstallHandlerEntry entry;
58
59     /**
60      * Optional progress monitor, can be <code>null</code>
61      *
62      * @since 2.0
63      */

64     protected InstallMonitor monitor;
65
66     /**
67      * Plug-in entries downloaded
68      *
69      * @see IInstallHandler#HANDLER_ACTION_INSTALL
70      * @since 2.0
71      */

72     protected IPluginEntry[] pluginEntries;
73
74     /**
75      * Non-plug-in entries downloaded
76      *
77      * @see IInstallHandler#HANDLER_ACTION_INSTALL
78      * @since 2.0
79      */

80     protected INonPluginEntry[] nonPluginEntries;
81
82     /**
83      * Indicates if handler has been initialized
84      *
85      * @since 2.0
86      */

87     protected boolean initialized = false;
88
89     /**
90      * Initialize the install handler.
91      *
92      * @see IInstallHandler#initialize(int, IFeature, IInstallHandlerEntry, InstallMonitor)
93      * @since 2.0
94      */

95     public void initialize(
96         int type,
97         IFeature feature,
98         IInstallHandlerEntry entry,
99         InstallMonitor monitor)
100         throws CoreException {
101
102         if (this.initialized)
103             return;
104         else {
105             if (feature == null)
106                 throw new IllegalArgumentException JavaDoc();
107             this.type = type;
108             this.feature = feature;
109             this.entry = entry;
110             this.monitor = monitor;
111             this.initialized = true;
112         }
113     }
114
115     /**
116      * Called at the start of the install action.
117      *
118      * @see IInstallHandler#installInitiated
119      * @since 2.0
120      */

121     public void installInitiated() throws CoreException {
122     }
123
124     /**
125      * Called after files corresponding to plug-in entries have been downloaded,
126      * but before they are actully unpacked and installed.
127      *
128      * @see IInstallHandler#pluginsDownloaded(IPluginEntry[])
129      * @since 2.0
130      */

131     public void pluginsDownloaded(IPluginEntry[] plugins) throws CoreException {
132
133         this.pluginEntries = plugins;
134     }
135
136     /**
137      * Called after files corresponding to non-plug-in entries have been
138      * downloaded.
139      *
140      * @see IInstallHandler#nonPluginDataDownloaded(INonPluginEntry[], IVerificationListener)
141      * @since 2.0
142      */

143     public void nonPluginDataDownloaded(
144         INonPluginEntry[] nonPluginData,
145         IVerificationListener listener)
146         throws CoreException {
147
148         this.nonPluginEntries = nonPluginData;
149     }
150
151     /**
152      * Called after the feature files and any downloaded plug-ins have
153      * been installed.
154      *
155      * @see IInstallHandler#completeInstall(IFeatureContentConsumer)
156      * @since 2.0
157      */

158     public void completeInstall(IFeatureContentConsumer consumer)
159         throws CoreException {
160     }
161
162     /**
163      * Called at the end of the install action.
164      *
165      * @see IInstallHandler#installCompleted(boolean)
166      * @since 2.0
167      */

168     public void installCompleted(boolean success) throws CoreException {
169     }
170
171     /**
172      * Called at the start of the configure action.
173      *
174      * @see IInstallHandler#configureInitiated()
175      * @since 2.0
176      */

177     public void configureInitiated() throws CoreException {
178     }
179
180     /**
181      * Called after the feature has been configured.
182      *
183      * @see IInstallHandler#completeConfigure()
184      * @since 2.0
185      */

186     public void completeConfigure() throws CoreException {
187     }
188
189     /**
190      * Called at the end of the configure action.
191      *
192      * @see IInstallHandler#configureCompleted(boolean)
193      * @since 2.0
194      */

195     public void configureCompleted(boolean success) throws CoreException {
196     }
197
198     /**
199      * Called at the start of the unconfigure action.
200      *
201      * @see IInstallHandler#unconfigureInitiated()
202      * @since 2.0
203      */

204     public void unconfigureInitiated() throws CoreException {
205     }
206
207     /**
208      * Called after the feature has been unconfigured.
209      *
210      * @see IInstallHandler#completeUnconfigure()
211      * @since 2.0
212      */

213     public void completeUnconfigure() throws CoreException {
214     }
215
216     /**
217      * Called at the end of the unconfigure action.
218      *
219      * @see IInstallHandler#unconfigureCompleted(boolean)
220      * @since 2.0
221      */

222     public void unconfigureCompleted(boolean success) throws CoreException {
223     }
224
225     /**
226      * Called at the start of the uninstall action.
227      *
228      * @see IInstallHandler#uninstallInitiated()
229      * @since 2.0
230      */

231     public void uninstallInitiated() throws CoreException {
232     }
233
234     /**
235      * Called after the feature has been uninstalled.
236      *
237      * @see IInstallHandler#completeUninstall()
238      * @since 2.0
239      */

240     public void completeUninstall() throws CoreException {
241     }
242
243     /**
244      * Called at the end of the uninstall action.
245      *
246      * @see IInstallHandler#uninstallCompleted(boolean)
247      * @since 2.0
248      */

249     public void uninstallCompleted(boolean success) throws CoreException {
250     }
251 }
252
Popular Tags