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/02/13 22:46:54 UTC
svn commit: r507245 - in /incubator/tuscany/branches/sca-java-integration:
sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/
spec/sca-api-r1.0/src/main/java/org/osoa/sca/
spec/sca-api-r1.0/src/test/java/sample/client/
Author: rfeng
Date: Tue Feb 13 13:46:52 2007
New Revision: 507245
URL: http://svn.apache.org/viewvc?view=rev&rev=507245
Log:
[sca-integration-branch] Merge the SCA 1.0 spec APIs from trunk into this branch
Removed:
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ReferenceFactory.java
Modified:
incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java
incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java
Modified: incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java (original)
+++ incubator/tuscany/branches/sca-java-integration/sca/kernel/core/src/main/java/org/apache/tuscany/core/implementation/composite/ManagedRequestContext.java Tue Feb 13 13:46:52 2007
@@ -22,6 +22,7 @@
import org.osoa.sca.RequestContext;
import org.osoa.sca.ServiceReference;
+import org.osoa.sca.CallableReference;
import org.apache.tuscany.spi.component.WorkContext;
@@ -43,7 +44,15 @@
return workContext.getCurrentServiceName();
}
- public ServiceReference getServiceReference() {
+ public <B> ServiceReference<B> getServiceReference() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CB getCallback() {
+ throw new UnsupportedOperationException();
+ }
+
+ public <CB> CallableReference<CB> getCallbackReference() {
throw new UnsupportedOperationException();
}
}
Modified: incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java (original)
+++ incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java Tue Feb 13 13:46:52 2007
@@ -4,6 +4,7 @@
* Common superclass for references that can be passed between components.
*
* @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
*/
public interface CallableReference<B> {
/**
Modified: incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java (original)
+++ incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java Tue Feb 13 13:46:52 2007
@@ -13,9 +13,13 @@
/**
* Cast a type-safe reference to a CallableReference.
- * Converts a type-safe reference to an equivalent CallableReference.
+ * Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service
+ * then a ServiceReference will be returned, if the target refers to a callback then a CallableReference
+ * will be returned.
*
* @param target a reference proxy provided by the SCA runtime
+ * @param <B> the Java type of the business interface for the reference
+ * @param <R> the type of reference to be returned
* @return a CallableReference equivalent for the proxy
* @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime
*/
@@ -26,6 +30,7 @@
*
* @param businessInterface the interface that will be used to invoke the service
* @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
* @return an object that implements the business interface
*/
<B> B getService(Class<B> businessInterface, String referenceName);
@@ -35,6 +40,7 @@
*
* @param businessInterface the interface that will be used to invoke the service
* @param referenceName the name of the reference
+ * @param <B> the Java type of the business interface for the reference
* @return a ServiceReference for the designated reference
*/
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
@@ -44,6 +50,7 @@
*
* @param type the Java type to be returned for the property
* @param propertyName the name of the property whose value should be returned
+ * @param <B> the Java type of the property
* @return the property value
*/
<B> B getProperty(Class<B> type, String propertyName);
@@ -52,6 +59,7 @@
* Returns a ServiceReference that can be used to invoke this component over the default service.
*
* @param businessInterface the interface that will be used to invoke the service
+ * @param <B> the Java type of the business interface for the reference
* @return a ServiceReference that will invoke this component
*/
<B> ServiceReference<B> createSelfReference(Class<B> businessInterface);
@@ -61,6 +69,7 @@
*
* @param businessInterface the interface that will be used to invoke the service
* @param serviceName the name of the service to invoke
+ * @param <B> the Java type of the business interface for the reference
* @return a ServiceReference that will invoke this component
*/
<B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName);
Modified: incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java (original)
+++ incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/RequestContext.java Tue Feb 13 13:46:52 2007
@@ -41,9 +41,23 @@
String getServiceName();
/**
- * Returns a CallableReference to the service or callback that was invoked.
+ * Returns a ServiceReference for the service that was invoked by the caller.
*
- * @return a CallableReference to the service or callback that was invoked
+ * @return a ServiceReference for the service that was invoked by the caller
*/
- <B, R extends CallableReference<B>> R getServiceReference();
+ <B> ServiceReference<B> getServiceReference();
+
+ /**
+ * Returns a type-safe reference to the callback provided by the caller.
+ *
+ * @return a type-safe reference to the callback provided by the caller
+ */
+ <CB> CB getCallback();
+
+ /**
+ * Returns a CallbackReference to the callback provided by the caller.
+ *
+ * @return a CallbackReference to the callback provided by the caller
+ */
+ <CB> CallableReference<CB> getCallbackReference();
}
Modified: incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java (original)
+++ incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java Tue Feb 13 13:46:52 2007
@@ -23,6 +23,7 @@
* A ServiceReference represents a client's perspective of a reference to another service.
*
* @version $Rev$ $Date$
+ * @param <B> the Java interface associated with this reference
*/
public interface ServiceReference<B> extends CallableReference<B> {
/**
Modified: incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java?view=diff&rev=507245&r1=507244&r2=507245
==============================================================================
--- incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java (original)
+++ incubator/tuscany/branches/sca-java-integration/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java Tue Feb 13 13:46:52 2007
@@ -3,6 +3,7 @@
import org.osoa.sca.ComponentContext;
import org.osoa.sca.ServiceReference;
import org.osoa.sca.CallableReference;
+import org.osoa.sca.RequestContext;
import sample.HelloService;
import sample.HelloCallback;
@@ -11,6 +12,7 @@
*/
public class BasicClient {
private ComponentContext context;
+ private RequestContext request;
public void useComponentDirectly() {
HelloService helloService = context.getService(HelloService.class, "helloService");
@@ -41,5 +43,11 @@
public void castCallback() {
HelloCallback callback = null;
CallableReference<HelloCallback> cb = context.cast(callback);
+ }
+
+ public void getCallback() {
+ ServiceReference<HelloService> sr = request.getServiceReference();
+ CallableReference<HelloCallback> cb = request.getCallbackReference();
+ HelloCallback callback = request.getCallback();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org