KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.eclipse.core.runtime.IProgressMonitor;
15
16 /**
17  * Feature content consumer.
18  * A feature content consumer is an abstraction of each feature internal
19  * packaging mechanism. It allows content to be stored into a feature in
20  * a standard way regardless of the packaging mechanism used. Only concrete
21  * features that support storing need to implement a content consumer.
22  * The platform implements at least one feature type supporting content
23  * consumer. This is the feature type representing a locally-installed
24  * feature.
25  * <p>
26  * A feature content consumer delegates the storage of plug-in and
27  * non-plug-in files to a generic content consumer.
28  * </p>
29  * <p>
30  * Clients may implement this interface. However, in most cases clients
31  * will only use the feature content consumer provided by the feature type(s)
32  * implemented by the platform.
33  * </p>
34  * <p>
35  * <b>Note:</b> This class/interface is part of an interim API that is still under development and expected to
36  * change significantly before reaching stability. It is being made available at this early stage to solicit feedback
37  * from pioneering adopters on the understanding that any code that uses this API will almost certainly be broken
38  * (repeatedly) as the API evolves.
39  * </p>
40  * @see org.eclipse.update.core.IContentConsumer
41  * @since 2.0
42  */

43 public interface IFeatureContentConsumer {
44
45     
46     /**
47      * Store a feature file.
48      * Note that only the feature definition files should be stored using
49      * this method. Plug-in files and non-plug-in data files should be
50      * stored using the content consumers corresponding to their respective
51      * entries.
52      *
53      * @see #open(IPluginEntry)
54      * @see #open(INonPluginEntry)
55      * @param contentReference content reference to feature file
56      * @param monitor progress monitor, can be <code>null</code>
57      * @exception CoreException
58      * @since 2.0
59      */

60     public void store(ContentReference contentReference, IProgressMonitor monitor)
61         throws CoreException;
62
63     /**
64      * Opens a generic content consumer for the specified plug-in entry.
65      * Plug-in files corresponding to this entry should be stored
66      * using this content consumer.
67      *
68      * @param pluginEntry plug-in entry
69      * @return generic content consumer for the entry
70      * @exception CoreException
71      * @since 2.0
72      */

73     public IContentConsumer open(IPluginEntry pluginEntry) throws CoreException;
74
75     /**
76      * Opens a generic content consumer for the specified non-plug-in entry.
77      * Non-plug-in files corresponding to this entry should be stored
78      * using this content consumer.
79      *
80      * @param nonPluginEntry non-plug-in entry
81      * @return generic content consumer for the entry
82      * @exception CoreException
83      * @since 2.0
84      */

85     public IContentConsumer open(INonPluginEntry nonPluginEntry)
86         throws CoreException;
87
88     /**
89      * Closes this content consumer. This indicates a successful completion
90      * of the store operations. The content consumer commits any changes
91      * made by this consumer.
92      *
93      * @return reference to the newly populated feature
94      * @exception CoreException
95      * @since 2.0
96      */

97     public IFeatureReference close() throws CoreException;
98
99     /**
100      * Closes this content consumer, indicating the store operations should
101      * be aborted. The content consumer attempts to back out any changes
102      * made by this content consumer.
103      *
104      * @exception CoreException
105      * @since 2.0
106      */

107     public void abort() throws CoreException;
108
109     /**
110      * Sets the feature for this content consumer.
111      * In general, this method should only be called as part of
112      * feature creation. Once set, the feature should not be reset.
113      *
114      * @param feature feature for this content consumer
115      * @since 2.0
116      */

117     public void setFeature(IFeature feature);
118
119     /**
120      * Returns the feature for this content consumer.
121      *
122      * @return the feature for this content consumer
123      * @since 2.0
124      */

125     public IFeature getFeature();
126
127     /**
128      * Sets the parent for this content consumer.
129      * In general, this method should only be called as part of
130      * feature creation. Once set, the feature should not be reset.
131      *
132      * @param parent parent feature content consumer.
133      * @since 2.0
134      */

135     public void setParent(IFeatureContentConsumer parent);
136
137     /**
138      * Returns the feature content consumer that opened
139      * this feature content consumer, or <code>null</code>
140      * if this feature content consumer is a root feature
141      * content consumer.
142      *
143      * @return the parent feature content consumer, or null.
144      * @since 2.0
145      */

146     public IFeatureContentConsumer getParent();
147
148     /**
149      * Link the content consumer of the feature as a child
150      * content consumer
151      *
152      * @param feature the child feature.
153      * @throws CoreException
154      * @since 2.0
155      */

156     public void addChild(IFeature feature) throws CoreException;
157
158     /**
159      * Returns the feature content consumers that
160      * this feature content consumer opened
161      *
162      * @return an array of feature content consumer, or en empty array.
163      * @since 2.0
164      */

165     public IFeatureContentConsumer[] getChildren();
166 }
167
Popular Tags