Top Description Inners Fields Methods
org.osgi.framework.connect

public Interface ConnectContent

Annotations
@ConsumerType
Imports
java.io.ByteArrayOutputStream, .IOException, .InputStream, java.util.Map, .Optional, org.osgi.annotation.versioning.ConsumerType, org.osgi.framework.Bundle, org.osgi.framework.launch.Framework, org.osgi.framework.namespace.IdentityNamespace, org.osgi.framework.wiring.BundleRevisions

A ConnectContent provides a Framework instance access to the content of a ConnectModule.

A framework may open and close the content for a ConnectModule multiple times while the ConnectContent is in use by the framework. The framework must close the ConnectContent once the ConnectContent 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. A ConnectContent 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.

Author
$Id: 9e455f9d467f0e38daea0ea52a59a5ccb8c81257 $
See Also
BundleRevisions

Nested and Inner Type Summary

Modifier and TypeClass and Description
public static interface
ConnectContent.ConnectEntry

Represents the entry of a ConnectContent.

Field Summary

Modifier and TypeField and Description
public static final String
TAG_OSGI_CONNECT

The osgi.identity tags attribute value used by the framework to tag connect bundle revisions.

Method Summary

Modifier and TypeMethod and Description
public void
close()

Closes this ConnectContent.

public Optional<ClassLoader>

Returns:

An Optional containing the class loader for this ConnectContent, or an empty Optional if framework should handle creating a class loader for the bundle revision associated with this ConnectContent.
getClassLoader
()

Returns a class loader for this ConnectContent.

public Iterable<String>

Returns:

An Iterable which can supply the available entry names.
getEntries
()

Returns the entry names available in this ConnectContent.

public Optional<ConnectContent.ConnectEntry>

Returns:

An Optional containing the ConnectEntry for the specified path, or an empty Optional if no entry for specified path can be found.
getEntry
(String
The path name of the entry.
path
)

Returns the ConnectEntry for the specified path name in this content.

public Optional<Map<String, String>>

Returns:

An Optional containing the Manifest headers and values for this ConnectContent, or an empty Optional if the framework should handle parsing the Manifest of the content itself.
getHeaders
()

Returns the Manifest headers and values of this ConnectContent.

public void
open()

Opens this ConnectContent.

Field Detail

TAG_OSGI_CONNECTback to summary
public static final String TAG_OSGI_CONNECT

The osgi.identity tags attribute value used by the framework to tag connect bundle revisions.

Method Detail

closeback to summary
public void close() throws IOException

Closes this ConnectContent.

Exceptions
IOException:
If an error occurred closing this ConnectContent.
getClassLoaderback to summary
public Optional<ClassLoader> getClassLoader()

Returns a class loader for this ConnectContent.

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 a ConnectModule is refreshed and resolved again, the framework will ask the ConnectContent for the class loader again. This allows for a ConnectContent to reuse or create a new class loader each time the bundle revision is resolved.

Returns:Optional<ClassLoader>

An Optional containing the class loader for this ConnectContent, or an empty Optional if framework should handle creating a class loader for the bundle revision associated with this ConnectContent.

Exceptions
IllegalStateException:
If this ConnectContent has been closed.
getEntriesback to summary
public Iterable<String> getEntries() throws IOException

Returns the entry names available in this ConnectContent.

Returns:Iterable<String>

An Iterable which can supply the available entry names.

Exceptions
IOException:
If an error occurs reading this ConnectContent.
IllegalStateException:
If this ConnectContent has been closed.
getEntryback to summary
public Optional<ConnectContent.ConnectEntry> getEntry(String path)

Returns the 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:String

The path name of the entry.

Returns:Optional<ConnectContent.ConnectEntry>

An Optional containing the ConnectEntry for the specified path, or an empty Optional if no entry for specified path can be found.

Exceptions
IllegalStateException:
If this ConnectContent has been closed.
getHeadersback to summary
public Optional<Map<String, String>> getHeaders()

Returns the Manifest headers and values of this ConnectContent.

Returns:Optional<Map<String, String>>

An Optional containing the Manifest headers and values for this ConnectContent, or an empty Optional if the framework should handle parsing the Manifest of the content itself.

Exceptions
IllegalStateException:
If this ConnectContent has been closed.
openback to summary
public void open() throws IOException

Opens this ConnectContent.

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.

Exceptions
IOException:
If an error occurred opening this ConnectContent.
org.osgi.framework.connect back to summary

public Interface ConnectContent.ConnectEntry

Annotations
@ConsumerType

Represents the entry of a ConnectContent.

Method Summary

Modifier and TypeMethod and Description
public default byte[]

Returns:

The content of this entry.
getBytes
()

Returns the content of this entry.

public long

Returns:

The content length of the entry, or -1 if the content length is not known.
getContentLength
()

Returns the content length of this entry.

public InputStream

Returns:

An input stream for the content of this entry.
getInputStream
()

Returns an input stream for the content of this entry.

public long

Returns:

The last modification time of this entry measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).
getLastModified
()

Returns the last modification time of this entry.

public String

Returns:

The path name of this entry.
getName
()

Returns the path name of this entry.

Method Detail

getBytesback to summary
public default byte[] getBytes() throws IOException

Returns the content of this entry.

Returns:byte[]

The content of this entry.

Exceptions
IOException:
If an error occurs reading the content.
getContentLengthback to summary
public long getContentLength()

Returns the content length of this entry.

Returns:long

The content length of the entry, or -1 if the content length is not known.

getInputStreamback to summary
public InputStream getInputStream() throws IOException

Returns an input stream for the content of this entry.

Returns:InputStream

An input stream for the content of this entry.

Exceptions
IOException:
If an error occurs reading the content.
getLastModifiedback to summary
public long getLastModified()

Returns the last modification time of this entry.

Returns:long

The last modification time of this entry measured in milliseconds since the epoch (00:00:00 GMT, January 1, 1970).

getNameback to summary
public String getName()

Returns the path name of this entry.

Returns:String

The path name of this entry.