tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r551321 - in /incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2: extension/CRUDImplementation.java helper/
Date Wed, 27 Jun 2007 20:57:02 GMT
Author: jsdelfino
Date: Wed Jun 27 13:57:01 2007
New Revision: 551321

URL: http://svn.apache.org/viewvc?view=rev&rev=551321
Log:
Minor clean up, moved the creation of the default service to the CRUDImplementation constructor
and added more comments.

Removed:
    incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/helper/
Modified:
    incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java

Modified: incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java?view=diff&rev=551321&r1=551320&r2=551321
==============================================================================
--- incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
(original)
+++ incubator/tuscany/java/sca/samples/implementation-crud2-extension/src/main/java/crud2/extension/CRUDImplementation.java
Wed Jun 27 13:57:01 2007
@@ -21,16 +21,25 @@
 import java.util.Collections;
 import java.util.List;
 
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.apache.tuscany.sca.assembly.Property;
 import org.apache.tuscany.sca.assembly.Reference;
 import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.DefaultJavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.apache.tuscany.sca.interfacedef.java.introspect.DefaultJavaInterfaceIntrospectorExtensionPoint;
+import org.apache.tuscany.sca.interfacedef.java.introspect.ExtensibleJavaInterfaceIntrospector;
+import org.apache.tuscany.sca.interfacedef.java.introspect.JavaInterfaceIntrospector;
 import org.apache.tuscany.sca.policy.Intent;
 import org.apache.tuscany.sca.policy.PolicySet;
 
 import crud2.CRUD;
-import crud2.helper.TemporaryExtensionHelper;
 
 
 /**
@@ -47,8 +56,29 @@
     public CRUDImplementation() {
 
         // CRUD implementation always provide a single service exposing
-        // the CRUD interface, and have no references and properties
-        crudService = TemporaryExtensionHelper.createJavaService("CRUD", CRUD.class);
+        // the CRUD Java interface, create the model representing that
+        // fixed service here
+        
+        // Create a default service named CRUD
+        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
+        crudService = assemblyFactory.createService();
+        crudService.setName("CRUD");
+        
+        // Create a Java interface model for the CRUD Java interface
+        JavaInterfaceFactory javaFactory = new DefaultJavaInterfaceFactory();
+        JavaInterface javaInterface;
+        try {
+            JavaInterfaceIntrospector javaIntrospector = new ExtensibleJavaInterfaceIntrospector(javaFactory,
new DefaultJavaInterfaceIntrospectorExtensionPoint());
+            javaInterface = javaIntrospector.introspect(CRUD.class);
+        } catch (InvalidInterfaceException e) {
+            throw new IllegalArgumentException(e);
+        }
+        
+        // Create a Java interface contract model and set it
+        // into the service
+        JavaInterfaceContract interfaceContract = javaFactory.createJavaInterfaceContract();
+        interfaceContract.setInterface(javaInterface);
+        crudService.setInterfaceContract(interfaceContract);
     }
 
     public String getDirectory() {



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


Mime
View raw message