summaryrefslogtreecommitdiffstats
path: root/java/sca/modules/implementation-osgi-runtime/src/main/java/org
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-18 00:06:29 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-07-18 00:06:29 +0000
commit0271e8155a8afa2d31c6af759c13f9dfbb198751 (patch)
tree651d41fea56b50f09f5ae202569c4e6b1f47ac79 /java/sca/modules/implementation-osgi-runtime/src/main/java/org
parent57a1311b991c18e0b3a5b37c7cc9e45362a4776a (diff)
Change the name of OSGi remote service related properties
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@795280 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'java/sca/modules/implementation-osgi-runtime/src/main/java/org')
-rw-r--r--java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java65
1 files changed, 34 insertions, 31 deletions
diff --git a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
index 8f032efc47..be38b46f52 100644
--- a/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
+++ b/java/sca/modules/implementation-osgi-runtime/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java
@@ -19,6 +19,10 @@
package org.apache.tuscany.sca.implementation.osgi.runtime;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.REMOTE_CONFIG_SCA;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SCA_REFERENCE;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_IMPORTED;
+import static org.apache.tuscany.sca.implementation.osgi.OSGiProperty.SERVICE_IMPORTED_CONFIGS;
import static org.osgi.framework.Constants.SERVICE_RANKING;
import java.security.AccessController;
@@ -91,18 +95,17 @@ public class OSGiImplementationProvider implements ImplementationProvider {
JavaInterface javaInterface = (JavaInterface)interfaceContract.getInterface();
final Class<?> interfaceClass = javaInterface.getJavaClass();
-// final Hashtable<String, Object> props = new Hashtable<String, Object>();
-// props.put(FILTER_MATCH_CRITERIA, "");
-// Collection<String> interfaceNames = new ArrayList<String>();
-// props.put(INTERFACE_MATCH_CRITERIA, interfaceNames);
-// interfaceNames.add(interfaceClass.getName());
+ // final Hashtable<String, Object> props = new Hashtable<String, Object>();
+ // props.put(FILTER_MATCH_CRITERIA, "");
+ // Collection<String> interfaceNames = new ArrayList<String>();
+ // props.put(INTERFACE_MATCH_CRITERIA, interfaceNames);
+ // interfaceNames.add(interfaceClass.getName());
final Hashtable<String, Object> osgiProps = getOSGiProperties(reference);
osgiProps.put(SERVICE_RANKING, Integer.MAX_VALUE);
- osgiProps.put("sca.reference", component.getURI() + "#reference(" + ref.getName() + ")");
- osgiProps.put(OSGiProperty.OSGI_REMOTE, "true");
- osgiProps.put(OSGiProperty.OSGI_REMOTE_CONFIGURATION_TYPE, "sca");
- osgiProps.put(OSGiProperty.OSGI_REMOTE_INTERFACES, new String[] {interfaceClass.getName()});
+ osgiProps.put(SCA_REFERENCE, component.getURI() + "#reference(" + ref.getName() + ")");
+ osgiProps.put(SERVICE_IMPORTED, "true");
+ osgiProps.put(SERVICE_IMPORTED_CONFIGS, new String[] {REMOTE_CONFIG_SCA});
ProxyFactory proxyService = proxyFactoryExtensionPoint.getInterfaceProxyFactory();
if (!interfaceClass.isInterface()) {
@@ -119,8 +122,8 @@ public class OSGiImplementationProvider implements ImplementationProvider {
ServiceRegistration registration =
context.registerService(interfaceClass.getName(), proxy, osgiProps);
// Create a DiscoveredServiceTracker to track the status of the remote service
-// RemoteServiceTracker tracker = new RemoteServiceTracker(registration);
-// context.registerService(DiscoveredServiceTracker.class.getName(), tracker, props);
+ // RemoteServiceTracker tracker = new RemoteServiceTracker(registration);
+ // context.registerService(DiscoveredServiceTracker.class.getName(), tracker, props);
return registration;
}
});
@@ -163,12 +166,12 @@ public class OSGiImplementationProvider implements ImplementationProvider {
}
return props;
}
-
+
protected Object getOSGiService(ComponentService service) {
JavaInterface javaInterface = (JavaInterface)service.getInterfaceContract().getInterface();
// String filter = getOSGiFilter(provider.getOSGiProperties(service));
// FIXME: What is the filter?
- String filter = "(!(sca.reference=*))";
+ String filter = "(!(" + SERVICE_IMPORTED + "=*))";
// "(sca.service=" + component.getURI() + "#service-name\\(" + service.getName() + "\\))";
BundleContext bundleContext = osgiBundle.getBundleContext();
ServiceReference ref;
@@ -193,23 +196,23 @@ public class OSGiImplementationProvider implements ImplementationProvider {
return implementation;
}
-// private class RemoteServiceTracker implements DiscoveredServiceTracker {
-// private ServiceRegistration referenceRegistration;
-//
-// private RemoteServiceTracker(ServiceRegistration referenceRegistration) {
-// super();
-// this.referenceRegistration = referenceRegistration;
-// }
-//
-// public void serviceChanged(DiscoveredServiceNotification notification) {
-// ServiceEndpointDescription description = notification.getServiceEndpointDescription();
-// switch(notification.getType()) {
-// case UNAVAILABLE:
-// case AVAILABLE:
-// case MODIFIED:
-// case MODIFIED_ENDMATCH:
-// }
-// }
-// }
+ // private class RemoteServiceTracker implements DiscoveredServiceTracker {
+ // private ServiceRegistration referenceRegistration;
+ //
+ // private RemoteServiceTracker(ServiceRegistration referenceRegistration) {
+ // super();
+ // this.referenceRegistration = referenceRegistration;
+ // }
+ //
+ // public void serviceChanged(DiscoveredServiceNotification notification) {
+ // ServiceEndpointDescription description = notification.getServiceEndpointDescription();
+ // switch(notification.getType()) {
+ // case UNAVAILABLE:
+ // case AVAILABLE:
+ // case MODIFIED:
+ // case MODIFIED_ENDMATCH:
+ // }
+ // }
+ // }
}