Package aQute.bnd.osgi.resource
Class ResourceBuilder
- java.lang.Object
-
- aQute.bnd.osgi.resource.ResourceBuilder
-
- Direct Known Subclasses:
ResourceBuilder.SafeResourceBuilder
public class ResourceBuilder extends java.lang.Object
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private class
ResourceBuilder.SafeResourceBuilder
-
Field Summary
Fields Modifier and Type Field Description private boolean
built
private static java.lang.String
BUNDLE_MIME_TYPE
private java.util.Map<org.osgi.resource.Capability,org.osgi.resource.Capability>
capabilities
private static java.lang.String
JAR_MIME_TYPE
private ReporterAdapter
reporter
private java.util.Map<org.osgi.resource.Requirement,org.osgi.resource.Requirement>
requirements
private ResourceImpl
resource
-
Constructor Summary
Constructors Constructor Description ResourceBuilder()
ResourceBuilder(org.osgi.resource.Resource source)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAllExecutionEnvironments(EE ee)
void
addCapabilities(java.util.List<org.osgi.resource.Capability> capabilities)
ResourceBuilder
addCapability(CapReqBuilder builder)
ResourceBuilder
addCapability(org.osgi.resource.Capability capability)
private org.osgi.resource.Capability
addCapability0(CapReqBuilder builder)
void
addContentCapability(java.net.URI uri, java.lang.String sha256, long length, java.lang.String mime)
void
addEE(EE ee)
void
addExecutionEnvironment(EE ee)
void
addExportPackage(java.lang.String packageName, Attrs attrs)
void
addExportPackages(Parameters exports)
Add Exported Packagesvoid
addExportServices(Parameters exportServices)
boolean
addFile(java.io.File file, java.net.URI uri)
void
addFragmentHost(java.lang.String bsn, Attrs attrs)
(package private) void
addFragmentHostCap(java.lang.String bsn, Version version)
org.osgi.resource.Requirement
addImportPackage(java.lang.String pname, Attrs attrs)
void
addImportPackages(Parameters imports)
Add imported packagesvoid
addImportServices(Parameters importServices)
boolean
addManifest(Domain manifest)
Parse the manifest and turn them into requirements & capabilitiesjava.util.List<org.osgi.resource.Capability>
addProvideCapabilities(Parameters capabilities)
java.util.List<org.osgi.resource.Capability>
addProvideCapabilities(java.lang.String clauses)
org.osgi.resource.Capability
addProvideCapability(java.lang.String namespace, Attrs attrs)
void
addRequireBundle(java.lang.String bsn, Attrs attrs)
void
addRequireBundle(java.lang.String bsn, VersionRange range)
void
addRequireBundles(Parameters requireBundle)
Add the Require-Bundle headervoid
addRequireCapabilities(Parameters required)
void
addRequireCapability(java.lang.String namespace, java.lang.String name, Attrs attrs)
ResourceBuilder
addRequirement(CapReqBuilder builder)
void
addRequirement(java.util.List<org.osgi.resource.Requirement> requirements)
ResourceBuilder
addRequirement(org.osgi.resource.Requirement requirement)
private org.osgi.resource.Requirement
addRequirement0(CapReqBuilder builder)
void
addRequirements(java.util.List<org.osgi.resource.Requirement> requires)
org.osgi.resource.Resource
build()
void
copyCapabilities(java.util.Set<java.lang.String> ignoreNamespaces, org.osgi.resource.Resource r)
private static void
doOr(FilterBuilder sb, java.lang.String key, java.lang.String attribute, Attrs attrs)
java.util.List<org.osgi.resource.Capability>
findCapabilities(java.lang.String ns, java.lang.String filter)
java.util.Map<org.osgi.resource.Capability,org.osgi.resource.Capability>
from(org.osgi.resource.Resource bundle)
java.util.List<org.osgi.resource.Capability>
getCapabilities()
RequirementBuilder
getNativeCode(java.lang.String header)
Caclulate the requirement from a native code headerReporter
getReporter()
java.util.List<org.osgi.resource.Requirement>
getRequirements()
ResourceBuilder
safeResourceBuilder()
(package private) java.lang.Object
toBundleVersionFilter(VersionRange range)
-
-
-
Field Detail
-
BUNDLE_MIME_TYPE
private static final java.lang.String BUNDLE_MIME_TYPE
- See Also:
- Constant Field Values
-
JAR_MIME_TYPE
private static final java.lang.String JAR_MIME_TYPE
- See Also:
- Constant Field Values
-
resource
private final ResourceImpl resource
-
capabilities
private final java.util.Map<org.osgi.resource.Capability,org.osgi.resource.Capability> capabilities
-
requirements
private final java.util.Map<org.osgi.resource.Requirement,org.osgi.resource.Requirement> requirements
-
reporter
private ReporterAdapter reporter
-
built
private boolean built
-
-
Method Detail
-
addCapability
public ResourceBuilder addCapability(org.osgi.resource.Capability capability) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addCapability
public ResourceBuilder addCapability(CapReqBuilder builder)
-
addCapability0
private org.osgi.resource.Capability addCapability0(CapReqBuilder builder)
-
addRequirement
public ResourceBuilder addRequirement(org.osgi.resource.Requirement requirement) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequirement
public ResourceBuilder addRequirement(CapReqBuilder builder)
-
addRequirement0
private org.osgi.resource.Requirement addRequirement0(CapReqBuilder builder)
-
build
public org.osgi.resource.Resource build()
-
getCapabilities
public java.util.List<org.osgi.resource.Capability> getCapabilities()
-
getRequirements
public java.util.List<org.osgi.resource.Requirement> getRequirements()
-
addManifest
public boolean addManifest(Domain manifest) throws java.lang.Exception
Parse the manifest and turn them into requirements & capabilities- Parameters:
manifest
- The manifest to parse- Throws:
java.lang.Exception
-
addExportServices
public void addExportServices(Parameters exportServices) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addImportServices
public void addImportServices(Parameters importServices)
-
getNativeCode
public RequirementBuilder getNativeCode(java.lang.String header) throws java.lang.Exception
Caclulate the requirement from a native code header- Parameters:
header
- the Bundle-NativeCode header or null- Returns:
- a Requirement Builder set to the requirements according tot he core spec
- Throws:
java.lang.Exception
-
doOr
private static void doOr(FilterBuilder sb, java.lang.String key, java.lang.String attribute, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequireBundles
public void addRequireBundles(Parameters requireBundle) throws java.lang.Exception
Add the Require-Bundle header- Throws:
java.lang.Exception
-
addRequireBundle
public void addRequireBundle(java.lang.String bsn, VersionRange range) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequireBundle
public void addRequireBundle(java.lang.String bsn, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
toBundleVersionFilter
java.lang.Object toBundleVersionFilter(VersionRange range)
-
addFragmentHostCap
void addFragmentHostCap(java.lang.String bsn, Version version) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addFragmentHost
public void addFragmentHost(java.lang.String bsn, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequireCapabilities
public void addRequireCapabilities(Parameters required) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequireCapability
public void addRequireCapability(java.lang.String namespace, java.lang.String name, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addProvideCapabilities
public java.util.List<org.osgi.resource.Capability> addProvideCapabilities(Parameters capabilities) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addProvideCapabilities
public java.util.List<org.osgi.resource.Capability> addProvideCapabilities(java.lang.String clauses) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addProvideCapability
public org.osgi.resource.Capability addProvideCapability(java.lang.String namespace, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addExportPackages
public void addExportPackages(Parameters exports) throws java.lang.Exception
Add Exported Packages- Throws:
java.lang.Exception
-
addEE
public void addEE(EE ee) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addExportPackage
public void addExportPackage(java.lang.String packageName, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addImportPackages
public void addImportPackages(Parameters imports) throws java.lang.Exception
Add imported packages- Throws:
java.lang.Exception
-
addImportPackage
public org.osgi.resource.Requirement addImportPackage(java.lang.String pname, Attrs attrs) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addExecutionEnvironment
public void addExecutionEnvironment(EE ee) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addAllExecutionEnvironments
public void addAllExecutionEnvironments(EE ee) throws java.lang.Exception
- Throws:
java.lang.Exception
-
copyCapabilities
public void copyCapabilities(java.util.Set<java.lang.String> ignoreNamespaces, org.osgi.resource.Resource r) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addCapabilities
public void addCapabilities(java.util.List<org.osgi.resource.Capability> capabilities) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequirement
public void addRequirement(java.util.List<org.osgi.resource.Requirement> requirements) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addRequirements
public void addRequirements(java.util.List<org.osgi.resource.Requirement> requires) throws java.lang.Exception
- Throws:
java.lang.Exception
-
findCapabilities
public java.util.List<org.osgi.resource.Capability> findCapabilities(java.lang.String ns, java.lang.String filter) throws java.lang.Exception
- Throws:
java.lang.Exception
-
from
public java.util.Map<org.osgi.resource.Capability,org.osgi.resource.Capability> from(org.osgi.resource.Resource bundle) throws java.lang.Exception
- Throws:
java.lang.Exception
-
getReporter
public Reporter getReporter()
-
addContentCapability
public void addContentCapability(java.net.URI uri, java.lang.String sha256, long length, java.lang.String mime) throws java.lang.Exception
- Throws:
java.lang.Exception
-
addFile
public boolean addFile(java.io.File file, java.net.URI uri) throws java.lang.Exception
- Throws:
java.lang.Exception
-
safeResourceBuilder
public ResourceBuilder safeResourceBuilder()
-
-