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/01/31 18:50:43 UTC
svn commit: r501923 - in /incubator/tuscany/sandbox/jboynes/sca-client/src:
main/java/org/osoa/sca/ test/java/org/osoa/sca/ test/java/sample/client/
Author: jboynes
Date: Wed Jan 31 09:50:40 2007
New Revision: 501923
URL: http://svn.apache.org/viewvc?view=rev&rev=501923
Log:
remove SCADomain and DomainFactory as mechanism is implementation-defined
add javadoc
Removed:
incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/DomainFactory.java
incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/DomainFactoryException.java
incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/SCADomain.java
incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/org/osoa/sca/DelegatingDomainFactory.java
Modified:
incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/ComponentContext.java
incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java
Modified: incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/ComponentContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/ComponentContext.java?view=diff&rev=501923&r1=501922&r2=501923
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/ComponentContext.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/main/java/org/osoa/sca/ComponentContext.java Wed Jan 31 09:50:40 2007
@@ -40,6 +40,15 @@
<B> ServiceReference<B> getServiceReference(Class<B> businessInterface, String referenceName);
/**
+ * Returns the value of an SCA property defined by this component.
+ *
+ * @param type the Java type to be returned for the property
+ * @param propertyName the name of the property whose value should be returned
+ * @return the property value
+ */
+ <B> B getProperty(Class<B> type, String propertyName);
+
+ /**
* 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
@@ -56,7 +65,11 @@
*/
<B> ServiceReference<B> createSelfReference(Class<B> businessInterface, String serviceName);
- <B> B getProperty(Class<B> type, String propertyName);
-
+ /**
+ * Returns the context for the current SCA service request, or null if there is no current request
+ * or if the context is unavailable.
+ *
+ * @return the SCA request context; may be null
+ */
RequestContext getRequestContext();
}
Modified: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java?view=diff&rev=501923&r1=501922&r2=501923
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/BasicClient.java Wed Jan 31 09:50:40 2007
@@ -1,10 +1,6 @@
package sample.client;
-import java.net.URI;
-
import org.osoa.sca.ComponentContext;
-import org.osoa.sca.DomainFactory;
-import org.osoa.sca.SCADomain;
import org.osoa.sca.ServiceReference;
import sample.HelloService;
@@ -12,9 +8,7 @@
* @version $Rev$ $Date$
*/
public class BasicClient {
- private static final URI DOMAIN_URI = URI.create("http://sca.example.com/Domain");
-
- private static ComponentContext context;
+ private ComponentContext context;
public void useComponentDirectly() {
HelloService helloService = context.getService(HelloService.class, "helloService");
@@ -27,7 +21,6 @@
helloService.hello("World");
ServiceReference<HelloService> ref2 = context.cast(helloService);
- assert ref == ref2;
}
public void useReferenceDirectly() {
@@ -41,12 +34,5 @@
helloService.hello("World");
ServiceReference<HelloService> ref2 = context.cast(helloService);
- assert ref == ref2;
- }
-
- public static void main(String[] args) {
- SCADomain domain = DomainFactory.getInstance().connect(DOMAIN_URI);
- context = domain.getContext(URI.create("path/to/unmanaged/component"));
- // call methods
}
}
Modified: incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java?view=diff&rev=501923&r1=501922&r2=501923
==============================================================================
--- incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java (original)
+++ incubator/tuscany/sandbox/jboynes/sca-client/src/test/java/sample/client/ReallyBasicClient.java Wed Jan 31 09:50:40 2007
@@ -1,18 +1,12 @@
package sample.client;
-import java.net.URI;
-
import org.osoa.sca.ComponentContext;
-import org.osoa.sca.DomainFactory;
-import org.osoa.sca.SCADomain;
import sample.HelloService;
/**
* @version $Rev$ $Date$
*/
public class ReallyBasicClient {
- private static final URI DOMAIN_URI = URI.create("http://example.com/sca");
-
/**
* <composite name="impl2">
* <component name="comp2a">
@@ -26,14 +20,15 @@
* </composite>
*/
public static void main(String[] args) {
- // connect to the domain
- SCADomain domain = DomainFactory.getInstance().connect(DOMAIN_URI);
-
- // retreive the context for the unmanaged component
- ComponentContext context = domain.getContext(URI.create("comp2/comp2A"));
+ ComponentContext context = getComponentContext();
// access a service through its reference
HelloService helloService = context.getService(HelloService.class, "helloService");
helloService.hello("World");
+ }
+
+ public static ComponentContext getComponentContext() {
+ // implementation defined mechanism to retrieve appropriate ComponentContext
+ throw new UnsupportedOperationException();
}
}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org