public class InstallableResource
extends java.lang.Object
OsgiInstaller
Currently the OSGi installer supports bundles and configurations,
but it can be extended by additional task factories supporting
other formats.
The installable resource contains as much information as the client
can provide. An input stream or dictionary is mandatory everything
else is optional. All optional values will be tried to be evaluated
by the OSGi installer. If such evaluation fails the resource will
be ignore during installation.
If the client provides a configuration it should use the
resource type TYPE_PROPERTIES
. Otherwise the resource
type TYPE_FILE
should be used. These two generic types
are transformed by resource transformer services to the appropriate
resource type like bundle or configuration etc. This frees the
client from having any knowledge about the provided data.
However, if the client has the knowledge about the data it can
provided a specific resource type.
The provider should provide a digest for files (input streams).
The installer will calculate a digest for dictionaries, regardless
if the provider provided a dictionary.Modifier and Type | Field and Description |
---|---|
static java.lang.String |
BUNDLE_START_LEVEL
Optional parameter in the dictionary if a bundle is installed.
|
static int |
DEFAULT_PRIORITY
Default resource priority
|
static java.lang.String |
INSTALLATION_HINT
Optional parameter in the dictionary if a resource (not a dict) is installed.
|
static java.lang.String |
RESOURCE_IS_TEMPLATE
Optional parameter to be passed in the dictionary.
|
static java.lang.String |
RESOURCE_URI_HINT
Optional parameter in the dictionary if a resource (not a dict) is installed.
|
static java.lang.String |
TYPE_BUNDLE
The type for a bundle - in this case
getInputStream() must
return an input stream to the bundle. |
static java.lang.String |
TYPE_CONFIG
The type for a configuration - in this case
getDictionary()
must return a dictionary with the configuration. |
static java.lang.String |
TYPE_FILE
The type for all other provided data like a bundle etc.
|
static java.lang.String |
TYPE_PROPERTIES
The type for properties - in this case
getDictionary()
should contain a dictionary or the getInputStream()
should point to a property or configuration file. |
Constructor and Description |
---|
InstallableResource(java.lang.String id,
java.io.InputStream is,
java.util.Dictionary<java.lang.String,java.lang.Object> dict,
java.lang.String digest,
java.lang.String type,
java.lang.Integer priority)
Create a data object - this is a simple constructor just using the
values as they are provided.
|
Modifier and Type | Method and Description |
---|---|
java.util.Dictionary<java.lang.String,java.lang.Object> |
getDictionary()
Return this resource's dictionary.
|
java.lang.String |
getDigest()
Return this resource's digest.
|
java.lang.String |
getId()
Return this data's id.
|
java.io.InputStream |
getInputStream()
Return an input stream with the data of this resource.
|
int |
getPriority()
Return the priority of this resource.
|
java.lang.String |
getType()
Return the type of this resource.
|
java.lang.String |
toString() |
public static final java.lang.String TYPE_PROPERTIES
getDictionary()
should contain a dictionary or the getInputStream()
should point to a property or configuration file.public static final java.lang.String TYPE_FILE
getInputStream()
must return an input
stream to the data. getDictionary()
might return
additional information.public static final java.lang.String TYPE_BUNDLE
getInputStream()
must
return an input stream to the bundle. getDictionary()
might
return additional information.
This type should only be used if the client really knows that the
provided data is a bundle.public static final java.lang.String TYPE_CONFIG
getDictionary()
must return a dictionary with the configuration.
This type should only be used if the client really knows that the
provided data is an OSGi configuration.public static final java.lang.String BUNDLE_START_LEVEL
public static final java.lang.String INSTALLATION_HINT
public static final java.lang.String RESOURCE_URI_HINT
TYPE_FILE
and a digest for the resource is delivered.
The value of this property is a string.
This property might also be set for an UpdateHandler
in order
to give a hint for the (file) name the resource or dictionary should
have.public static final java.lang.String RESOURCE_IS_TEMPLATE
public static final int DEFAULT_PRIORITY
public InstallableResource(java.lang.String id, java.io.InputStream is, java.util.Dictionary<java.lang.String,java.lang.Object> dict, java.lang.String digest, java.lang.String type, java.lang.Integer priority)
id
- Unique id for the resource, For auto detection of the resource
type, the id should contain an extension like .jar, .cfg etc.is
- The input stream to the data ordict
- A dictionary with datadigest
- A digest of the data - providers should make sure to set
a digest. Calculating a digest by the installer can be very
expensive for input streamstype
- The resource type if known, otherwise TYPE_PROPERTIES
or TYPE_FILE
priority
- Optional priority - if not specified DEFAULT_PRIORITY
is usedjava.lang.IllegalArgumentException
- if something is wrongpublic java.lang.String getId()
OsgiInstaller
but should uniquely identify the resource within the namespace of
the used installation mechanism.public java.lang.String getType()
null
if the type is unknown for the client.public java.io.InputStream getInputStream()
public java.util.Dictionary<java.lang.String,java.lang.Object> getDictionary()
public java.lang.String getDigest()
public int getPriority()
public java.lang.String toString()
toString
in class java.lang.Object
Copyright © 2010 - 2020 Adobe. All Rights Reserved