Author: rsivaram
Date: Tue Oct 21 03:26:17 2008
New Revision: 706572

URL: http://svn.apache.org/viewvc?rev=706572&view=rev
Log:
Event prototype: initial model changes

Added:
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
   (with props)
    
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
   (with props)
    
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
   (with props)
    
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
   (with props)
    
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
   (with props)
    
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
   (with props)
    
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
   (with props)

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,32 @@
+/*
+ * 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.assembly;
+
+
+/**
+ * Represents a component consumer.
+ * 
+ * @version $$
+ */
+public interface ComponentConsumer extends Consumer {
+    
+    Consumer getConsumer();
+    void setConsumer(Consumer consumer);
+
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,33 @@
+/*
+ * 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.assembly;
+
+
+
+/**
+ * Represents a component producer.
+ * 
+ * @version $$
+ */
+public interface ComponentProducer extends Producer {
+    
+    Producer getProducer();
+    void setProducer(Producer producer);
+    
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/ComponentProducer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.assembly;
+
+
+/**
+ * Represents a composite consumer.
+ * 
+ * @version $$
+ */
+public interface CompositeConsumer extends Consumer {
+    
+
+
+    /**
+     * Returns the promoted component.
+     * 
+     * @return the promoted component.
+     */
+    Component getPromotedComponent();
+
+    /**
+     * Sets the promoted component
+     * 
+     * @param promotedComponent the promoted component.
+     */
+    void setPromotedComponent(Component promotedComponent);
+    
+    ComponentConsumer getPromotedConsumer();
+    void setPromotedConsumer(ComponentConsumer consumer);
+}
\ No newline at end of file

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeConsumer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,47 @@
+/*
+ * 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.assembly;
+
+
+/**
+ * Represents a composite producer.
+ * 
+ * @version $$
+ */
+public interface CompositeProducer extends Producer {
+    
+
+
+    /**
+     * Returns the promoted component.
+     * 
+     * @return the promoted component.
+     */
+    Component getPromotedComponent();
+
+    /**
+     * Sets the promoted component
+     * 
+     * @param promotedComponent the promoted component.
+     */
+    void setPromotedComponent(Component promotedComponent);
+    
+    ComponentProducer getPromotedProducer();
+    void setPromotedProducer(ComponentProducer producer);
+}
\ No newline at end of file

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/CompositeProducer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,38 @@
+/*
+ * 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.assembly;
+
+import java.util.List;
+
+
+/**
+ * Represents a consumer.
+ * 
+ * @version $$
+ */
+public interface Consumer extends EventTarget, Contract {
+
+    
+    List<EventSource> getSources();
+    
+    String getOperationName();
+    
+    void setOperationName(String operationName);
+
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Consumer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,31 @@
+/*
+ * 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.assembly;
+
+/**
+ * Represents an Event binding.
+ * 
+ * @version $$
+ */
+public interface EventBinding extends Binding {
+       
+       Binding getBaseBinding();
+       
+       void setBaseBinding(Binding baseBinding);
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBinding.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.assembly;
+
+
+/**
+ * A factory for the Event binding model
+ * 
+ * @version $$
+ */
+public interface EventBindingFactory {
+
+    /**
+     * Create a new Event binding.
+     * 
+     * @return a new Event binding
+     */
+    EventBinding createEventBinding();
+
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventBindingFactory.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.assembly;
+
+public interface EventSource extends Base, Extensible, Cloneable {
+    
+    /**
+     * Returns the name of the source.
+     * 
+     * @return the name of the source
+     */
+    String getName();
+
+    /**
+     * Sets the name of the source.
+     * 
+     * @param name the name of the source
+     */
+    void setName(String name);
+    
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventSource.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,37 @@
+/*
+ * 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.assembly;
+
+public interface EventTarget extends Base, Extensible, Cloneable {
+    
+    /**
+     * Returns the name of the target.
+     * 
+     * @return the name of the target
+     */
+    String getName();
+
+    /**
+     * Sets the name of the target.
+     * 
+     * @param name the name of the target
+     */
+    void setName(String name);
+    
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/EventTarget.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
 (added)
+++ 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,34 @@
+/*
+ * 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.assembly;
+
+import java.util.List;
+
+
+/**
+ * Represents a producer
+ * 
+ * @version $$
+ */
+public interface Producer extends EventSource, Contract {
+    
+    List<EventTarget> getTargets();
+    
+
+}

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/assembly/src/main/java/org/apache/tuscany/sca/assembly/Producer.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
 (added)
+++ 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
 Tue Oct 21 03:26:17 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.logging.Logger;
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Service;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+
+/**
+ * Processes an [EMAIL PROTECTED] org.osoa.sca.annotations.Service} annotation 
and updates
+ * the component type with corresponding [EMAIL PROTECTED] Service}s. Also 
processes
+ * related [EMAIL PROTECTED] org.osoa.sca.annotations.Callback} annotations.
+ * 
+ * @version $$
+ */
+public class ConsumerProcessor extends BaseJavaClassVisitor {
+       @SuppressWarnings("unused")
+    private static final Logger logger = 
Logger.getLogger(ConsumerProcessor.class.getName());
+
+    private JavaInterfaceFactory javaFactory;
+    
+    public ConsumerProcessor(AssemblyFactory assemblyFactory, 
JavaInterfaceFactory javaFactory) {
+        super(assemblyFactory);
+        this.javaFactory = javaFactory;
+    }
+    
+    @Override
+    public void visitMethod(Method method, JavaImplementation type) throws 
IntrospectionException {
+
+       org.osoa.sca.annotations.Consumer annotation = 
method.getAnnotation(org.osoa.sca.annotations.Consumer.class);
+        if (annotation == null) {
+            return;
+        }
+        if(Modifier.isPrivate(method.getModifiers())) {
+            throw new IllegalConsumerException("Illegal annotation @Consumer 
found on "+method, method);
+        }
+        if (method.getParameterTypes().length != 1) {
+            throw new IllegalConsumerException("Consumer must have one 
parameter", method);
+        }
+        JavaElementImpl element = new 
JavaElementImpl(method.getDeclaringClass());
+        try {
+                       createConsumer(type, element, annotation.name(), 
method.getName());
+               } catch (InvalidInterfaceException e) {
+                       throw new IntrospectionException(e);
+               }
+    }
+
+    /**
+     * @param type
+     * @param element
+     * @throws IllegalConsumerException
+     */
+    private void createConsumer(JavaImplementation type, JavaElementImpl 
element, String consumerName, String operationName)
+        throws IllegalConsumerException, InvalidInterfaceException {
+       
+        Class<?> consumerClass = element.getType();
+        
+        org.apache.tuscany.sca.assembly.Consumer consumer = 
assemblyFactory.createConsumer();
+        JavaInterfaceContract interfaceContract = 
javaFactory.createJavaInterfaceContract();
+        consumer.setInterfaceContract(interfaceContract);
+        consumer.setName(consumerName);       
+        JavaInterface consumerInterface = javaFactory.createJavaInterface();
+        consumerInterface.setRemotable(true);
+        javaFactory.createJavaInterface(consumerInterface, consumerClass);
+        consumer.getInterfaceContract().setInterface(consumerInterface);
+        consumer.setOperationName(operationName);
+
+        type.getConsumers().add(consumer);
+    }
+    
+
+}

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ConsumerProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
 (added)
+++ 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,35 @@
+/*
+ * 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.implementation.java.introspect.impl;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Thrown when an implementation has more than one producer injection site 
with the same name
+ *
+ * @version $$
+ */
+public class DuplicateProducerException extends IntrospectionException {
+    private static final long serialVersionUID = 907910648213477158L;
+
+    public DuplicateProducerException(String message) {
+        super(message);
+    }
+
+}

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/DuplicateProducerException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
 (added)
+++ 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
 Tue Oct 21 03:26:17 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal use of [EMAIL PROTECTED] 
org.osoa.sca.annotations.Consumer} 
+ *
+ * @version $$
+ */
+public class IllegalConsumerException extends IntrospectionException {
+    private static final long serialVersionUID = -8932525723147700591L;
+
+    public IllegalConsumerException(String message) {
+        super(message);
+    }
+    
+    public IllegalConsumerException(String message, Member member) {
+        super(message, member);
+    }
+}

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalConsumerException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
 (added)
+++ 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,41 @@
+/*
+ * 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.implementation.java.introspect.impl;
+
+import java.lang.reflect.Member;
+
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+
+/**
+ * Denotes an illegal producer definition in a component type
+ *
+ * @version $$
+ */
+public class IllegalProducerException extends IntrospectionException {
+       
+    private static final long serialVersionUID = 4612984122225271395L;
+
+    public IllegalProducerException(String message) {
+        super(message);
+    }
+    
+    public IllegalProducerException(String message, Member member) {
+        super(message, member);
+    }
+}

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/IllegalProducerException.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java?rev=706572&view=auto
==============================================================================
--- 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
 (added)
+++ 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
 Tue Oct 21 03:26:17 2008
@@ -0,0 +1,178 @@
+/*
+ * 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.implementation.java.introspect.impl;
+
+import static 
org.apache.tuscany.sca.implementation.java.introspect.impl.JavaIntrospectionHelper.getBaseType;
+
+import java.lang.annotation.ElementType;
+import java.lang.reflect.Field;
+import java.lang.reflect.Method;
+import java.lang.reflect.Type;
+import java.util.List;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.implementation.java.IntrospectionException;
+import org.apache.tuscany.sca.implementation.java.JavaImplementation;
+import org.apache.tuscany.sca.implementation.java.impl.JavaElementImpl;
+import org.apache.tuscany.sca.implementation.java.impl.JavaParameterImpl;
+import org.apache.tuscany.sca.interfacedef.InvalidInterfaceException;
+import org.apache.tuscany.sca.interfacedef.Operation;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterface;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceContract;
+import org.apache.tuscany.sca.interfacedef.java.JavaInterfaceFactory;
+import org.osoa.sca.annotations.Producer;
+
+/**
+ * Processes an [EMAIL PROTECTED] @Producer} annotation, updating the 
component type 
+ * 
+ * @version $$
+ */
+public class ProducerProcessor extends BaseJavaClassVisitor {
+    private JavaInterfaceFactory javaFactory;
+
+    public ProducerProcessor(AssemblyFactory assemblyFactory, 
JavaInterfaceFactory javaFactory) {
+        super(assemblyFactory);
+        this.javaFactory = javaFactory;
+    }
+
+    @Override
+    public void visitMethod(Method method, JavaImplementation type) throws 
IntrospectionException {
+        Producer annotation = method.getAnnotation(Producer.class);
+        if (annotation == null) {
+            return; // Not a producer annotation.
+        }
+        if (!JavaIntrospectionHelper.isSetter(method)) {
+            throw new IllegalProducerException("Annotated method is not a 
setter: " + method, method);
+        }
+        String name = annotation.name();
+        if ("".equals(name)) {
+            name = JavaIntrospectionHelper.toPropertyName(method.getName());
+        }
+        JavaElementImpl prod = type.getReferenceMembers().get(name);
+        // Setter override field
+        if (prod != null && prod.getElementType() != ElementType.FIELD) {
+            throw new DuplicateProducerException(name);
+        }
+        removeProducer(prod, type);
+
+        JavaElementImpl element = new JavaElementImpl(method, 0);
+        org.apache.tuscany.sca.assembly.Producer producer = 
createProducer(element, name);
+        type.getProducers().add(producer);
+        type.getReferenceMembers().put(name, element);
+    }
+
+    private boolean removeProducer(JavaElementImpl producer, 
JavaImplementation type) {
+        if (producer == null) {
+            return false;
+        }
+        List<org.apache.tuscany.sca.assembly.Producer> producers = 
type.getProducers();
+        for (int i = 0; i < producers.size(); i++) {
+            if (producers.get(i).getName().equals(producer.getName())) {
+               producers.remove(i);
+                return true;
+            }
+        }
+        return false;
+    }
+
+    @Override
+    public void visitField(Field field, JavaImplementation type) throws 
IntrospectionException {
+        Producer annotation = field.getAnnotation(Producer.class);
+        if (annotation == null) {
+            return;
+        }
+        String name = annotation.name();
+        if ("".equals(name)) {
+            name = field.getName();
+        }
+        JavaElementImpl prod = type.getReferenceMembers().get(name);
+        if (prod != null && prod.getElementType() == ElementType.FIELD) {
+            throw new DuplicateProducerException(name);
+        }
+
+        // Setter method override field
+        if (prod == null) {
+            JavaElementImpl element = new JavaElementImpl(field);
+            org.apache.tuscany.sca.assembly.Producer producer = 
createProducer(element, name);
+            type.getProducers().add(producer);
+            type.getReferenceMembers().put(name, element);
+        }
+    }
+
+    @Override
+    public void visitConstructorParameter(JavaParameterImpl parameter, 
JavaImplementation type)
+        throws IntrospectionException {
+        Producer refAnnotation = parameter.getAnnotation(Producer.class);
+        if (refAnnotation == null) {
+            return;
+        }
+        String paramName = parameter.getName();
+        String name = getProducerName(paramName, parameter.getIndex(), 
refAnnotation.name());
+        JavaElementImpl prod = type.getReferenceMembers().get(name);
+
+        // Setter override field
+        if (prod != null && prod.getElementType() != ElementType.FIELD) {
+            throw new DuplicateProducerException(name);
+        }
+
+        removeProducer(prod, type);
+        org.apache.tuscany.sca.assembly.Producer producer = 
createProducer(parameter, name);
+        type.getProducers().add(producer);
+        type.getReferenceMembers().put(name, parameter);
+        parameter.setClassifer(Producer.class);
+        parameter.setName(name);
+    }
+
+    private String getProducerName(String paramName, int pos, String name) 
throws InvalidConstructorException {
+        if ("".equals(name)) {
+            name = paramName;
+        }
+        if ("".equals(name)) {
+            return "_producer" + pos;
+        }
+        if (!"".equals(paramName) && !name.equals(paramName)) {
+            throw new InvalidConstructorException("Mismatching names specified 
for producer parameter " + pos);
+        } else {
+            return name;
+        }
+    }
+
+    private org.apache.tuscany.sca.assembly.Producer 
createProducer(JavaElementImpl element, String name)
+        throws IntrospectionException {
+       
+        org.apache.tuscany.sca.assembly.Producer producer = 
assemblyFactory.createProducer();
+        JavaInterfaceContract interfaceContract = 
javaFactory.createJavaInterfaceContract();
+        producer.setInterfaceContract(interfaceContract);
+        producer.setName(name);
+        Class<?> rawType = element.getType();
+        Type genericType = element.getGenericType();
+        Class<?> baseType = getBaseType(rawType, genericType);
+        try {
+            JavaInterface interfaze = 
javaFactory.createJavaInterface(baseType);
+            producer.getInterfaceContract().setInterface(interfaze);
+            
+            for (Operation op : interfaze.getOperations()) {
+               op.setNonBlocking(true);
+            }
+        } catch (InvalidInterfaceException e) {
+            throw new IntrospectionException(e);
+        }
+        return producer;
+    }
+}

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/sandbox/event/modules/implementation-java/src/main/java/org/apache/tuscany/sca/implementation/java/introspect/impl/ProducerProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date


Reply via email to