summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-01 16:45:57 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-12-01 16:45:57 +0000
commit959ac6c9a2ce735b02a2f9fb75234326423695ad (patch)
tree2a5bbfb8d868fc770f00916d5f51b3db514f8ccf /sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src
parentb69be18919d5d912b5ff3f518c3807a954aad9e9 (diff)
Add a mechanism for specifying default intents on policy subjects. This is a rewrite of the previous attempt after Greg pointed out a build order issue on the mail list.
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1209146 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src')
-rw-r--r--sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WebServiceBindingBuilder.java56
1 files changed, 55 insertions, 1 deletions
diff --git a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WebServiceBindingBuilder.java b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WebServiceBindingBuilder.java
index 08f8ce7cf4..211e7647d9 100644
--- a/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WebServiceBindingBuilder.java
+++ b/sca-java-2.x/trunk/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WebServiceBindingBuilder.java
@@ -19,8 +19,11 @@
package org.apache.tuscany.sca.binding.ws.wsdlgen;
+import java.util.List;
+
import javax.xml.namespace.QName;
+import org.apache.tuscany.sca.assembly.Base;
import org.apache.tuscany.sca.assembly.Component;
import org.apache.tuscany.sca.assembly.Contract;
import org.apache.tuscany.sca.assembly.builder.BindingBuilder;
@@ -30,6 +33,8 @@ import org.apache.tuscany.sca.core.ExtensionPointRegistry;
import org.apache.tuscany.sca.core.FactoryExtensionPoint;
import org.apache.tuscany.sca.definitions.Definitions;
import org.apache.tuscany.sca.policy.BindingType;
+import org.apache.tuscany.sca.policy.DefaultingPolicySubject;
+import org.apache.tuscany.sca.policy.DefaultIntent;
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.policy.PolicySubject;
@@ -42,9 +47,13 @@ import org.apache.tuscany.sca.policy.PolicySubject;
public class WebServiceBindingBuilder implements BindingBuilder<WebServiceBinding> {
private ExtensionPointRegistry extensionPoints;
+ private PolicyFactory policyFactory;
public WebServiceBindingBuilder(ExtensionPointRegistry extensionPoints) {
this.extensionPoints = extensionPoints;
+
+ FactoryExtensionPoint modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
+ this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
}
/**
@@ -67,7 +76,51 @@ public class WebServiceBindingBuilder implements BindingBuilder<WebServiceBindin
* it implements SOAP.v1_1 by default and hence the default intent
* is SOAP.v1_1. Binding.ws doesn't allwaysProvide SOAP.v1_1 though as if the
* user specifies the SOAP.v1_2 the binding does SOAP.v1_2 instead of SOAP.v1_1
- */
+ *
+ * This logic is here rather than in the binding model so that the behaviour
+ * of the implementation is not dictated by the hard coded condifuration of the
+ * model. This build runs before the policy builders where this information is used
+ * TODO - can we get this code into the actual impl modules itself. Move this builder?
+ */
+ List<DefaultIntent> defaultIntents = ((DefaultingPolicySubject)binding).getDefaultIntents();
+ DefaultIntent defaultIntent = policyFactory.createDefaultIntent();
+
+ Definitions systemDefinitions = context.getDefinitions();
+ if (systemDefinitions != null){
+ BindingType bindingType = systemDefinitions.getBindingType(binding.getType());
+ for (Intent mayProvideIntent : bindingType.getMayProvidedIntents()){
+ if (mayProvideIntent.getName().getLocalPart().equals("SOAP.v1_1")){
+ defaultIntent.setIntent(mayProvideIntent);
+ }
+ if (mayProvideIntent.getName().getLocalPart().equals("SOAP.v1_2")){
+ defaultIntent.getMutuallyExclusiveIntents().add(mayProvideIntent);
+ }
+ }
+
+ defaultIntents.add(defaultIntent);
+ }
+
+ // if the binding may provide SOAP.v1_1 then use this is as the default if no
+ // other intents are specified
+/*
+ if (intent != null){
+ List<DefaultIntent> defaultIntents = ((DefaultingPolicySubject)binding).getDefaultIntents();
+ DefaultIntent defaultIntent = policyFactory.createDefaultIntent();
+
+ // Add the default intent
+ defaultIntent.setDefaultIntent(intent);
+
+ // Add the names of all of the intents that must not be present in
+ // order for the default intent to come into force
+ defaultIntent.getMutuallyExclusiveIntents().add(new QName(Base.SCA11_NS, "SOAP.v1_1"));
+ defaultIntent.getMutuallyExclusiveIntents().add(new QName(Base.SCA11_NS, "SOAP.v1_2"));
+ defaultIntent.getMutuallyExclusiveIntents().add(new QName(Base.SCA11_NS, "SOAP"));
+
+ defaultIntents.add(defaultIntent);
+ }
+*/
+
+/*
boolean addDefaultSOAPIntent = true;
for(Intent intent : ((PolicySubject)binding).getRequiredIntents()){
@@ -97,6 +150,7 @@ public class WebServiceBindingBuilder implements BindingBuilder<WebServiceBindin
}
}
}
+*/
}