tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From isil...@apache.org
Subject svn commit: r551614 [4/5] - in /incubator/tuscany/java/sca/modules/binding-notification: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/tuscany/ src/main/java/org/apache/tuscany/sca/ src/main/java...
Date Thu, 28 Jun 2007 16:30:55 GMT
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Neighbors.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,45 @@
+/*
+ * 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.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Neighbors implements EncodingObject {
+    
+    private List<Broker> brokerSequence;
+    
+    public List<Broker> getBrokerSequence() {
+        return brokerSequence;
+    }
+
+    public void addBrokerToSequence(Broker broker) {
+        if(this.brokerSequence == null) {
+            this.brokerSequence = new ArrayList<Broker>();
+        }
+        this.brokerSequence.add(broker);
+    }
+    
+    public void setBrokerSequence(List<Broker> brokerSequence) {
+        this.brokerSequence = brokerSequence;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborsEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,87 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NeighborsEnDeCoder extends AbstractEnDeCoder<Neighbors> {
+
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Neighbors);
+    
+    public NeighborsEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(Neighbors encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            QName qName = getEncodingObjectQName();
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+            if (encodingObject.getBrokerSequence() != null) {
+                for (Broker broker : encodingObject.getBrokerSequence()) {
+                    registry.encode(broker, writer);
+                }
+            }
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public Neighbors decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            Neighbors neighborsElement = new Neighbors();
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject encodingObject = registry.decode(reader);
+                        neighborsElement.addBrokerToSequence((Broker)encodingObject);
+                        break;
+                    case END_ELEMENT:
+                        return neighborsElement;
+                }
+            }
+        } catch (XMLStreamException ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<Neighbors> getEncodingObjectType() {
+        
+        return Neighbors.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBroker.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBroker extends AbstractBroker {
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAck.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerAck implements EncodingObject {
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerAckEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,75 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerAckEnDeCoder extends AbstractEnDeCoder<NewBrokerAck> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerAck);
+    
+    public NewBrokerAckEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(NewBrokerAck encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public NewBrokerAck decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            NewBrokerAck newBrokerAck = new NewBrokerAck();
+            while (true) {
+                switch (reader.next()) {
+                    case END_ELEMENT:
+                        return newBrokerAck;
+                }
+            }
+        } catch (Exception ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<NewBrokerAck> getEncodingObjectType() {
+        
+        return NewBrokerAck.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerEnDeCoder extends AbstractBrokerEnDeCoder<NewBroker> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBroker);
+        
+    public NewBrokerEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<NewBroker> getEncodingObjectType() {
+        
+        return NewBroker.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponse.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,62 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerResponse implements EncodingObject {
+
+    private EndProducers endProducers;
+    private EndConsumers endConsumers;
+    private Brokers brokers;
+    private boolean firstBroker;
+    
+    public EndProducers getEndProducers() {
+        return this.endProducers;
+    }
+    
+    public void setEndProducers(EndProducers endProducers) {
+        this.endProducers = endProducers;
+    }
+    
+    public EndConsumers getEndConsumers() {
+        return this.endConsumers;
+    }
+    
+    public void setEndConsumers(EndConsumers endConsumers) {
+        this.endConsumers = endConsumers;
+    }
+    
+    public Brokers getBrokers() {
+        return this.brokers;
+    }
+    
+    public void setBrokers(Brokers brokers) {
+        this.brokers = brokers;
+    }
+    
+    public boolean isFirstBroker() {
+        return this.firstBroker;
+    }
+    
+    public void setFirstBroker(boolean firstBroker) {
+        this.firstBroker = firstBroker;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewBrokerResponseEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,117 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewBrokerResponseEnDeCoder extends AbstractEnDeCoder<NewBrokerResponse> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewBrokerResponse);
+        
+    public NewBrokerResponseEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(NewBrokerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            QName qName = getEncodingObjectQName();
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, qName.getLocalPart(), qName.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, qName.getNamespaceURI());
+            writer.writeAttribute(Constants.FirstBroker, String.valueOf(encodingObject.isFirstBroker()));
+            if (encodingObject.isFirstBroker()) {
+                registry.encode(encodingObject.getEndConsumers(), writer);
+                registry.encode(encodingObject.getEndProducers(), writer);
+            }
+            else {
+                registry.encode(encodingObject.getBrokers(), writer);
+            }
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public NewBrokerResponse decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            NewBrokerResponse newBrokerResponseElement = new NewBrokerResponse();
+            boolean firstBroker = Boolean.parseBoolean(reader.getAttributeValue(null, Constants.FirstBroker));
+            newBrokerResponseElement.setFirstBroker(firstBroker);
+            boolean haveEC = false;
+            boolean haveEP = false;
+            boolean haveB = false;
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject encodingObject = registry.decode(reader);
+                        if (encodingObject instanceof EndProducers && !haveEP && firstBroker) {
+                            newBrokerResponseElement.setEndProducers((EndProducers)encodingObject);
+                            haveEP = true;
+                        }
+                        else if(encodingObject instanceof EndConsumers && !haveEC && firstBroker) {
+                            newBrokerResponseElement.setEndConsumers((EndConsumers)encodingObject);
+                            haveEC = true;
+                        }
+                        else if(encodingObject instanceof Brokers && !haveB && !firstBroker) {
+                            newBrokerResponseElement.setBrokers((Brokers)encodingObject);
+                            haveB = true;
+                        }
+                        else {
+                            throw new EncodingException("Invalid encoding object");
+                        }
+                        break;
+                    case END_ELEMENT:
+                        if (!haveEP && firstBroker) {
+                            throw new EncodingException("Missing end producers");
+                        }
+                        if (!haveEC && firstBroker) {
+                            throw new EncodingException("Missing end consumers");
+                        }
+                        if (!haveB && !firstBroker) {
+                            throw new EncodingException("Missing brokers");
+                        }
+                        return newBrokerResponseElement;
+                }
+            }
+        } catch (Exception ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<NewBrokerResponse> getEncodingObjectType() {
+        
+        return NewBrokerResponse.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumer.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumer extends EndpointReferenceWrapper {
+
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewConsumer> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumer);
+
+    public NewConsumerEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        return QNAME;
+    }
+
+    protected Class<NewConsumer> getEncodingObjectType() {
+        return NewConsumer.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponse.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerResponse extends EndpointReferenceSequence {
+
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewConsumerResponseEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewConsumerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewConsumerResponse> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewConsumerResponse);
+
+    public NewConsumerResponseEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        return QNAME;
+    }
+
+    protected Class<NewConsumerResponse> getEncodingObjectType() {
+        return NewConsumerResponse.class;
+    }
+
+    protected void encodeSequenceTypeAttribute(NewConsumerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+        try {
+            writer.writeAttribute(Constants.ProducerSequenceType, encodingObject.getSequenceType());
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+    
+    protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+        return reader.getAttributeValue(null, Constants.ProducerSequenceType);
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducer.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducer extends EndpointReferenceWrapper {
+
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<NewProducer> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducer);
+
+    public NewProducerEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        return QNAME;
+    }
+
+    protected Class<NewProducer> getEncodingObjectType() {
+        return NewProducer.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponse.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerResponse extends EndpointReferenceSequence {
+
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NewProducerResponseEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,57 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class NewProducerResponseEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NewProducerResponse> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NewProducerResponse);
+
+    public NewProducerResponseEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        return QNAME;
+    }
+
+    protected Class<NewProducerResponse> getEncodingObjectType() {
+        return NewProducerResponse.class;
+    }
+
+    protected void encodeSequenceTypeAttribute(NewProducerResponse encodingObject, XMLStreamWriter writer) throws EncodingException {
+        try {
+            writer.writeAttribute(Constants.ConsumerSequenceType, encodingObject.getSequenceType());
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+    
+    protected String decodeSequenceTypeAttribute(XMLStreamReader reader) {
+        return reader.getAttributeValue(null, Constants.ConsumerSequenceType);
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferenceProperties.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,54 @@
+/*
+ * 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.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferenceProperties implements EncodingObject {
+    
+    private List<EncodingObject> properties;
+    
+    public List<EncodingObject> getProperties() {
+        return properties;
+    }
+
+    public void addProperty(EncodingObject property) {
+        if(this.properties == null) {
+            this.properties = new ArrayList<EncodingObject>();
+        }
+        this.properties.add(property);
+    }
+    
+    @SuppressWarnings("unchecked")
+    public <E extends EncodingObject> E getProperty(Class<E> propertyType) {
+        if (this.properties == null) {
+            return null;
+        }
+        for (EncodingObject eo : properties) {
+            if (propertyType.isInstance(eo)) {
+                return (E)eo;
+            }
+        }
+        return null;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReferencePropertiesEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,85 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReferencePropertiesEnDeCoder extends AbstractEnDeCoder<ReferenceProperties> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.ReferenceProperties);
+
+    public ReferencePropertiesEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(ReferenceProperties encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+            writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+            if (encodingObject.getProperties() != null) {
+                for (EncodingObject property : encodingObject.getProperties()) {
+                    registry.encode(property, writer);
+                }
+            }
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public ReferenceProperties decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            ReferenceProperties referencePropertiesElement = new ReferenceProperties();
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject property = registry.decode(reader);
+                        referencePropertiesElement.addProperty(property);
+                        break;
+                    case END_ELEMENT:
+                        return referencePropertiesElement;
+                }
+            }
+        } catch (XMLStreamException ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<ReferenceProperties> getEncodingObjectType() {
+        
+        return ReferenceProperties.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBroker.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemoveBroker implements EncodingObject {
+
+    private BrokerConsumerReference brokerConsumerReference;
+    private NeighborBrokerConsumers neighborBrokerConsumers;
+    
+    public BrokerConsumerReference getBrokerConsumerReference() {
+        return this.brokerConsumerReference;
+    }
+    
+    public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
+        this.brokerConsumerReference = brokerConsumerReference;
+    }
+    
+    public NeighborBrokerConsumers getNeighborBrokerConsumers() {
+        return this.neighborBrokerConsumers;
+    }
+    
+    public void setNeighborBrokerConsumers(NeighborBrokerConsumers neighborBrokerConsumers) {
+        this.neighborBrokerConsumers = neighborBrokerConsumers;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemoveBrokerEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,99 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemoveBrokerEnDeCoder extends AbstractEnDeCoder<RemoveBroker> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemoveBroker);
+
+    public RemoveBrokerEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(RemoveBroker encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+            registry.encode(encodingObject.getBrokerConsumerReference(), writer);
+            if (encodingObject.getNeighborBrokerConsumers() != null) {
+                registry.encode(encodingObject.getNeighborBrokerConsumers(), writer);
+            }
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public RemoveBroker decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            RemoveBroker removeBrokerElement = new RemoveBroker();
+            boolean haveBCR = false;
+            boolean haveNBC = false;
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject encodingObject = registry.decode(reader);
+                        if (encodingObject instanceof BrokerConsumerReference && !haveBCR) {
+                            removeBrokerElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
+                            haveBCR = true;
+                        }
+                        else if(encodingObject instanceof NeighborBrokerConsumers && !haveNBC) {
+                            removeBrokerElement.setNeighborBrokerConsumers((NeighborBrokerConsumers)encodingObject);
+                            haveNBC = true;
+                        }
+                        else {
+                            throw new EncodingException("Invalid encoding object");
+                        }
+                        break;
+                    case END_ELEMENT:
+                        if (!haveBCR) {
+                            throw new EncodingException("Missing broker consumer reference");
+                        }
+                        return removeBrokerElement;
+                }
+            }
+        } catch (Exception ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<RemoveBroker> getEncodingObjectType() {
+        
+        return RemoveBroker.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBroker.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,26 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemovedBroker extends EndpointReferenceWrapper {
+
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/RemovedBrokerEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.notification.encoding;
+
+import javax.xml.namespace.QName;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class RemovedBrokerEnDeCoder extends EndpointReferenceWrapperEnDeCoder<RemovedBroker> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.RemovedBroker);
+
+    public RemovedBrokerEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    protected QName getEncodingObjectQName() {
+        return QNAME;
+    }
+
+    protected Class<RemovedBroker> getEncodingObjectType() {
+        return RemovedBroker.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnection.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReplaceBrokerConnection implements EncodingObject {
+
+    private RemovedBroker removedBroker;
+    private Neighbors neighbors;
+    
+    public RemovedBroker getRemovedBroker() {
+        return this.removedBroker;
+    }
+    
+    public void setRemovedBroker(RemovedBroker removedBroker) {
+        this.removedBroker = removedBroker;
+    }
+    
+    public Neighbors getNeighbors() {
+        return this.neighbors;
+    }
+    
+    public void setNeighbors(Neighbors neighbors) {
+        this.neighbors = neighbors;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ReplaceBrokerConnectionEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,99 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class ReplaceBrokerConnectionEnDeCoder extends AbstractEnDeCoder<ReplaceBrokerConnection> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ReplaceBrokerConnection);
+
+    public ReplaceBrokerConnectionEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(ReplaceBrokerConnection encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+            registry.encode(encodingObject.getRemovedBroker(), writer);
+            if (encodingObject.getNeighbors() != null) {
+                registry.encode(encodingObject.getNeighbors(), writer);
+            }
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public ReplaceBrokerConnection decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            ReplaceBrokerConnection replaceBrokerConnectionElement = new ReplaceBrokerConnection();
+            boolean haveRB = false;
+            boolean haveN = false;
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject encodingObject = registry.decode(reader);
+                        if (encodingObject instanceof RemovedBroker && !haveRB) {
+                            replaceBrokerConnectionElement.setRemovedBroker((RemovedBroker)encodingObject);
+                            haveRB = true;
+                        }
+                        else if(encodingObject instanceof Neighbors && !haveN) {
+                            replaceBrokerConnectionElement.setNeighbors((Neighbors)encodingObject);
+                            haveN = true;
+                        }
+                        else {
+                            throw new EncodingException("Invalid encoding object");
+                        }
+                        break;
+                    case END_ELEMENT:
+                        if (!haveRB) {
+                            throw new EncodingException("Missing removed broker");
+                        }
+                        return replaceBrokerConnectionElement;
+                }
+            }
+        } catch (Exception ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<ReplaceBrokerConnection> getEncodingObjectType() {
+        
+        return ReplaceBrokerConnection.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Subscribe.java Thu Jun 28 09:30:41 2007
@@ -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.binding.notification.encoding;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Subscribe implements EncodingObject {
+
+    private ConsumerReference consumerReference;
+    
+    public ConsumerReference getConsumerReference() {
+        return consumerReference;
+    }
+    
+    public void setConsumerReference(ConsumerReference consumerReference) {
+        this.consumerReference = consumerReference;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/SubscribeEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,81 @@
+/*
+ * 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.notification.encoding;
+
+import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
+import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class SubscribeEnDeCoder extends AbstractEnDeCoder<Subscribe> {
+
+    // QName for the root element
+    public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Subscribe);
+    
+    public SubscribeEnDeCoder(EncodingRegistry registry) {
+        super(registry);
+    }
+
+    public void encode(Subscribe encodingObject, XMLStreamWriter writer) throws EncodingException {
+        
+        try {
+            writer.writeStartElement(Constants.NOTIFICATION_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+            writer.writeNamespace(Constants.NOTIFICATION_PREFIX, QNAME.getNamespaceURI());
+            registry.encode(encodingObject.getConsumerReference(), writer);
+            writer.writeEndElement();
+        } catch(XMLStreamException e) {
+            throw new EncodingException(e);
+        }
+    }
+
+    public Subscribe decode(XMLStreamReader reader) throws EncodingException {
+        
+        try {
+            Subscribe subscribeElement = new Subscribe();
+            while (true) {
+                switch (reader.next()) {
+                    case START_ELEMENT:
+                        EncodingObject encodingObject = registry.decode(reader);
+                        subscribeElement.setConsumerReference((ConsumerReference)encodingObject);
+                        break;
+                    case END_ELEMENT:
+                        return subscribeElement;
+                }
+            }
+        } catch (XMLStreamException ex) {
+            throw new EncodingException(ex);
+        }
+    }
+
+    protected QName getEncodingObjectQName() {
+        
+        return QNAME;
+    }
+
+    protected Class<Subscribe> getEncodingObjectType() {
+        
+        return Subscribe.class;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/IOUtils.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,174 @@
+/*
+ * 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.notification.util;
+
+import java.io.ByteArrayOutputStream;
+import java.io.EOFException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.HttpURLConnection;
+import java.net.URL;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class IOUtils {
+
+    public static final String  Notification_Source    = "Notification-Source";
+    public static final String  Notification_Target    = "Notification-Target";
+    public static final String  Notification_Operation = "Notification-Operation";
+
+    public static final int DEF_BLOCK_SIZE = 512;
+
+    public static Object sendHttpRequest(URL targetURL,
+                                         String opName,
+                                         Writeable wbody,
+                                         ReadableContinuation rcont) throws Exception {
+        if (opName == null) {
+            opName = "";
+        }
+        Map<String, String> headers = new HashMap<String, String>();
+        headers.put(Notification_Operation, opName);
+        return sendHttpRequest(targetURL, headers, wbody, rcont);
+    }
+    
+    public static Object sendHttpRequest(URL targetURL,
+                                         Map<String, String> headers,
+                                         Writeable wbody,
+                                         ReadableContinuation rcont) throws Exception {
+        
+        String targetUri = targetURL.toString();
+        String sourceUri = "";
+        
+        final HttpURLConnection con = (HttpURLConnection) targetURL.openConnection();
+        con.setRequestMethod("POST");
+        //con.setRequestProperty("Content-Length", Integer.toString(sbody.getBytes().length));
+        con.setAllowUserInteraction(false);
+        con.setInstanceFollowRedirects(false);
+        if (targetUri != null) {
+            con.setRequestProperty(Notification_Target, targetUri);
+        }
+        
+        if (sourceUri != null) {
+            con.setRequestProperty(Notification_Source, sourceUri);
+        }
+        
+        for (String key : headers.keySet()) {
+            con.setRequestProperty(key, headers.get(key));
+        }
+        con.setDoOutput(true);
+        con.setDoInput(true);
+        con.connect();
+        Object response = null;
+        try {
+            if (wbody != null) {
+                OutputStream ost = con.getOutputStream();
+                wbody.write(ost);
+            }
+            else {
+                throw new IOUtilsException("Missing writeable body");
+            }
+            final int rc = con.getResponseCode();
+            switch (rc) {
+                case HttpURLConnection.HTTP_OK:
+                    if (rcont != null) {
+                        InputStream ist = con.getInputStream();
+                        response = rcont.read(ist);
+                    }
+                    break;
+                case HttpURLConnection.HTTP_NO_CONTENT:
+                    break;
+                default:
+                    throw new RuntimeException("Unexpected response code: " + rc);
+            }
+        }
+        finally
+        {
+            con.disconnect();
+        }
+        return response;
+    }
+    
+    public interface Writeable {
+        void write(OutputStream os) throws IOUtilsException;
+    }
+    
+    public interface ReadableContinuation {
+        Object read(InputStream is) throws IOUtilsException;
+    }
+    
+    @SuppressWarnings("serial")
+    public static class IOUtilsException extends Exception {
+        
+        public IOUtilsException(String message) {
+            super(message);
+        }
+
+        public IOUtilsException(Throwable cause) {
+            super(cause);
+        }
+    }
+    
+    public static byte [] readFully(final InputStream ist, int len) throws IOException {
+        ByteArrayOutputStream baost = new ByteArrayOutputStream();
+        copyStream(ist,baost,len);
+        return baost.toByteArray();
+    }
+
+    public static int copyStream(final InputStream ist, final OutputStream ost) throws IOException {
+        return copyStream(ist, ost, -1, 0);
+    }
+
+    public static int copyStream(final InputStream ist, final OutputStream ost, int length) throws IOException {
+        return copyStream(ist, ost, length, 0);
+    }
+
+    public static int copyStream(final InputStream ist, final OutputStream ost, final int length, int blockSize) throws IOException {
+
+        int cbCopied = 0;
+        if (blockSize <= 0) {
+            blockSize = DEF_BLOCK_SIZE;
+        }
+
+        final byte[] block = new byte[blockSize];
+        boolean done = length == 0;
+        while (!done) {
+            try {
+                // determine how many bytes to read
+                final int cbToRead = length == -1 ? block.length : (Math.min(length - cbCopied, block.length));
+                final int cbRead = ist.read(block, 0, cbToRead);
+                if (cbRead == -1) {
+                    done = true;
+                }
+                else {
+                    ost.write(block, 0, cbRead);
+                    cbCopied += cbRead;
+                    done = cbCopied == length;
+                }
+            } catch (final EOFException e) {
+                done = true;
+            }
+        }
+        ost.flush();
+        return cbCopied;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/NotificationServlet.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,86 @@
+/*
+ * 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.notification.util;
+
+import java.io.IOException;
+import java.util.Enumeration;
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.ServletInputStream;
+import javax.servlet.ServletOutputStream;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+
+/**
+ * Receives notification in HTTP request and dispatches it down the wire
+ *
+ * @version $Rev$ $Date$
+ */
+@SuppressWarnings("serial")
+public class NotificationServlet extends HttpServlet {
+    
+    private NotificationServletHandler handler;
+    private NotificationServletStreamHandler servletStreamHandler;
+    
+    public NotificationServlet(NotificationServletHandler handler) {
+        this.handler = handler;
+        this.servletStreamHandler = null;
+    }
+
+    public NotificationServlet(NotificationServletStreamHandler servletStreamHandler) {
+        this.handler = null;
+        this.servletStreamHandler = servletStreamHandler;
+    }
+
+    public void doPost(HttpServletRequest request, HttpServletResponse response) throws IOException {
+        HashMap<String, String> headers = new HashMap<String, String>();
+        Enumeration headerNames = request.getHeaderNames();
+        while (headerNames.hasMoreElements()) {
+            String headerName = (String)headerNames.nextElement();
+            headers.put(headerName, request.getHeader(headerName));
+        }
+        if (handler != null) {
+            byte[] requestBody = IOUtils.readFully(request.getInputStream(), request.getContentLength());
+            byte[] handlersResponse = handler.handle(headers, requestBody);
+            if (handlersResponse != null) {
+                response.getOutputStream().write(handlersResponse);
+                response.getOutputStream().flush();
+            }
+        }
+        else {
+            try {
+                servletStreamHandler.handle(headers, request.getInputStream(), request.getContentLength(), response.getOutputStream());
+            }
+            catch(RuntimeException e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    public interface NotificationServletHandler {
+        public byte[] handle(Map<String, String> headers, byte[] payload);
+    }
+    
+    public interface NotificationServletStreamHandler {
+        public void handle(Map<String, String> headers, ServletInputStream istream, int contentLength, ServletOutputStream ostream);
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/util/URIUtil.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,42 @@
+/*
+ * 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.notification.util;
+
+import java.net.URI;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class URIUtil {
+
+    public static String getPath(URI uri) {
+        String path = null;
+        
+        if (uri.isOpaque()) {
+            path = "/" + uri.getSchemeSpecificPart();
+        }
+        else if (uri.isAbsolute()) {
+            path = uri.getPath();
+        } else {
+            path = "/" + uri.getPath();
+        }
+        
+        return path;
+    }
+}

Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/resources/META-INF/services/org.apache.tuscany.sca.core.ModuleActivator Thu Jun 28 09:30:41 2007
@@ -0,0 +1,2 @@
+# Implementation class for the ExtensionActivator
+org.apache.tuscany.sca.binding.notification.NotificationBindingModuleActivator



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message