You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2014/10/22 00:57:42 UTC
svn commit: r1633482 - in /felix/sandbox/pderop/dependencymanager-prototype:
org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/
org.apache.felix.dependencymanager.runtime/
org.apache.felix.dependencymanager/src...
Author: pderop
Date: Tue Oct 21 22:57:42 2014
New Revision: 1633482
URL: http://svn.apache.org/r1633482
Log:
FELIX-4676 - Add Provide-Capability for DependencyManager Runtime bundle.
Modified:
felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationPlugin.java
felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/bnd.bnd
felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ComponentExecutorFactory.java
Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationPlugin.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationPlugin.java?rev=1633482&r1=1633481&r2=1633482&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationPlugin.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.annotation/src/org/apache/felix/dm/annotation/plugin/bnd/AnnotationPlugin.java Tue Oct 21 22:57:42 2014
@@ -39,11 +39,16 @@ import aQute.service.reporter.Reporter;
public class AnnotationPlugin implements AnalyzerPlugin, Plugin {
private static final String IMPORT_SERVICE = "Import-Service";
private static final String EXPORT_SERVICE = "Export-Service";
+ private static final String REQUIRE_CAPABILITY = "Require-Capability";
+
private static final String LOGLEVEL = "log";
private static final String BUILD_IMPEXT = "build-import-export-service";
+ private static final String ADD_REQUIRE_CAPABILITY = "add-require-capability";
+ private static final String DM_RUNTIME_CAPABILITY = "osgi.extender; filter:=\"(&(osgi.extender=org.apache.felix.dependencymanager.runtime)(version>=4.0.0))\"";
private BndLogger m_logger;
private Reporter m_reporter;
private boolean m_buildImportExportService;
+ private boolean m_addRequireCapability;
private Map<String, String> m_properties;
public void setReporter(Reporter reporter) {
@@ -77,6 +82,11 @@ public class AnnotationPlugin implements
// We have parsed some annotations: set the OSGi "DependencyManager-Component" header in the target bundle.
analyzer.setProperty("DependencyManager-Component", generator.getDescriptorPaths());
+ if (m_addRequireCapability) {
+ // Add our Require-Capability header
+ buildRequireCapability(analyzer);
+ }
+
// Possibly set the Import-Service/Export-Service header
if (m_buildImportExportService) {
// Don't override Import-Service header, if it is found from the bnd directives.
@@ -117,7 +127,8 @@ public class AnnotationPlugin implements
private void init(Analyzer analyzer) {
m_logger.setLevel(parseOption(m_properties, LOGLEVEL, BndLogger.Level.Warn.toString()));
- m_buildImportExportService = parseOption(m_properties, BUILD_IMPEXT, true);
+ m_buildImportExportService = parseOption(m_properties, BUILD_IMPEXT, false);
+ m_addRequireCapability = parseOption(m_properties, ADD_REQUIRE_CAPABILITY, true);
analyzer.setExceptions(true);
m_logger.info("Initialized Bnd DependencyManager plugin: buildImportExport=%b", m_buildImportExportService);
}
@@ -145,6 +156,16 @@ public class AnnotationPlugin implements
}
}
+ private void buildRequireCapability(Analyzer analyzer) {
+ String requireCapability = analyzer.getProperty(REQUIRE_CAPABILITY);
+ if (requireCapability == null) {
+ analyzer.setProperty(REQUIRE_CAPABILITY, DM_RUNTIME_CAPABILITY);
+ } else {
+ StringBuilder sb = new StringBuilder(requireCapability).append(",").append(DM_RUNTIME_CAPABILITY);
+ analyzer.setProperty(REQUIRE_CAPABILITY, sb.toString());
+ }
+ }
+
/**
* Parse an exception into a string.
* @param e The exception to parse
Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/bnd.bnd
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/bnd.bnd?rev=1633482&r1=1633481&r2=1633482&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/bnd.bnd (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager.runtime/bnd.bnd Tue Oct 21 22:57:42 2014
@@ -7,4 +7,6 @@ Private-Package: \
osgi.cmpn;version=4.2,\
org.apache.felix.dependencymanager;version=latest,\
de.twentyeleven.skysail.org.json-osgi;version=20080701.0
-Bundle-Activator:org.apache.felix.dm.runtime.Activator
\ No newline at end of file
+Bundle-Activator:org.apache.felix.dm.runtime.Activator
+Provide-Capability: osgi.extender; osgi.extender="org.apache.felix.dependencymanager.runtime";\
+ uses:="org.apache.felix.dm";version:Version="4.0.0"
\ No newline at end of file
Modified: felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ComponentExecutorFactory.java
URL: http://svn.apache.org/viewvc/felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ComponentExecutorFactory.java?rev=1633482&r1=1633481&r2=1633482&view=diff
==============================================================================
--- felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ComponentExecutorFactory.java (original)
+++ felix/sandbox/pderop/dependencymanager-prototype/org.apache.felix.dependencymanager/src/org/apache/felix/dm/ComponentExecutorFactory.java Tue Oct 21 22:57:42 2014
@@ -27,14 +27,14 @@ import java.util.concurrent.Executor;
* Some class name prefixes can also be negated (using "!"), in order to exclude some components from the
* list of components using the ComponentExecutorFactory service.<p>
*
- * Notice that if the ComponentExecutorFactory itself and all it's dependent services are defined using
+ * Notice that if the ComponentExecutorFactory itself and all its dependent services are defined using
* the Dependency Manager API, then you have to list the package of such components with a "!"
* prefix, in order to indicate that those components must not wait for a ComponentExecutorFactory service
* (since they are part of the ComponentExecutorFactory implementation !).<p>
*
* Examples:
*
- * * <blockquote>
+ * <blockquote>
*
* <pre>
* org.apache.felix.dependencymanager.parallel=*