Source code: javax/ide/extension/spi/ExtensionSource.java
1 package javax.ide.extension.spi;
2
3 import java.io.IOException;
4 import java.io.InputStream;
5 import java.net.URI;
6 import javax.ide.extension.Extension;
7
8 /**
9 * Represents an extension source. An extension source is typically a JAR file
10 * in an IDE specific location for extension jar files. However, an
11 * ExtensionSource could potentially be some other abstract representation of
12 * an extension. One example would be an as-yet unbundled extension manifest
13 * launched from the extension development runtime of an IDE.<p>
14 *
15 * A default implementation of this interface is provided in JARExtensionSource.
16 *
17 */
18 public interface ExtensionSource
19 {
20 /**
21 * Get the classpath entry for this extension source. This is the
22 * (optional) entry that should be added to the classpath prior to
23 * processing this extension.
24 *
25 * @return an {@link URI} to the classpath to be used by the class loader
26 * that will load an extension classes.
27 */
28 public URI getClasspathEntry();
29
30 /**
31 * Resolve a (relative) path referenced in the manifest file for this
32 * extension source.
33 *
34 * @param extension the extension being processed.
35 * @param path a relative path used in the manifest file of this extension
36 * source.
37 * @return an absolute URI pointing to the location of the specified
38 * resource.
39 */
40 public URI resolvePath( Extension extension, String path );
41
42 /**
43 * Get an input stream for this sources manifest.
44 *
45 * @return an input stream for this sources manifest.
46 */
47 public InputStream getInputStream() throws IOException;
48
49 /**
50 * Get the URI of the manifest file contained in this source.
51 *
52 * @return the URI of the manifest file. May return null, in which case
53 * this source will be skipped.
54 */
55 public URI getManifestURI();
56
57 /**
58 * Get the name of this source. This will be used to present the source
59 * in human readable messages.
60 *
61 * @return the name of this source.
62 */
63 public String getName();
64
65 /**
66 * Get the URI of this source. This is the container of the extension.
67 *
68 * @return the URI of the source. For JAR extensions, this is the URI of
69 * the jar file.
70 */
71 public URI getURI();
72
73 }