You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tuscany.apache.org by is...@apache.org on 2007/06/28 18:30:55 UTC
svn commit: r551614 [3/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...
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReference.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 BrokerProducerReference extends EndpointReferenceWrapper {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokerProducerReferenceEnDeCoder.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 BrokerProducerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<BrokerProducerReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.BrokerProducerReference);
+
+ public BrokerProducerReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ protected QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+ protected Class<BrokerProducerReference> getEncodingObjectType() {
+ return BrokerProducerReference.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Brokers.java Thu Jun 28 09:30:41 2007
@@ -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.binding.notification.encoding;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class Brokers 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);
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/BrokersEnDeCoder.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 BrokersEnDeCoder extends AbstractEnDeCoder<Brokers> {
+
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.Brokers);
+
+ public BrokersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(Brokers 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 Brokers decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ Brokers brokersElement = new Brokers();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ brokersElement.addBrokerToSequence((Broker)encodingObject);
+ break;
+ case END_ELEMENT:
+ return brokersElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+ protected Class<Brokers> getEncodingObjectType() {
+
+ return Brokers.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverride.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 ConnectionOverride implements EncodingObject {
+
+ private BrokerConsumerReference brokerConsumerReference;
+
+ public BrokerConsumerReference getBrokerConsumerReference() {
+ return this.brokerConsumerReference;
+ }
+
+ public void setBrokerConsumerReference(BrokerConsumerReference brokerConsumerReference) {
+ this.brokerConsumerReference = brokerConsumerReference;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideEnDeCoder.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 ConnectionOverrideEnDeCoder extends AbstractEnDeCoder<ConnectionOverride> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverride);
+
+ public ConnectionOverrideEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ConnectionOverride 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);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ConnectionOverride decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ConnectionOverride connectionOverrideElement = new ConnectionOverride();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ connectionOverrideElement.setBrokerConsumerReference((BrokerConsumerReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return connectionOverrideElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+ protected Class<ConnectionOverride> getEncodingObjectType() {
+
+ return ConnectionOverride.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponse.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 ConnectionOverrideResponse implements EncodingObject {
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConnectionOverrideResponseEnDeCoder.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 ConnectionOverrideResponseEnDeCoder extends AbstractEnDeCoder<ConnectionOverrideResponse> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConnectionOverrideResponse);
+
+ public ConnectionOverrideResponseEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ConnectionOverrideResponse 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 ConnectionOverrideResponse decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ConnectionOverrideResponse connectionOverrideResponseElement = new ConnectionOverrideResponse();
+ while (true) {
+ switch (reader.next()) {
+ case END_ELEMENT:
+ return connectionOverrideResponseElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+ protected Class<ConnectionOverrideResponse> getEncodingObjectType() {
+
+ return ConnectionOverrideResponse.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/Constants.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,74 @@
+/*
+ * 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 interface Constants {
+
+ String NOTIFICATION_NS = "http://docs.oasis-open.org/wsn/b-2";
+ String NOTIFICATION_PREFIX = "wsnt";
+ String ADDRESSING_NS = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ String ADDRESSING_PREFIX = "wsa";
+ String Subscribe = "Subscribe";
+ String ConsumerReference = "ConsumerReference";
+ String Address = "Address";
+ String ReferenceProperties = "ReferenceProperties";
+ String EndpointReference = "EndpointReference";
+ String BrokerID = "BrokerID";
+ String NewConsumer = "NewConsumer";
+ String NewProducer = "NewProducer";
+ String NewConsumerResponse = "NewConsumerResponse";
+ String NewProducerResponse = "NewProducerResponse";
+ String ConsumerSequenceType = "ConsumerSequenceType";
+ String EndConsumers = "EndConsumers";
+ String BrokerConsumers = "BrokerConsumers";
+ String NoConsumers = "NoConsumers";
+ String ProducerSequenceType = "ProducerSequenceType";
+ String EndProducers = "EndProducers";
+ String BrokerProducers = "BrokerProducers";
+ String NoProducers = "NoProducers";
+ String Broker = "Broker";
+ String NewBroker = "NewBroker";
+ String NewBrokerAck = "NewBrokerAck";
+ String BrokerConsumerReference = "BrokerConsumerReference";
+ String BrokerProducerReference = "BrokerProducerReference";
+ String NewBrokerResponse = "NewBrokerResponse";
+ String FirstBroker = "FirstBroker";
+ String Brokers = "Brokers";
+ String ConnectionOverride = "ConnectionOverride";
+ String ConnectionOverrideResponse = "ConnectionOverrideResponse";
+ String NeighborBrokerConsumers = "NeighborBrokerConsumers";
+ String RemoveBroker = "RemoveBroker";
+ String RemovedBroker = "RemovedBroker";
+ String Neighbors = "Neighbors";
+ String ReplaceBrokerConnection = "ReplaceBrokerConnection";
+
+ String SUBSCRIBE_OP = "subscribe";
+ String CONNECTION_OVERRIDE_OP = "connectionOverride";
+ String NEW_CONSUMER_OP = "newConsumer";
+ String NEW_PRODUCER_OP = "newProducer";
+ String NEW_BROKER_OP = "newBroker";
+ String NEW_BROKER_ACK_OP = "newBrokerAck";
+ String REMOVE_BROKER_OP = "removeBroker";
+ String REPLACE_BROKER_CONNECTION_OP = "replaceBrokerConnection";
+
+ String Broker_ID = "brokerID";
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReference.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 ConsumerReference extends EndpointReferenceWrapper {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/ConsumerReferenceEnDeCoder.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 ConsumerReferenceEnDeCoder extends EndpointReferenceWrapperEnDeCoder<ConsumerReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.ConsumerReference);
+
+ public ConsumerReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ protected QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+ protected Class<ConsumerReference> getEncodingObjectType() {
+ return ConsumerReference.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/DefaultEncodingRegistry.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.tuscany.sca.binding.notification.encoding;
+
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.xml.namespace.QName;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class DefaultEncodingRegistry implements EncodingRegistry {
+
+ private final Map<Class<? extends EncodingObject>, EnDeCoder> encoderRegistry =
+ new ConcurrentHashMap<Class<? extends EncodingObject>, EnDeCoder>();
+
+ private final Map<QName, EnDeCoder> decoderRegistry = new ConcurrentHashMap<QName, EnDeCoder>();
+
+ public DefaultEncodingRegistry() {
+ }
+
+ public <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder) {
+
+ encoderRegistry.put(encodingClass, enDeCoder);
+ decoderRegistry.put(qname, enDeCoder);
+ }
+
+ public <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname) {
+
+ encoderRegistry.remove(encodingClass);
+ decoderRegistry.remove(qname);
+ }
+
+ @SuppressWarnings("unchecked")
+ public void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ EnDeCoder encoder = encoderRegistry.get(encodingObject.getClass());
+ if (encoder == null) {
+ throw new EncodingException("No encoder defined for " + encodingObject.getClass());
+ }
+ encoder.encode(encodingObject, writer);
+ }
+
+ public EncodingObject decode(XMLStreamReader reader) throws EncodingException {
+
+ QName qname = reader.getName();
+
+ EnDeCoder decoder = decoderRegistry.get(qname);
+ if (decoder == null) {
+ throw new EncodingException("No decoder defined for " + qname);
+ }
+ return decoder.decode(reader);
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,46 @@
+/*
+ * 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.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EnDeCoder<E extends EncodingObject> {
+
+ /**
+ * Encodes an object to the specified stream writer.
+ *
+ * @param encodingObject Object to be serialized.
+ * @param writer Stream writer to which the infoset is serialized.
+ * @throws EncodingException In case of any encoding error.
+ */
+ void encode(E encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ /**
+ * Decodes an XML stream to an object.
+ *
+ * @param reader XML stream from where the encoded XML is read.
+ * @return Encoding object.
+ * @throws EncodingException In case of any encoding error.
+ */
+ E decode(XMLStreamReader reader) throws EncodingException;
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingException.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$
+ */
+@SuppressWarnings("serial")
+public class EncodingException extends Exception {
+
+ /**
+ * Initializes the exception message.
+ *
+ * @param message Message for the exception.
+ */
+ public EncodingException(String message) {
+ super(message);
+ }
+
+ /**
+ * Initializes the root cause.
+ *
+ * @param cause Root cause for the exception.
+ */
+ public EncodingException(Throwable cause) {
+ super(cause);
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingObject.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 interface EncodingObject {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingRegistry.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.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public interface EncodingRegistry {
+
+ /**
+ * Registers an en/de coder.
+ *
+ * @param <E> Encoding object type.
+ * @param encodingClass Encoding obejct class.
+ * @param qname Qualified name of the root element of the encoded XML.
+ * @param enDeCoder Encoding object enDeCoder.
+ */
+ <E extends EncodingObject> void registerEnDeCoder(Class<E> encodingClass, QName qname, EnDeCoder<E> enDeCoder);
+
+ <E extends EncodingObject> void unregisterEnDeCoder(Class<E> encodingClass, QName qname);
+
+ /**
+ * Encodes an object.
+ *
+ * @param encodingObject Encoding object to be encoded.
+ * @param writer Writer to which encoded information is written.
+ */
+ void encode(EncodingObject encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ /**
+ * Decodes an XML stream to an encoding object.
+ *
+ * @param reader Reader from which encoded information is read.
+ * @return Encoding object from the encoded stream.
+ */
+ EncodingObject decode(XMLStreamReader reader) throws EncodingException;
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EncodingUtils.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 java.io.InputStream;
+import java.io.OutputStream;
+import java.net.URL;
+
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+import org.apache.tuscany.sca.binding.notification.util.IOUtils.IOUtilsException;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EncodingUtils {
+
+ private static XMLOutputFactory xof = XMLOutputFactory.newInstance("javax.xml.stream.XMLOuputFactory",
+ EncodingUtils.class.getClassLoader());
+ private static XMLInputFactory xif = XMLInputFactory.newInstance("javax.xml.stream.XMLInputFactory",
+ EncodingUtils.class.getClassLoader());
+
+ public static void encodeToStream(EncodingRegistry encodingRegistry,
+ EncodingObject eo,
+ OutputStream os) throws IOUtilsException {
+ try {
+ XMLStreamWriter writer = xof.createXMLStreamWriter(os);
+ encodingRegistry.encode(eo, writer);
+ writer.flush();
+ writer.close();
+ }
+ catch(Exception e) {
+ throw new IOUtilsException(e);
+ }
+ }
+
+ public static EncodingObject decodeFromStream(EncodingRegistry encodingRegistry,
+ InputStream istream) throws EncodingException {
+ EncodingObject eo = null;
+ try {
+ XMLStreamReader reader = xif.createXMLStreamReader(istream);
+ reader.next();
+ eo = encodingRegistry.decode(reader);
+ reader.close();
+ }
+ catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+
+ return eo;
+ }
+
+ public static EndpointReference createEndpointReference(URL address, String brokerID) {
+ EndpointAddress epa = new EndpointAddress();
+ epa.setAddress(address);
+ EndpointReference epr = new EndpointReference();
+ epr.setEndpointAddress(epa);
+ if (brokerID != null) {
+ BrokerID bi = new BrokerID();
+ bi.setID(brokerID);
+ ReferenceProperties rp = new ReferenceProperties();
+ rp.addProperty(bi);
+ epr.setReferenceProperties(rp);
+ }
+ return epr;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumers.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 EndConsumers extends EndpointReferenceSequence {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndConsumersEnDeCoder.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 EndConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndConsumers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndConsumers);
+
+ public EndConsumersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ protected QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+ protected Class<EndConsumers> getEncodingObjectType() {
+ return EndConsumers.class;
+ }
+
+ protected void encodeSequenceTypeAttribute(EndConsumers 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/EndProducers.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducers.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 EndProducers extends EndpointReferenceSequence {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndProducersEnDeCoder.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 EndProducersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<EndProducers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.EndProducers);
+
+ public EndProducersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ protected QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+ protected Class<EndProducers> getEncodingObjectType() {
+ return EndProducers.class;
+ }
+
+ protected void encodeSequenceTypeAttribute(EndProducers 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/EndpointAddress.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddress.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.net.URL;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointAddress implements EncodingObject {
+
+ private URL address;
+
+ public URL getAddress() {
+ return address;
+ }
+
+ public void setAddress(URL address) {
+ this.address = address;
+ }
+
+ public void setAddress(String addressText) throws EncodingException {
+ try {
+ this.address = new URL(addressText);
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointAddressEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,89 @@
+/*
+ * 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.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class EndpointAddressEnDeCoder extends AbstractEnDeCoder<EndpointAddress> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.Address);
+
+ public EndpointAddressEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(EndpointAddress encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+ writer.writeCharacters(encodingObject.getAddress().toString());
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public EndpointAddress decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ EndpointAddress endpointAddressElement = new EndpointAddress();
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ if (reader.hasText()) {
+ String address = reader.getText();
+ endpointAddressElement.setAddress(address);
+ }
+ else {
+ throw new EncodingException("Endpoint address is missing address");
+ }
+ break;
+ case END_ELEMENT:
+ return endpointAddressElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+ protected Class<EndpointAddress> getEncodingObjectType() {
+
+ return EndpointAddress.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReference.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 EndpointReference implements EncodingObject {
+
+ private EndpointAddress endpointAddress;
+ private ReferenceProperties referenceProperties;
+
+ public EndpointAddress getEndpointAddress() {
+ return this.endpointAddress;
+ }
+
+ public void setEndpointAddress(EndpointAddress endpointAddress) {
+ this.endpointAddress = endpointAddress;
+ }
+
+ public ReferenceProperties getReferenceProperties() {
+ return this.referenceProperties;
+ }
+
+ public void setReferenceProperties(ReferenceProperties referenceProperties) {
+ this.referenceProperties = referenceProperties;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceEnDeCoder.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 EndpointReferenceEnDeCoder extends AbstractEnDeCoder<EndpointReference> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.ADDRESSING_NS, Constants.EndpointReference);
+
+ public EndpointReferenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(EndpointReference encodingObject, XMLStreamWriter writer) throws EncodingException {
+
+ try {
+ writer.writeStartElement(Constants.ADDRESSING_PREFIX, QNAME.getLocalPart(), QNAME.getNamespaceURI());
+ writer.writeNamespace(Constants.ADDRESSING_PREFIX, QNAME.getNamespaceURI());
+ registry.encode(encodingObject.getEndpointAddress(), writer);
+ if (encodingObject.getReferenceProperties() != null) {
+ registry.encode(encodingObject.getReferenceProperties(), writer);
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public EndpointReference decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ EndpointReference endpointReferenceElement = new EndpointReference();
+ boolean haveEPA = false;
+ boolean haveRP = false;
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ if (encodingObject instanceof EndpointAddress && !haveEPA) {
+ endpointReferenceElement.setEndpointAddress((EndpointAddress)encodingObject);
+ haveEPA = true;
+ }
+ else if(encodingObject instanceof ReferenceProperties && !haveRP) {
+ endpointReferenceElement.setReferenceProperties((ReferenceProperties)encodingObject);
+ haveRP = true;
+ }
+ else {
+ throw new EncodingException("Invalid encoding object");
+ }
+ break;
+ case END_ELEMENT:
+ if (!haveEPA) {
+ throw new EncodingException("Missing endpoint address");
+ }
+ return endpointReferenceElement;
+ }
+ }
+ } catch (Exception ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected QName getEncodingObjectQName() {
+
+ return QNAME;
+ }
+
+ protected Class<EndpointReference> getEncodingObjectType() {
+
+ return EndpointReference.class;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequence.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 EndpointReferenceSequence implements EncodingObject {
+
+ private List<EndpointReference> referenceSequence;
+ private String sequenceType;
+
+ public List<EndpointReference> getReferenceSequence() {
+ return referenceSequence;
+ }
+
+ public void addReferenceToSequence(EndpointReference address) {
+ if(this.referenceSequence == null) {
+ this.referenceSequence = new ArrayList<EndpointReference>();
+ }
+ this.referenceSequence.add(address);
+ }
+
+ public void setReferenceSequence(List<EndpointReference> referenceSequence) {
+ this.referenceSequence = referenceSequence;
+ }
+
+ public String getSequenceType() {
+ return this.sequenceType;
+ }
+
+ public void setSequenceType(String sequenceType) {
+ this.sequenceType = sequenceType;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceSequenceEnDeCoder.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 abstract class EndpointReferenceSequenceEnDeCoder<ERS extends EndpointReferenceSequence> extends AbstractEnDeCoder<ERS> {
+
+ public EndpointReferenceSequenceEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ERS 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());
+ encodeSequenceTypeAttribute(encodingObject, writer);
+ if (encodingObject.getReferenceSequence() != null) {
+ for (EndpointReference endpointReference : encodingObject.getReferenceSequence()) {
+ registry.encode(endpointReference, writer);
+ }
+ }
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ protected abstract void encodeSequenceTypeAttribute(ERS encodingObject, XMLStreamWriter writer) throws EncodingException;
+
+ public ERS decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ERS endpointReferenceSequenceElement = null;
+ try {
+ endpointReferenceSequenceElement = getEncodingObjectType().newInstance();
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ String sequenceType = decodeSequenceTypeAttribute(reader);
+ endpointReferenceSequenceElement.setSequenceType(sequenceType);
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ endpointReferenceSequenceElement.addReferenceToSequence((EndpointReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return endpointReferenceSequenceElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+
+ protected abstract String decodeSequenceTypeAttribute(XMLStreamReader reader);
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapper.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 EndpointReferenceWrapper implements EncodingObject {
+
+ private EndpointReference reference;
+
+ public EndpointReference getReference() {
+ return reference;
+ }
+
+ public void setReference(EndpointReference reference) {
+ this.reference = reference;
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/EndpointReferenceWrapperEnDeCoder.java Thu Jun 28 09:30:41 2007
@@ -0,0 +1,74 @@
+/*
+ * 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 abstract class EndpointReferenceWrapperEnDeCoder<ERW extends EndpointReferenceWrapper> extends AbstractEnDeCoder<ERW> {
+
+ public EndpointReferenceWrapperEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ public void encode(ERW 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());
+ registry.encode(encodingObject.getReference(), writer);
+ writer.writeEndElement();
+ } catch(XMLStreamException e) {
+ throw new EncodingException(e);
+ }
+ }
+
+ public ERW decode(XMLStreamReader reader) throws EncodingException {
+
+ try {
+ ERW endpointReferenceWrapperElement = null;
+ try {
+ endpointReferenceWrapperElement = getEncodingObjectType().newInstance();
+ } catch(Exception e) {
+ throw new EncodingException(e);
+ }
+ while (true) {
+ switch (reader.next()) {
+ case START_ELEMENT:
+ EncodingObject encodingObject = registry.decode(reader);
+ endpointReferenceWrapperElement.setReference((EndpointReference)encodingObject);
+ break;
+ case END_ELEMENT:
+ return endpointReferenceWrapperElement;
+ }
+ }
+ } catch (XMLStreamException ex) {
+ throw new EncodingException(ex);
+ }
+ }
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumers.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 NeighborBrokerConsumers extends EndpointReferenceSequence {
+
+}
Added: incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java?view=auto&rev=551614
==============================================================================
--- incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.java (added)
+++ incubator/tuscany/java/sca/modules/binding-notification/src/main/java/org/apache/tuscany/sca/binding/notification/encoding/NeighborBrokerConsumersEnDeCoder.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 NeighborBrokerConsumersEnDeCoder extends EndpointReferenceSequenceEnDeCoder<NeighborBrokerConsumers> {
+
+ // QName for the root element
+ public static final QName QNAME = new QName(Constants.NOTIFICATION_NS, Constants.NeighborBrokerConsumers);
+
+ public NeighborBrokerConsumersEnDeCoder(EncodingRegistry registry) {
+ super(registry);
+ }
+
+ protected QName getEncodingObjectQName() {
+ return QNAME;
+ }
+
+ protected Class<NeighborBrokerConsumers> getEncodingObjectType() {
+ return NeighborBrokerConsumers.class;
+ }
+
+ protected void encodeSequenceTypeAttribute(NeighborBrokerConsumers 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);
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org