You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by rs...@apache.org on 2008/10/21 11:04:42 UTC
svn commit: r706556 [1/2] - in /tuscany/sandbox/event:
modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/
modules/assembly-xsd/src/main/resources/
modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/
modules/assembly/src...
Author: rsivaram
Date: Tue Oct 21 02:04:28 2008
New Revision: 706556
URL: http://svn.apache.org/viewvc?rev=706556&view=rev
Log:
Event prototype: Initial model changes
Added:
tuscany/sandbox/event/modules/binding-event/
tuscany/sandbox/event/modules/binding-event/src/
tuscany/sandbox/event/modules/binding-event/src/main/
tuscany/sandbox/event/modules/binding-event/src/main/java/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java (with props)
tuscany/sandbox/event/modules/binding-event/src/main/resources/
tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/
tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/
tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory
tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.BindingProviderFactory
tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.provider.SCADefinitionsProvider
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/
tuscany/sandbox/event/modules/binding-event/src/main/resources/org/apache/tuscany/sca/binding/sca/definitions.xml (with props)
tuscany/sandbox/event/modules/sca-api/src/main/java/org/osoa/sca/annotations/EventType.java (with props)
Modified:
tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/CompositeProcessor.java
tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
tuscany/sandbox/event/modules/assembly-xsd/src/main/resources/sca-core.xsd
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
tuscany/sandbox/event/modules/extension-helper/src/main/java/org/apache/tuscany/sca/extension/helper/utils/AbstractImplementation.java
tuscany/sandbox/event/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntime.java
tuscany/sandbox/event/modules/host-embedded/src/main/java/org/apache/tuscany/sca/host/embedded/impl/ReallySmallRuntimeBuilder.java
tuscany/sandbox/event/modules/host-embedded/src/test/java/org/apache/tuscany/sca/host/embedded/test/extension/impl/TestImplementationImpl.java
tuscany/sandbox/event/modules/implementation-java-xml/src/main/java/org/apache/tuscany/sca/implementation/java/xml/JavaImplementationProcessor.java
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/JavaImplementation.java
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationActivator.java
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/impl/JavaImplementationImpl.java
tuscany/sandbox/event/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/builder/impl/NodeCompositeBuilderImpl.java
tuscany/sandbox/event/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/ConfiguredNodeImplementationImpl.java
tuscany/sandbox/event/modules/implementation-node/src/main/java/org/apache/tuscany/sca/implementation/node/impl/NodeImplementationImpl.java
tuscany/sandbox/event/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBootStrapper.java
tuscany/sandbox/event/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/RuntimeBuilder.java
tuscany/sandbox/event/samples/event-jms/src/main/java/weather/WeatherPublisher.java
tuscany/sandbox/event/samples/event-jms/src/main/java/weather/WeatherPublisherComponent.java
tuscany/sandbox/event/samples/event-jms/src/main/java/weather/WeatherSubscriberComponent.java
tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherPublisher.composite
tuscany/sandbox/event/samples/event-jms/src/main/resources/weatherSubscriber.composite
tuscany/sandbox/event/samples/event-jms/src/test/java/weather/WeatherTestCase.java
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=706556&r1=706555&r2=706556&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 Tue Oct 21 02:04:28 2008
@@ -40,10 +40,14 @@
import org.apache.tuscany.sca.assembly.Binding;
import org.apache.tuscany.sca.assembly.Callback;
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.ComponentProperty;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.CompositeConsumer;
+import org.apache.tuscany.sca.assembly.CompositeProducer;
import org.apache.tuscany.sca.assembly.CompositeReference;
import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.ConfiguredOperation;
@@ -159,6 +163,10 @@
ComponentProperty componentProperty = null;
CompositeService compositeService = null;
CompositeReference compositeReference = null;
+ ComponentConsumer componentConsumer = null;
+ ComponentProducer componentProducer = null;
+ CompositeConsumer compositeConsumer = null;
+ CompositeProducer compositeProducer = null;
Contract contract = null;
Wire wire = null;
Callback callback = null;
@@ -297,6 +305,108 @@
composite.getReferences().add(compositeReference);
policyProcessor.readPolicies(contract, reader);
}
+ } else if (CONSUMER_QNAME.equals(name)) {
+ if (component != null) {
+
+ // Read a <component><consumer>
+ componentConsumer = assemblyFactory.createComponentConsumer();
+ contract = componentConsumer;
+ componentConsumer.setName(getString(reader, NAME));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, componentConsumer, extensionAttributeProcessor);
+
+ component.getConsumers().add(componentConsumer);
+ policyProcessor.readPolicies(componentConsumer, reader);
+
+ } else {
+
+ // Read a <composite><consumer>
+ compositeConsumer = assemblyFactory.createCompositeConsumer();
+ contract = componentConsumer;
+ compositeConsumer.setName(getString(reader, NAME));
+
+ String promoted = getString(reader, PROMOTE);
+ if (promoted != null) {
+ String promotedComponentName;
+ String promotedConsumerName;
+ int s = promoted.indexOf('/');
+ if (s == -1) {
+ promotedComponentName = promoted;
+ promotedConsumerName = null;
+ } else {
+ promotedComponentName = promoted.substring(0, s);
+ promotedConsumerName = promoted.substring(s + 1);
+ }
+
+ Component promotedComponent = assemblyFactory.createComponent();
+ promotedComponent.setUnresolved(true);
+ promotedComponent.setName(promotedComponentName);
+ compositeConsumer.setPromotedComponent(promotedComponent);
+
+ ComponentConsumer promotedConsumer = assemblyFactory.createComponentConsumer();
+ promotedConsumer.setUnresolved(true);
+ promotedConsumer.setName(promotedConsumerName);
+ compositeConsumer.setPromotedConsumer(promotedConsumer);
+ }
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, compositeConsumer, extensionAttributeProcessor);
+
+ composite.getConsumers().add(compositeConsumer);
+ policyProcessor.readPolicies(compositeConsumer, reader);
+ }
+
+ } else if (PRODUCER_QNAME.equals(name)) {
+ if (component != null) {
+ // Read a <component><reference>
+ componentProducer = assemblyFactory.createComponentProducer();
+ contract = componentProducer;
+ componentProducer.setName(getString(reader, NAME));
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, componentProducer, extensionAttributeProcessor);
+
+ component.getProducers().add(componentProducer);
+ policyProcessor.readPolicies(componentProducer, reader);
+
+ } else {
+ // Read a <composite><reference>
+ compositeProducer = assemblyFactory.createCompositeProducer();
+ contract = componentProducer;
+ compositeProducer.setName(getString(reader, NAME));
+ String promoted = getString(reader, PROMOTE);
+ if (promoted != null) {
+ String promotedComponentName;
+ String promotedProducerName;
+ int s = promoted.indexOf('/');
+ if (s == -1) {
+ promotedComponentName = promoted;
+ promotedProducerName = null;
+ } else {
+ promotedComponentName = promoted.substring(0, s);
+ promotedProducerName = promoted.substring(s + 1);
+ }
+
+ Component promotedComponent = assemblyFactory.createComponent();
+ promotedComponent.setUnresolved(true);
+ promotedComponent.setName(promotedComponentName);
+ compositeProducer.setPromotedComponent(promotedComponent);
+
+ ComponentProducer promotedProducer = assemblyFactory.createComponentProducer();
+ promotedProducer.setUnresolved(true);
+ promotedProducer.setName(promotedProducerName);
+ compositeProducer.setPromotedProducer(promotedProducer);
+ }
+
+ //handle extension attributes
+ this.readExtendedAttributes(reader, name, compositeProducer, extensionAttributeProcessor);
+
+ composite.getProducers().add(compositeProducer);
+ policyProcessor.readPolicies(compositeProducer, reader);
+ }
+
+
} else if (PROPERTY_QNAME.equals(name)) {
if (component != null) {
@@ -560,6 +670,12 @@
wire = null;
} else if (CALLBACK_QNAME.equals(name)) {
callback = null;
+ } else if (CONSUMER_QNAME.equals(name)) {
+ componentConsumer = null;
+ compositeConsumer = null;
+ } else if (PRODUCER_QNAME.equals(name)) {
+ componentProducer = null;
+ compositeProducer = null;
}
break;
}
@@ -946,6 +1062,8 @@
//Resolve composite services and references
resolveContracts(composite, composite.getServices(), resolver);
resolveContracts(composite, composite.getReferences(), resolver);
+ resolveContracts(composite, composite.getConsumers(), resolver);
+ resolveContracts(composite, composite.getProducers(), resolver);
// Resolve component implementations, services and references
for (Component component : composite.getComponents()) {
@@ -971,6 +1089,8 @@
//resolve component services and references
resolveContracts(component, component.getServices(), resolver);
resolveContracts(component, component.getReferences(), resolver);
+ resolveContracts(component, component.getConsumers(), resolver);
+ resolveContracts(component, component.getProducers(), resolver);
for (ComponentProperty componentProperty : component.getProperties()) {
if (componentProperty.getFile() != null) {
Modified: tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java (original)
+++ tuscany/sandbox/event/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/Constants.java Tue Oct 21 02:04:28 2008
@@ -72,6 +72,12 @@
String BINDING_SCA = "binding.sca";
QName BINDING_SCA_QNAME = new QName(Constants.SCA10_NS, BINDING_SCA);
+ String CONSUMER = "consumer";
+ QName CONSUMER_QNAME = new QName(SCA10_NS, CONSUMER);
+
+ String PRODUCER = "producer";
+ QName PRODUCER_QNAME = new QName(SCA10_NS, PRODUCER);
+
String NAME = "name";
String TARGET_NAMESPACE = "targetNamespace";
String LOCAL = "local";
Modified: tuscany/sandbox/event/modules/assembly-xsd/src/main/resources/sca-core.xsd
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly-xsd/src/main/resources/sca-core.xsd?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly-xsd/src/main/resources/sca-core.xsd (original)
+++ tuscany/sandbox/event/modules/assembly-xsd/src/main/resources/sca-core.xsd Tue Oct 21 02:04:28 2008
@@ -15,7 +15,9 @@
<choice minOccurs="0" maxOccurs="unbounded">
<element name="service" type="sca:ComponentService" />
<element name="reference" type="sca:ComponentReference"/>
- <element name="property" type="sca:Property"/>
+ <element name="property" type="sca:Property"/>
+ <element name="producer" type="sca:ComponentProducer"/>
+ <element name="consumer" type="sca:ComponentConsumer"/>
</choice>
<!--
<any namespace="##other" processContents="lax" minOccurs="0"
@@ -34,7 +36,9 @@
<element name="service" type="sca:Service"/>
<element name="property" type="sca:Property"/>
<element name="component" type="sca:Component"/>
- <element name="reference" type="sca:Reference"/>
+ <element name="reference" type="sca:Reference"/>
+ <element name="producer" type="sca:Producer"/>
+ <element name="consumer" type="sca:Consumer"/>
<element name="wire" type="sca:Wire"/>
<!-- <any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/> -->
</choice>
@@ -147,6 +151,41 @@
</complexContent>
</complexType>
+
+ <complexType name="Producer">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
+ <complexType name="Consumer">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+ <attribute name="name" type="NCName" use="required" />
+ <attribute name="promote" type="anyURI" use="required" />
+ <attribute name="source" type="sca:listOfAnyURIs" use="optional" />
+ <attribute name="requires" type="sca:listOfQNames" use="optional" />
+ <attribute name="policySets" type="sca:listOfQNames" use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax" />
+ </complexType>
+
<element name="binding" type="sca:Binding" abstract="true"/>
<complexType name="Binding" abstract="true">
<sequence>
@@ -190,7 +229,9 @@
<choice minOccurs="0" maxOccurs="unbounded">
<element name="service" type="sca:ComponentService"/>
<element name="reference" type="sca:ComponentReference"/>
- <element name="property" type="sca:PropertyValue" />
+ <element name="property" type="sca:PropertyValue" />
+ <element name="producer" type="sca:ComponentProducer"/>
+ <element name="consumer" type="sca:ComponentConsumer"/>
</choice>
<!--
<any namespace="##other" processContents="lax" minOccurs="0"
@@ -252,6 +293,43 @@
use="optional"/>
<anyAttribute namespace="##any" processContents="lax" />
</complexType>
+
+ <complexType name="ComponentProducer">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="target" type="sca:listOfAnyURIs" use="optional" />
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
+ <complexType name="ComponentConsumer">
+ <sequence>
+ <element name="operation" type="sca:Operation" minOccurs="0"
+ maxOccurs="unbounded" />
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="sca:binding" />
+ <any namespace="##other" processContents="lax"/>
+ </choice>
+ </sequence>
+ <attribute name="name" type="NCName" use="required"/>
+ <attribute name="source" type="sca:listOfAnyURIs" use="optional" />
+ <attribute name="requires" type="sca:listOfQNames"
+ use="optional"/>
+ <attribute name="policySets" type="sca:listOfQNames"
+ use="optional"/>
+ <anyAttribute namespace="##any" processContents="lax"/>
+ </complexType>
+
<element name="implementation" type="sca:Implementation"
abstract="true" />
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/AssemblyFactory.java Tue Oct 21 02:04:28 2008
@@ -81,6 +81,20 @@
* @return a new component service
*/
ComponentService createComponentService();
+
+ /**
+ * Create a new component producer.
+ *
+ * @return a new component producer
+ */
+ ComponentProducer createComponentProducer();
+
+ /**
+ * Create a new component consumer.
+ *
+ * @return a new component consumer
+ */
+ ComponentConsumer createComponentConsumer();
/**
* Create a new component type
@@ -109,6 +123,21 @@
* @return a new composite service
*/
CompositeService createCompositeService();
+
+
+ /**
+ * Create a new composite producer.
+ *
+ * @return a new composite producer
+ */
+ CompositeProducer createCompositeProducer();
+
+ /**
+ * Create a new composite consumer.
+ *
+ * @return a new composite consumer
+ */
+ CompositeConsumer createCompositeConsumer();
/**
* Create a new constraining type.
@@ -137,6 +166,21 @@
* @return a new service
*/
Service createService();
+
+
+ /**
+ * Create a new producer.
+ *
+ * @return a new producer
+ */
+ Producer createProducer();
+
+ /**
+ * Create a new consumer.
+ *
+ * @return a new consumer
+ */
+ Consumer createConsumer();
/**
* Create a new wire.
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Component.java Tue Oct 21 02:04:28 2008
@@ -85,6 +85,20 @@
* @return a list of services exposed by the component
*/
List<ComponentService> getServices();
+
+ /**
+ * Returns a list of producers used by the component.
+ *
+ * @return a list of producers used by the component
+ */
+ List<ComponentProducer> getProducers();
+
+ /**
+ * Returns a list of consumers exposed by the component.
+ *
+ * @return a list of consumers exposed by the component
+ */
+ List<ComponentConsumer> getConsumers();
/**
* Returns a list of properties for the component.
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentType.java Tue Oct 21 02:04:28 2008
@@ -53,6 +53,21 @@
*/
List<Reference> getReferences();
+
+ /**
+ * Returns a list of consumers that are offered.
+ *
+ * @return a list of consumers that are offered
+ */
+ List<Consumer> getConsumers();
+
+ /**
+ * Returns the list of producer types that are used.
+ *
+ * @return the list of producer types that are used
+ */
+ List<Producer> getProducers();
+
/**
* Returns the list of properties that can be set.
*
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/BaseConfigurationBuilderImpl.java Tue Oct 21 02:04:28 2008
@@ -36,8 +36,12 @@
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.Consumer;
import org.apache.tuscany.sca.assembly.Contract;
+import org.apache.tuscany.sca.assembly.EventBinding;
+import org.apache.tuscany.sca.assembly.EventBindingFactory;
import org.apache.tuscany.sca.assembly.Implementation;
+import org.apache.tuscany.sca.assembly.Producer;
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.SCABinding;
@@ -67,6 +71,7 @@
private AssemblyFactory assemblyFactory;
private SCABindingFactory scaBindingFactory;
+ private EventBindingFactory eventBindingFactory;
private Monitor monitor;
private InterfaceContractMapper interfaceContractMapper;
private SCADefinitions policyDefinitions;
@@ -75,6 +80,7 @@
protected BaseConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
+ EventBindingFactory eventBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
InterfaceContractMapper interfaceContractMapper,
@@ -82,6 +88,7 @@
Monitor monitor) {
this.assemblyFactory = assemblyFactory;
this.scaBindingFactory = scaBindingFactory;
+ this.eventBindingFactory = eventBindingFactory;
this.documentBuilderFactory = documentBuilderFactory;
this.transformerFactory = transformerFactory;
this.interfaceContractMapper = interfaceContractMapper;
@@ -110,6 +117,8 @@
*/
private void configureComponents(Composite composite, String uri) {
String parentURI = uri;
+
+ configureProducersAndConsumers(composite);
// Process nested composites recursively
for (Component component : composite.getComponents()) {
@@ -1334,4 +1343,81 @@
return URI.create(baseURI.toString() + str).normalize();
}
+ private void configureProducersAndConsumers(Composite composite) {
+
+ for (Component component : composite.getComponents()) {
+ Implementation impl = component.getImplementation();
+ for (Producer producer : impl.getProducers()) {
+ Reference reference = assemblyFactory.createReference();
+ reference.setName(producer.getName());
+ reference.setInterfaceContract(producer.getInterfaceContract());
+ if (producer.getInterfaceContract() != null && producer.getInterfaceContract().getInterface() != null)
+ producer.getInterfaceContract().getInterface().setRemotable(true);
+ reference.setType(producer.getType());
+ reference.getApplicablePolicySets().addAll(producer.getApplicablePolicySets());
+ reference.getPolicySets().addAll(producer.getPolicySets());
+ reference.getRequiredIntents().addAll(producer.getRequiredIntents());
+ for (Binding binding : producer.getBindings()) {
+ EventBinding eventBinding = eventBindingFactory.createEventBinding();
+ eventBinding.setBaseBinding(binding);
+ reference.getBindings().add(binding);// FIXME: remove
+ reference.getBindings().add(eventBinding);
+ }
+ impl.getReferences().add(reference);
+ }
+
+ for (Producer producer : component.getProducers()) {
+ ComponentReference reference = assemblyFactory.createComponentReference();
+ reference.setName(producer.getName());
+ reference.setInterfaceContract(producer.getInterfaceContract());
+ if (producer.getInterfaceContract() != null && producer.getInterfaceContract().getInterface() != null)
+ producer.getInterfaceContract().getInterface().setRemotable(true);
+ reference.setType(producer.getType());
+ reference.getApplicablePolicySets().addAll(producer.getApplicablePolicySets());
+ reference.getPolicySets().addAll(producer.getPolicySets());
+ reference.getRequiredIntents().addAll(producer.getRequiredIntents());
+ for (Binding binding : producer.getBindings()) {
+ EventBinding eventBinding = eventBindingFactory.createEventBinding();
+ eventBinding.setBaseBinding(binding);
+ reference.getBindings().add(binding);// FIXME: remove
+ reference.getBindings().add(eventBinding);
+ }
+ component.getReferences().add(reference);
+ }
+
+ for (Consumer consumer : impl.getConsumers()) {
+ Service service = assemblyFactory.createService();
+ service.setName(consumer.getName());
+ service.setInterfaceContract(consumer.getInterfaceContract());
+ service.setType(consumer.getType());
+ service.getApplicablePolicySets().addAll(consumer.getApplicablePolicySets());
+ service.getPolicySets().addAll(consumer.getPolicySets());
+ service.getRequiredIntents().addAll(consumer.getRequiredIntents());
+ for (Binding binding : consumer.getBindings()) {
+ EventBinding eventBinding = eventBindingFactory.createEventBinding();
+ eventBinding.setBaseBinding(binding);
+ service.getBindings().add(binding);// FIXME: remove
+ service.getBindings().add(eventBinding);
+ }
+ impl.getServices().add(service);
+ }
+
+ for (Consumer consumer : component.getConsumers()) {
+ ComponentService service = assemblyFactory.createComponentService();
+ service.setName(consumer.getName());
+ service.setInterfaceContract(consumer.getInterfaceContract());
+ service.setType(consumer.getType());
+ service.getApplicablePolicySets().addAll(consumer.getApplicablePolicySets());
+ service.getPolicySets().addAll(consumer.getPolicySets());
+ service.getRequiredIntents().addAll(consumer.getRequiredIntents());
+ for (Binding binding : consumer.getBindings()) {
+ EventBinding eventBinding = eventBindingFactory.createEventBinding();
+ eventBinding.setBaseBinding(binding);
+ service.getBindings().add(binding); // FIXME: remove
+ service.getBindings().add(eventBinding);
+ }
+ component.getServices().add(service);
+ }
+ }
+ }
}
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/ComponentConfigurationBuilderImpl.java Tue Oct 21 02:04:28 2008
@@ -24,6 +24,7 @@
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EventBindingFactory;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
@@ -45,10 +46,11 @@
SCADefinitions policyDefinitions,
Monitor monitor) {
super(assemblyFactory, scaBindingFactory,
- null, null,
+ null, null, null,
interfaceContractMapper, policyDefinitions, monitor);
}
+ @Deprecated
public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
@@ -56,10 +58,25 @@
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
+ super(assemblyFactory, scaBindingFactory, null,
documentBuilderFactory, transformerFactory,
interfaceContractMapper, policyDefinitions, monitor);
}
+
+ public ComponentConfigurationBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ EventBindingFactory eventBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ super(assemblyFactory, scaBindingFactory, eventBindingFactory,
+ documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions, monitor);
+
+ }
public void build(Composite composite) throws CompositeBuilderException {
configureComponents(composite);
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBindingURIBuilderImpl.java Tue Oct 21 02:04:28 2008
@@ -24,6 +24,7 @@
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.EventBindingFactory;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
@@ -45,10 +46,11 @@
SCADefinitions policyDefinitions,
Monitor monitor) {
super(assemblyFactory, scaBindingFactory,
- null, null,
+ null, null, null,
interfaceContractMapper, policyDefinitions, monitor);
}
+ @Deprecated
public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
DocumentBuilderFactory documentBuilderFactory,
@@ -56,10 +58,24 @@
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
Monitor monitor) {
- super(assemblyFactory, scaBindingFactory,
+ super(assemblyFactory, scaBindingFactory, null,
documentBuilderFactory, transformerFactory,
interfaceContractMapper, policyDefinitions, monitor);
}
+
+ public CompositeBindingURIBuilderImpl(AssemblyFactory assemblyFactory,
+ SCABindingFactory scaBindingFactory,
+ EventBindingFactory eventBindingFactory,
+ DocumentBuilderFactory documentBuilderFactory,
+ TransformerFactory transformerFactory,
+ InterfaceContractMapper interfaceContractMapper,
+ SCADefinitions policyDefinitions,
+ Monitor monitor) {
+
+ super(assemblyFactory, scaBindingFactory, eventBindingFactory,
+ documentBuilderFactory, transformerFactory,
+ interfaceContractMapper, policyDefinitions, monitor);
+ }
public void build(Composite composite) throws CompositeBuilderException {
configureBindingURIsAndNames(composite);
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/builder/impl/CompositeBuilderImpl.java Tue Oct 21 02:04:28 2008
@@ -27,6 +27,7 @@
import org.apache.tuscany.sca.assembly.Composite;
import org.apache.tuscany.sca.assembly.DefaultEndpointFactory;
import org.apache.tuscany.sca.assembly.EndpointFactory;
+import org.apache.tuscany.sca.assembly.EventBindingFactory;
import org.apache.tuscany.sca.assembly.SCABindingFactory;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilder;
import org.apache.tuscany.sca.assembly.builder.CompositeBuilderException;
@@ -79,7 +80,7 @@
InterfaceContractMapper interfaceContractMapper,
SCADefinitions policyDefinitions,
Monitor monitor) {
- this(assemblyFactory, endpointFactory, scaBindingFactory, intentAttachPointTypeFactory,
+ this(assemblyFactory, endpointFactory, scaBindingFactory, null, intentAttachPointTypeFactory,
null, null, interfaceContractMapper, policyDefinitions, monitor);
}
@@ -100,7 +101,7 @@
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
InterfaceContractMapper interfaceContractMapper,
Monitor monitor) {
- this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
+ this(assemblyFactory, null, scaBindingFactory, null, intentAttachPointTypeFactory,
null, null, interfaceContractMapper, null, monitor);
}
@@ -117,12 +118,13 @@
*/
public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
SCABindingFactory scaBindingFactory,
+ EventBindingFactory eventBindingFactory,
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
InterfaceContractMapper interfaceContractMapper,
Monitor monitor) {
- this(assemblyFactory, null, scaBindingFactory, intentAttachPointTypeFactory,
+ this(assemblyFactory, null, scaBindingFactory, eventBindingFactory, intentAttachPointTypeFactory,
documentBuilderFactory, transformerFactory, interfaceContractMapper, null, monitor);
}
@@ -140,6 +142,7 @@
public CompositeBuilderImpl(AssemblyFactory assemblyFactory,
EndpointFactory endpointFactory,
SCABindingFactory scaBindingFactory,
+ EventBindingFactory eventBindingFactory,
IntentAttachPointTypeFactory intentAttachPointTypeFactory,
DocumentBuilderFactory documentBuilderFactory,
TransformerFactory transformerFactory,
@@ -156,10 +159,10 @@
componentReferencePromotionWireBuilder = new ComponentReferencePromotionWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
compositeReferenceWireBuilder = new CompositeReferenceWireBuilderImpl(assemblyFactory, endpointFactory, monitor);
compositeCloneBuilder = new CompositeCloneBuilderImpl(monitor);
- componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ componentConfigurationBuilder = new ComponentConfigurationBuilderImpl(assemblyFactory, scaBindingFactory, eventBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
compositeServiceConfigurationBuilder = new CompositeServiceConfigurationBuilderImpl(assemblyFactory);
compositeReferenceConfigurationBuilder = new CompositeReferenceConfigurationBuilderImpl(assemblyFactory);
- compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
+ compositeBindingURIBuilder = new CompositeBindingURIBuilderImpl(assemblyFactory, scaBindingFactory, eventBindingFactory, documentBuilderFactory, transformerFactory, interfaceContractMapper, policyDefinitions, monitor);
componentServicePromotionBuilder = new ComponentServicePromotionBuilderImpl(assemblyFactory);
compositeServicePromotionBuilder = new CompositeServicePromotionBuilderImpl(assemblyFactory);
compositePromotionBuilder = new CompositePromotionBuilderImpl(assemblyFactory, endpointFactory, interfaceContractMapper, monitor);
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/AssemblyFactoryImpl.java Tue Oct 21 02:04:28 2008
@@ -25,15 +25,21 @@
import org.apache.tuscany.sca.assembly.AssemblyFactory;
import org.apache.tuscany.sca.assembly.Callback;
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.ComponentProperty;
import org.apache.tuscany.sca.assembly.ComponentReference;
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.CompositeConsumer;
+import org.apache.tuscany.sca.assembly.CompositeProducer;
import org.apache.tuscany.sca.assembly.CompositeReference;
import org.apache.tuscany.sca.assembly.CompositeService;
import org.apache.tuscany.sca.assembly.ConfiguredOperation;
import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Consumer;
+import org.apache.tuscany.sca.assembly.Producer;
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
@@ -77,6 +83,15 @@
public ComponentService createComponentService() {
return new ComponentServiceImpl();
}
+
+
+ public ComponentProducer createComponentProducer() {
+ return new ComponentProducerImpl();
+ }
+
+ public ComponentConsumer createComponentConsumer() {
+ return new ComponentConsumerImpl();
+ }
public ComponentType createComponentType() {
return new ComponentTypeImpl();
@@ -93,6 +108,15 @@
public CompositeService createCompositeService() {
return new CompositeServiceImpl();
}
+
+
+ public CompositeProducer createCompositeProducer() {
+ return new CompositeProducerImpl();
+ }
+
+ public CompositeConsumer createCompositeConsumer() {
+ return new CompositeConsumerImpl();
+ }
public ConstrainingType createConstrainingType() {
return new ConstrainingTypeImpl();
@@ -109,6 +133,14 @@
public Service createService() {
return new ServiceImpl();
}
+
+ public Producer createProducer() {
+ return new ProducerImpl();
+ }
+
+ public Consumer createConsumer() {
+ return new ConsumerImpl();
+ }
public Wire createWire() {
return new WireImpl();
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentImpl.java Tue Oct 21 02:04:28 2008
@@ -22,6 +22,8 @@
import java.util.List;
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.ComponentProperty;
import org.apache.tuscany.sca.assembly.ComponentReference;
import org.apache.tuscany.sca.assembly.ComponentService;
@@ -46,6 +48,8 @@
private List<ComponentProperty> properties = new ArrayList<ComponentProperty>();
private List<ComponentReference> references = new ArrayList<ComponentReference>();
private List<ComponentService> services = new ArrayList<ComponentService>();
+ private List<ComponentProducer> producers = new ArrayList<ComponentProducer>();
+ private List<ComponentConsumer> consumers = new ArrayList<ComponentConsumer>();
private List<Intent> requiredIntents = new ArrayList<Intent>();
private List<PolicySet> policySets = new ArrayList<PolicySet>();
private Boolean autowire;
@@ -109,6 +113,14 @@
return services;
}
+ public List<ComponentProducer> getProducers() {
+ return producers;
+ }
+
+ public List<ComponentConsumer> getConsumers() {
+ return consumers;
+ }
+
public void setConstrainingType(ConstrainingType constrainingType) {
this.constrainingType = constrainingType;
}
Modified: tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java?rev=706556&r1=706555&r2=706556&view=diff
==============================================================================
--- tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java (original)
+++ tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/impl/ComponentTypeImpl.java Tue Oct 21 02:04:28 2008
@@ -23,6 +23,8 @@
import org.apache.tuscany.sca.assembly.ComponentType;
import org.apache.tuscany.sca.assembly.ConstrainingType;
+import org.apache.tuscany.sca.assembly.Consumer;
+import org.apache.tuscany.sca.assembly.Producer;
import org.apache.tuscany.sca.assembly.Property;
import org.apache.tuscany.sca.assembly.Reference;
import org.apache.tuscany.sca.assembly.Service;
@@ -38,6 +40,9 @@
private List<Property> properties = new ArrayList<Property>();
private List<Reference> references = new ArrayList<Reference>();
private List<Service> services = new ArrayList<Service>();
+ private List<Producer> producers = new ArrayList<Producer>();
+ private List<Consumer> consumers = new ArrayList<Consumer>();
+
/**
* Constructs a new component type.
*/
@@ -86,6 +91,15 @@
public List<Service> getServices() {
return services;
}
+
+
+ public List<Producer> getProducers() {
+ return producers;
+ }
+
+ public List<Consumer> getConsumers() {
+ return consumers;
+ }
public void setConstrainingType(ConstrainingType constrainingType) {
this.constrainingType = constrainingType;
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event;
+
+import java.net.URI;
+import java.net.URL;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+import java.security.PrivilegedExceptionAction;
+
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessor;
+import org.apache.tuscany.sca.contribution.processor.URLArtifactProcessorExtensionPoint;
+import org.apache.tuscany.sca.contribution.service.ContributionReadException;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.definitions.SCADefinitions;
+import org.apache.tuscany.sca.provider.SCADefinitionsProvider;
+import org.apache.tuscany.sca.provider.SCADefinitionsProviderException;
+
+/**
+ * Provider for Policy Intents and PolicySet definitions for event binding
+ *
+ * @version $$
+ */
+public class EventBindingDefinitionsProvider implements SCADefinitionsProvider {
+ private String definitionsFile = "org/apache/tuscany/sca/binding/sca/definitions.xml";
+ URLArtifactProcessor urlArtifactProcessor = null;
+
+ public EventBindingDefinitionsProvider(ExtensionPointRegistry registry) {
+ URLArtifactProcessorExtensionPoint documentProcessors = registry.getExtensionPoint(URLArtifactProcessorExtensionPoint.class);
+ urlArtifactProcessor = (URLArtifactProcessor)documentProcessors.getProcessor(SCADefinitions.class);
+ }
+
+ public SCADefinitions getSCADefinition() throws SCADefinitionsProviderException {
+ // Allow privileged access to load resource. Requires RuntimePermssion in security policy.
+ final URL definitionsFileUrl = AccessController.doPrivileged(new PrivilegedAction<URL>() {
+ public URL run() {
+ return getClass().getClassLoader().getResource(definitionsFile);
+ }
+ });
+
+ SCADefinitions scaDefn = null;
+ try {
+ final URI uri = new URI(definitionsFile);
+ // Allow bindings to read properties. Requires PropertyPermission read in security policy.
+ scaDefn = AccessController.doPrivileged(new PrivilegedExceptionAction<SCADefinitions>() {
+ public SCADefinitions run() throws ContributionReadException {
+ return (SCADefinitions)urlArtifactProcessor.read(null, uri, definitionsFileUrl);
+ }
+ });
+ } catch (Exception e) {
+ throw new SCADefinitionsProviderException(e);
+ }
+ return scaDefn;
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/EventBindingDefinitionsProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+import org.apache.tuscany.sca.assembly.EventBinding;
+import org.apache.tuscany.sca.assembly.EventBindingFactory;
+
+/**
+ * A factory for the Event binding model.
+ *
+ * @version $$
+ */
+public class EventBindingFactoryImpl implements EventBindingFactory {
+
+ public EventBindingFactoryImpl (){
+
+ }
+
+ public EventBinding createEventBinding() {
+ return new EventBindingImpl();
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingFactoryImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,243 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.event.impl;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.Binding;
+import org.apache.tuscany.sca.assembly.Component;
+import org.apache.tuscany.sca.assembly.ComponentService;
+import org.apache.tuscany.sca.assembly.EventBinding;
+import org.apache.tuscany.sca.assembly.Extensible;
+import org.apache.tuscany.sca.assembly.OptimizableBinding;
+import org.apache.tuscany.sca.assembly.builder.AutomaticBinding;
+import org.apache.tuscany.sca.policy.Intent;
+import org.apache.tuscany.sca.policy.IntentAttachPointType;
+import org.apache.tuscany.sca.policy.PolicySet;
+import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
+
+/**
+ * The assembly mode object for an Event binding.
+ *
+ * @version $$
+ */
+public class EventBindingImpl implements EventBinding, Extensible, PolicySetAttachPoint, OptimizableBinding, AutomaticBinding {
+ private String name;
+ private String uri;
+ private Binding baseBinding;
+ private List<Object> extensions = new ArrayList<Object>();
+ private List<Intent> requiredIntents = new ArrayList<Intent>();
+ private List<PolicySet> policySets = new ArrayList<PolicySet>();
+ private IntentAttachPointType intentAttachPointType;
+
+ private Component targetComponent;
+ private ComponentService targetComponentService;
+ private Binding targetBinding;
+ private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
+
+ private boolean isAutomatic = false;
+
+ public List<PolicySet> getApplicablePolicySets() {
+ return applicablePolicySets;
+ }
+
+ /**
+ * Constructs a new SCA binding.
+ */
+ protected EventBindingImpl() {
+ }
+
+ // Event Binding operations
+
+ /**
+ * Setters for the binding name. Defaults to the
+ * name of the service or reference with which the binding is
+ * associated
+ *
+ * @return the binding name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * Setter for the binding name
+ *
+ * @param name the binding name
+ */
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ /**
+ * Getters for the binding URI. The computed URI for the
+ * service that the reference is targeting or which the service represents
+ * depending on whether the biding is associated with a reference or
+ * service
+ *
+ * @return the binding URI
+ */
+ public String getURI() {
+ return uri;
+ }
+
+ /**
+ * Setter for the binding URI
+ *
+ * @param uri the binding URI
+ */
+ public void setURI(String uri) {
+ this.uri = uri;
+ }
+
+
+ /**
+ * Getter for the base binding
+ *
+ * @return base binding
+ */
+ public Binding getBaseBinding() {
+ return baseBinding;
+ }
+
+ /**
+ * Setter for the base binding
+ *
+ * @param baseBinding the base binding
+ */
+ public void setBaseBinding(Binding baseBinding) {
+ this.baseBinding = baseBinding;
+ }
+
+ /**
+ * Returns a list of extension objects contained in this model object.
+ *
+ * @return a list of extension objects container in this model object
+ */
+ public List<Object> getExtensions() {
+ return extensions;
+ }
+
+ /**
+ * Returns true if the model element is unresolved.
+ *
+ * @return true if the model element is unresolved.
+ */
+ public boolean isUnresolved() {
+ if (targetComponentService == null){
+ return true;
+ } else {
+ return targetComponentService.isUnresolved();
+ }
+ }
+
+ /**
+ * Sets whether the model element is unresolved.
+ *
+ * @param unresolved whether the model element is unresolved
+ */
+ public void setUnresolved(boolean unresolved) {
+ }
+
+ /**
+ * @see java.lang.Object#clone()
+ */
+ @Override
+ public Object clone() throws CloneNotSupportedException {
+ return super.clone();
+ }
+
+ public List<PolicySet> getPolicySets() {
+ return policySets;
+ }
+
+ public List<Intent> getRequiredIntents() {
+ return requiredIntents;
+ }
+
+ public IntentAttachPointType getType() {
+ return intentAttachPointType;
+ }
+
+ public void setType(IntentAttachPointType intentAttachPointType) {
+ this.intentAttachPointType = intentAttachPointType;
+ }
+
+ // Wireable binding operations
+
+ /**
+ * @return the targetComponent
+ */
+ public Component getTargetComponent() {
+ return targetComponent;
+ }
+
+ /**
+ * @param targetComponent the targetComponent to set
+ */
+ public void setTargetComponent(Component targetComponent) {
+ this.targetComponent = targetComponent;
+ }
+
+ /**
+ * @return the targetComponentService
+ */
+ public ComponentService getTargetComponentService() {
+ return targetComponentService;
+ }
+
+ /**
+ * @param targetComponentService the targetComponentService to set
+ */
+ public void setTargetComponentService(ComponentService targetComponentService) {
+ this.targetComponentService = targetComponentService;
+ }
+
+ /**
+ * @return the targetBinding
+ */
+ public Binding getTargetBinding() {
+ return targetBinding;
+ }
+
+ /**
+ * @param targetBinding the targetBinding to set
+ */
+ public void setTargetBinding(Binding targetBinding) {
+ this.targetBinding = targetBinding;
+ }
+
+ public void setPolicySets(List<PolicySet> policySets) {
+ this.policySets = policySets;
+ }
+
+ public void setRequiredIntents(List<Intent> intents) {
+ this.requiredIntents = intents;
+ }
+
+
+ public void setIsAutomatic(boolean isAutomatic){
+ this.isAutomatic = isAutomatic;
+ }
+
+ public boolean getIsAutomatic(){
+ return this.isAutomatic;
+ }
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingImpl.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,72 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+import org.apache.tuscany.sca.invocation.Interceptor;
+import org.apache.tuscany.sca.invocation.InvocationChain;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.invocation.Message;
+import org.apache.tuscany.sca.invocation.DataExchangeSemantics;
+
+/**
+ * TODO: Implement event binding invoker
+ * @version $$
+ */
+public class EventBindingInvoker implements Interceptor, DataExchangeSemantics {
+ private InvocationChain chain;
+
+ /**
+ * Construct a EventBindingInvoker that delegates to the service invocaiton chain
+ * @param chain
+ */
+ public EventBindingInvoker(InvocationChain chain) {
+ super();
+ this.chain = chain;
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#getNext()
+ */
+ public Invoker getNext() {
+ return chain.getHeadInvoker();
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Interceptor#setNext(org.apache.tuscany.sca.invocation.Invoker)
+ */
+ public void setNext(Invoker next) {
+ // NOOP
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.Invoker#invoke(org.apache.tuscany.sca.invocation.Message)
+ */
+ public Message invoke(Message msg) {
+ return getNext().invoke(msg);
+ }
+
+ /**
+ * @see org.apache.tuscany.sca.invocation.DataExchangeSemantics#allowsPassByReference()
+ */
+ public boolean allowsPassByReference() {
+ return chain.allowsPassByReference();
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingInvoker.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * The Event Binding provider implementation.
+ *
+ * @version $$
+ */
+public class EventBindingProvider implements ReferenceBindingProvider {
+
+ private RuntimeComponentReference reference;
+
+ public EventBindingProvider(RuntimeComponent component, RuntimeComponentReference reference, EventBindingImpl binding) {
+ this.reference = reference;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ return reference.getInterfaceContract();
+ }
+
+ public Invoker createInvoker(Operation operation) {
+ return null;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,60 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.provider.BindingProviderFactory;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The factory for creating Event Binding providers
+ *
+ * @version $$
+ */
+public class EventBindingProviderFactory implements BindingProviderFactory<EventBindingImpl> {
+
+ private ExtensionPointRegistry extensionPoints;
+
+ public EventBindingProviderFactory(ExtensionPointRegistry extensionPoints) {
+ this.extensionPoints = extensionPoints;
+
+ }
+
+ public ReferenceBindingProvider createReferenceBindingProvider(RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EventBindingImpl binding) {
+
+ return new EventReferenceBindingProvider(extensionPoints, component, reference, binding);
+ }
+
+ public ServiceBindingProvider createServiceBindingProvider(RuntimeComponent component,
+ RuntimeComponentService service,
+ EventBindingImpl binding) {
+ return new EventServiceBindingProvider(extensionPoints, component, service, binding);
+ }
+
+ public Class<EventBindingImpl> getModelType() {
+ return EventBindingImpl.class;
+ }
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventBindingProviderFactory.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,97 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+import java.util.logging.Logger;
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.invocation.Invoker;
+import org.apache.tuscany.sca.provider.ReferenceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentReference;
+
+/**
+ * Event reference binding provider
+ *
+ * @version $$
+ */
+public class EventReferenceBindingProvider implements ReferenceBindingProvider {
+
+ @SuppressWarnings("unused")
+ private static final Logger logger = Logger.getLogger(EventReferenceBindingProvider.class.getName());
+
+ @SuppressWarnings("unused")
+ private RuntimeComponent component;
+ @SuppressWarnings("unused")
+ private EventBindingImpl binding;
+ private RuntimeComponentReference reference;
+ private boolean started = false;
+ private ReferenceBindingProvider baseBindingProvider;
+
+
+ public EventReferenceBindingProvider(ExtensionPointRegistry extensionPoints,
+ RuntimeComponent component,
+ RuntimeComponentReference reference,
+ EventBindingImpl binding) {
+ this.component = component;
+ this.reference = reference;
+ this.binding = binding;
+
+ // TODO: Set baseBindingProvider
+ }
+
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (reference.getReference() != null) {
+ return reference.getReference().getInterfaceContract();
+ } else {
+ return reference.getInterfaceContract();
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+
+ public Invoker createInvoker(Operation operation) {
+ return baseBindingProvider.createInvoker(operation);
+ }
+
+ public void start() {
+ if (started) {
+ return;
+ } else {
+ started = true;
+ }
+ }
+
+ public void stop() {
+ if (!started) {
+ return;
+ } else {
+ started = false;
+ }
+
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventReferenceBindingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java Tue Oct 21 02:04:28 2008
@@ -0,0 +1,63 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.binding.event.impl;
+
+
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.interfacedef.InterfaceContract;
+import org.apache.tuscany.sca.provider.ServiceBindingProvider;
+import org.apache.tuscany.sca.runtime.RuntimeComponent;
+import org.apache.tuscany.sca.runtime.RuntimeComponentService;
+
+/**
+ * The event service binding provider
+ *
+ * @version $$
+ */
+public class EventServiceBindingProvider implements ServiceBindingProvider {
+
+ private RuntimeComponentService service;
+
+ public EventServiceBindingProvider(ExtensionPointRegistry extensionPoints,
+ RuntimeComponent component,
+ RuntimeComponentService service,
+ EventBindingImpl binding) {
+ this.service = service;
+ }
+
+ public InterfaceContract getBindingInterfaceContract() {
+ if (service.getService() != null) {
+ return service.getService().getInterfaceContract();
+ } else {
+ return service.getInterfaceContract();
+ }
+ }
+
+ public boolean supportsOneWayInvocation() {
+ return true;
+ }
+
+ public void start() {
+ }
+
+ public void stop() {
+ }
+
+}
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: tuscany/sandbox/event/modules/binding-event/src/main/java/org/apache/tuscany/sca/binding/event/impl/EventServiceBindingProvider.java
------------------------------------------------------------------------------
svn:keywords = Rev Date
Added: tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory
URL: http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory?rev=706556&view=auto
==============================================================================
--- tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory (added)
+++ tuscany/sandbox/event/modules/binding-event/src/main/resources/META-INF/services/org.apache.tuscany.sca.assembly.EventBindingFactory Tue Oct 21 02:04:28 2008
@@ -0,0 +1,18 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements. See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership. The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied. See the License for the
+# specific language governing permissions and limitations
+# under the License.
+
+org.apache.tuscany.sca.binding.event.impl.EventBindingFactoryImpl