Author: lresende
Date: Thu Sep 13 22:10:22 2007
New Revision: 575534

URL: http://svn.apache.org/viewvc?rev=575534&view=rev
Log:
Adding processors and factories to proper extension points and fixing up some 
test cases

Added:
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
Modified:
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.componentType
    
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.composite

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/DefaultBPELFactory.java
 Thu Sep 13 22:10:22 2007
@@ -20,6 +20,7 @@
 package org.apache.tuscany.sca.implementation.bpel;
 
 import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationImpl;
 import 
org.apache.tuscany.sca.implementation.bpel.impl.BPELProcessDefinitionImpl;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
@@ -34,10 +35,9 @@
     private AssemblyFactory assemblyFactory;
     private WSDLFactory wsdlFactory;
     
-    public DefaultBPELFactory(AssemblyFactory assemblyFactory,
-                                            WSDLFactory wsdlFactory) {
-        this.assemblyFactory = assemblyFactory;
-        this.wsdlFactory = wsdlFactory;
+    public DefaultBPELFactory(ModelFactoryExtensionPoint modelFactories) {
+        this.assemblyFactory = 
modelFactories.getFactory(AssemblyFactory.class);
+        this.wsdlFactory  = modelFactories.getFactory(WSDLFactory.class);
     }
 
     public BPELImplementation createBPELImplementation() {

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELDocumentProcessor.java
 Thu Sep 13 22:10:22 2007
@@ -31,6 +31,7 @@
 import javax.xml.stream.XMLStreamReader;
 
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
+import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
@@ -43,8 +44,9 @@
  * 
  * @version $Rev$ $Date$
  */
-public class BPELDocumentProcessor implements 
URLArtifactProcessor<BPELProcessDefinition> {
+public class BPELDocumentProcessor extends BaseStAXArtifactProcessor 
implements URLArtifactProcessor<BPELProcessDefinition> {
     public final static QName BPEL_PROCESS_DEFINITION = new 
QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/";, "process");
+    public final static String NAME_ELEMENT = "name";
     
     private final static XMLInputFactory inputFactory = 
XMLInputFactory.newInstance();
     
@@ -55,7 +57,7 @@
     }
     
     public String getArtifactType() {
-        return "*.wsdl";
+        return "*.bpel";
     }    
 
     public Class<BPELProcessDefinition> getModelType() {
@@ -73,7 +75,6 @@
 
     public void resolve(BPELProcessDefinition model, ModelResolver resolver) 
throws ContributionResolveException {
         // TODO Auto-generated method stub
-
     }
     
     /**
@@ -90,14 +91,17 @@
         processDefinition.setLocation(doc);
 
         InputStream is = doc.openStream();
+        XMLStreamReader reader = null;
         try {
-            XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
+            reader = inputFactory.createXMLStreamReader(is);
             int eventType = reader.getEventType();
             while (true) {
                 if (eventType == XMLStreamConstants.START_ELEMENT) {
                     QName elementName = reader.getName();
                     if (BPEL_PROCESS_DEFINITION.equals(elementName)) {
-                        processDefinition.setName(elementName);
+                        QName processName = new QName(getString(reader, 
org.apache.tuscany.sca.assembly.xml.Constants.TARGET_NAMESPACE), 
getString(reader, NAME_ELEMENT));
+                        processDefinition.setName(processName);
+                        break;
                     }
                 }
                 if (reader.hasNext()) {
@@ -106,10 +110,14 @@
                     break;
                 }
             }
-            return processDefinition;
         } finally {
+            if(reader != null) {
+                reader.close();
+            }
             is.close();
         }
+        
+        return processDefinition;
     }
     
 

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/java/org/apache/tuscany/sca/implementation/bpel/impl/BPELImplementationProcessor.java
 Thu Sep 13 22:10:22 2007
@@ -20,18 +20,11 @@
 
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 
-import java.io.ByteArrayOutputStream;
-import java.io.File;
-import java.io.IOException;
-import java.net.URL;
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
-import org.apache.ode.bpel.compiler.BpelC;
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.xml.Constants;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
@@ -39,10 +32,9 @@
 import org.apache.tuscany.sca.contribution.service.ContributionReadException;
 import 
org.apache.tuscany.sca.contribution.service.ContributionResolveException;
 import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
 import org.apache.tuscany.sca.implementation.bpel.BPELFactory;
+import org.apache.tuscany.sca.implementation.bpel.BPELImplementation;
 import org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory;
-import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 
 /**
  * Implements a STAX artifact processor for BPEL implementations.
@@ -60,9 +52,7 @@
     private BPELFactory bpelFactory;
     
     public BPELImplementationProcessor(ModelFactoryExtensionPoint 
modelFactories) {
-        AssemblyFactory assemblyFactory = 
modelFactories.getFactory(AssemblyFactory.class);
-        WSDLFactory wsdlFactory = modelFactories.getFactory(WSDLFactory.class);
-        this.bpelFactory = new DefaultBPELFactory(assemblyFactory, 
wsdlFactory);
+        this.bpelFactory = new DefaultBPELFactory(modelFactories);
     }
 
     public QName getArtifactType() {

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
 Thu Sep 13 22:10:22 2007
@@ -16,4 +16,5 @@
 # under the License. 
 
 # Implementation class for the artifact processor extension
-org.apache.tuscany.sca.implementation.bpel.impl.BPELArtifactProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
+org.apache.tuscany.sca.implementation.bpel.impl.BPELImplementationProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#implementation.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELImplementation
+org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;qname=http://schemas.xmlsoap.org/ws/2004/03/business-process#process,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition
\ No newline at end of file

Added: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor?rev=575534&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor
 Thu Sep 13 22:10:22 2007
@@ -0,0 +1,19 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License. 
+
+# Implementation class for the artifact processor extension
+org.apache.tuscany.sca.implementation.bpel.impl.BPELDocumentProcessor;type=.bpel,model=org.apache.tuscany.sca.implementation.bpel.BPELProcessDefinition
\ No newline at end of file

Added: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory?rev=575534&view=auto
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
 (added)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/main/resources/META-INF/services/org.apache.tuscany.sca.implementation.bpel.BPELFactory
 Thu Sep 13 22:10:22 2007
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+# 
+#   http://www.apache.org/licenses/LICENSE-2.0
+# 
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License. 
+
+org.apache.tuscany.sca.implementation.bpel.DefaultBPELFactory

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELDocumentProcessorTestCase.java
 Thu Sep 13 22:10:22 2007
@@ -26,7 +26,6 @@
 
 import junit.framework.TestCase;
 
-import org.apache.tuscany.sca.assembly.AssemblyFactory;
 import org.apache.tuscany.sca.assembly.DefaultAssemblyFactory;
 import org.apache.tuscany.sca.contribution.DefaultModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
@@ -47,9 +46,10 @@
         super.setUp();
        
         modelFactories = new DefaultModelFactoryExtensionPoint();
-        AssemblyFactory assemblyFactory = new DefaultAssemblyFactory();
-        modelFactories.addFactory(assemblyFactory);
-        BPELFactory bpelFactory = new DefaultBPELFactory(new 
DefaultAssemblyFactory(), new DefaultWSDLFactory());
+        modelFactories.addFactory(new DefaultAssemblyFactory());
+        modelFactories.addFactory(new DefaultWSDLFactory());
+        
+        BPELFactory bpelFactory = new DefaultBPELFactory(modelFactories);
         modelFactories.addFactory(bpelFactory);
     }
 
@@ -61,7 +61,7 @@
         BPELProcessDefinition bpelProcessDefinition = 
bpelDocumentProcessor.read(null, processURI, processLocation);
         
         assertNotNull(bpelProcessDefinition);
-        assertEquals(new 
QName("http://schemas.xmlsoap.org/ws/2004/03/business-process/";, "process"), 
bpelProcessDefinition.getName());
+        assertEquals(new 
QName("http://tuscany.apache.org/implementation/bpel/example/helloworld";, 
"HelloWorld"), bpelProcessDefinition.getName());
         assertEquals(processLocation, bpelProcessDefinition.getLocation());
         assertEquals(true, bpelProcessDefinition.isUnresolved());
     }

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/java/org/apache/tuscany/sca/implementation/bpel/BPELTestCase.java
 Thu Sep 13 22:10:22 2007
@@ -21,6 +21,7 @@
 
 import junit.framework.TestCase;
 
+import org.apache.tuscany.implementation.bpel.example.helloworld.HelloPortType;
 import org.apache.tuscany.sca.host.embedded.SCADomain;
 
 /**
@@ -30,7 +31,8 @@
  */
 public class BPELTestCase extends TestCase {
 
-    private SCADomain scaDomain;
+    //private SCADomain scaDomain;
+    //HelloPortType bpelService = null;
     
     /**
      * @throws java.lang.Exception
@@ -38,7 +40,7 @@
     @Override
     protected void setUp() throws Exception {
         //scaDomain = SCADomain.newInstance("helloworld.composite");
-        //bpelService = scaDomain.getService(BPEL.class, 
"BPELHelloWorldComponent");
+        //bpelService = scaDomain.getService(HelloPortType.class, 
"BPELHelloWorldComponent");
 
     }
 
@@ -50,7 +52,7 @@
         //scaDomain.close();
     }
     
-    public void testSomething() {
-        
+    public void testInvoke() {
+        //bpelService.hello("Luciano");
     }
 }

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.componentType
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.componentType?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.componentType
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.componentType
 Thu Sep 13 22:10:22 2007
@@ -22,7 +22,7 @@
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
        xmlns:xsd="http://www.w3.org/2001/XMLSchema";>
 
-  <service name="BPELHelloWorldService">
+  <service name="HelloService">
         <interface.wsdl 
interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsd#wsdl.interface(HelloPortType)"
 />
   </service>
 

Modified: 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.composite
URL: 
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.composite?rev=575534&r1=575533&r2=575534&view=diff
==============================================================================
--- 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.composite
 (original)
+++ 
incubator/tuscany/java/sca/modules/implementation-bpel/src/test/resources/helloworld.composite
 Thu Sep 13 22:10:22 2007
@@ -21,10 +21,6 @@
        targetNamespace="http://bpel";
     
xmlns:hns="http://tuscany.apache.org/implementation/bpel/example/helloworld";
     name="bpel">
-
-    <service name="BPELHelloWorldService" promote="BPELHelloWorldComponent">
-          <interface.wsdl 
interface="http://tuscany.apache.org/implementation/bpel/example/helloworld.wsd#wsdl.interface(HelloPortType)"
 />
-    </service>
     
     <component name="BPELHelloWorldComponent">
         <!-- implementation.bpel process="hns:HelloWorld" 
file="HelloWorld.bpel"/ -->



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to