tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jsdelf...@apache.org
Subject svn commit: r532985 - in /incubator/tuscany/java/sca/modules: assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/ assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/ assembly/src/main/java/org/apache/tuscany/assembly/util/ core-spring/s...
Date Fri, 27 Apr 2007 06:25:42 GMT
Author: jsdelfino
Date: Thu Apr 26 23:25:41 2007
New Revision: 532985

URL: http://svn.apache.org/viewvc?view=rev&rev=532985
Log:
Removed InterfaceUtil and replaced it by calls to an InterfaceContractMapper. Pass the InterfaceContractMapper
to the constructor of CompositeUtil and CompositeProcessor.

Removed:
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/InterfaceUtil.java
Modified:
    incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
    incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/StAXPerfTest.java
    incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
    incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java?view=diff&rev=532985&r1=532984&r2=532985
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
(original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/main/java/org/apache/tuscany/assembly/xml/CompositeProcessor.java
Thu Apr 26 23:25:41 2007
@@ -59,7 +59,9 @@
 import org.apache.tuscany.contribution.service.ContributionWireException;
 import org.apache.tuscany.contribution.service.ContributionWriteException;
 import org.apache.tuscany.interfacedef.InterfaceContract;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
 import org.apache.tuscany.interfacedef.Operation;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 import org.apache.tuscany.policy.PolicyFactory;
 import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
@@ -69,6 +71,8 @@
  * @version $Rev$ $Date$
  */
 public class CompositeProcessor extends BaseArtifactProcessor implements StAXArtifactProcessorExtension<Composite>
{
+    
+    private InterfaceContractMapper interfaceContractMapper;
 
     /**
      * Construct a new composite processor
@@ -76,8 +80,11 @@
      * @param policyFactory
      * @param extensionProcessor 
      */
-    public CompositeProcessor(AssemblyFactory factory, PolicyFactory policyFactory, StAXArtifactProcessorExtension
extensionProcessor) {
+    public CompositeProcessor(AssemblyFactory factory, PolicyFactory policyFactory,
+                              InterfaceContractMapper interfaceContractMapper,
+                              StAXArtifactProcessorExtension extensionProcessor) {
         super(factory, policyFactory, extensionProcessor);
+        this.interfaceContractMapper = interfaceContractMapper;
     }
 
     /**
@@ -85,7 +92,8 @@
      * @param extensionProcessor
      */
     public CompositeProcessor(StAXArtifactProcessorExtension extensionProcessor) {
-        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(), extensionProcessor);
+        this(new DefaultAssemblyFactory(), new DefaultPolicyFactory(),
+             new DefaultInterfaceContractMapper(), extensionProcessor);
     }
 
     public Composite read(XMLStreamReader reader) throws ContributionReadException {
@@ -490,7 +498,7 @@
     public void wire(Composite composite) throws ContributionWireException {
         
         // Process the composite configuration
-        CompositeUtil compositeUtil = new CompositeUtil(factory, composite);
+        CompositeUtil compositeUtil = new CompositeUtil(factory, interfaceContractMapper,
composite);
         List<Base> problems = new ArrayList<Base>();
         compositeUtil.configure(problems);
        

Modified: incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/StAXPerfTest.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/StAXPerfTest.java?view=diff&rev=532985&r1=532984&r2=532985
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/StAXPerfTest.java
(original)
+++ incubator/tuscany/java/sca/modules/assembly-xml/src/test/java/org/apache/tuscany/assembly/xml/StAXPerfTest.java
Thu Apr 26 23:25:41 2007
@@ -28,6 +28,8 @@
 import org.apache.tuscany.assembly.Composite;
 import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
 import org.apache.tuscany.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 import org.apache.tuscany.policy.PolicyFactory;
 import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
 
@@ -41,6 +43,7 @@
     private XMLInputFactory inputFactory;
     private AssemblyFactory assemblyFactory;
     private PolicyFactory policyFactory;
+    private InterfaceContractMapper interfaceContractMapper;
     private DefaultStAXArtifactProcessorExtensionPoint staxProcessors;
 
     public static void main(String[] args) throws Exception {
@@ -70,6 +73,7 @@
         inputFactory = XMLInputFactory.newInstance();
         assemblyFactory = new DefaultAssemblyFactory();
         policyFactory = new DefaultPolicyFactory();
+        interfaceContractMapper = new DefaultInterfaceContractMapper();
         staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
     }
 
@@ -82,7 +86,8 @@
 
     public void testReadComposite() throws Exception {
         InputStream is = getClass().getResourceAsStream("TestAllCalculator.composite");
-        CompositeProcessor loader = new CompositeProcessor(assemblyFactory, policyFactory,
staxProcessors);
+        CompositeProcessor loader = new CompositeProcessor(assemblyFactory,
+                                                           policyFactory, interfaceContractMapper,
staxProcessors);
         XMLStreamReader reader = inputFactory.createXMLStreamReader(is);
 
         Composite composite = loader.read(reader);

Modified: incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java?view=diff&rev=532985&r1=532984&r2=532985
==============================================================================
--- incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
(original)
+++ incubator/tuscany/java/sca/modules/assembly/src/main/java/org/apache/tuscany/assembly/util/CompositeUtil.java
Thu Apr 26 23:25:41 2007
@@ -40,6 +40,8 @@
 import org.apache.tuscany.assembly.Service;
 import org.apache.tuscany.assembly.Wire;
 import org.apache.tuscany.assembly.impl.DefaultAssemblyFactory;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 
 /**
  * A utility class that handles the configuration of the components inside a 
@@ -50,15 +52,20 @@
 public class CompositeUtil {
 
     private AssemblyFactory assemblyFactory;
+    private InterfaceContractMapper interfaceContractMapper;
     private Composite composite;
 
-    public CompositeUtil(AssemblyFactory assemblyFactory, Composite composite) {
+    public CompositeUtil(AssemblyFactory assemblyFactory,
+                         InterfaceContractMapper interfaceContractMapper,
+                         Composite composite) {
         this.assemblyFactory = assemblyFactory;
+        this.interfaceContractMapper = interfaceContractMapper;
         this.composite = composite;
     }
 
     public CompositeUtil(Composite composite) {
-        this(new DefaultAssemblyFactory(), composite);
+        this(new DefaultAssemblyFactory(),
+             new DefaultInterfaceContractMapper(), composite);
     }
 
     public void configure(List<Base> problems) {
@@ -165,7 +172,7 @@
                 // Reconcile interface
                 if (componentService.getInterfaceContract() != null) {
                     if (!componentService.getInterfaceContract().equals(service.getInterfaceContract()))
{
-                        if (!InterfaceUtil.checkInterfaceCompatibility(componentService.getInterfaceContract(),

+                        if (!interfaceContractMapper.isCompatible(componentService.getInterfaceContract(),

                                                                        service.getInterfaceContract()))
{
                             problems.add(componentService);
                         }
@@ -232,7 +239,7 @@
                 // Reconcile interface
                 if (componentReference.getInterfaceContract() != null) {
                     if (!componentReference.getInterfaceContract().equals(reference.getInterfaceContract()))
{
-                        if (!InterfaceUtil.checkInterfaceCompatibility(reference.getInterfaceContract(),

+                        if (!interfaceContractMapper.isCompatible(reference.getInterfaceContract(),

                                                                        componentReference.getInterfaceContract()))
{
                             problems.add(componentReference);
                         }
@@ -547,7 +554,7 @@
                 for (Component component: composite.getComponents()) {
                     for (ComponentService componentService: component.getServices()) {
                         if (componentReference.getInterfaceContract() == null ||
-                            InterfaceUtil.checkInterfaceCompatibility(componentReference.getInterfaceContract(),
+                            interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
                             componentService.getInterfaceContract())) {
                             
                             targets.add(componentService);
@@ -570,7 +577,7 @@
                             // Check that the target component service provides a superset
of
                             // the component reference interface
                             if (componentReference.getInterfaceContract() ==null ||
-                                InterfaceUtil.checkInterfaceCompatibility(componentReference.getInterfaceContract(),
+                                interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
                                 resolved.getInterfaceContract())) {
                                 
                                 targets.set(i, resolved);
@@ -594,7 +601,7 @@
                             // Check that the target component service provides a superset
of
                             // the component reference interface
                             if (componentReference.getInterfaceContract() == null ||
-                                InterfaceUtil.checkInterfaceCompatibility(componentReference.getInterfaceContract(),
+                                interfaceContractMapper.isCompatible(componentReference.getInterfaceContract(),
                                 resolved.getInterfaceContract())) {
                                 
                                 targets.add(resolved);

Modified: incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java?view=diff&rev=532985&r1=532984&r2=532985
==============================================================================
--- incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
(original)
+++ incubator/tuscany/java/sca/modules/core-spring/src/test/java/test/model/variant/VariantRuntimeContext.java
Thu Apr 26 23:25:41 2007
@@ -34,6 +34,8 @@
 import org.apache.tuscany.implementation.java.bean.impl.BeanJavaImplementationFactory;
 import org.apache.tuscany.implementation.java.introspect.DefaultJavaClassIntrospector;
 import org.apache.tuscany.implementation.java.xml.JavaImplementationProcessor;
+import org.apache.tuscany.interfacedef.InterfaceContractMapper;
+import org.apache.tuscany.interfacedef.impl.DefaultInterfaceContractMapper;
 import org.apache.tuscany.interfacedef.java.xml.JavaInterfaceProcessor;
 import org.apache.tuscany.policy.PolicyFactory;
 import org.apache.tuscany.policy.impl.DefaultPolicyFactory;
@@ -57,11 +59,13 @@
         // Create SCA assembly and SCA Java factories
         AssemblyFactory assemblyFactory = new BeanAssemblyFactory(new DefaultAssemblyFactory(),
beanFactory);
         PolicyFactory policyFactory = new DefaultPolicyFactory();
+        InterfaceContractMapper interfaceContractMapper = new DefaultInterfaceContractMapper();
         JavaImplementationFactory javaImplementationFactory = new BeanJavaImplementationFactory(beanFactory);
 
         // Populate ArtifactProcessor registry
         DefaultStAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint();
-        CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory,
staxProcessors);
+        CompositeProcessor compositeProcessor = new CompositeProcessor(assemblyFactory, policyFactory,
+                                                                       interfaceContractMapper,
staxProcessors);
         staxProcessors.addExtension(compositeProcessor);
         staxProcessors.addExtension(new ComponentTypeProcessor(assemblyFactory, policyFactory,
staxProcessors));
         staxProcessors.addExtension(new ConstrainingTypeProcessor(staxProcessors));



---------------------------------------------------------------------
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