Package org.eclipse.osgi.container
Class ModuleRevisionBuilder
java.lang.Object
org.eclipse.osgi.container.ModuleRevisionBuilder
A builder for creating module
ModuleRevision
objects. A builder can
only be used by the module container
to build
revisions when
installing
or
updating
a module.
The builder provides the instructions to the container for creating a
ModuleRevision
. They are not thread-safe; in the absence of external
synchronization, they do not support concurrent access by multiple threads.
- Since:
- 3.10
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
Provides information about a capability or requirement -
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a capability to this builder using the specified namespace, directives and attributesvoid
Adds a requirement to this builder using the specified namespace, directives and attributesReturns a snapshot of the capabilities for this buildergetCapabilities
(String namespace) Returns a snapshot of the capabilities in the given namespace for this builderlong
getId()
Returns the module id for this builder.Returns a snapshot of the requirements for this buildergetRequirements
(String namespace) Returns a snapshot of the requirements in the given namespace for this builderReturns the symbolic name for this builder.int
getTypes()
Returns the module type for this builder.Returns the module version for this builder.void
setId
(long id) Sets the module ID for the builder.void
setSymbolicName
(String symbolicName) Sets the symbolic name for the buildervoid
setTypes
(int types) Sets the module types for the builder.void
setVersion
(Version version) Sets the module version for the builder.
-
Constructor Details
-
ModuleRevisionBuilder
public ModuleRevisionBuilder()Constructs a new module builder
-
-
Method Details
-
setSymbolicName
Sets the symbolic name for the builder- Parameters:
symbolicName
- the symbolic name
-
setVersion
Sets the module version for the builder.- Parameters:
version
- the version
-
setTypes
public void setTypes(int types) Sets the module types for the builder.- Parameters:
types
- the module types
-
setId
public void setId(long id) Sets the module ID for the builder.This module ID will be used if this builder is used to
install
a module. If the ID is not set then a module ID will be generated by the module container at install time. If a module already exists with the specified ID then an error will occur when attempting to install a new module with this builder.Note that the system module with location
Constants.SYSTEM_BUNDLE_LOCATION
always gets module ID of zero. The builder for the system module is not asked to provide the module ID for the system module at install time.- Parameters:
id
- the module ID to use. Must be >= 1.- Since:
- 3.13
-
addCapability
public void addCapability(String namespace, Map<String, String> directives, Map<String, Object> attributes) Adds a capability to this builder using the specified namespace, directives and attributes- Parameters:
namespace
- the namespace of the capabilitydirectives
- the directives of the capabilityattributes
- the attributes of the capability
-
getCapabilities
Returns a snapshot of the capabilities for this builder- Returns:
- the capabilities
-
getCapabilities
Returns a snapshot of the capabilities in the given namespace for this builder- Parameters:
namespace
- The namespace of the capabilities to return or null to return the capabilities from all namespaces.- Returns:
- the capabilities
- Since:
- 3.17
-
addRequirement
public void addRequirement(String namespace, Map<String, String> directives, Map<String, Object> attributes) Adds a requirement to this builder using the specified namespace, directives and attributes- Parameters:
namespace
- the namespace of the requirementdirectives
- the directives of the requirementattributes
- the attributes of the requirement
-
getRequirements
Returns a snapshot of the requirements for this builder- Returns:
- the requirements
-
getRequirements
Returns a snapshot of the requirements in the given namespace for this builder- Parameters:
namespace
- The namespace of the requirements to return or null to return the requirements from all namespaces.- Returns:
- the requirements
- Since:
- 3.17
-
getSymbolicName
Returns the symbolic name for this builder.- Returns:
- the symbolic name for this builder.
-
getVersion
Returns the module version for this builder.- Returns:
- the module version for this builder.
-
getTypes
public int getTypes()Returns the module type for this builder.- Returns:
- the module type for this builder.
-
getId
public long getId()Returns the module id for this builder. A value of -1 indicates that the module ID will be generated by the module container atinstall
time.- Returns:
- the module id for this builder.
- Since:
- 3.13
-