Package aQute.bnd.osgi.resource
Class ResourceBuilder
java.lang.Object
aQute.bnd.osgi.resource.ResourceBuilder
- Direct Known Subclasses:
ResourceBuilder.SafeResourceBuilder
,SyntheticBuilder
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
We order the wiring namespaces ahead of the other namespaces.private class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
private ReporterAdapter
private final ResourceImpl
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static <CR> void
void
void
addCapabilities
(List<org.osgi.resource.Capability> capabilities) addCapability
(CapReqBuilder builder) addCapability
(org.osgi.resource.Capability capability) private org.osgi.resource.Capability
addCapability0
(CapReqBuilder builder) 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) private void
addHashes
(Hierarchy index, org.osgi.resource.Capability cap, CapReqBuilder builder) void
Add simple class name hashes to the exported packages.private void
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) private org.osgi.resource.Requirement
addRequirement0
(CapReqBuilder builder) 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) private static void
doOr
(FilterBuilder sb, String key, String attribute, Attrs attrs) List<org.osgi.resource.Capability>
findCapabilities
(String ns, String filter) private static <CR> List<CR>
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 headerList<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()
-
Field Details
-
resource
-
capabilities
-
requirements
-
reporter
-
built
private boolean built
-
-
Constructor Details
-
ResourceBuilder
public ResourceBuilder(org.osgi.resource.Resource source) -
ResourceBuilder
public ResourceBuilder()
-
-
Method Details
-
addCapability
-
addCapability
-
addCapability0
-
add
-
flatten
-
buildCapability
-
addRequirement
-
addRequirement
-
addRequirement0
-
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
-
doOr
-
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
-
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
-
addHashes
- Throws:
IOException
-
addHashes
-
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
-