You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rf...@apache.org on 2007/04/13 22:27:48 UTC
svn commit: r528646 - in
/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany:
api/SCARuntime.java host/embedded/DefaultSCARuntime.java
host/embedded/SimpleRuntime.java host/embedded/SimpleRuntimeImpl.java
Author: rfeng
Date: Fri Apr 13 13:27:47 2007
New Revision: 528646
URL: http://svn.apache.org/viewvc?view=rev&rev=528646
Log:
Add support to get extension point for SCARuntime
Modified:
incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java
incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java
incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntime.java
incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java?view=diff&rev=528646&r1=528645&r2=528646
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/api/SCARuntime.java Fri Apr 13 13:27:47 2007
@@ -199,12 +199,12 @@
}
/**
- * Get access to a system service
+ * Get access to an extension point
*
- * @param serviceName
- * @return
+ * @param extensionPointType The interface for the extension point
+ * @return The instance of the extension point
*/
- protected abstract Object getSystemService(String serviceName);
+ protected abstract <T> T getExtensionPoint(Class<T> extensionPointType);
/**
* Stop the SCA Runtime
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java?view=diff&rev=528646&r1=528645&r2=528646
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/DefaultSCARuntime.java Fri Apr 13 13:27:47 2007
@@ -64,9 +64,9 @@
}
@Override
- public Object getSystemService(String serviceName) {
+ public <T> T getExtensionPoint(Class<T> extensionPointType) {
try {
- return runtime.getSystemService(Object.class, serviceName);
+ return runtime.getExtensionPoint(extensionPointType);
} catch (TargetResolutionException e) {
throw new ServiceUnavailableException(e);
}
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntime.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntime.java?view=diff&rev=528646&r1=528645&r2=528646
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntime.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntime.java Fri Apr 13 13:27:47 2007
@@ -37,12 +37,12 @@
Component start() throws Exception;
/**
- * Look up system services by name
+ * Look up an extension point by type
* @param <T>
* @param type
* @param name
* @return
* @throws TargetResolutionException
*/
- <T> T getSystemService(Class<T> type, String name) throws TargetResolutionException;
+ <T> T getExtensionPoint(Class<T> type) throws TargetResolutionException;
}
Modified: incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java?view=diff&rev=528646&r1=528645&r2=528646
==============================================================================
--- incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java (original)
+++ incubator/tuscany/java/sca/modules/host-embedded/src/main/java/org/apache/tuscany/host/embedded/SimpleRuntimeImpl.java Fri Apr 13 13:27:47 2007
@@ -141,8 +141,8 @@
DefaultArtifactResolver artifactResolver = new DefaultArtifactResolver();
- ContributionService contributionService =
- new ContributionServiceImpl(repository, pkgRegistry, documentExtensionPoint, artifactResolver);
+ ContributionService contributionService = new ContributionServiceImpl(repository, pkgRegistry,
+ documentExtensionPoint, artifactResolver);
extensionRegistry.addExtensionPoint(ContributionService.class, contributionService);
initialize(extensionRegistry, contributionService);
@@ -169,23 +169,18 @@
workContext.setIdentifier(Scope.COMPOSITE, DEFAULT_COMPOSITE);
PojoWorkContextTunnel.setThreadWorkContext(workContext);
tuscanySystem = getComponentManager().getComponent(URI.create("/" + composite.getName().getLocalPart()));
-
- // Temporary here to help the bring up of samples and integration tests that still
+
+ // Temporary here to help the bring up of samples and integration tests
+ // that still
// use the 0.95 API
CompositeContext context = new SimpleCompositeContextImpl(this, composite);
CurrentCompositeContext.setContext(context);
-
+
return tuscanySystem;
}
- @SuppressWarnings("deprecation")
- public <T> T getSystemService(Class<T> type, String name) throws TargetResolutionException {
- SCAObject child = getComponentManager().getComponent(URI.create(name));
- if (child == null) {
- return null;
- }
- AtomicComponent service = (AtomicComponent)child;
- return type.cast(service.getTargetInstance());
+ public <T> T getExtensionPoint(Class<T> type) throws TargetResolutionException {
+ return extensionRegistry.getExtensionPoint(type);
}
@Override
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org