/** * Constructor * * @param log * the log service to use */ public RepoIndex() { analyzers.add( new BundleAnalyzer() ); analyzers.add( new OSGiFrameworkAnalyzer() ); analyzers.add( new SCRAnalyzer() ); analyzers.add( new BlueprintAnalyzer() ); }
public void analyzeResource(Jar resource, ResourceBuilder rb) throws Exception { Resource fwkFactorySvc = resource.getResource(SERVICE_FRAMEWORK_FACTORY); if (fwkFactorySvc != null) { CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_CONTRACT).addAttribute(Namespaces.NS_CONTRACT, Namespaces.CONTRACT_OSGI_FRAMEWORK); Version specVersion = null; StringBuilder uses = new StringBuilder(); boolean firstPkg = true; for (Capability cap : rb.getCapabilities()) { if (Namespaces.NS_WIRING_PACKAGE.equals(cap.getNamespace())) { // Add to the uses directive if (!firstPkg) uses.append(','); String pkgName = (String) cap.getAttributes().get(Namespaces.NS_WIRING_PACKAGE); uses.append(pkgName); firstPkg = false; // If it's org.osgi.framework, get the package version and // map to OSGi spec version if (FRAMEWORK_PACKAGE.equals(pkgName)) { Version frameworkPkgVersion = (Version) cap.getAttributes().get(Namespaces.ATTR_VERSION); specVersion = mapFrameworkPackageVersion(frameworkPkgVersion); } } } if (specVersion != null) builder.addAttribute(Namespaces.ATTR_VERSION, specVersion); builder.addDirective(Namespaces.DIRECTIVE_USES, uses.toString()); rb.addCapability(builder); } }
public void analyzeResource(Jar resource, ResourceBuilder rb) throws Exception { Resource fwkFactorySvc = resource.getResource(SERVICE_FRAMEWORK_FACTORY); if (fwkFactorySvc != null) { CapReqBuilder builder = new CapReqBuilder(Namespaces.NS_CONTRACT).addAttribute(Namespaces.NS_CONTRACT, Namespaces.CONTRACT_OSGI_FRAMEWORK); Version specVersion = null; StringBuilder uses = new StringBuilder(); boolean firstPkg = true; for (Capability cap : rb.getCapabilities()) { if (Namespaces.NS_WIRING_PACKAGE.equals(cap.getNamespace())) { // Add to the uses directive if (!firstPkg) uses.append(','); String pkgName = (String) cap.getAttributes().get(Namespaces.NS_WIRING_PACKAGE); uses.append(pkgName); firstPkg = false; // If it's org.osgi.framework, get the package version and // map to OSGi spec version if (FRAMEWORK_PACKAGE.equals(pkgName)) { Version frameworkPkgVersion = (Version) cap.getAttributes().get(Namespaces.ATTR_VERSION); specVersion = mapFrameworkPackageVersion(frameworkPkgVersion); } } } if (specVersion != null) builder.addAttribute(Namespaces.ATTR_VERSION, specVersion); builder.addDirective(Namespaces.DIRECTIVE_USES, uses.toString()); rb.addCapability(builder); } }
/** * Constructor * * @param log * the log service to use */ public RepoIndex() { analyzers.add( new BundleAnalyzer() ); analyzers.add( new OSGiFrameworkAnalyzer() ); analyzers.add( new SCRAnalyzer() ); analyzers.add( new BlueprintAnalyzer() ); }