You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by jb...@apache.org on 2007/02/02 17:55:17 UTC

svn commit: r502653 - in /incubator/tuscany/java/spec/sca-api-r1.0/src: main/java/org/osoa/sca/ test/java/sample/client/

Author: jboynes
Date: Fri Feb  2 08:55:17 2007
New Revision: 502653

URL: http://svn.apache.org/viewvc?view=rev&rev=502653
Log:
rename AbstractReference to CallableReference
remove CallbackReference, moving methods to superclass
refactor ComponentContext#cast to return CallableReference

Added:
    incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java   (contents, props changed)
      - copied, changed from r502452, incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/AbstractReference.java
Removed:
    incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/AbstractReference.java
    incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallbackReference.java
Modified:
    incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
    incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java
    incubator/tuscany/java/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java

Copied: incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java (from r502452, incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/AbstractReference.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java?view=diff&rev=502653&p1=incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/AbstractReference.java&r1=502452&p2=incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java&r2=502653
==============================================================================
--- incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/AbstractReference.java (original)
+++ incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java Fri Feb  2 08:55:17 2007
@@ -5,7 +5,16 @@
  * 
  * @version $Rev$ $Date$
  */
-public interface AbstractReference<B> {
+public interface CallableReference<B> {
+    /**
+     * Returns a type-safe reference to the target of this reference.
+     * The instance returned is guaranteed to implement the business interface for this reference
+     * but may not be a proxy as defined by java.lang.reflect.Proxy.
+     *
+     * @return a proxy to the target that implements the business interface associated with this reference
+     */
+    B getService();
+
     /**
      * Returns the Java class for the business interface associated with this reference.
      *

Propchange: incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/CallableReference.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java?view=diff&rev=502653&r1=502652&r2=502653
==============================================================================
--- incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java (original)
+++ incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ComponentContext.java Fri Feb  2 08:55:17 2007
@@ -12,14 +12,14 @@
     String getURI();
 
     /**
-     * Cast a type-safe reference to a ServiceReference.
-     * Converts a type-safe reference returned by locateService to an equivalent ServiceReference.
+     * Cast a type-safe reference to a CallableReference.
+     * Converts a type-safe reference to an equivalent CallableReference.
      *
      * @param target a reference proxy provided by the SCA runtime
-     * @return a ServiceReference equivalent for the proxy
+     * @return a CallableReference equivalent for the proxy
      * @throws IllegalArgumentException if the supplied instance is not a reference supplied by the SCA runtime
      */
-    <B> ServiceReference<B> cast(B target) throws IllegalArgumentException;
+    <B, R extends CallableReference<B>> R cast(B target) throws IllegalArgumentException;
 
     /**
      * Returns a proxy for a reference defined by this component.
@@ -37,7 +37,7 @@
      * @param referenceName the name of the reference
      * @return a ServiceReference for the designated reference
      */
-    <B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
+    <B> ServiceReference<B> getCallableReference(Class<B> businessInterface, String referenceName);
 
     /**
      * Returns the value of an SCA property defined by this component.

Modified: incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java?view=diff&rev=502653&r1=502652&r2=502653
==============================================================================
--- incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java (original)
+++ incubator/tuscany/java/spec/sca-api-r1.0/src/main/java/org/osoa/sca/ServiceReference.java Fri Feb  2 08:55:17 2007
@@ -24,16 +24,7 @@
  *
  * @version $Rev$ $Date$
  */
-public interface ServiceReference<B> extends AbstractReference<B> {
-    /**
-     * Returns a type-safe reference to the target of this reference.
-     * The instance returned is guaranteed to implement the business interface for this reference
-     * but may not be a proxy as defined by java.lang.reflect.Proxy.
-     *
-     * @return a proxy to the target that implements the business interface associated with this reference
-     */
-    B getService();
-
+public interface ServiceReference<B> extends CallableReference<B> {
     /**
      * Returns the id supplied by the user that will be associated with conversations initiated through this reference.
      *

Modified: incubator/tuscany/java/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java?view=diff&rev=502653&r1=502652&r2=502653
==============================================================================
--- incubator/tuscany/java/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java (original)
+++ incubator/tuscany/java/spec/sca-api-r1.0/src/test/java/sample/client/BasicClient.java Fri Feb  2 08:55:17 2007
@@ -2,7 +2,9 @@
 
 import org.osoa.sca.ComponentContext;
 import org.osoa.sca.ServiceReference;
+import org.osoa.sca.CallableReference;
 import sample.HelloService;
+import sample.HelloCallback;
 
 /**
  * @version $Rev$ $Date$
@@ -16,7 +18,7 @@
     }
 
     public void useComponentViaReference() {
-        ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloService");
+        ServiceReference<HelloService> ref = context.getCallableReference(HelloService.class, "helloService");
         HelloService helloService = ref.getService();
         helloService.hello("World");
 
@@ -29,10 +31,15 @@
     }
 
     public void useReferenceViaReference() {
-        ServiceReference<HelloService> ref = context.getServiceReference(HelloService.class, "helloReference");
+        ServiceReference<HelloService> ref = context.getCallableReference(HelloService.class, "helloReference");
         HelloService helloService = ref.getService();
         helloService.hello("World");
 
         ServiceReference<HelloService> ref2 = context.cast(helloService);
+    }
+
+    public void castCallback() {
+        HelloCallback callback = null;
+        CallableReference<HelloCallback> cb = context.cast(callback);
     }
 }



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org