[DOSGI-229] Use separate bundles for API and RSA impl. Remove dynamic import
diff --git a/distribution/features/src/main/resources/features.xml b/distribution/features/src/main/resources/features.xml
index 1c19381..b39562b 100644
--- a/distribution/features/src/main/resources/features.xml
+++ b/distribution/features/src/main/resources/features.xml
@@ -24,6 +24,8 @@
<feature>cxf-http</feature>
<feature>http</feature>
<bundle start-level="8">mvn:${project.groupId}/cxf-dosgi-ri-osgi-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/cxf-dosgi-ri-provider-api/${project.version}</bundle>
+ <bundle>mvn:${project.groupId}/cxf-dosgi-ri-rsa/${project.version}</bundle>
<bundle>mvn:${project.groupId}/cxf-dosgi-ri-topology-manager/${project.version}</bundle>
<bundle>mvn:${project.groupId}/cxf-dosgi-ri-dsw-cxf/${project.version}</bundle>
</feature>
diff --git a/dsw/cxf-dosgi-provider-api/pom.xml b/dsw/cxf-dosgi-provider-api/pom.xml
new file mode 100644
index 0000000..9b248fb
--- /dev/null
+++ b/dsw/cxf-dosgi-provider-api/pom.xml
@@ -0,0 +1,64 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-ri-parent</artifactId>
+ <version>1.8-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>cxf-dosgi-ri-provider-api</artifactId>
+ <packaging>bundle</packaging>
+ <name>Distributed OSGI Distributed Software Modules</name>
+
+ <properties>
+ <topDirectoryLocation>../..</topDirectoryLocation>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.7.14</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
\ No newline at end of file
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
rename to dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/DistributionProvider.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
rename to dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/Endpoint.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java b/dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
rename to dsw/cxf-dosgi-provider-api/src/main/java/org/apache/cxf/dosgi/dsw/api/IntentUnsatisfiedException.java
diff --git a/dsw/cxf-dosgi-rsa/pom.xml b/dsw/cxf-dosgi-rsa/pom.xml
new file mode 100644
index 0000000..3327135
--- /dev/null
+++ b/dsw/cxf-dosgi-rsa/pom.xml
@@ -0,0 +1,71 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-ri-parent</artifactId>
+ <version>1.8-SNAPSHOT</version>
+ <relativePath>../../parent/pom.xml</relativePath>
+ </parent>
+ <artifactId>cxf-dosgi-ri-rsa</artifactId>
+ <packaging>bundle</packaging>
+ <name>CXF dOSGi Remote Service Admin Implementation</name>
+ <description>The CXF Remote Service Admin as described in the OSGi Remote Service Admin specification</description>
+
+ <properties>
+ <topDirectoryLocation>../..</topDirectoryLocation>
+ </properties>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-api</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.core</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.osgi</groupId>
+ <artifactId>org.osgi.compendium</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-provider-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.easymock</groupId>
+ <artifactId>easymockclassextension</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jdk14</artifactId>
+ <version>1.7.14</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.felix</groupId>
+ <artifactId>maven-bundle-plugin</artifactId>
+ <extensions>true</extensions>
+ <configuration>
+ <instructions>
+ <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
+ <Bundle-Activator>org.apache.cxf.dosgi.dsw.service.Activator</Bundle-Activator>
+ </instructions>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
+</project>
\ No newline at end of file
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java
new file mode 100644
index 0000000..4c4d7ad
--- /dev/null
+++ b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/Activator.java
@@ -0,0 +1,37 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.service;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+public class Activator implements BundleActivator {
+
+ private DistributionProviderTracker tracker;
+
+ public void start(BundleContext bundlecontext) throws Exception {
+ tracker = new DistributionProviderTracker(bundlecontext);
+ tracker.open();
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ tracker.close();
+ }
+
+}
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactory.java
diff --git a/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
new file mode 100644
index 0000000..7dd31b7
--- /dev/null
+++ b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderTracker.java
@@ -0,0 +1,67 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.cxf.dosgi.dsw.service;
+
+import java.util.Dictionary;
+import java.util.Hashtable;
+
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.FrameworkUtil;
+import org.osgi.framework.ServiceReference;
+import org.osgi.framework.ServiceRegistration;
+import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
+import org.osgi.util.tracker.ServiceTracker;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("rawtypes")
+public class DistributionProviderTracker extends ServiceTracker<DistributionProvider, ServiceRegistration> {
+ private static final Logger LOG = LoggerFactory.getLogger(Activator.class);
+
+ public DistributionProviderTracker(BundleContext context) {
+ super(context, DistributionProvider.class, null);
+ }
+
+ @Override
+ public ServiceRegistration addingService(ServiceReference<DistributionProvider> reference) {
+ LOG.debug("RemoteServiceAdmin Implementation is starting up");
+ DistributionProvider provider = context.getService(reference);
+ Bundle apiBundle = FrameworkUtil.getBundle(DistributionProvider.class);
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(context,
+ apiBundle.getBundleContext(),
+ provider);
+ RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(rsaCore);
+ Dictionary<String, Object> props = new Hashtable<String, Object>();
+ props.put("remote.intents.supported", reference.getProperty("remote.intents.supported"));
+ props.put("remote.configs.supported", reference.getProperty("remote.configs.supported"));
+ LOG.info("Registering RemoteServiceAdmin for provider " + provider.getClass().getName());
+ return context.registerService(RemoteServiceAdmin.class.getName(), rsaf, props);
+ }
+
+ @Override
+ public void removedService(ServiceReference<DistributionProvider> reference,
+ ServiceRegistration reg) {
+ LOG.debug("RemoteServiceAdmin Implementation is shutting down now");
+ reg.unregister();
+ super.removedService(reference, reg);
+ }
+
+}
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventAdminHelper.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/EventProducer.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportReferenceImpl.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ExportRegistrationImpl.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImpl.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
similarity index 96%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
index 9f4e5fa..aa6e4ee 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
+++ b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCore.java
@@ -67,9 +67,11 @@
private final EventProducer eventProducer;
private final ServiceListener exportedServiceListener;
private DistributionProvider provider;
+ private BundleContext apictx;
- public RemoteServiceAdminCore(BundleContext bc, DistributionProvider provider) {
- this.bctx = bc;
+ public RemoteServiceAdminCore(BundleContext context, BundleContext apiContext, DistributionProvider provider) {
+ this.bctx = context;
+ this.apictx = apiContext;
this.eventProducer = new EventProducer(bctx);
this.provider = provider;
// listen for exported services being unregistered so we can close the export
@@ -82,7 +84,7 @@
};
try {
String filter = "(" + RemoteConstants.SERVICE_EXPORTED_INTERFACES + "=*)";
- bc.addServiceListener(exportedServiceListener, filter);
+ context.addServiceListener(exportedServiceListener, filter);
} catch (InvalidSyntaxException ise) {
throw new RuntimeException(ise); // can never happen
}
@@ -370,10 +372,6 @@
DistributionProvider handler) {
ImportRegistrationImpl imReg = new ImportRegistrationImpl(epd, this);
try {
- // FIXME This should not be done here but without it the service factory
- // does not seem to be picked up by the consumers
- bctx.getBundle().loadClass(interfaceName);
-
EndpointDescription endpoint = imReg.getImportedEndpointDescription();
Dictionary<String, Object> serviceProps = new Hashtable<String, Object>(endpoint.getProperties());
serviceProps.put(RemoteConstants.SERVICE_IMPORTED, true);
@@ -381,7 +379,13 @@
ClientServiceFactory csf = new ClientServiceFactory(endpoint, handler, imReg);
imReg.setClientServiceFactory(csf);
- ServiceRegistration<?> csfReg = bctx.registerService(interfaceName, csf, serviceProps);
+
+ /**
+ * Export the factory using the api context as it has very few imports.
+ * If the bundle publishing the factory does not import the service interface
+ * package then the factory is visible for all consumers which we want.
+ */
+ ServiceRegistration<?> csfReg = apictx.registerService(interfaceName, csf, serviceProps);
imReg.setImportedServiceRegistration(csfReg);
} catch (Exception ex) {
// Only logging at debug level as this might be written to the log at the TopologyManager
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminInstance.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceadminFactory.java
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java b/dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
similarity index 100%
rename from dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
rename to dsw/cxf-dosgi-rsa/src/main/java/org/apache/cxf/dosgi/dsw/service/StringPlus.java
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
similarity index 99%
rename from dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
rename to dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
index 2f32ab7..20cdd02 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
+++ b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ClientServiceFactoryTest.java
@@ -18,8 +18,6 @@
*/
package org.apache.cxf.dosgi.dsw.service;
-
-
import java.util.HashMap;
import java.util.Map;
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
similarity index 100%
rename from dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
rename to dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/EventProducerTest.java
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
similarity index 100%
rename from dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
rename to dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/ImportRegistrationImplTest.java
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
similarity index 99%
rename from dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
rename to dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
index c9eae7b..af7052f 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
+++ b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/RemoteServiceAdminCoreTest.java
@@ -88,7 +88,7 @@
c.replay();
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, provider);
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, provider);
// must return an empty List as sref if from the same bundle
List<ExportRegistration> exRefs = rsaCore.exportService(sref, null);
@@ -121,7 +121,7 @@
.andReturn(new String[]{MYCONFIG}).atLeastOnce();
c.replay();
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, provider);
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, provider);
// must be null as the endpoint doesn't contain any usable configurations
assertNull(rsaCore.importService(endpoint));
@@ -221,7 +221,7 @@
anyObject(Map.class), isA(Class[].class))).andReturn(er);
EasyMock.replay(handler);
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handler);
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, handler);
// Export the service for the first time
List<ExportRegistration> ereg = rsaCore.exportService(sref, null);
@@ -312,7 +312,7 @@
anyObject(Map.class), isA(Class[].class))).andThrow(new TestException());
EasyMock.replay(handler);
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, handler);
+ RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, bc, handler);
List<ExportRegistration> ereg = rsaCore.exportService(sref, sProps);
assertEquals(1, ereg.size());
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java b/dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
similarity index 100%
rename from dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
rename to dsw/cxf-dosgi-rsa/src/test/java/org/apache/cxf/dosgi/dsw/service/StringPlusTest.java
diff --git a/dsw/cxf-dsw/pom.xml b/dsw/cxf-dsw/pom.xml
index 3693a23..44fdc98 100644
--- a/dsw/cxf-dsw/pom.xml
+++ b/dsw/cxf-dsw/pom.xml
@@ -22,8 +22,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>cxf-dosgi-ri-dsw-cxf</artifactId>
<packaging>bundle</packaging>
- <name>CXF dOSGi Remote Service Admin Implementation</name>
- <description>The CXF Remote Service Admin as described in the OSGi Remote Service Admin specification</description>
+ <name>CXF dOSGi Distribution provider</name>
<parent>
<groupId>org.apache.cxf.dosgi</groupId>
@@ -50,6 +49,12 @@
<artifactId>org.osgi.compendium</artifactId>
</dependency>
+
+ <dependency>
+ <groupId>org.apache.cxf.dosgi</groupId>
+ <artifactId>cxf-dosgi-provider-api</artifactId>
+ <version>${project.version}</version>
+ </dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-core</artifactId>
@@ -132,9 +137,6 @@
!*
</Export-Package>
<Bundle-Activator>org.apache.cxf.dosgi.dsw.Activator</Bundle-Activator>
-
- <!-- Is currently needed to create a proxy of an interface given in String form -->
- <DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
index c2383aa..743e8f2 100644
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
+++ b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/Activator.java
@@ -34,8 +34,6 @@
import org.apache.cxf.dosgi.dsw.qos.IntentManagerImpl;
import org.apache.cxf.dosgi.dsw.qos.IntentMap;
import org.apache.cxf.dosgi.dsw.qos.IntentTracker;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceAdminCore;
-import org.apache.cxf.dosgi.dsw.service.RemoteServiceadminFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.BundleListener;
@@ -43,7 +41,6 @@
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.cm.ConfigurationException;
import org.osgi.service.cm.ManagedService;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -89,14 +86,11 @@
httpServiceManager = new HttpServiceManager(bc, httpBase, cxfServletAlias);
DistributionProvider cxfProvider
= new CXFDistributionProvider(bc, intentManager, httpServiceManager);
- RemoteServiceAdminCore rsaCore = new RemoteServiceAdminCore(bc, cxfProvider);
- RemoteServiceadminFactory rsaf = new RemoteServiceadminFactory(rsaCore);
Dictionary<String, Object> props = new Hashtable<String, Object>();
String[] supportedIntents = intentMap.keySet().toArray(new String[] {});
props.put("remote.intents.supported", supportedIntents);
props.put("remote.configs.supported", cxfProvider.getSupportedTypes());
- LOG.info("Registering RemoteServiceAdminFactory...");
- rsaFactoryReg = bc.registerService(RemoteServiceAdmin.class.getName(), rsaf, props);
+ rsaFactoryReg = bc.registerService(DistributionProvider.class.getName(), cxfProvider, props);
ServiceDecoratorImpl serviceDecorator = new ServiceDecoratorImpl();
bundleListener = new ServiceDecoratorBundleListener(serviceDecorator);
bc.addBundleListener(bundleListener);
diff --git a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageFinder.java b/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageFinder.java
deleted file mode 100644
index cc7d4f8..0000000
--- a/dsw/cxf-dsw/src/main/java/org/apache/cxf/dosgi/dsw/service/PackageFinder.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.service;
-
-import java.util.List;
-
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.Version;
-import org.osgi.framework.wiring.BundleCapability;
-import org.osgi.framework.wiring.BundleWiring;
-import org.osgi.service.remoteserviceadmin.EndpointDescription;
-
-public class PackageFinder {
- private BundleContext context;
-
- public PackageFinder(BundleContext context) {
- this.context = context;
- }
-
- public void findPackageFor(String interfaceName, EndpointDescription epd) {
- BundleWiring wiring = context.getBundle().adapt(BundleWiring.class);
- List<BundleCapability> caps = wiring.getCapabilities("osgi.wiring.package");
- Version version = epd.getPackageVersion(getPackageName(interfaceName));
- }
-
-
- private String getPackageName(String interfaceName) {
- return interfaceName.substring(0, interfaceName.lastIndexOf("."));
- }
-
-}
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
index 98e2cfc..65e93bc 100644
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
+++ b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/ActivatorTest.java
@@ -23,13 +23,13 @@
import junit.framework.TestCase;
+import org.apache.cxf.dosgi.dsw.api.DistributionProvider;
import org.easymock.EasyMock;
import org.easymock.IMocksControl;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
import org.osgi.framework.Filter;
import org.osgi.framework.ServiceRegistration;
-import org.osgi.service.remoteserviceadmin.RemoteServiceAdmin;
public class ActivatorTest extends TestCase {
@@ -54,7 +54,7 @@
EasyMock.expect(bc.createFilter(EasyMock.<String>anyObject())).andReturn(filter);
EasyMock.expectLastCall().atLeastOnce();
ServiceRegistration sr = control.createMock(ServiceRegistration.class);
- EasyMock.expect(bc.registerService(EasyMock.eq(RemoteServiceAdmin.class.getName()),
+ EasyMock.expect(bc.registerService(EasyMock.eq(DistributionProvider.class.getName()),
EasyMock.anyObject(), (Dictionary<String, String>)EasyMock.anyObject()))
.andReturn(sr).atLeastOnce();
diff --git a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java b/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java
deleted file mode 100644
index f3cf46d..0000000
--- a/dsw/cxf-dsw/src/test/java/org/apache/cxf/dosgi/dsw/service/DistributionProviderImplTest.java
+++ /dev/null
@@ -1,124 +0,0 @@
-/**
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.cxf.dosgi.dsw.service;
-
-import junit.framework.TestCase;
-
-public class DistributionProviderImplTest extends TestCase {
-
- public void testDUMMY() {
- assertTrue(true);
- }
-
-// public void testExposedServices() {
-// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-// EasyMock.replay(bc);
-// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
-//
-// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
-// ServiceReference sr = new TestServiceReference();
-// ServiceReference sr2 = new TestServiceReference();
-//
-// dp.addExposedService(sr, null);
-// assertEquals(1, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
-// assertSame(sr, dp.getExposedServices().iterator().next());
-//
-// dp.addExposedService(sr, null);
-// assertEquals(1, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
-// assertSame(sr, dp.getExposedServices().iterator().next());
-//
-// dp.addExposedService(sr2, null);
-// assertEquals(2, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
-// }
-//
-// public void testRemoteServices() {
-// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-// EasyMock.replay(bc);
-// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
-//
-// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(0, dp.getRemoteServices().size());
-// ServiceReference sr = new TestServiceReference();
-// ServiceReference sr2 = new TestServiceReference();
-//
-// dp.addRemoteService(sr);
-// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(1, dp.getRemoteServices().size());
-// assertSame(sr, dp.getRemoteServices().iterator().next());
-//
-// dp.addRemoteService(sr);
-// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(1, dp.getRemoteServices().size());
-// assertSame(sr, dp.getRemoteServices().iterator().next());
-//
-// dp.addRemoteService(sr2);
-// assertEquals(0, dp.getExposedServices().size());
-// assertEquals(2, dp.getRemoteServices().size());
-// }
-//
-// public void testPublicationProperties() {
-// BundleContext bc = EasyMock.createNiceMock(BundleContext.class);
-// EasyMock.replay(bc);
-//
-// RemoteServiceAdminCore dp = new RemoteServiceAdminCore(bc);
-// ServiceReference sr = new TestServiceReference();
-// ServiceReference sr2 = new TestServiceReference();
-//
-// assertNull(dp.getExposedProperties(sr));
-//
-// dp.addExposedService(sr, null);
-// Map<String, String> pp = new HashMap<String, String>();
-// pp.put("a", "b");
-// dp.addExposedService(sr2, pp);
-//
-// assertEquals(0, dp.getExposedProperties(sr).size());
-// assertEquals(pp, dp.getExposedProperties(sr2));
-// }
-//
-// private static class TestServiceReference implements ServiceReference {
-
-// public Bundle getBundle() {
-// return null;
-// }
-//
-// public Object getProperty(String arg0) {
-// return null;
-// }
-//
-// public String[] getPropertyKeys() {
-// return null;
-// }
-//
-// public Bundle[] getUsingBundles() {
-// return null;
-// }
-//
-// public boolean isAssignableTo(Bundle arg0, String arg1) {
-// return false;
-// }
-//
-// public int compareTo(Object o) {
-// return 0;
-// }
-// }
-}
diff --git a/dsw/pom.xml b/dsw/pom.xml
index 121a7c3..becd4ea 100644
--- a/dsw/pom.xml
+++ b/dsw/pom.xml
@@ -41,5 +41,7 @@
<modules>
<module>cxf-dsw</module>
<module>cxf-topology-manager</module>
+ <module>cxf-dosgi-provider-api</module>
+ <module>cxf-dosgi-rsa</module>
</modules>
</project>