Interface ConnectContent
-
@ConsumerType public interface ConnectContent
AConnectContent
provides aFramework
instance access to the content of aConnectModule
.A framework may
open
andclose
the content for aConnectModule
multiple times while theConnectContent
is in use by the framework. The framework must close theConnectContent
once theConnectContent
is no longer used as the content of a current bundle revision or an in use bundle revision.An entry in a
ConnectContent
is identified by a path name that is a solidus ('/' /
) separated path. AConnectContent
may treat directories as entries. A directory entry path name will end with a solidus. A directory entry may be located using a path name that omits the trailing solidus.- See Also:
BundleRevisions
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ConnectContent.ConnectEntry
Represents the entry of aConnectContent
.
-
Field Summary
Fields Modifier and Type Field Description static java.lang.String
TAG_OSGI_CONNECT
Theosgi.identity
tags
attribute value used by the framework to tag connect bundle revisions.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
close()
Closes thisConnectContent
.java.util.Optional<java.lang.ClassLoader>
getClassLoader()
Returns a class loader for thisConnectContent
.java.lang.Iterable<java.lang.String>
getEntries()
Returns the entry names available in thisConnectContent
.java.util.Optional<ConnectContent.ConnectEntry>
getEntry(java.lang.String path)
Returns theConnectContent.ConnectEntry
for the specified path name in this content.java.util.Optional<java.util.Map<java.lang.String,java.lang.String>>
getHeaders()
Returns the Manifest headers and values of thisConnectContent
.void
open()
Opens thisConnectContent
.
-
-
-
Field Detail
-
TAG_OSGI_CONNECT
static final java.lang.String TAG_OSGI_CONNECT
Theosgi.identity
tags
attribute value used by the framework to tag connect bundle revisions.- See Also:
- Constant Field Values
-
-
Method Detail
-
getHeaders
java.util.Optional<java.util.Map<java.lang.String,java.lang.String>> getHeaders()
Returns the Manifest headers and values of thisConnectContent
.- Returns:
- An
Optional
containing the Manifest headers and values for thisConnectContent
, or an emptyOptional
if the framework should handle parsing the Manifest of the content itself. - Throws:
java.lang.IllegalStateException
- If thisConnectContent
has been closed.
-
getEntries
java.lang.Iterable<java.lang.String> getEntries() throws java.io.IOException
Returns the entry names available in thisConnectContent
.- Returns:
- An
Iterable
which can supply the available entry names. - Throws:
java.io.IOException
- If an error occurs reading thisConnectContent
.java.lang.IllegalStateException
- If thisConnectContent
has been closed.
-
getEntry
java.util.Optional<ConnectContent.ConnectEntry> getEntry(java.lang.String path)
Returns theConnectContent.ConnectEntry
for the specified path name in this content.The
empty
value is returned if an entry with the specified path name does not exist. The path must not start with a "/" and is relative to the root of this content. A connect entry for a directory will have a path name that ends with a slash ('/').- Parameters:
path
- The path name of the entry.- Returns:
- An
Optional
containing theConnectContent.ConnectEntry
for the specified path, or an emptyOptional
if no entry for specified path can be found. - Throws:
java.lang.IllegalStateException
- If thisConnectContent
has been closed.
-
getClassLoader
java.util.Optional<java.lang.ClassLoader> getClassLoader()
Returns a class loader for thisConnectContent
.This method is called by the framework for
resolved
bundles only and will be called at most once while a bundle is resolved. If a bundle associated with aConnectModule
is refreshed and resolved again, the framework will ask theConnectContent
for the class loader again. This allows for aConnectContent
to reuse or create a new class loader each time the bundle revision is resolved.- Returns:
- An
Optional
containing the class loader for thisConnectContent
, or an emptyOptional
if framework should handle creating a class loader for the bundle revision associated with thisConnectContent
. - Throws:
java.lang.IllegalStateException
- If thisConnectContent
has been closed.
-
open
void open() throws java.io.IOException
Opens thisConnectContent
.The framework will open the content when it needs to access the content for a bundle revision associated with this
ConnectContent
. The framework may defer calling this method until requests to access the bundle revision content are made.- Throws:
java.io.IOException
- If an error occurred opening thisConnectContent
.
-
close
void close() throws java.io.IOException
Closes thisConnectContent
.- Throws:
java.io.IOException
- If an error occurred closing thisConnectContent
.
-
-