public CapReqBuilder addAttributes(Map<? extends String, ? extends Object> attributes) throws Exception { for (Entry<? extends String, ? extends Object> e : attributes.entrySet()) { addAttribute(e.getKey(), e.getValue()); } return this; }
public void addExportPackage(String packageName, Attrs attrs) throws Exception { CapReqBuilder capb = new CapReqBuilder(resource, PackageNamespace.PACKAGE_NAMESPACE); capb.addAttributesOrDirectives(attrs); if (!attrs.containsKey(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE)) { capb.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion); } capb.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, packageName); addCapability(capb); }
public CapReqBuilder addAttributes(Map<? extends String, ? extends Object> attributes) throws Exception { for (Entry<? extends String, ? extends Object> e : attributes.entrySet()) { addAttribute(e.getKey(), e.getValue()); } return this; }
public void addExportPackage(String packageName, Attrs attrs) throws Exception { CapReqBuilder capb = new CapReqBuilder(resource, PackageNamespace.PACKAGE_NAMESPACE); capb.addAttributesOrDirectives(attrs); if (!attrs.containsKey(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE)) { capb.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, Version.emptyVersion); } capb.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, packageName); addCapability(capb); }
private static void copyAttribs(Requirement req, CapReqBuilder builder, Set<String> excludes) throws Exception { for (Entry<String, Object> entry : req.getAttributes() .entrySet()) { if (!excludes.contains(entry.getKey())) builder.addAttribute(entry.getKey(), entry.getValue()); } }
private void parseAttribute(CapReqBuilder capReqBuilder) throws Exception { String attributeName = reader.getAttributeValue(null, ATTR_NAME); String attributeValue = reader.getAttributeValue(null, ATTR_VALUE); String attributeType = reader.getAttributeValue(null, ATTR_TYPE); if (isContent(capReqBuilder) && attributeName.equals("url")) { attributeValue = url.resolve(attributeValue) .toString(); } Object value = Attrs.convert(attributeType, attributeValue); capReqBuilder.addAttribute(attributeName, value); }
public CapReqBuilder(String namespace, Attrs attrs) throws Exception { this(namespace); for (Entry<String, String> entry : attrs.entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) addDirective(key.substring(0, key.length() - 1), entry.getValue()); else addAttribute(key, entry.getValue()); } }
public CapReqBuilder(String ns, Attrs attrs) { this.namespace = ns; for (Entry<String,String> entry : attrs.entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) addDirective(key.substring(0, key.length() - 1), entry.getValue()); else addAttribute(key, entry.getValue()); } }
private void parseAttribute(CapReqBuilder capReqBuilder) throws Exception { String attributeName = reader.getAttributeValue(null, ATTR_NAME); String attributeValue = reader.getAttributeValue(null, ATTR_VALUE); String attributeType = reader.getAttributeValue(null, ATTR_TYPE); if (isContent(capReqBuilder) && attributeName.equals("url")) { attributeValue = url.resolve(attributeValue) .toString(); } Object value = Attrs.convert(attributeType, attributeValue); capReqBuilder.addAttribute(attributeName, value); }
public CapReqBuilder(String namespace, Attrs attrs) throws Exception { this(namespace); for (Entry<String, String> entry : attrs.entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) addDirective(key.substring(0, key.length() - 1), entry.getValue()); else addAttribute(key, entry.getValue()); } }
public CapReqBuilder(String ns, Attrs attrs) { this.namespace = ns; for (Entry<String,String> entry : attrs.entrySet()) { String key = entry.getKey(); if (key.endsWith(":")) addDirective(key.substring(0, key.length() - 1), entry.getValue()); else addAttribute(key, entry.getValue()); } }
void addFragmentHostCap(String bsn, aQute.bnd.version.Version version) throws Exception { CapReqBuilder rbb = new CapReqBuilder(resource, HostNamespace.HOST_NAMESPACE); rbb.addAttribute(HostNamespace.HOST_NAMESPACE, bsn); rbb.addAttribute(AbstractWiringNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, version); addCapability(rbb.buildCapability()); }
public static Capability createPackageCapability(String packageName, String versionString) throws Exception { CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE); builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, packageName); Version version = versionString != null ? new Version(versionString) : Version.emptyVersion; builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version); return builder.buildSyntheticCapability(); }
void addFragmentHostCap(String bsn, aQute.bnd.version.Version version) throws Exception { CapReqBuilder rbb = new CapReqBuilder(resource, HostNamespace.HOST_NAMESPACE); rbb.addAttribute(HostNamespace.HOST_NAMESPACE, bsn); rbb.addAttribute(AbstractWiringNamespace.CAPABILITY_BUNDLE_VERSION_ATTRIBUTE, version); addCapability(rbb.buildCapability()); }
public static Capability createPackageCapability(String packageName, String versionString) throws Exception { CapReqBuilder builder = new CapReqBuilder(PackageNamespace.PACKAGE_NAMESPACE); builder.addAttribute(PackageNamespace.PACKAGE_NAMESPACE, packageName); Version version = versionString != null ? new Version(versionString) : Version.emptyVersion; builder.addAttribute(PackageNamespace.CAPABILITY_VERSION_ATTRIBUTE, version); return builder.buildSyntheticCapability(); }
public void addExecutionEnvironment(EE ee) throws Exception { CapReqBuilder builder = new CapReqBuilder(resource, ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); builder.addAttribute(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, ee.getCapabilityName()); builder.addAttribute(ExecutionEnvironmentNamespace.CAPABILITY_VERSION_ATTRIBUTE, ee.getCapabilityVersion()); addCapability(builder); // Compatibility with old version... builder = new CapReqBuilder(resource, ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); builder.addAttribute(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, ee.getEEName()); addCapability(builder); }
public void addExecutionEnvironment(EE ee) throws Exception { CapReqBuilder builder = new CapReqBuilder(resource, ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); builder.addAttribute(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, ee.getCapabilityName()); builder.addAttribute(ExecutionEnvironmentNamespace.CAPABILITY_VERSION_ATTRIBUTE, ee.getCapabilityVersion()); addCapability(builder); // Compatibility with old version... builder = new CapReqBuilder(resource, ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE); builder.addAttribute(ExecutionEnvironmentNamespace.EXECUTION_ENVIRONMENT_NAMESPACE, ee.getEEName()); addCapability(builder); }
void doExportService(Domain domain, List< ? super Capability> caps) throws Exception { @SuppressWarnings("deprecation") Parameters exports = new Parameters(domain.get(Constants.EXPORT_SERVICE)); for (Entry<String,Attrs> export : exports.entrySet()) { String service = Processor.removeDuplicateMarker(export.getKey()); CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_SERVICE).addAttribute(Constants.OBJECTCLASS, service); for (Entry<String,String> attribEntry : export.getValue().entrySet()) builder.addAttribute(attribEntry.getKey(), attribEntry.getValue()); builder.addDirective(Namespaces.DIRECTIVE_EFFECTIVE, Namespaces.EFFECTIVE_ACTIVE); caps.add(builder.buildCapability()); } }
Resource constructInputRequirements() throws Exception { ResourceBuilder resBuilder = new ResourceBuilder(); CapReqBuilder identity = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE) .addAttribute(IdentityNamespace.IDENTITY_NAMESPACE, IDENTITY_INITIAL_RESOURCE); resBuilder.addCapability(identity); Parameters inputRequirements = new Parameters(properties.mergeProperties(Constants.RUNREQUIRES), project); if (inputRequirements != null && !inputRequirements.isEmpty()) { List<Requirement> requires = CapReqBuilder.getRequirementsFrom(inputRequirements); resBuilder.addRequirements(requires); } return resBuilder.build(); }
Resource constructInputRequirements() throws Exception { ResourceBuilder resBuilder = new ResourceBuilder(); CapReqBuilder identity = new CapReqBuilder(IdentityNamespace.IDENTITY_NAMESPACE) .addAttribute(IdentityNamespace.IDENTITY_NAMESPACE, IDENTITY_INITIAL_RESOURCE); resBuilder.addCapability(identity); Parameters inputRequirements = new Parameters(properties.mergeProperties(Constants.RUNREQUIRES), project); if (inputRequirements != null && !inputRequirements.isEmpty()) { List<Requirement> requires = CapReqBuilder.getRequirementsFrom(inputRequirements); resBuilder.addRequirements(requires); } return resBuilder.build(); }