Author: svkrish
Date: Tue Jan 22 23:52:05 2008
New Revision: 614447
URL: http://svn.apache.org/viewvc?rev=614447&view=rev
Log:
putting back intents into bindings and implementations, linking up binding and
implementation instances to corresponding bindingType and implementationType
definitions
Modified:
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/services/definitions.xml
incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
Modified:
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Tue Jan 22 23:52:05 2008
@@ -62,9 +62,11 @@
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPoint;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.IntentAttachPointTypeFactory;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+import org.apache.tuscany.sca.policy.impl.IntentAttachPointTypeFactoryImpl;
import org.apache.tuscany.sca.policy.util.PolicyValidationUtils;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -85,6 +87,7 @@
protected StAXArtifactProcessor<Object> extensionProcessor;
protected PolicyAttachPointProcessor policyProcessor;
private DocumentBuilderFactory documentBuilderFactory;
+ protected IntentAttachPointTypeFactory intentAttachPointTypeFactory;
/**
* Construcst a new BaseArtifactProcessor.
@@ -102,6 +105,7 @@
this.extensionProcessor =
(StAXArtifactProcessor<Object>)extensionProcessor;
this.contributionFactory = contribFactory;
this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
+ this.intentAttachPointTypeFactory = new
IntentAttachPointTypeFactoryImpl();
}
/**
@@ -243,6 +247,14 @@
resolver.addModel(implementation);
}
}
+ }
+
+ if ( implementation instanceof IntentAttachPoint &&
+ ((IntentAttachPoint)implementation).getType() != null &&
+ ((IntentAttachPoint)implementation).getType().isUnresolved() )
{
+ ((IntentAttachPoint)implementation).setType(
+
resolver.resolveModel(IntentAttachPointType.class,
+
((IntentAttachPoint)implementation).getType()));
}
}
return implementation;
Modified:
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Tue Jan 22 23:52:05 2008
@@ -61,6 +61,7 @@
import org.apache.tuscany.sca.interfacedef.InterfaceContract;
import org.apache.tuscany.sca.interfacedef.InterfaceContractMapper;
import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
import org.apache.tuscany.sca.policy.PolicyFactory;
import org.apache.tuscany.sca.policy.PolicySet;
import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
@@ -87,6 +88,7 @@
InterfaceContractMapper interfaceContractMapper,
StAXArtifactProcessor extensionProcessor) {
super(contributionFactory, factory, policyFactory, extensionProcessor);
+
}
/**
@@ -341,8 +343,13 @@
composite.getExtensions().add(extension);
}
}
-
} else if (extension instanceof Binding) {
+ if ( extension instanceof PolicySetAttachPoint
) {
+ IntentAttachPointType bindingType =
intentAttachPointTypeFactory.createBindingType();
+ bindingType.setName(name);
+ bindingType.setUnresolved(true);
+
((PolicySetAttachPoint)extension).setType(bindingType);
+ }
// <service><binding> and
// <reference><binding>
if (callback != null) {
@@ -361,7 +368,12 @@
}
} else if (extension instanceof Implementation) {
-
+ if ( extension instanceof PolicySetAttachPoint
) {
+ IntentAttachPointType implType =
intentAttachPointTypeFactory.createImplementationType();
+ implType.setName(name);
+ implType.setUnresolved(true);
+
((PolicySetAttachPoint)extension).setType(implType);
+ }
// <component><implementation>
if (component != null) {
component.setImplementation((Implementation)extension);
Modified:
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BindingPolicyComputer.java
Tue Jan 22 23:52:05 2008
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
@@ -72,15 +73,15 @@
for (Binding binding : bindings) {
if (binding instanceof IntentAttachPoint) {
IntentAttachPoint policiedBinding = (IntentAttachPoint)binding;
- //since for an implementation the component has its policy
intents and policysets its possible
- //that there are some intents there that does not constrain
the implementation.. so prune
+ //since the parent component could also contain intents that
apply to implementation
+ //and binding elements within, we filter out only those that
apply to this binding type
List<Intent> prunedIntents =
computeInheritableIntents(policiedBinding.getType(),
inheritedIntents);
policiedBinding.getRequiredIntents().addAll(prunedIntents);
computeIntents(policiedBinding);
- trimInherentlyProvidedIntents(policiedBinding.getType(),
-
policiedBinding.getRequiredIntents());
+ //trimInherentlyProvidedIntents(policiedBinding.getType(),
+ //
policiedBinding.getRequiredIntents());
computeIntentsForOperations((IntentAttachPoint)policiedBinding);
}
@@ -106,6 +107,7 @@
}
public void determineApplicableBindingPolicySets(Contract source, Contract
target) throws PolicyComputationException {
+ List<Intent> intentsCopy = null;
for (Binding aBinding : source.getBindings()) {
if (aBinding instanceof PolicySetAttachPoint) {
PolicySetAttachPoint policiedBinding =
(PolicySetAttachPoint)aBinding;
@@ -134,11 +136,36 @@
OperationsConfigurator opConfigurator =
(OperationsConfigurator)aBinding;
for ( ConfiguredOperation confOp :
opConfigurator.getConfiguredOperations() ) {
+ intentsCopy = new
ArrayList<Intent>(confOp.getRequiredIntents());
+
+
trimInherentlyProvidedIntents(policiedBinding.getType(),
+
confOp.getRequiredIntents());
trimProvidedIntents(confOp.getRequiredIntents(),
confOp.getPolicySets());
trimProvidedIntents(confOp.getRequiredIntents(),
policiedBinding.getPolicySets());
+
+ if (domainPolicySets != null) {
+ determineApplicableDomainPolicySets(aBinding,
+ confOp,
+
policiedBinding.getType());
+
+ if (confOp.getRequiredIntents().size() > 0) {
+ new PolicyComputationException("The following
are unfulfilled intents for operations configured in "
+ + "binding - " + aBinding.getName() +
"\nUnfulfilled Intents = " +
+ confOp.getRequiredIntents());
+ }
+ }
+
+ //the intents list could have been trimmed when
matching for policysets
+ //since the bindings may need the original set of
intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(intentsCopy);
+
}
}
+ intentsCopy = new
ArrayList<Intent>(policiedBinding.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedBinding.getType(),
+
policiedBinding.getRequiredIntents());
trimProvidedIntents(policiedBinding.getRequiredIntents(),
policiedBinding
.getPolicySets());
@@ -149,6 +176,12 @@
// if there are intents that are not provided by any policy set
// throw a warning
determineApplicableDomainPolicySets(source, policiedBinding);
+
+ //the intents list could have been trimmed when matching for
policysets
+ //since the bindings may need the original set of intents we
copy that back
+ policiedBinding.getRequiredIntents().clear();
+ policiedBinding.getRequiredIntents().addAll(intentsCopy);
+
}
}
}
Modified:
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
(original)
+++
incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ImplementationPolicyComputer.java
Tue Jan 22 23:52:05 2008
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca.assembly.builder.impl;
+import java.util.ArrayList;
import java.util.List;
import org.apache.tuscany.sca.assembly.Component;
@@ -51,8 +52,8 @@
parent.getRequiredIntents().clear();
parent.getRequiredIntents().addAll(prunedIntents);
computeIntents(parent);
- trimInherentlyProvidedIntents(policiedImplementation.getType(),
- parent.getRequiredIntents());
+ //trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ // parent.getRequiredIntents());
computeIntentsForOperations((OperationsConfigurator)parent,
(IntentAttachPoint)implementation,
@@ -74,6 +75,7 @@
}
private void determineApplicableImplementationPolicySets(Component
component) throws PolicyComputationException {
+ List<Intent> intentsCopy = null;
if ( component.getImplementation() instanceof PolicySetAttachPoint ) {
PolicySetAttachPoint policiedImplementation =
(PolicySetAttachPoint)component.getImplementation();
@@ -83,6 +85,9 @@
OperationsConfigurator opConfigurator =
(OperationsConfigurator)component;
for ( ConfiguredOperation confOp :
opConfigurator.getConfiguredOperations() ) {
+ intentsCopy = new
ArrayList<Intent>(confOp.getRequiredIntents());
+
trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ confOp.getRequiredIntents());
trimProvidedIntents(confOp.getRequiredIntents(),
confOp.getPolicySets());
trimProvidedIntents(confOp.getRequiredIntents(),
component.getPolicySets());
@@ -97,9 +102,17 @@
confOp.getRequiredIntents());
}
}
+
+ //the intents list could have been trimmed when matching
for policysets
+ //since the implementation may need the original set of
intents we copy that back
+ confOp.getRequiredIntents().clear();
+ confOp.getRequiredIntents().addAll(intentsCopy);
}
}
+ intentsCopy = new
ArrayList<Intent>(component.getRequiredIntents());
+ trimInherentlyProvidedIntents(policiedImplementation.getType(),
+ component.getRequiredIntents());
trimProvidedIntents(component.getRequiredIntents(),
component.getPolicySets());
//determine additional policysets that match remaining intents
@@ -116,9 +129,11 @@
.getName() + "\nUnfulfilled Intents = " +
component.getRequiredIntents());
}
}
+
+ //the intents list could have been trimmed when matching for
policysets
+ //since the bindings may need the original set of intents we copy
that back
+ component.getRequiredIntents().clear();
+ component.getRequiredIntents().addAll(intentsCopy);
}
}
-
-
-
}
Modified:
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/services/definitions.xml
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/services/definitions.xml?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/services/definitions.xml
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-axis2/src/main/resources/META-INF/services/definitions.xml
Tue Jan 22 23:52:05 2008
@@ -21,6 +21,9 @@
targetNamespace="http://www.osoa.org/xmlns/sca/1.0"
xmlns:sca="http://www.osoa.org/xmlns/sca/1.0"
xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0">
+
+ <sca:bindingType type="sca:binding.ws" alwaysProvides=""
+
mayProvide=""/>
<!-- PolicyIntents defined by the SCA Runtime Extension for WS Binding
Axis 2 -->
<sca:intent name="soap"
Modified:
incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
(original)
+++
incubator/tuscany/java/sca/modules/binding-ws-xml/src/main/java/org/apache/tuscany/sca/binding/ws/xml/WebServiceBindingProcessor.java
Tue Jan 22 23:52:05 2008
@@ -81,10 +81,10 @@
// Read a <binding.ws>
WebServiceBinding wsBinding = wsFactory.createWebServiceBinding();
- IntentAttachPointType bindingType =
intentAttachPointTypeFactory.createBindingType();
+ /*IntentAttachPointType bindingType =
intentAttachPointTypeFactory.createBindingType();
bindingType.setName(getArtifactType());
bindingType.setUnresolved(true);
- ((PolicySetAttachPoint)wsBinding).setType(bindingType);
+ ((PolicySetAttachPoint)wsBinding).setType(bindingType);*/
wsBinding.setUnresolved(true);
// Read policies
Modified:
incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
(original)
+++
incubator/tuscany/java/sca/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
Tue Jan 22 23:52:05 2008
@@ -86,12 +86,12 @@
// Read an <implementation.java>
JavaImplementation javaImplementation =
javaFactory.createJavaImplementation();
- if ( javaImplementation instanceof PolicySetAttachPoint ) {
+ /*if ( javaImplementation instanceof PolicySetAttachPoint ) {
IntentAttachPointType implType =
intentAttachPointTypeFactory.createImplementationType();
implType.setName(getArtifactType());
implType.setUnresolved(true);
((PolicySetAttachPoint)javaImplementation).setType(implType);
- }
+ }*/
javaImplementation.setUnresolved(true);
javaImplementation.setName(reader.getAttributeValue(null, CLASS));
Modified:
incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
(original)
+++
incubator/tuscany/java/sca/modules/implementation-java-xml/src/test/java/org/apache/tuscany/sca/implementation/java/xml/ReadTestCase.java
Tue Jan 22 23:52:05 2008
@@ -210,10 +210,6 @@
CompositeBuilderImpl compositeUtil = new
CompositeBuilderImpl(assemblyFactory, scaBindingFactory,
intentAttachPointTypeFactory, mapper, scaDefns.getPolicySets(), null);
compositeUtil.build(composite);
- //intents are computed and erased since there will be matching
policysets
-
assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getRequiredIntents().size(),
0);
-
assertEquals(((PolicySetAttachPoint)composite.getComponents().get(5)).getRequiredIntents().size(),
0);
-
//test for determination of policysets for implementation
assertEquals(((PolicySetAttachPoint)composite.getComponents().get(0)).getPolicySets().size(),
1);
for ( PolicySet policySet :
((PolicySetAttachPoint)composite.getComponents().get(0).getImplementation()).getPolicySets()
) {
Modified:
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
(original)
+++
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/BindingTypeImpl.java
Tue Jan 22 23:52:05 2008
@@ -25,6 +25,7 @@
import org.apache.tuscany.sca.policy.Intent;
import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
/**
* Concrete implementation for a BindingType
@@ -59,5 +60,30 @@
public void setUnresolved(boolean unresolved) {
this.unResolved = unresolved;
+ }
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof BindingTypeImpl ) {
+ if (getName() != null) {
+ return getName().equals(((BindingTypeImpl)obj).getName());
+ } else {
+ return ((BindingTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
}
}
Modified:
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
URL:
http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java?rev=614447&r1=614446&r2=614447&view=diff
==============================================================================
---
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
(original)
+++
incubator/tuscany/java/sca/modules/policy/src/main/java/org/apache/tuscany/sca/policy/impl/ImplementationTypeImpl.java
Tue Jan 22 23:52:05 2008
@@ -59,4 +59,29 @@
public void setUnresolved(boolean unresolved) {
this.unResolved = unresolved;
}
+
+ @Override
+ public int hashCode() {
+ return String.valueOf(getName()).hashCode();
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ } else if (obj instanceof ImplementationTypeImpl ) {
+ if (getName() != null) {
+ return
getName().equals(((ImplementationTypeImpl)obj).getName());
+ } else {
+ return ((ImplementationTypeImpl)obj).getName() == null;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getName().toString();
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]