Package aQute.bnd.osgi.resource
Class ResourceBuilder
java.lang.Object
aQute.bnd.osgi.resource.ResourceBuilder
- Direct Known Subclasses:
SyntheticBuilder
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
void
addCapabilities
(List<org.osgi.resource.Capability> capabilities) addCapability
(CapReqBuilder builder) addCapability
(org.osgi.resource.Capability capability) void
addContentCapability
(URI uri, String sha256, long length, String mime) void
void
void
addExportPackage
(String name, Attrs attrs) void
addExportPackage
(String name, Attrs attrs, String bundle_symbolic_name, org.osgi.framework.Version bundle_version) void
addExportPackages
(Parameters exports) Add Exported Packagesvoid
addExportPackages
(Parameters exports, String bundle_symbolic_name, org.osgi.framework.Version bundle_version) void
addExportServices
(Parameters exportServices) boolean
void
addFragmentHost
(String bsn, Attrs attrs) void
Add simple class name hashes to the exported packages.org.osgi.resource.Requirement
addImportPackage
(String name, Attrs attrs) void
addImportPackages
(Parameters imports) Add imported packagesvoid
addImportServices
(Parameters importServices) boolean
addManifest
(Domain manifest) Parse the manifest and turn them into requirements & capabilitiesList<org.osgi.resource.Capability>
addProvideCapabilities
(Parameters capabilities) List<org.osgi.resource.Capability>
addProvideCapabilities
(String clauses) org.osgi.resource.Capability
addProvideCapability
(String namespace, Attrs attrs) void
addRequireBundle
(String bsn, Attrs attrs) void
addRequireBundle
(String bsn, VersionRange range) void
addRequireBundles
(Parameters requireBundle) Add the Require-Bundle headervoid
addRequireCapabilities
(Parameters required) void
addRequireCapability
(String namespace, String name, Attrs attrs) addRequirement
(CapReqBuilder builder) void
addRequirement
(List<org.osgi.resource.Requirement> requirements) addRequirement
(org.osgi.resource.Requirement requirement) void
addRequirements
(List<org.osgi.resource.Requirement> requires) void
addWorkspaceNamespace
(String name) A repository that implements theWorkspaceRepositoryMarker
in the resolver must add a WORKSPACE_NAMESPACE capability to make its clear the resources are from the workspace.org.osgi.resource.Resource
build()
protected org.osgi.resource.Capability
buildCapability
(CapReqBuilder builder) protected org.osgi.resource.Requirement
buildRequirement
(CapReqBuilder builder) void
copyCapabilities
(Set<String> ignoreNamespaces, org.osgi.resource.Resource r) List<org.osgi.resource.Capability>
findCapabilities
(String ns, String filter) Map<org.osgi.resource.Capability,
org.osgi.resource.Capability> from
(org.osgi.resource.Resource bundle) List<org.osgi.resource.Capability>
getNativeCode
(String header) Caclulate the requirement from a native code headeraQute.service.reporter.Reporter
List<org.osgi.resource.Requirement>
static Supplier<org.osgi.resource.Resource>
Create a deferred resource builder so that any expensive actions are deferred until the supplier is called to get the resource.toString()
-
Constructor Details
-
ResourceBuilder
public ResourceBuilder(org.osgi.resource.Resource source) -
ResourceBuilder
public ResourceBuilder()
-
-
Method Details
-
addCapability
-
addCapability
-
buildCapability
-
addRequirement
-
addRequirement
-
buildRequirement
-
build
public org.osgi.resource.Resource build() -
getCapabilities
-
getRequirements
-
addManifest
Parse the manifest and turn them into requirements & capabilities- Parameters:
manifest
- The manifest to parse
-
addExportServices
-
addImportServices
-
getNativeCode
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
-
addRequireBundles
Add the Require-Bundle header -
addRequireBundle
-
addRequireBundle
-
addFragmentHost
-
addRequireCapabilities
-
addRequireCapability
-
addProvideCapabilities
-
addProvideCapabilities
-
addProvideCapability
-
addExportPackages
Add Exported Packages -
addExportPackages
public void addExportPackages(Parameters exports, String bundle_symbolic_name, org.osgi.framework.Version bundle_version) -
addEE
-
addExportPackage
-
addExportPackage
-
addImportPackages
Add imported packages -
addImportPackage
-
addExecutionEnvironment
-
addAllExecutionEnvironments
-
copyCapabilities
-
addCapabilities
-
addRequirement
-
addRequirements
-
findCapabilities
-
from
public Map<org.osgi.resource.Capability,org.osgi.resource.Capability> from(org.osgi.resource.Resource bundle) -
getReporter
public aQute.service.reporter.Reporter getReporter() -
addContentCapability
-
addFile
- Throws:
Exception
-
addHashes
Add simple class name hashes to the exported packages. This should not be called before any package capabilities are set since we only hash class names in exports. So no exports, no hash.- Throws:
IOException
-
safeResourceBuilder
-
addWorkspaceNamespace
A repository that implements theWorkspaceRepositoryMarker
in the resolver must add a WORKSPACE_NAMESPACE capability to make its clear the resources are from the workspace. Ideally this would not be necessary but we're having two workspace repositories. One for Bndtools where the repository is interactive, the other is for resolving in Gradle, etc.- Parameters:
name
- the project name
-
toString
-
memoize
public static Supplier<org.osgi.resource.Resource> memoize(Jar jar, URI uri, String projectName) throws Exception Create a deferred resource builder so that any expensive actions are deferred until the supplier is called to get the resource.- Parameters:
jar
- a Jar, preferably with checksum calculated, or nulluri
- the uri to use or null (will use file uri as default)projectName
- if in a workspace, the project name or otherwise null- Returns:
- a memo for creating the corresponding resource
- Throws:
Exception
-