From bcf6871abfa4171330ce970ff9319ada6c25e0bf Mon Sep 17 00:00:00 2001 From: edwardsmj Date: Thu, 30 Oct 2008 16:19:33 +0000 Subject: Added in processing for reading EventTypes for CompositeConsumers and Composite Producers git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@709192 13f79535-47bb-0310-9956-ffa450edef68 --- .../sca/assembly/xml/CompositeProcessor.java | 33 ++++++++++++++++++++++ .../apache/tuscany/sca/assembly/xml/Constants.java | 1 + 2 files changed, 34 insertions(+) (limited to 'sandbox/event') diff --git a/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java b/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java index 93199e7d6f..be57b6cb9d 100644 --- a/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java +++ b/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java @@ -313,6 +313,14 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt contract = componentConsumer; componentConsumer.setName(getString(reader, NAME)); + // Read the EventTypes attribute + String eventTypes = reader.getAttributeValue(null, Constants.EVENTTYPES); + if (eventTypes != null) { + for (StringTokenizer tokens = new StringTokenizer(eventTypes); tokens.hasMoreTokens();) { + componentConsumer.getEventTypes().addEventType(tokens.nextToken()); + } // end for + } // end if + //handle extension attributes this.readExtendedAttributes(reader, name, componentConsumer, extensionAttributeProcessor); @@ -325,6 +333,14 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt compositeConsumer = assemblyFactory.createCompositeConsumer(); contract = componentConsumer; compositeConsumer.setName(getString(reader, NAME)); + + // Read the EventTypes attribute + String eventTypes = reader.getAttributeValue(null, Constants.EVENTTYPES); + if (eventTypes != null) { + for (StringTokenizer tokens = new StringTokenizer(eventTypes); tokens.hasMoreTokens();) { + compositeConsumer.getEventTypes().addEventType(tokens.nextToken()); + } // end for + } // end if String promoted = getString(reader, PROMOTE); if (promoted != null) { @@ -364,6 +380,14 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt contract = componentProducer; componentProducer.setName(getString(reader, NAME)); + // Read the EventTypes attribute + String eventTypes = reader.getAttributeValue(null, Constants.EVENTTYPES); + if (eventTypes != null) { + for (StringTokenizer tokens = new StringTokenizer(eventTypes); tokens.hasMoreTokens();) { + componentProducer.getEventTypes().addEventType(tokens.nextToken()); + } // end for + } // end if + //handle extension attributes this.readExtendedAttributes(reader, name, componentProducer, extensionAttributeProcessor); @@ -375,6 +399,15 @@ public class CompositeProcessor extends BaseAssemblyProcessor implements StAXArt compositeProducer = assemblyFactory.createCompositeProducer(); contract = componentProducer; compositeProducer.setName(getString(reader, NAME)); + + // Read the EventTypes attribute + String eventTypes = reader.getAttributeValue(null, Constants.EVENTTYPES); + if (eventTypes != null) { + for (StringTokenizer tokens = new StringTokenizer(eventTypes); tokens.hasMoreTokens();) { + compositeProducer.getEventTypes().addEventType(tokens.nextToken()); + } // end for + } // end if + String promoted = getString(reader, PROMOTE); if (promoted != null) { String promotedComponentName; diff --git a/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java b/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java index 8f29f4efa4..89e2946129 100644 --- a/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java +++ b/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java @@ -88,6 +88,7 @@ public interface Constants { String PROMOTE = "promote"; String TARGET = "target"; String WIRED_BY_IMPL = "wiredByImpl"; + String EVENTTYPES = "eventTypes"; String MULTIPLICITY = "multiplicity"; String TYPE = "type"; String ELEMENT = "element"; -- cgit v1.2.3