diff options
author | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-12 17:02:22 +0000 |
---|---|---|
committer | rfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68> | 2009-03-12 17:02:22 +0000 |
commit | 2ea38322668f654bfea5e9fa498f919226c1cead (patch) | |
tree | f031ceb51f8b7ab5b47909adabd49536f08d422e | |
parent | 543123a87ba13d49f7880bdb89e2d33c9835ffa2 (diff) |
clean up the provider
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@752935 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
2 files changed, 11 insertions, 54 deletions
diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java index 47f1775e1f..c4788a8865 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProvider.java @@ -41,16 +41,12 @@ import org.apache.tuscany.sca.core.factory.ObjectCreationException; import org.apache.tuscany.sca.core.invocation.ProxyFactory; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; import org.apache.tuscany.sca.core.scope.Scope; -import org.apache.tuscany.sca.core.scope.ScopeRegistry; -import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; import org.apache.tuscany.sca.implementation.osgi.OSGiProperty; import org.apache.tuscany.sca.interfacedef.Interface; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; import org.apache.tuscany.sca.interfacedef.Operation; import org.apache.tuscany.sca.interfacedef.java.JavaInterface; import org.apache.tuscany.sca.invocation.Invoker; -import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.runtime.EndpointReference; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -93,7 +89,6 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame private boolean wiresResolved; private AtomicInteger startBundleEntryCount = new AtomicInteger(); - private AtomicInteger processAnnotationsEntryCount = new AtomicInteger(); private Hashtable<String, Object> componentProperties = new Hashtable<String, Object>(); private RuntimeComponent runtimeComponent; @@ -103,30 +98,17 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame private OSGiServiceListener osgiServiceListener; private PackageAdmin packageAdmin; - private ScopeRegistry scopeRegistry; - private DataBindingExtensionPoint dataBindingRegistry; private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint; private boolean packagesRefreshed; - private MessageFactory messageFactory; - private InterfaceContractMapper mapper; - public OSGiImplementationProvider(RuntimeComponent component, OSGiImplementation impl, - DataBindingExtensionPoint dataBindingRegistry, - ScopeRegistry scopeRegistry, - MessageFactory messageFactory, - ProxyFactoryExtensionPoint proxyFactoryExtensionPoint, - InterfaceContractMapper mapper) throws BundleException { + ProxyFactoryExtensionPoint proxyFactoryExtensionPoint) throws BundleException { this.implementation = impl; this.runtimeComponent = component; - this.dataBindingRegistry = dataBindingRegistry; - this.scopeRegistry = scopeRegistry; - this.messageFactory = messageFactory; this.proxyFactoryExtensionPoint = proxyFactoryExtensionPoint; - this.mapper = mapper; BundleContext bundleContext = OSGiImplementationActivator.getBundleContext(); osgiBundle = (Bundle)implementation.getBundle(); @@ -183,7 +165,7 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame * service listener, we use this method to filter all service references so that * the service matching functionality of OSGi can be directly used. */ - private org.osgi.framework.ServiceReference getOSGiServiceReference(String scaServiceName, + private ServiceReference getOSGiServiceReference(String scaServiceName, String osgiServiceName, String filter) throws InvalidSyntaxException { @@ -192,9 +174,9 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame org.osgi.framework.ServiceReference[] references = osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, filter); - org.osgi.framework.ServiceReference reference = null; + ServiceReference reference = null; if (references != null) { - for (org.osgi.framework.ServiceReference ref : references) { + for (ServiceReference ref : references) { if (ref.getBundle() != osgiBundle) continue; Object compName = ref.getProperty(COMPONENT_SERVICE_NAME); @@ -213,11 +195,11 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame filter = scaServiceName == null ? null : "(" + COMPONENT_SERVICE_NAME + "=" + compServiceName + ")"; - org.osgi.framework.ServiceReference[] references = + ServiceReference[] references = osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, filter); if (references != null) { - for (org.osgi.framework.ServiceReference ref : references) { + for (ServiceReference ref : references) { if (ref.getBundle() == osgiBundle) { return ref; } @@ -226,10 +208,10 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame references = osgiBundle.getBundleContext().getServiceReferences(osgiServiceName, null); - org.osgi.framework.ServiceReference reference = null; + ServiceReference reference = null; if (references != null) { - for (org.osgi.framework.ServiceReference ref : references) { + for (ServiceReference ref : references) { if (ref.getBundle() != osgiBundle) continue; @@ -687,7 +669,7 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame if (componentProperties.size() == 0) return; - org.osgi.framework.ServiceReference configAdminReference = + ServiceReference configAdminReference = osgiBundle.getBundleContext().getServiceReference("org.osgi.service.cm.ConfigurationAdmin"); if (configAdminReference != null) { @@ -850,7 +832,7 @@ public class OSGiImplementationProvider implements ImplementationProvider, Frame public void serviceChanged(org.osgi.framework.ServiceEvent event) { - org.osgi.framework.ServiceReference reference = event.getServiceReference(); + ServiceReference reference = event.getServiceReference(); if (event.getType() == ServiceEvent.REGISTERED && reference.getBundle() == bundle) { diff --git a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java index 408b864252..0e4a3ef995 100644 --- a/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java +++ b/java/sca/modules/implementation-osgi/src/main/java/org/apache/tuscany/sca/implementation/osgi/runtime/OSGiImplementationProviderFactory.java @@ -19,14 +19,8 @@ package org.apache.tuscany.sca.implementation.osgi.runtime; import org.apache.tuscany.sca.core.ExtensionPointRegistry; -import org.apache.tuscany.sca.core.FactoryExtensionPoint; -import org.apache.tuscany.sca.core.UtilityExtensionPoint; import org.apache.tuscany.sca.core.invocation.ProxyFactoryExtensionPoint; -import org.apache.tuscany.sca.core.scope.ScopeRegistry; -import org.apache.tuscany.sca.databinding.DataBindingExtensionPoint; import org.apache.tuscany.sca.implementation.osgi.OSGiImplementation; -import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper; -import org.apache.tuscany.sca.invocation.MessageFactory; import org.apache.tuscany.sca.provider.ImplementationProvider; import org.apache.tuscany.sca.provider.ImplementationProviderFactory; import org.apache.tuscany.sca.runtime.RuntimeComponent; @@ -40,27 +34,9 @@ import org.osgi.framework.BundleException; public class OSGiImplementationProviderFactory implements ImplementationProviderFactory<OSGiImplementation> { private ProxyFactoryExtensionPoint proxyFactoryExtensionPoint; - private DataBindingExtensionPoint dataBindings; - private ScopeRegistry scopeRegistry; - private MessageFactory messageFactory; - private InterfaceContractMapper mapper; public OSGiImplementationProviderFactory(ExtensionPointRegistry extensionPoints) { - - dataBindings = extensionPoints.getExtensionPoint(DataBindingExtensionPoint.class); - - // FIXME: Scope registry is not an extension point, and this usage is specific - // to implementation.osgi since it needs to change scope after the component is - // created. Do we need to find a better way? - scopeRegistry = extensionPoints.getExtensionPoint(ScopeRegistry.class); - proxyFactoryExtensionPoint = extensionPoints.getExtensionPoint(ProxyFactoryExtensionPoint.class); - - FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class); - messageFactory = modelFactories.getFactory(MessageFactory.class); - - UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class); - mapper = utilities.getUtility(InterfaceContractMapper.class); } public ImplementationProvider createImplementationProvider(RuntimeComponent component, @@ -68,8 +44,7 @@ public class OSGiImplementationProviderFactory implements ImplementationProvider try { - return new OSGiImplementationProvider(component, implementation, dataBindings, scopeRegistry, - messageFactory, proxyFactoryExtensionPoint, mapper); + return new OSGiImplementationProvider(component, implementation, proxyFactoryExtensionPoint); } catch (BundleException e) { throw new RuntimeException(e); |