tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From edward...@apache.org
Subject svn commit: r711908 - in /tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml: BaseAssemblyProcessor.java CompositeProcessor.java
Date Thu, 06 Nov 2008 16:57:37 GMT
Author: edwardsmj
Date: Thu Nov  6 08:57:27 2008
New Revision: 711908

URL: http://svn.apache.org/viewvc?rev=711908&view=rev
Log:
Changes to enable consumers and producers to be connected via binding.sca

Modified:
    tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
    tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java

Modified: tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java?rev=711908&r1=711907&r2=711908&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
(original)
+++ tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/BaseAssemblyProcessor.java
Thu Nov  6 08:57:27 2008
@@ -43,9 +43,12 @@
 import org.apache.tuscany.sca.assembly.Base;
 import org.apache.tuscany.sca.assembly.Binding;
 import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentConsumer;
+import org.apache.tuscany.sca.assembly.ComponentProducer;
 import org.apache.tuscany.sca.assembly.ComponentService;
 import org.apache.tuscany.sca.assembly.ComponentType;
 import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Consumer;
 import org.apache.tuscany.sca.assembly.ConfiguredOperation;
 import org.apache.tuscany.sca.assembly.ConstrainingType;
 import org.apache.tuscany.sca.assembly.Contract;
@@ -53,6 +56,7 @@
 import org.apache.tuscany.sca.assembly.Implementation;
 import org.apache.tuscany.sca.assembly.Multiplicity;
 import org.apache.tuscany.sca.assembly.OperationsConfigurator;
+import org.apache.tuscany.sca.assembly.Producer;
 import org.apache.tuscany.sca.assembly.Reference;
 import org.apache.tuscany.sca.assembly.Service;
 import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
@@ -251,6 +255,44 @@
             reference.setMultiplicity(Multiplicity.ZERO_N);
         }
     }
+    
+    /**
+     * Read list of producer targets
+     * @param producer - the producer
+     * @param reader - XMLStreamReader for the producer element
+     */
+    protected void readProducerTargets(Producer producer, XMLStreamReader reader) {
+        String value = reader.getAttributeValue(null, TARGET);
+        ComponentConsumer target = null;
+        // TODO - need to deal with a target that is a Channel
+        if (value != null) {
+            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();)
{
+                target = assemblyFactory.createComponentConsumer();
+                target.setUnresolved(true);
+                target.setName(tokens.nextToken());
+                producer.getTargets().add(target);
+            }
+        }
+    } // end readProducerTargets
+    
+    /**
+     * Read list of consumer sources
+     * @param producer - the consumer
+     * @param reader - XMLStreamReader for the consumer element
+     */
+    protected void readConsumerSources(Consumer consumer, XMLStreamReader reader) {
+        String value = reader.getAttributeValue(null, SOURCE);
+        ComponentProducer source = null;
+        // TODO - need to deal with a source that is a Channel
+        if (value != null) {
+            for (StringTokenizer tokens = new StringTokenizer(value); tokens.hasMoreTokens();)
{
+                source = assemblyFactory.createComponentProducer();
+                source.setUnresolved(true);
+                source.setName(tokens.nextToken());
+                consumer.getSources().add(source);
+            }
+        }
+    } // end readConsumerSources
 
     /**
      * Returns the value of a constrainingType attribute.

Modified: tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java?rev=711908&r1=711907&r2=711908&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
(original)
+++ tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
Thu Nov  6 08:57:27 2008
@@ -321,6 +321,8 @@
                                 } // end for
                             } // end if
                             
+                            readConsumerSources( componentConsumer, reader );
+                            
                             //handle extension attributes
                             this.readExtendedAttributes(reader, name, componentConsumer,
extensionAttributeProcessor);
 
@@ -341,6 +343,8 @@
                                     compositeConsumer.getEventTypes().addEventType(tokens.nextToken());
                                 } // end for
                             } // end if
+                            
+                            //TODO deal with @source attribute
 
                             String promoted = getString(reader, PROMOTE);
                             if (promoted != null) {
@@ -388,6 +392,8 @@
                                 } // end for
                             } // end if
                             
+                            readProducerTargets( componentProducer, reader );
+                                                        
                             //handle extension attributes
                             this.readExtendedAttributes(reader, name, componentProducer,
extensionAttributeProcessor);
 
@@ -395,7 +401,7 @@
                             policyProcessor.readPolicies(componentProducer, reader);
                             
                         } else {
-                            // Read a <composite><reference>
+                            // Read a <composite><producer>
                             compositeProducer = assemblyFactory.createCompositeProducer();
                             contract = componentProducer;
                             compositeProducer.setName(getString(reader, NAME));
@@ -408,6 +414,8 @@
                                 } // end for
                             } // end if
                             
+                            //TODO deal with @target attribute
+                            
                             String promoted = getString(reader, PROMOTE);
                             if (promoted != null) {
                                 String promotedComponentName;



Mime
View raw message