tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lrese...@apache.org
Subject svn commit: r665979 - in /incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl: WSDLFactoryImpl.java WSDLInterfaceIntrospectorImpl.java
Date Tue, 10 Jun 2008 04:47:52 GMT
Author: lresende
Date: Mon Jun  9 21:47:51 2008
New Revision: 665979

URL: http://svn.apache.org/viewvc?rev=665979&view=rev
Log:
Adding support for wsdl policy annotations

Modified:
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
    incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java?rev=665979&r1=665978&r2=665979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLFactoryImpl.java
Mon Jun  9 21:47:51 2008
@@ -27,8 +27,6 @@
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLFactory;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterfaceContract;
-import org.apache.tuscany.sca.xsd.XSDefinition;
-import org.apache.tuscany.sca.xsd.XSDFactory;
 
 /**
  * A factory for the WSDL model.
@@ -40,8 +38,7 @@
     private WSDLInterfaceIntrospectorImpl introspector;
     
     public WSDLFactoryImpl(ModelFactoryExtensionPoint modelFactories) {
-        XSDFactory factory = modelFactories.getFactory(XSDFactory.class);
-        introspector = new WSDLInterfaceIntrospectorImpl(factory);
+        introspector = new WSDLInterfaceIntrospectorImpl(modelFactories);
     }
 
     public WSDLInterface createWSDLInterface() {

Modified: incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java?rev=665979&r1=665978&r2=665979&view=diff
==============================================================================
--- incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
(original)
+++ incubator/tuscany/java/sca/modules/interface-wsdl/src/main/java/org/apache/tuscany/sca/interfacedef/wsdl/impl/WSDLInterfaceIntrospectorImpl.java
Mon Jun  9 21:47:51 2008
@@ -20,16 +20,20 @@
 package org.apache.tuscany.sca.interfacedef.wsdl.impl;
 
 import java.util.ArrayList;
+import java.util.Enumeration;
 import java.util.List;
 import java.util.Vector;
 
 import javax.wsdl.PortType;
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
 import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
 import org.apache.tuscany.sca.interfacedef.Operation;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLDefinition;
 import org.apache.tuscany.sca.interfacedef.wsdl.WSDLInterface;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.PolicyFactory;
 import org.apache.tuscany.sca.xsd.XSDFactory;
 
 /**
@@ -42,9 +46,11 @@
     private static final QName POLICY_CONVERSATIONAL = new QName("http://www.osoa.org/xmlns/sca/1.0",
"conversational");
     
     private XSDFactory xsdFactory;
+    private PolicyFactory policyFactory;
     
-    public WSDLInterfaceIntrospectorImpl(XSDFactory xsdFactory) {
-        this.xsdFactory = xsdFactory;
+    public WSDLInterfaceIntrospectorImpl(ModelFactoryExtensionPoint modelFactories) {
+        this.xsdFactory = modelFactories.getFactory(XSDFactory.class);;
+        this.policyFactory = modelFactories.getFactory(PolicyFactory.class);;
     }
 
     // FIXME: Do we want to deal with document-literal wrapped style based on the JAX-WS
Specification?
@@ -58,6 +64,7 @@
     }
 
     public void introspectPortType(WSDLInterface wsdlInterface, PortType portType, WSDLDefinition
wsdlDefinition, ModelResolver resolver) throws InvalidWSDLException {
+        processIntents(wsdlInterface, portType);
         wsdlInterface.setPortType(portType);
         wsdlInterface.getOperations().addAll(introspectOperations(portType, wsdlDefinition,
resolver));
         wsdlInterface.setConversational(isConversational(portType));
@@ -71,6 +78,32 @@
         return op.getOperation();
     }
     
+    private void processIntents(WSDLInterface wsdlInterface, PortType portType) {
+        Object o =  portType.getExtensionAttribute(POLICY_REQUIRES);
+        if(o != null && o instanceof Vector) {
+            Vector<QName> policyAttributes = (Vector<QName>) o;
+            
+            Enumeration<QName> policyItents = policyAttributes.elements();
+            while(policyItents.hasMoreElements()) {
+                QName intentName = policyItents.nextElement();
+                
+                //ignores conversational, as it will have it's own
+                //attribute in the wsdl interface model
+                if(! intentName.equals(POLICY_CONVERSATIONAL)) {
+                    //process the intent
+                    System.out.println(">>> Intent : " + intentName);
+                    
+                    // Add each intent to the list
+                    Intent intent = policyFactory.createIntent();
+                    intent.setName(intentName);
+                    
+                    wsdlInterface.getRequiredIntents().add(intent);
+                }
+            }
+            
+        }
+    }
+    
     private boolean isConversational(PortType portType) {
         boolean conversational = false;
         



Mime
View raw message