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 classResourceBuilder.SafeResourceBuilder
-
Field Summary
Fields Modifier and Type Field Description private booleanbuiltprivate static java.lang.StringBUNDLE_MIME_TYPEprivate java.util.Map<org.osgi.resource.Capability,org.osgi.resource.Capability>capabilitiesprivate static java.lang.StringJAR_MIME_TYPEprivate ReporterAdapterreporterprivate java.util.Map<org.osgi.resource.Requirement,org.osgi.resource.Requirement>requirementsprivate ResourceImplresource
-
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 voidaddAllExecutionEnvironments(EE ee)voidaddCapabilities(java.util.List<org.osgi.resource.Capability> capabilities)ResourceBuilderaddCapability(CapReqBuilder builder)ResourceBuilderaddCapability(org.osgi.resource.Capability capability)private org.osgi.resource.CapabilityaddCapability0(CapReqBuilder builder)voidaddContentCapability(java.net.URI uri, java.lang.String sha256, long length, java.lang.String mime)voidaddEE(EE ee)voidaddExecutionEnvironment(EE ee)voidaddExportPackage(java.lang.String packageName, Attrs attrs)voidaddExportPackages(Parameters exports)Add Exported PackagesvoidaddExportServices(Parameters exportServices)booleanaddFile(java.io.File file, java.net.URI uri)voidaddFragmentHost(java.lang.String bsn, Attrs attrs)(package private) voidaddFragmentHostCap(java.lang.String bsn, Version version)org.osgi.resource.RequirementaddImportPackage(java.lang.String pname, Attrs attrs)voidaddImportPackages(Parameters imports)Add imported packagesvoidaddImportServices(Parameters importServices)booleanaddManifest(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.CapabilityaddProvideCapability(java.lang.String namespace, Attrs attrs)voidaddRequireBundle(java.lang.String bsn, Attrs attrs)voidaddRequireBundle(java.lang.String bsn, VersionRange range)voidaddRequireBundles(Parameters requireBundle)Add the Require-Bundle headervoidaddRequireCapabilities(Parameters required)voidaddRequireCapability(java.lang.String namespace, java.lang.String name, Attrs attrs)ResourceBuilderaddRequirement(CapReqBuilder builder)voidaddRequirement(java.util.List<org.osgi.resource.Requirement> requirements)ResourceBuilderaddRequirement(org.osgi.resource.Requirement requirement)private org.osgi.resource.RequirementaddRequirement0(CapReqBuilder builder)voidaddRequirements(java.util.List<org.osgi.resource.Requirement> requires)org.osgi.resource.Resourcebuild()voidcopyCapabilities(java.util.Set<java.lang.String> ignoreNamespaces, org.osgi.resource.Resource r)private static voiddoOr(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()RequirementBuildergetNativeCode(java.lang.String header)Caclulate the requirement from a native code headerReportergetReporter()java.util.List<org.osgi.resource.Requirement>getRequirements()ResourceBuildersafeResourceBuilder()(package private) java.lang.ObjecttoBundleVersionFilter(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()
-
-