summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.5/modules/binding-jms
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.5/modules/binding-jms')
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/LICENSE205
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/NOTICE6
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/pom.xml66
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java71
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java896
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java74
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java45
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java1511
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java45
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java76
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java45
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java78
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java45
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java78
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java45
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java78
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java48
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java78
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor25
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties49
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java735
-rw-r--r--branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java385
22 files changed, 0 insertions, 4684 deletions
diff --git a/branches/sca-java-1.5/modules/binding-jms/LICENSE b/branches/sca-java-1.5/modules/binding-jms/LICENSE
deleted file mode 100644
index 8aa906c321..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/LICENSE
+++ /dev/null
@@ -1,205 +0,0 @@
-
- Apache License
- Version 2.0, January 2004
- http://www.apache.org/licenses/
-
- TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
-
- 1. Definitions.
-
- "License" shall mean the terms and conditions for use, reproduction,
- and distribution as defined by Sections 1 through 9 of this document.
-
- "Licensor" shall mean the copyright owner or entity authorized by
- the copyright owner that is granting the License.
-
- "Legal Entity" shall mean the union of the acting entity and all
- other entities that control, are controlled by, or are under common
- control with that entity. For the purposes of this definition,
- "control" means (i) the power, direct or indirect, to cause the
- direction or management of such entity, whether by contract or
- otherwise, or (ii) ownership of fifty percent (50%) or more of the
- outstanding shares, or (iii) beneficial ownership of such entity.
-
- "You" (or "Your") shall mean an individual or Legal Entity
- exercising permissions granted by this License.
-
- "Source" form shall mean the preferred form for making modifications,
- including but not limited to software source code, documentation
- source, and configuration files.
-
- "Object" form shall mean any form resulting from mechanical
- transformation or translation of a Source form, including but
- not limited to compiled object code, generated documentation,
- and conversions to other media types.
-
- "Work" shall mean the work of authorship, whether in Source or
- Object form, made available under the License, as indicated by a
- copyright notice that is included in or attached to the work
- (an example is provided in the Appendix below).
-
- "Derivative Works" shall mean any work, whether in Source or Object
- form, that is based on (or derived from) the Work and for which the
- editorial revisions, annotations, elaborations, or other modifications
- represent, as a whole, an original work of authorship. For the purposes
- of this License, Derivative Works shall not include works that remain
- separable from, or merely link (or bind by name) to the interfaces of,
- the Work and Derivative Works thereof.
-
- "Contribution" shall mean any work of authorship, including
- the original version of the Work and any modifications or additions
- to that Work or Derivative Works thereof, that is intentionally
- submitted to Licensor for inclusion in the Work by the copyright owner
- or by an individual or Legal Entity authorized to submit on behalf of
- the copyright owner. For the purposes of this definition, "submitted"
- means any form of electronic, verbal, or written communication sent
- to the Licensor or its representatives, including but not limited to
- communication on electronic mailing lists, source code control systems,
- and issue tracking systems that are managed by, or on behalf of, the
- Licensor for the purpose of discussing and improving the Work, but
- excluding communication that is conspicuously marked or otherwise
- designated in writing by the copyright owner as "Not a Contribution."
-
- "Contributor" shall mean Licensor and any individual or Legal Entity
- on behalf of whom a Contribution has been received by Licensor and
- subsequently incorporated within the Work.
-
- 2. Grant of Copyright License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- copyright license to reproduce, prepare Derivative Works of,
- publicly display, publicly perform, sublicense, and distribute the
- Work and such Derivative Works in Source or Object form.
-
- 3. Grant of Patent License. Subject to the terms and conditions of
- this License, each Contributor hereby grants to You a perpetual,
- worldwide, non-exclusive, no-charge, royalty-free, irrevocable
- (except as stated in this section) patent license to make, have made,
- use, offer to sell, sell, import, and otherwise transfer the Work,
- where such license applies only to those patent claims licensable
- by such Contributor that are necessarily infringed by their
- Contribution(s) alone or by combination of their Contribution(s)
- with the Work to which such Contribution(s) was submitted. If You
- institute patent litigation against any entity (including a
- cross-claim or counterclaim in a lawsuit) alleging that the Work
- or a Contribution incorporated within the Work constitutes direct
- or contributory patent infringement, then any patent licenses
- granted to You under this License for that Work shall terminate
- as of the date such litigation is filed.
-
- 4. Redistribution. You may reproduce and distribute copies of the
- Work or Derivative Works thereof in any medium, with or without
- modifications, and in Source or Object form, provided that You
- meet the following conditions:
-
- (a) You must give any other recipients of the Work or
- Derivative Works a copy of this License; and
-
- (b) You must cause any modified files to carry prominent notices
- stating that You changed the files; and
-
- (c) You must retain, in the Source form of any Derivative Works
- that You distribute, all copyright, patent, trademark, and
- attribution notices from the Source form of the Work,
- excluding those notices that do not pertain to any part of
- the Derivative Works; and
-
- (d) If the Work includes a "NOTICE" text file as part of its
- distribution, then any Derivative Works that You distribute must
- include a readable copy of the attribution notices contained
- within such NOTICE file, excluding those notices that do not
- pertain to any part of the Derivative Works, in at least one
- of the following places: within a NOTICE text file distributed
- as part of the Derivative Works; within the Source form or
- documentation, if provided along with the Derivative Works; or,
- within a display generated by the Derivative Works, if and
- wherever such third-party notices normally appear. The contents
- of the NOTICE file are for informational purposes only and
- do not modify the License. You may add Your own attribution
- notices within Derivative Works that You distribute, alongside
- or as an addendum to the NOTICE text from the Work, provided
- that such additional attribution notices cannot be construed
- as modifying the License.
-
- You may add Your own copyright statement to Your modifications and
- may provide additional or different license terms and conditions
- for use, reproduction, or distribution of Your modifications, or
- for any such Derivative Works as a whole, provided Your use,
- reproduction, and distribution of the Work otherwise complies with
- the conditions stated in this License.
-
- 5. Submission of Contributions. Unless You explicitly state otherwise,
- any Contribution intentionally submitted for inclusion in the Work
- by You to the Licensor shall be under the terms and conditions of
- this License, without any additional terms or conditions.
- Notwithstanding the above, nothing herein shall supersede or modify
- the terms of any separate license agreement you may have executed
- with Licensor regarding such Contributions.
-
- 6. Trademarks. This License does not grant permission to use the trade
- names, trademarks, service marks, or product names of the Licensor,
- except as required for reasonable and customary use in describing the
- origin of the Work and reproducing the content of the NOTICE file.
-
- 7. Disclaimer of Warranty. Unless required by applicable law or
- agreed to in writing, Licensor provides the Work (and each
- Contributor provides its Contributions) on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
- implied, including, without limitation, any warranties or conditions
- of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
- PARTICULAR PURPOSE. You are solely responsible for determining the
- appropriateness of using or redistributing the Work and assume any
- risks associated with Your exercise of permissions under this License.
-
- 8. Limitation of Liability. In no event and under no legal theory,
- whether in tort (including negligence), contract, or otherwise,
- unless required by applicable law (such as deliberate and grossly
- negligent acts) or agreed to in writing, shall any Contributor be
- liable to You for damages, including any direct, indirect, special,
- incidental, or consequential damages of any character arising as a
- result of this License or out of the use or inability to use the
- Work (including but not limited to damages for loss of goodwill,
- work stoppage, computer failure or malfunction, or any and all
- other commercial damages or losses), even if such Contributor
- has been advised of the possibility of such damages.
-
- 9. Accepting Warranty or Additional Liability. While redistributing
- the Work or Derivative Works thereof, You may choose to offer,
- and charge a fee for, acceptance of support, warranty, indemnity,
- or other liability obligations and/or rights consistent with this
- License. However, in accepting such obligations, You may act only
- on Your own behalf and on Your sole responsibility, not on behalf
- of any other Contributor, and only if You agree to indemnify,
- defend, and hold each Contributor harmless for any liability
- incurred by, or claims asserted against, such Contributor by reason
- of your accepting any such warranty or additional liability.
-
- END OF TERMS AND CONDITIONS
-
- APPENDIX: How to apply the Apache License to your work.
-
- To apply the Apache License to your work, attach the following
- boilerplate notice, with the fields enclosed by brackets "[]"
- replaced with your own identifying information. (Don't include
- the brackets!) The text should be enclosed in the appropriate
- comment syntax for the file format. We also recommend that a
- file or class name and description of purpose be included on the
- same "printed page" as the copyright notice for easier
- identification within third-party archives.
-
- Copyright [yyyy] [name of copyright owner]
-
- Licensed 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.
-
-
-
diff --git a/branches/sca-java-1.5/modules/binding-jms/NOTICE b/branches/sca-java-1.5/modules/binding-jms/NOTICE
deleted file mode 100644
index fdfa0e9faa..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/NOTICE
+++ /dev/null
@@ -1,6 +0,0 @@
-${pom.name}
-Copyright (c) 2005 - 2008 The Apache Software Foundation
-
-This product includes software developed by
-The Apache Software Foundation (http://www.apache.org/).
-
diff --git a/branches/sca-java-1.5/modules/binding-jms/pom.xml b/branches/sca-java-1.5/modules/binding-jms/pom.xml
deleted file mode 100644
index 83feaa6514..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/pom.xml
+++ /dev/null
@@ -1,66 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
- * 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.
--->
-<project>
- <modelVersion>4.0.0</modelVersion>
- <parent>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-modules</artifactId>
- <version>1.5-SNAPSHOT</version>
- <relativePath>../pom.xml</relativePath>
- </parent>
- <artifactId>tuscany-binding-jms</artifactId>
- <name>Apache Tuscany SCA JMS Binding Model</name>
-
- <dependencies>
-
- <dependency>
- <groupId>org.apache.tuscany.sca</groupId>
- <artifactId>tuscany-assembly-xml</artifactId>
- <version>1.5-SNAPSHOT</version>
- </dependency>
-
- <dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- <version>4.5</version>
- <scope>test</scope>
- </dependency>
-
- </dependencies>
-
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
-
- <configuration>
- <instructions>
- <Bundle-Version>${tuscany.version}</Bundle-Version>
- <Bundle-SymbolicName>org.apache.tuscany.sca.binding.jms</Bundle-SymbolicName>
- <Bundle-Description>${pom.name}</Bundle-Description>
- <Export-Package>org.apache.tuscany.sca.binding.jms*</Export-Package>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
-
-</project>
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java
deleted file mode 100644
index 277cba43ca..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/BindingProperty.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.jms.impl;
-
-public class BindingProperty {
-
- private String name;
- private String type;
- private Object value;
-
- public BindingProperty(String name, String type, Object value) {
- this.name = name;
- this.type = type;
- this.value = value;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- public Object getValue() {
- return value;
- }
-
- @Override
- public boolean equals( Object object ) {
- return ( object instanceof BindingProperty ) && equals( (BindingProperty) object );
- }
-
- /**
- * Test whether this and another Binding Property are equal.
- * @param property
- * @return true if all fields of property match.
- */
- public boolean equals( BindingProperty property ) {
- if ( name == null && property.getName() != null )
- return false;
- else if ( !name.equals( property.getName() ))
- return false;
- else if ( type == null && property.getType() != null )
- return false;
- else if ( !type.equals( property.getType() ))
- return false;
- else if ( value == null && property.getValue() != null )
- return false;
- else if ( !value.equals( property.getValue() ))
- return false;
- return true;
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
deleted file mode 100644
index 03157061d9..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBinding.java
+++ /dev/null
@@ -1,896 +0,0 @@
-/*
- * 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.jms.impl;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import javax.xml.namespace.QName;
-import java.util.TreeSet;
-
-import org.apache.tuscany.sca.assembly.BindingRRB;
-import org.apache.tuscany.sca.assembly.DefinitionElement;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.policy.Intent;
-import org.apache.tuscany.sca.policy.IntentAttachPointType;
-import org.apache.tuscany.sca.policy.PolicySet;
-import org.apache.tuscany.sca.policy.PolicySetAttachPoint;
-
-/**
- * Models a binding to a JMS resource.
- *
- * @version $Rev$ $Date$
- */
-
-public class JMSBinding implements BindingRRB, PolicySetAttachPoint, OperationsConfigurator, DefinitionElement {
-
- @Override
- public Object clone() throws CloneNotSupportedException {
- return super.clone();
- }
-
- // properties required to implement the Tuscany binding extension SPI
- private String uri = null;
- private String name = null;
- private boolean unresolved = false;
- private List<Object> extensions = new ArrayList<Object>();
-
- // properties required by PolicySetAttachPoint
- private List<PolicySet> policySets = new ArrayList<PolicySet>();
- private List<PolicySet> applicablePolicySets = new ArrayList<PolicySet>();
-
- // properties required by IntentAttachPoint
- private List<Intent> requiredIntents = new ArrayList<Intent>();
- private IntentAttachPointType intentAttachPointType;
-
- // properties required to describe configured operations
- private List<ConfiguredOperation> configuredOperations = new ArrayList<ConfiguredOperation>();
-
- // properties required by DefinitionElement @575803A
- private String targetNamespace;
-
- // Properties required to describe the JMS binding model
-
- private String correlationScheme = JMSBindingConstants.CORRELATE_MSG_ID;
- private String initialContextFactoryName;
- private String jndiURL;
-
- private String destinationName = null;
- private String destinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
- private String destinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> destinationProperties = new HashMap<String, BindingProperty>();
-
- private String connectionFactoryName = null;
- private String connectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> connectionFactoryProperties = new HashMap<String, BindingProperty>();
-
- private String activationSpecName = null;
- private String activationSpecCreate = null;
- private Map<String, BindingProperty> activationSpecProperties = new HashMap<String, BindingProperty>();
-
- private String resourceAdapterName;;
- private Map<String, BindingProperty> resourceAdapterProperties = new HashMap<String, BindingProperty>();
-
- private String responseActivationSpecName = null;
- private String responseActivationSpecCreate = null;
- private Map<String, BindingProperty> responseActivationSpecProperties = new HashMap<String, BindingProperty>();
-
- private String responseDestinationName = null;
- private String responseDestinationType = JMSBindingConstants.DESTINATION_TYPE_QUEUE;
- private String responseDestinationCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> responseDestinationProperties = new HashMap<String, BindingProperty>();
-
- private String responseConnectionFactoryName = null;
- private String responseConnectionFactoryCreate = JMSBindingConstants.CREATE_IF_NOT_EXIST;
- private Map<String, BindingProperty> responseConnectionFactoryProperties = new HashMap<String, BindingProperty>();
-
- // Provides the name of the factory that interfaces to the JMS API for us.
- private String jmsResourceFactoryName = JMSBindingConstants.DEFAULT_RF_CLASSNAME;
-
- // Message processors used to deal with the request and response messages
- public String requestMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
- public String responseMessageProcessorName = JMSBindingConstants.DEFAULT_MP_CLASSNAME;
-
- // The JMS message property used to hold the name of the operation being called
- private String operationSelectorPropertyName = JMSBindingConstants.DEFAULT_OPERATION_PROP_NAME;
-
- // If the operation selector is derived automatically from the service interface it's stored here
- private String operationSelectorName = null;
-
- private boolean containsHeaders = false;
- private String replyTo;
- private String jmsType;
- private String jmsCorrelationId;
- private Boolean deliveryModePersistent;
- private Long timeToLive;
- private Integer jmsPriority;
-
- private Map<String, Object> properties = new HashMap<String, Object>();
- private Map<String, Map<String, Object>> operationProperties = new HashMap<String, Map<String,Object>>();
- private Map<String, String> nativeOperationNames = new HashMap<String, String>();
- private Map<String, String> operationJMSTypes = new HashMap<String, String>();
- private Map<String, String> operationJMSCorrelationIds = new HashMap<String, String>();
- private Map<String, Boolean> operationJMSDeliveryModes = new HashMap<String, Boolean>();
- private Map<String, Long> operationJMSTimeToLives = new HashMap<String, Long>();
- private Map<String, Integer> operationJMSPriorities = new HashMap<String, Integer>();
- private Map<String, Map<String, BindingProperty>> operationPropertiesProperties = new HashMap<String, Map<String,BindingProperty>>();
-
- private String jmsSelector;
- private QName requestConnectionName;
- private QName responseConnectionName;
- private JMSBinding requestConnectionBinding;
- private JMSBinding responseConnectionBinding;
-
- private WireFormat requestWireFormat;
- private WireFormat responseWireFormat;
- private OperationSelector operationSelector;
-
- public JMSBinding() {
- super();
- }
-
- // operations required by Binding
- public String getURI() {
- return this.uri;
- }
-
- public void setURI(String uri) {
- this.uri = uri;
- }
-
- public String getName() {
- return this.name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public boolean isUnresolved() {
- return this.unresolved;
- }
-
- public void setUnresolved(boolean unresolved) {
- this.unresolved = unresolved;
- }
-
- public List<Object> getExtensions() {
- return extensions;
- }
-
- public WireFormat getRequestWireFormat() {
- return requestWireFormat;
- }
-
- public void setRequestWireFormat(WireFormat wireFormat) {
- this.requestWireFormat = wireFormat;
- }
-
- public WireFormat getResponseWireFormat() {
- return responseWireFormat;
- }
-
- public void setResponseWireFormat(WireFormat wireFormat) {
- this.responseWireFormat = wireFormat;
- }
-
- public OperationSelector getOperationSelector() {
- return operationSelector;
- }
-
- public void setOperationSelector(OperationSelector operationSelector) {
- this.operationSelector = operationSelector;
- }
-
- // Methods for getting/setting JMS binding model information
- // as derived from the XML of the binding.jms element
-
- public void setCorrelationScheme(String correlationScheme) {
- this.correlationScheme = correlationScheme;
- }
-
- public String getCorrelationScheme() {
- return correlationScheme;
- }
-
- public String getInitialContextFactoryName() {
- return initialContextFactoryName;
- }
-
- public void setInitialContextFactoryName(String initialContextFactoryName) {
- this.initialContextFactoryName = initialContextFactoryName;
- }
-
- public String getJndiURL() {
- return this.jndiURL;
- }
-
- public void setJndiURL(String jndiURL) {
- this.jndiURL = jndiURL;
- }
-
- public String getDestinationName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationName() != null) {
- return requestConnectionBinding.getDestinationName();
- } else {
- return destinationName;
- }
- }
-
- public void setDestinationName(String destinationName) {
- this.destinationName = destinationName;
- }
-
- public String getDestinationType() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationType() != null) {
- return requestConnectionBinding.getDestinationType();
- } else {
- return destinationType;
- }
- }
-
- public void setDestinationType(String destinationType) {
- this.destinationType = destinationType;
- }
-
- public String getDestinationCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getDestinationCreate() != null) {
- return requestConnectionBinding.getDestinationCreate();
- } else {
- return this.destinationCreate;
- }
- }
-
- public void setDestinationCreate(String create) {
- this.destinationCreate = create;
- }
-
- public String getConnectionFactoryName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getConnectionFactoryName() != null) {
- return requestConnectionBinding.getConnectionFactoryName();
- } else {
- return connectionFactoryName;
- }
- }
-
- public void setConnectionFactoryName(String connectionFactoryName) {
- this.connectionFactoryName = connectionFactoryName;
- }
-
- public String getConnectionFactoryCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getConnectionFactoryCreate() != null) {
- return requestConnectionBinding.getConnectionFactoryCreate();
- } else {
- return this.connectionFactoryCreate;
- }
- }
-
- public void setConnectionFactoryCreate(String create) {
- this.connectionFactoryCreate = create;
- }
-
- public String getResourceAdapterName() {
- return resourceAdapterName;
- }
-
- public void setResourceAdapterName(String name) {
- resourceAdapterName = name;
- }
-
- public String getActivationSpecName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getActivationSpecName() != null) {
- return requestConnectionBinding.getActivationSpecName();
- } else {
- return activationSpecName;
- }
- }
-
- public void setActivationSpecName(String activationSpecName) {
- this.activationSpecName = activationSpecName;
- }
-
- public String getActivationSpecCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getActivationSpecCreate() != null) {
- return requestConnectionBinding.getActivationSpecCreate();
- } else {
- return this.activationSpecCreate;
- }
- }
-
- public void setActivationSpecCreate(String create) {
- this.activationSpecCreate = create;
- }
-
- public String getResponseDestinationName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationName() != null) {
- return requestConnectionBinding.getResponseDestinationName();
- } else {
- return this.responseDestinationName;
- }
- }
-
- public void setResponseDestinationName(String name) {
- this.responseDestinationName = name;
- }
-
- public String getResponseDestinationType() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationType() != null) {
- return requestConnectionBinding.getResponseDestinationType();
- } else {
- return this.responseDestinationType;
- }
- }
-
- public void setResponseDestinationType(String type) {
- this.responseDestinationType = type;
- }
-
- public String getResponseDestinationCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseDestinationCreate() != null) {
- return requestConnectionBinding.getResponseDestinationCreate();
- } else {
- return this.responseDestinationCreate;
- }
- }
-
- public void setResponseDestinationCreate(String create) {
- this.responseDestinationCreate = create;
- }
-
- public String getResponseConnectionFactoryName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseConnectionFactoryName() != null) {
- return requestConnectionBinding.getResponseConnectionFactoryName();
- } else {
- return responseConnectionFactoryName;
- }
- }
-
- public void setResponseConnectionFactoryName(String connectionFactoryName) {
- this.responseConnectionFactoryName = connectionFactoryName;
- }
-
- public String getResponseConnectionFactoryCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseConnectionFactoryCreate() != null) {
- return requestConnectionBinding.getResponseConnectionFactoryCreate();
- } else {
- return this.responseConnectionFactoryCreate;
- }
- }
-
- public void setResponseConnectionFactoryCreate(String create) {
- this.responseConnectionFactoryCreate = create;
- }
-
- public String getResponseActivationSpecName() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseActivationSpecName() != null) {
- return requestConnectionBinding.getResponseActivationSpecName();
- } else {
- return responseActivationSpecName;
- }
- }
-
- public void setResponseActivationSpecName(String activationSpecName) {
- this.responseActivationSpecName = activationSpecName;
- }
-
- public String getResponseActivationSpecCreate() {
- if (requestConnectionBinding != null && requestConnectionBinding.getResponseActivationSpecCreate() != null) {
- return requestConnectionBinding.getResponseActivationSpecCreate();
- } else {
- return this.responseActivationSpecCreate;
- }
- }
-
- public void setResponseActivationSpecCreate(String create) {
- this.responseActivationSpecCreate = create;
- }
-
- public String getJmsResourceFactoryName() {
- return jmsResourceFactoryName;
- }
-
- public void setJmsResourceFactoryName(String jmsResourceFactoryName) {
- this.jmsResourceFactoryName = jmsResourceFactoryName;
- }
-
- public void setRequestMessageProcessorName(String name) {
- this.requestMessageProcessorName = name;
- }
-
- public String getRequestMessageProcessorName() {
- return requestMessageProcessorName;
- }
-
- public void setResponseMessageProcessorName(String name) {
- this.responseMessageProcessorName = name;
- }
-
- public String getResponseMessageProcessorName() {
- return responseMessageProcessorName;
- }
-
- public String getOperationSelectorPropertyName() {
- return operationSelectorPropertyName;
- }
-
- public void setOperationSelectorPropertyName(String operationSelectorPropertyName) {
- this.operationSelectorPropertyName = operationSelectorPropertyName;
- }
-
- public String getOperationSelectorName() {
- return operationSelectorName;
- }
-
- public void setOperationSelectorName(String operationSelectorName) {
- this.operationSelectorName = operationSelectorName;
- }
-
- public void setHeaders( boolean containsHeaders ) {
- this.containsHeaders = containsHeaders;
- }
-
- public boolean containsHeaders() {
- return this.containsHeaders;
- }
-
- public String getReplyTo() {
- return replyTo;
- }
-
- public void setReplyTo(String replyTo) {
- this.replyTo = replyTo;
- }
-
- public String getJMSType() {
- return jmsType;
- }
- public void setJMSType(String jmsType) {
- setHeaders( true );
- this.jmsType = jmsType;
- }
-
- public String getJMSCorrelationId() {
- return jmsCorrelationId;
- }
-
- public void setJMSCorrelationId(String jmsCorrelationId) {
- setHeaders( true );
- this.jmsCorrelationId = jmsCorrelationId;
- }
-
- public Boolean isdeliveryModePersistent() {
- return deliveryModePersistent;
- }
- public void setJMSDeliveryMode(boolean persistent) {
- setHeaders( true );
- this.deliveryModePersistent = Boolean.valueOf(persistent);
- }
-
- public Integer getJMSPriority() {
- return jmsPriority;
- }
-
- public void setJMSPriority(int jmsPriority) {
- setHeaders( true );
- this.jmsPriority = Integer.valueOf(jmsPriority);
- }
-
- public Long getJMSTimeToLive() {
- return timeToLive;
- }
-
- public void setJMSTimeToLive(long timeToLive) {
- setHeaders( true );
- this.timeToLive = Long.valueOf(timeToLive);
- }
-
- public Set<String> getPropertyNames() {
- return properties.keySet();
- }
-
- public Object getProperty(String name) {
- return properties.get(name);
- }
-
- public void setProperty(String name, Object value) {
- properties.put(name, value);
- }
-
- protected Map<String, Object> getProperties() {
- return properties;
- }
-
- /**
- * Adds an operationName to this binding.
- * @param opName
- */
- public void addOperationName(String opName) {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- props = new HashMap<String, Object>();
- operationProperties.put(opName, props);
- }
- }
-
- /**
- * Provides set of operation names in this binding.
- * @return a Set<String> of operation names
- */
- public Set<String> getOperationNames() {
- // Make a defensive copy since key changes affect map, map changes affect keys.
- Set<String> opNames = operationProperties.keySet();
- Set<String> opNamesCopy = new TreeSet<String>( opNames );
- return opNamesCopy;
- }
-
- public Map<String, Object> getOperationProperties(String opName) {
- return operationProperties.get(opName);
- }
-
- public void setOperationProperty(String opName, String propName, Object value) {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- props = new HashMap<String, Object>();
- operationProperties.put(opName, props);
- }
- props.put(propName, value);
- }
-
- /**
- * Provides the value of a property for a given operation
- * @param opName is the name of the operation in this binding.
- * @param propName is the key name for the property
- * @return Object representing the property value for this property name. Returns
- * null for non existant operation name or property name.
- */
- public Object getOperationProperty(String opName, String propName ) {
- Map<String, Object> props = operationProperties.get(opName);
- if (props == null) {
- return null;
- }
- return props.get(propName);
- }
-
- public boolean hasNativeOperationName(String opName) {
- return nativeOperationNames.containsKey(opName);
- }
-
- public String getNativeOperationName(String opName) {
- if (nativeOperationNames.containsKey(opName)) {
- return nativeOperationNames.get(opName);
- } else {
- return opName;
- }
- }
-
- public void setNativeOperationName(String opName, String nativeOpName) {
- this.nativeOperationNames .put(opName, nativeOpName);
- }
-
- public String getOperationJMSType(String opName) {
- if (operationJMSTypes.containsKey(opName)) {
- return operationJMSTypes.get(opName);
- } else {
- return jmsType;
- }
- }
- public void setOperationJMSType(String opName, String jmsType) {
- this.operationJMSTypes.put(opName, jmsType);
- }
-
- public String getOperationJMSCorrelationId(String opName) {
- if (operationJMSCorrelationIds.containsKey(opName)) {
- return operationJMSCorrelationIds.get(opName);
- } else {
- return jmsCorrelationId;
- }
- }
- public void setOperationJMSCorrelationId(String opName, String jmsCorrelationId) {
- operationJMSCorrelationIds.put(opName, jmsCorrelationId);
- }
-
- public Boolean getOperationJMSDeliveryMode(String opName) {
- if (operationJMSDeliveryModes.containsKey(opName)) {
- return operationJMSDeliveryModes.get(opName);
- } else {
- return deliveryModePersistent;
- }
- }
- public void setOperationJMSDeliveryMode(String opName, boolean b) {
- operationJMSDeliveryModes.put(opName, b);
- }
-
- public Long getOperationJMSTimeToLive(String opName) {
- if (operationJMSTimeToLives.containsKey(opName)) {
- return operationJMSTimeToLives.get(opName);
- } else {
- return timeToLive;
- }
- }
- public void setOperationJMSTimeToLive(String opName, Long ttl) {
- operationJMSTimeToLives.put(opName, ttl);
- }
-
- public Integer getOperationJMSPriority(String opName) {
- if (operationJMSPriorities.containsKey(opName)) {
- return operationJMSPriorities.get(opName);
- } else {
- return jmsPriority;
- }
- }
- public void setOperationJMSPriority(String opName, int p) {
- operationJMSPriorities.put(opName, p);
- }
-
- public String getJMSSelector() {
- return jmsSelector;
- }
- public void setJMSSelector(String jmsSelector) {
- this.jmsSelector = jmsSelector;
- }
-
- public QName getRequestConnectionName() {
- return requestConnectionName;
- }
-
- public void setRequestConnectionName(QName requestConnectionName) {
- this.requestConnectionName = requestConnectionName;
- }
-
- public void setResponseConnectionName(QName responseConnectionName) {
- this.responseConnectionName = responseConnectionName;
- }
-
- public QName getResponseConnectionName() {
- return responseConnectionName;
- }
-
- public void setRequestConnectionBinding(JMSBinding binding) {
- this.requestConnectionBinding = binding;
- }
- public JMSBinding getRequestConnectionBinding() {
- return requestConnectionBinding;
- }
-
- public void setResponseConnectionBinding(JMSBinding binding) {
- this.responseConnectionBinding = binding;
- }
- public JMSBinding getResponseConnectionBinding() {
- return responseConnectionBinding;
- }
-
- // operations required by PolicySetAttachPoint
- public List<PolicySet> getPolicySets() {
- return policySets;
- }
-
- public List<PolicySet> getApplicablePolicySets() {
- return applicablePolicySets;
- }
-
- // operations required by IntentAttachPoint
- public List<Intent> getRequiredIntents() {
- return requiredIntents;
- }
-
- public IntentAttachPointType getType() {
- return intentAttachPointType;
- }
-
- public void setType(IntentAttachPointType intentAttachPointType) {
- this.intentAttachPointType = intentAttachPointType;
- }
-
- public Map<String, BindingProperty> getDestinationProperties() {
- return destinationProperties;
- }
-
- public Map<String, BindingProperty> getConnectionFactoryProperties() {
- return connectionFactoryProperties;
- }
-
- public Map<String, BindingProperty> getResourceAdapterProperties() {
- return resourceAdapterProperties;
- }
-
- public Map<String, BindingProperty> getActivationSpecProperties() {
- return activationSpecProperties;
- }
-
- public Map<String, BindingProperty> getResponseActivationSpecProperties() {
- return responseActivationSpecProperties;
- }
-
- public Map<String, BindingProperty> getResponseDestinationProperties() {
- return responseDestinationProperties;
- }
-
- public Map<String, BindingProperty> getResponseConnectionFactoryProperties() {
- return responseConnectionFactoryProperties;
- }
-
- public Map<String, BindingProperty> getOperationPropertiesProperties(String opName) {
- if (operationPropertiesProperties.get(opName)==null) {
- operationPropertiesProperties.put(opName, new HashMap<String, BindingProperty>());
- }
- return operationPropertiesProperties.get(opName);
- }
-
- public List<ConfiguredOperation> getConfiguredOperations() {
- return configuredOperations;
- }
-
- public void setConfiguredOperations(List<ConfiguredOperation> configuredOperations) {
- this.configuredOperations = configuredOperations;
- }
-
- public String getTargetNamespace() {
- return targetNamespace;
- }
-
- public void setTargetNamespace(String ns) {
- targetNamespace = ns;
- }
-
- // hashCode() is here because binding elements in definitions documents are added
- // to the model resolver hashmap. The namespace and name are keys.
- @Override
- public int hashCode() {
- return (String.valueOf(getTargetNamespace()) + String.valueOf(getName())).hashCode();
- }
-
- @Override
- public boolean equals( Object object ) {
- return ( object instanceof JMSBinding ) && equals( (JMSBinding) object );
- }
-
- /**
- * Compares two JMS bindings for equality.
- * Because of the many fields, this comparison is rather large O(n).
- * @param binding test binding for equality comparison
- * @return boolean stating whether objects are equal
- */
- public boolean equals( JMSBinding binding ) {
- // If the target namespace is set, this binding came from a definitions document.
- // The target namespace and name are used as keys for doing model resolver hashmap lookups.
- // Only the target namespace and name can be compared.
- if (this.targetNamespace != null) {
- if ( !optStringEquals( this.targetNamespace, binding.getTargetNamespace() )) return false;
- if ( !optStringEquals( this.name, binding.getName() )) return false;
- return true;
- }
-
- // Test all fields for equality.
- // First test simple fields to quickly weed out mismatches.
- if ( !optStringEquals( this.uri, binding.getURI() )) return false;
- if ( !optStringEquals( this.name, binding.getName() )) return false;
- if ( !optStringEquals( this.targetNamespace, binding.getTargetNamespace() )) return false;
- if ( !optStringEquals( this.destinationName, binding.getDestinationName() )) return false;
- if ( !optStringEquals( this.correlationScheme, binding.getCorrelationScheme() )) return false;
- if ( !optStringEquals( this.initialContextFactoryName, binding.getInitialContextFactoryName() )) return false;
- if ( !optStringEquals( this.jndiURL, binding.getJndiURL() )) return false;
- if ( !optStringEquals( this.requestConnectionName, binding.getRequestConnectionName() )) return false;
- if ( !optStringEquals( this.responseConnectionName, binding.getResponseConnectionName() )) return false;
- if ( !optStringEquals( this.jmsSelector, binding.getJMSSelector() )) return false;
- if ( !equals( properties, binding.getProperties()) )
- return false;
-
- // Test operation properties
- Set<String> operationNamesA = this.getOperationNames();
- Set<String> operationNamesB = binding.getOperationNames();
- if ( operationNamesA != null && operationNamesB != null ) {
- if ( operationNamesA == null && operationNamesB != null ) return false;
- if ( operationNamesA != null && operationNamesB == null ) return false;
- if ( operationNamesA.size() != operationNamesB.size() ) return false;
- for(Iterator<String> it=operationNamesA.iterator(); it.hasNext(); ) {
- String opName = it.next();
- if ( !operationNamesB.contains( opName )) {
- return false;
- }
- }
- }
-
- // Destination properties
- if ( !optStringEquals( this.getDestinationName(), binding.getDestinationName() )) return false;
- if ( !optStringEquals( this.getDestinationType(), binding.getDestinationType() )) return false;
-
- // Connection factory properties
- if ( !optStringEquals( this.getConnectionFactoryName(), binding.getConnectionFactoryName() )) return false;
-
- // Activation spec properties
- if ( !optStringEquals( this.getActivationSpecName(), binding.getActivationSpecName() )) return false;
-
- // Response properties
- if ( !optStringEquals( this.getResponseDestinationName(), binding.getResponseDestinationName() )) return false;
- if ( !optStringEquals( this.getResponseActivationSpecName(), binding.getResponseActivationSpecName() )) return false;
- if ( !optStringEquals( this.getResponseConnectionFactoryName(), binding.getResponseConnectionFactoryName() )) return false;
-
- // Resource adapter
- if ( !optStringEquals( this.getResourceAdapterName(), binding.getResourceAdapterName() )) return false;
-
- // Configured operations
- if ( this.configuredOperations.size() != binding.getConfiguredOperations().size() ) return false;
-
- // wire format
- if ( this.getRequestWireFormat().getClass() != binding.getRequestWireFormat().getClass()) return false;
- if ( this.getResponseWireFormat().getClass() != binding.getResponseWireFormat().getClass()) return false;
-
- // operation selector
- if ( this.getOperationSelector().getClass() != binding.getOperationSelector().getClass()) return false;
-
-
- // Other fields could also be checked for equality. See class fields for details.
- return true;
- }
-
- /**
- * Tests if Strings are equal.
- * Either one may be null. This will match true if both
- * are null or both are non-null and equal.
- * @param p1 property list 1
- * @param p2 property list 2
- * @return whether or not properties are equal
- */
- public static boolean optStringEquals( Object s1, Object s2 ) {
- if ( s1 == null && s2 == null ) return true;
- if ( s1 != null && s2 == null ) return false;
- if ( s1 == null && s2 != null ) return false;
- return s1.equals( s2 );
- }
-
- /**
- * Tests if two property lists are equal.
- * Either one may be null. This will match true if both
- * are null or both are non-null and equal.
- * @param p1 property list 1
- * @param p2 property list 2
- * @return whether or not properties are equal
- */
- public static boolean equals( Map<String, Object> p1, Map<String, Object> p2 ) {
- if ( p1 == null && p2 == null)
- return true;
- if ( p1 == null || p2 == null)
- return false;
- if ( p1.size() != p2.size())
- return false;
-
- // For both the keys and values of a map
- for (Iterator it=p1.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object k1 = entry.getKey();
- Object v1 = entry.getValue();
- Object v2 = p2.get( k1 );
-
- if ( v1 == null && v2 != null )
- return false;
- if ( v1 != null && v2 == null )
- return false;
- if ( !v1.equals( v2 ))
- return false;
- }
-
- return true;
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
deleted file mode 100644
index db02d6b53c..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingConstants.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * 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.jms.impl;
-
-import java.util.Arrays;
-import java.util.List;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-
-/**
- * Constants for the JMS binding.
- *
- * @version $Rev$ $Date$
- */
-public interface JMSBindingConstants {
-
- // Constants used when describing the JMS binding
- // model and for setting up defaults
- String BINDING_JMS = "binding.jms";
- QName BINDING_JMS_QNAME = new QName(Constants.SCA10_NS, BINDING_JMS);
- String CORRELATE_MSG_ID = "requestmsgidtocorrelid";
- String CORRELATE_CORRELATION_ID = "requestcorrelidtocorrelid";
- String CORRELATE_NONE = "none";
- List<String> VALID_CORRELATION_SCHEMES =
- Arrays.asList(new String[] {CORRELATE_MSG_ID, CORRELATE_CORRELATION_ID, CORRELATE_NONE});
- String DESTINATION_TYPE_QUEUE = "queue"; // 0
- String DESTINATION_TYPE_TOPIC = "topic"; // 1
- List<String> VALID_DESTINATION_TYPES =
- Arrays.asList(new String[] {DESTINATION_TYPE_QUEUE, DESTINATION_TYPE_TOPIC});
- String CREATE_ALWAYS = "always";
- String CREATE_NEVER = "never";
- String CREATE_IF_NOT_EXIST = "ifnotexist";
- String DEFAULT_CONTEXT_FACTORY_NAME = "org.apache.activemq.jndi.ActiveMQInitialContextFactory";
- String DEFAULT_JNDI_URL = "tcp://localhost:61616";
- int DEFAULT_TIME_TO_LIVE = 20000; // in milliseconds
- int DEFAULT_PRIORITY = 1;
- int NON_PERSISTENT = 1; // Maps to javax.jms.DeliveryMode
- String DEFAULT_RF_CLASSNAME = "org.apache.tuscany.sca.host.jms.activemq.JMSResourceFactoryImpl";
- String XML_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.XMLTextMessageProcessor";
- String TEXT_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.TextMessageProcessor";
- String OBJECT_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.ObjectMessageProcessor";
- String BYTES_MP_CLASSNAME = "org.apache.tuscany.sca.binding.jms.provider.BytesMessageProcessor";
- String DEFAULT_MP_CLASSNAME = XML_MP_CLASSNAME;
- String DEFAULT_OPERATION_PROP_NAME = "scaOperationName";
-
- String FAULT_PROPERTY = "org_apache_tuscany_sca_fault";
-
- String CALLBACK_ID_PROPERTY = "CallbackID";
- String CALLBACK_Q_PROPERTY = "scaCallbackQueue";
- String CONVERSATION_ID_PROPERTY = "scaConversationId";
-
- // XML element and attribute names
- String HEADERS = "headers";
-
- int MSG_CTXT_POSITION = 0;
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
deleted file mode 100644
index 0928e02082..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingException.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jms.impl;
-
-/**
- * Base exception for the JMSBinding.
- *
- * @version $Rev$ $Date$
- */
-public class JMSBindingException extends RuntimeException {
- private static final long serialVersionUID = 1L;
-
- public JMSBindingException() {
- super();
- }
-
- public JMSBindingException(String arg0, Throwable arg1) {
- super(arg0, arg1);
- }
-
- public JMSBindingException(String arg0) {
- super(arg0);
- }
-
- public JMSBindingException(Throwable arg0) {
- super(arg0);
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
deleted file mode 100644
index 4642a51d45..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessor.java
+++ /dev/null
@@ -1,1511 +0,0 @@
-/*
- * 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.jms.impl;
-
-import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
-import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.Extension;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.assembly.builder.impl.ProblemImpl;
-import org.apache.tuscany.sca.assembly.xml.ConfiguredOperationProcessor;
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.xml.PolicyAttachPointProcessor;
-import org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.DefaultModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ExtensibleModelResolver;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.Problem;
-import org.apache.tuscany.sca.monitor.Problem.Severity;
-import org.apache.tuscany.sca.policy.PolicyFactory;
-
-/**
- * A processor to read the XML that describes the JMS binding...
- *
- * <binding.jms correlationScheme="string"?
- * initialContextFactory="xs:anyURI"?
- * jndiURL="xs:anyURI"?
- * requestConnection="QName"?
- * responseConnection="QName"?
- * operationProperties="QName"?
- * ...>
- *
- * <headers JMSType="string"?
- * JMSCorrelationId="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- *
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- * <response>
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- *
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- * <wireFormat.someWireFormat/>?
- * </response>?
- *
- * <complexType name="SubscriptionHeaders">
- * <attribute name="JMSSelector" type="string"/>
- * </complexType>
- *
- * <resourceAdapter name="NMTOKEN">?
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </resourceAdapter>?
- *
- * <operationProperties name="string" nativeOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers JMSType="string"?
- * JMSCorrelationId="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- * </operationProperties>*
- *
- * <wireFormat.someWireFormat/>?
- * </binding.jms>
- *
- * Parsing error messages are recorded locally and reported as validation exceptions. Parsing
- * warnings do not cause validation exceptions.
- *
- * @version $Rev$ $Date$
- */
-
-public class JMSBindingProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<JMSBinding> {
- private PolicyFactory policyFactory;
- private PolicyAttachPointProcessor policyProcessor;
- private ConfiguredOperationProcessor configuredOperationProcessor;
- protected StAXArtifactProcessor<Object> extensionProcessor;
- private Monitor monitor;
-
- private ModelFactoryExtensionPoint modelFactories; // DOB
- public JMSBindingProcessor(ModelFactoryExtensionPoint modelFactories, StAXArtifactProcessor<Object> extensionProcessor, Monitor monitor) {
- this.policyFactory = modelFactories.getFactory(PolicyFactory.class);
- this.policyProcessor = new PolicyAttachPointProcessor(policyFactory);
- this.configuredOperationProcessor =
- new ConfiguredOperationProcessor(modelFactories, this.monitor);
- this.extensionProcessor = extensionProcessor;
- this.monitor = monitor;
- this.modelFactories = modelFactories;
- }
-
- /**
- * Report a error.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void warning(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.WARNING, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- /**
- * Report an error.
- * One side effect is that error messages are saved for future validation calls.
- *
- * @param problems
- * @param message
- * @param model
- */
- private void error(String message, Object model, Object... messageParameters) {
- if (monitor != null) {
- Problem problem = new ProblemImpl(this.getClass().getName(), "binding-jms-validation-messages", Severity.ERROR, model, message, (Object[])messageParameters);
- monitor.problem(problem);
- }
- }
-
- public QName getArtifactType() {
- return JMSBindingConstants.BINDING_JMS_QNAME;
- }
-
- public Class<JMSBinding> getModelType() {
- return JMSBinding.class;
- }
-
- public JMSBinding read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- JMSBinding jmsBinding = new JMSBinding();
- // Reset validation message to keep track of validation issues.
-
- // Read policies
- policyProcessor.readPolicies(jmsBinding, reader);
-
- // Read binding name
- String name = reader.getAttributeValue(null, "name");
- if (name != null) {
- jmsBinding.setName(name);
- }
-
- // Read binding URI
- String uri = reader.getAttributeValue(null, "uri");
- if (uri != null && uri.length() > 0) {
- parseURI(uri, jmsBinding);
- }
-
- // Read correlation scheme
- String correlationScheme = reader.getAttributeValue(null, "correlationScheme");
- if (correlationScheme != null && correlationScheme.length() > 0) {
- if (JMSBindingConstants.VALID_CORRELATION_SCHEMES.contains(correlationScheme.toLowerCase())) {
- jmsBinding.setCorrelationScheme(correlationScheme);
- } else {
- error("InvalidCorrelationScheme", reader, correlationScheme);
- }
- }
-
- // Read initial context factory
- String initialContextFactory = reader.getAttributeValue(null, "initialContextFactory");
- if (initialContextFactory != null && initialContextFactory.length() > 0) {
- jmsBinding.setInitialContextFactoryName(initialContextFactory);
- }
-
- // Read JNDI URL
- String jndiURL = reader.getAttributeValue(null, "jndiURL");
- if (jndiURL != null && jndiURL.length() > 0) {
- jmsBinding.setJndiURL(jndiURL);
- }
-
- // Read message processor class name
- // TODO - maintain this for the time being but move over to
- // configuring wire formats instead of message processors
- String messageProcessorName = reader.getAttributeValue(null, "messageProcessor");
- if (messageProcessorName != null && messageProcessorName.length() > 0) {
- if ("XMLTextMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSTextXML());
- jmsBinding.setResponseWireFormat(new WireFormatJMSTextXML());
- } else if ("TextMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSText());
- jmsBinding.setResponseWireFormat(new WireFormatJMSText());
- } else if ("ObjectMessage".equalsIgnoreCase(messageProcessorName)) {
- // may be overwritten be real wire format later
- jmsBinding.setRequestWireFormat(new WireFormatJMSObject());
- jmsBinding.setResponseWireFormat(new WireFormatJMSObject());
- } else {
- jmsBinding.setRequestMessageProcessorName(messageProcessorName);
- jmsBinding.setResponseMessageProcessorName(messageProcessorName);
- }
- }
-
- String requestConnectionName = reader.getAttributeValue(null, "requestConnection");
- if (requestConnectionName != null && requestConnectionName.length() > 0) {
- jmsBinding.setRequestConnectionName(getQNameValue(reader, requestConnectionName));
- }
- String responseConnectionName = reader.getAttributeValue(null, "responseConnection");
- if (responseConnectionName != null && responseConnectionName.length() > 0) {
- jmsBinding.setResponseConnectionName(getQNameValue(reader, responseConnectionName));
- }
-
- // Read sub-elements of binding.jms
- boolean endFound = false;
- while (!endFound) {
- int fg = reader.next();
- switch (fg) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("destination".equals(elementName)) {
- parseDestination(reader, jmsBinding);
- } else if ("connectionFactory".equals(elementName)) {
- parseConnectionFactory(reader, jmsBinding);
- } else if ("activationSpec".equals(elementName)) {
- parseActivationSpec(reader, jmsBinding);
- } else if ("response".equals(elementName)) {
- parseResponse(reader, jmsBinding);
- } else if ("resourceAdapter".equals(elementName)) {
- parseResourceAdapter(reader, jmsBinding);
- } else if ("headers".equals(elementName)) {
- parseHeaders(reader, jmsBinding);
- } else if ("operationProperties".equals(elementName)) {
- parseOperationProperties(reader, jmsBinding);
- } else if ("SubscriptionHeaders".equals(elementName)) {
- parseSubscriptionHeaders(reader, jmsBinding);
- } else if (Constants.OPERATION_QNAME.equals(reader.getName())) {
- ConfiguredOperation confOp = configuredOperationProcessor.read(reader);
- if (confOp != null) {
- ((OperationsConfigurator)jmsBinding).getConfiguredOperations().add(confOp);
- }
- } else {
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- jmsBinding.setRequestWireFormat((WireFormat)extension);
- } else if (extension instanceof OperationSelector) {
- jmsBinding.setOperationSelector((OperationSelector)extension);
- } else {
- error("UnexpectedElement", reader, extension.toString());
- }
- }
- }
- //reader.next();
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (Constants.OPERATION.equals(x.getLocalPart())) break;
- if (x.getLocalPart().equals("wireFormat.jmsBytes") || x.getLocalPart().equals("wireFormat.jmsText")
- || x.getLocalPart().equals("wireFormat.jmsObject") || x.getLocalPart().equals("wireFormat.jmsTextXML")) {
- break;
- }
- if (x.equals(JMSBindingConstants.BINDING_JMS_QNAME)) {
- endFound = true;
- } else {
- error("UnexpectedElement: expected " + JMSBindingConstants.BINDING_JMS_QNAME + ", found " + x.toString(),
- reader, x.toString());
- }
- }
- }
-
- // if no operation selector is specified then assume the default
- if (jmsBinding.getOperationSelector() == null){
- jmsBinding.setOperationSelector(new OperationSelectorJMSDefault());
- }
-
- // if no request wire format specified then assume the default
- if (jmsBinding.getRequestWireFormat() == null){
- jmsBinding.setRequestWireFormat(new WireFormatJMSTextXML());
- }
-
- // if no response wire format specific then assume the default
- if (jmsBinding.getResponseWireFormat() == null){
- jmsBinding.setResponseWireFormat(jmsBinding.getRequestWireFormat());
- }
-
- validate( jmsBinding );
-
- return jmsBinding;
- }
-
- protected void parseURI(String uri, JMSBinding jmsBinding) {
- if (!uri.startsWith("jms:")) {
- error("MustStartWithSchema", jmsBinding, uri);
- return;
- }
- int i = uri.indexOf('?');
- if (i >= 0) {
- StringTokenizer st = new StringTokenizer(uri.substring(i+1),"&");
- while (st.hasMoreTokens()) {
- String s = st.nextToken();
- if (s.startsWith("connectionFactoryName=")) {
- jmsBinding.setConnectionFactoryName(s.substring(22));
- } else {
- error("UnknownTokenInURI", jmsBinding, s, uri);
- return;
- }
- }
- jmsBinding.setDestinationName(uri.substring(4, i));
- } else {
- jmsBinding.setDestinationName(uri.substring(4));
- }
- }
-
- public void resolve(JMSBinding model, ModelResolver resolver) throws ContributionResolveException {
- if (model.getRequestConnectionName() != null) {
- model.setRequestConnectionBinding(getConnectionBinding(model, "requestConnection", model.getRequestConnectionName(), resolver));
- }
- if (model.getResponseConnectionName() != null) {
- model.setResponseConnectionBinding(getConnectionBinding(model, "responseConnection", model.getResponseConnectionName(), resolver));
- }
- }
-
- @SuppressWarnings("unchecked")
- private JMSBinding getConnectionBinding(JMSBinding model, String attrName, QName bindingName, ModelResolver resolver) {
- JMSBinding binding = new JMSBinding();
- binding.setTargetNamespace(bindingName.getNamespaceURI());
- binding.setName(bindingName.getLocalPart());
- binding.setUnresolved(true);
- binding = resolver.resolveModel(JMSBinding.class, binding);
- if (binding.isUnresolved())
- error("BindingNotFound", model, attrName, bindingName);
- return binding;
- }
-
- private void parseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- warning("DoesntProcessDestinationType", jmsBinding);
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
- jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
- } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
- jmsBinding.setDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
- } else {
- error("InvalidDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- jmsBinding.setDestinationCreate(create);
- }
-
- jmsBinding.getDestinationProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setConnectionFactoryName(name);
- } else {
- error("MissingConnectionFactoryName", reader);
- }
- jmsBinding.getConnectionFactoryProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setActivationSpecName(name);
- } else {
- warning("MissingActivationSpecName", reader);
- }
- jmsBinding.getActivationSpecProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseDestination(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseDestinationName(name);
- }
-
- String type = reader.getAttributeValue(null, "type");
- if (type != null && type.length() > 0) {
- warning("DoesntProcessResponseDestinationType", jmsBinding);
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE.equalsIgnoreCase(type)) {
- jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_QUEUE);
- } else if (JMSBindingConstants.DESTINATION_TYPE_TOPIC.equalsIgnoreCase(type)) {
- jmsBinding.setResponseDestinationType(JMSBindingConstants.DESTINATION_TYPE_TOPIC);
- } else {
- error("InvalidResponseDestinationType", reader, type);
- }
- }
-
- String create = reader.getAttributeValue(null, "create");
- if (create != null && create.length() > 0) {
- jmsBinding.setResponseDestinationCreate(create);
- }
-
- jmsBinding.getResponseDestinationProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseConnectionFactory(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseConnectionFactoryName(name);
- } else {
- warning("MissingResponseConnectionFactory", reader);
- }
- jmsBinding.getResponseConnectionFactoryProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponseActivationSpec(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResponseActivationSpecName(name);
- } else {
- warning("MissingResponseActivationSpec", reader);
- }
- jmsBinding.getResponseActivationSpecProperties().putAll(parseBindingProperties(reader));
- }
-
- private void parseResponse(XMLStreamReader reader, JMSBinding jmsBinding) throws ContributionReadException, XMLStreamException {
- // Read sub-elements of response
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("destination".equals(elementName)) {
- parseResponseDestination(reader, jmsBinding);
- } else if ("connectionFactory".equals(elementName)) {
- parseResponseConnectionFactory(reader, jmsBinding);
- } else if ("activationSpec".equals(elementName)) {
- parseResponseActivationSpec(reader, jmsBinding);
- } else {
- Object extension = extensionProcessor.read(reader);
- if (extension != null) {
- if (extension instanceof WireFormat) {
- jmsBinding.setResponseWireFormat((WireFormat)extension);
- } else {
- error("UnexpectedElement", reader, extension.toString());
- }
- }
- reader.next();
- }
- //reader.next();
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("response")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseResourceAdapter(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name != null && name.length() > 0) {
- jmsBinding.setResourceAdapterName(name);
- } else {
- error("MissingResourceAdapterName", reader);
- }
- jmsBinding.getResourceAdapterProperties().putAll(parseBindingProperties(reader));
- }
-
- /**
- * <headers JMSType=”string”?
- * JMSCorrelationID=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- */
- private void parseHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "JMSType");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setJMSType(jmsType);
- }
-
- String jmsCorrelationId = reader.getAttributeValue(null, "JMSCorrelationID");
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- jmsBinding.setJMSCorrelationId(jmsCorrelationId);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "JMSDeliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSDeliveryMode(true);
- } else if ("NON_PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSDeliveryMode(false);
- } else {
- error("InvalidJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "JMSTimeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setJMSTimeToLive(Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "JMSPriority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setJMSPriority(p);
- } else {
- warning("InvalidJMSPriority", jmsBinding, jmsPriority);
- }
- }
-
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("property")) {
- parseProperty(reader, jmsBinding);
- }
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseProperty(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- jmsBinding.setHeaders( true );
- String name = reader.getAttributeValue(null, "name");
- String type = reader.getAttributeValue(null, "type");
- if (name != null && name.length() > 0) {
- Object value = reader.getElementText();
- if ("boolean".equalsIgnoreCase(type)) {
- value = Boolean.parseBoolean((String)value);
- } else if ("byte".equalsIgnoreCase(type)) {
- value = Byte.parseByte(((String)value));
- } else if ("short".equalsIgnoreCase(type)) {
- value = Short.parseShort((String)value);
- } else if ("int".equalsIgnoreCase(type)) {
- value = Integer.parseInt((String)value);
- } else if ("long".equalsIgnoreCase(type)) {
- value = Long.parseLong((String)value);
- } else if ("float".equalsIgnoreCase(type)) {
- value = Float.parseFloat((String)value);
- } else if ("double".equalsIgnoreCase(type)) {
- value = Double.parseDouble((String)value);
- } else if ("String".equalsIgnoreCase(type)) {
- // its already a string
- }
- jmsBinding.setProperty(name, value);
- }
- }
-
- /**
- * <operationProperties name=”string” nativeOperation=”string”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * <headers JMSType=”string”?
- * JMSCorrelationId=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- * </operationProperties>*
- */
- private void parseOperationProperties(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String opName = reader.getAttributeValue(null, "name");
- if (opName == null || opName.length() < 1) {
- warning("MissingJMSOperationPropertyName", jmsBinding);
- return;
- }
- // Since nativeOpName, headers, and property elements are optional, must add opName.
- jmsBinding.addOperationName(opName);
- String nativeOpName = reader.getAttributeValue(null, "nativeOperation"); // optional
- if (nativeOpName != null && nativeOpName.length() > 0) {
- jmsBinding.setNativeOperationName(opName, nativeOpName);
- }
-
- Map<String, BindingProperty> props = new HashMap<String, BindingProperty>();
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("headers")) { // optional
- parseOperationHeaders(reader, jmsBinding, opName);
- } else if (reader.getName().getLocalPart().equals("property")) { // optional
- processProperty(reader, props);
- }
- break;
- case END_ELEMENT:
- if (reader.isEndElement()) {
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- break;
- }
- if (x.getLocalPart().equals("property")) {
- break;
- }
- if (x.getLocalPart().equals("operationProperties")) {
- jmsBinding.getOperationPropertiesProperties(opName).putAll(props);
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
- }
-
- private void parseOperationHeaders(XMLStreamReader reader, JMSBinding jmsBinding, String opName) throws XMLStreamException {
- String jmsType = reader.getAttributeValue(null, "JMSType");
- if (jmsType != null && jmsType.length() > 0) {
- jmsBinding.setOperationJMSType(opName, jmsType);
- }
-
- String jmsCorrelationId = reader.getAttributeValue(null, "JMSCorrelationID");
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- jmsBinding.setOperationJMSCorrelationId(opName, jmsCorrelationId);
- }
-
- String jmsDeliveryMode = reader.getAttributeValue(null, "JMSDeliveryMode");
- if (jmsDeliveryMode != null && jmsDeliveryMode.length() > 0) {
- if ("PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setJMSDeliveryMode(true);
- } else if ("NON_PERSISTENT".equalsIgnoreCase(jmsDeliveryMode)) {
- jmsBinding.setOperationJMSDeliveryMode(opName, false);
- } else {
- error("InvalidOPJMSDeliveryMode", jmsBinding, jmsDeliveryMode);
- }
- }
-
- String jmsTimeToLive = reader.getAttributeValue(null, "JMSTimeToLive");
- if (jmsTimeToLive != null && jmsTimeToLive.length() > 0) {
- jmsBinding.setOperationJMSTimeToLive(opName, Long.parseLong(jmsTimeToLive));
- }
-
- String jmsPriority = reader.getAttributeValue(null, "JMSPriority");
- if (jmsPriority != null && jmsPriority.length() > 0) {
- int p = Integer.parseInt(jmsPriority);
- if (p >= 0 && p <= 9) {
- jmsBinding.setOperationJMSPriority(opName, p);
- } else {
- warning("InvalidOPJMSPriority", jmsBinding, jmsPriority);
- }
- }
-
- while (true) {
- switch (reader.next()) {
- case START_ELEMENT:
- if (reader.getName().getLocalPart().equals("property")) {
- parseOperationPropertyProperties(reader, jmsBinding, opName);
- }
- break;
- case END_ELEMENT:
- QName x = reader.getName();
- if (x.getLocalPart().equals("headers")) {
- return;
- } else {
- error("UnexpectedResponseElement", reader, x.toString());
- }
- }
- }
- }
-
- private void parseOperationPropertyProperties(XMLStreamReader reader, JMSBinding jmsBinding, String opName) throws XMLStreamException {
- String propName = reader.getAttributeValue(null, "name");
- String type = reader.getAttributeValue(null, "type");
- if (propName != null && propName.length() > 0) {
- Object value = reader.getElementText();
- if ("boolean".equalsIgnoreCase(type)) {
- value = Boolean.parseBoolean((String)value);
- } else if ("byte".equalsIgnoreCase(type)) {
- value = Byte.parseByte(((String)value));
- } else if ("short".equalsIgnoreCase(type)) {
- value = Short.parseShort((String)value);
- } else if ("int".equalsIgnoreCase(type)) {
- value = Integer.parseInt((String)value);
- } else if ("long".equalsIgnoreCase(type)) {
- value = Long.parseLong((String)value);
- } else if ("float".equalsIgnoreCase(type)) {
- value = Float.parseFloat((String)value);
- } else if ("double".equalsIgnoreCase(type)) {
- value = Double.parseDouble((String)value);
- } else if ("String".equalsIgnoreCase(type)) {
- // its already a string
- }
- jmsBinding.setOperationProperty(opName, propName, value);
- }
- }
-
- private void parseSubscriptionHeaders(XMLStreamReader reader, JMSBinding jmsBinding) throws XMLStreamException {
- String jmsSelector = reader.getAttributeValue(null, "JMSSelector");
- if (jmsSelector != null && jmsSelector.length() > 0) {
- jmsBinding.setJMSSelector(jmsSelector);
- }
-
- // Skip to end element
- while (reader.hasNext()) {
- if (reader.next() == END_ELEMENT && "SubscriptionHeaders".equals(reader.getName().getLocalPart())) {
- break;
- }
- } // end while
- }
-
- private Map<String, BindingProperty> parseBindingProperties(XMLStreamReader reader) throws XMLStreamException {
- Map<String, BindingProperty> props = new HashMap<String, BindingProperty>();
- String parentName = reader.getName().getLocalPart();
- // Parse for all the properties within this element, until the end of
- // the element is reached.
- boolean completed = false;
- while (!completed) {
- switch (reader.next()) {
- case START_ELEMENT:
- String elementName = reader.getName().getLocalPart();
- if ("property".equals(elementName)) {
- processProperty(reader, props);
- }
- break;
- case END_ELEMENT:
- String endName = reader.getName().getLocalPart();
- if (parentName.equals(endName)) {
- completed = true;
- break;
- }
- }
- }
- return props;
- }
-
- private void processProperty(XMLStreamReader reader, Map<String, BindingProperty> props) throws XMLStreamException {
- String name = reader.getAttributeValue(null, "name");
- if (name == null || name.length() < 1) {
- error("InvalidPropertyElement", reader);
- }
- String type = reader.getAttributeValue(null, "type");
- String value = reader.getElementText();
- props.put(name, new BindingProperty(name, type, value));
- }
-
- /**
- * Preserve an existing public method. The method validate() is a legacy method
- * that was called from reading am XML stream via the read(XMLStreamReader) method above.
- * However read(XMLStreamReader) now calls validate(JMSBinding jmsBinding) and
- * passes in the jmsBinding model.
- * The older validate() now calls validate(JMSBinding jmsBinding) with a null model.
- */
- public void validate() {
- validate( null );
- }
-
- /**
- * Validates JMS parsing and JMSBinding model.
- * Validation rules are taken from the binding schema and the OSOA and OASIS specs:
- * http://www.oasis-open.org/committees/documents.php?wg_abbrev=sca-bindings
- * (sca-binding-jms-1.1-spec-cd01-rev4.pdf)
- * http://www.osoa.org/display/Main/Service+Component+Architecture+Specifications
- * (SCA JMS Binding V1.00 )
- * @param jmsBinding an optional JMS binding model to check for validity.
- * @since 1.4
- */
- protected void validate( JMSBinding jmsBinding ) {
- // If no JMSBinding model is provided, that is all the validation we can do.
- if ( jmsBinding == null ) {
- return;
- }
-
- // Connection factory should not contradict destination type.
- String connectionFactoryName = jmsBinding.getConnectionFactoryName();
- if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
- if (JMSBindingConstants.DESTINATION_TYPE_QUEUE == jmsBinding.getDestinationType()) {
- if ( connectionFactoryName.contains( "topic" )) {
- error("DestinationQueueContradiction", jmsBinding, connectionFactoryName );
- }
- }
- if (JMSBindingConstants.DESTINATION_TYPE_TOPIC == jmsBinding.getDestinationType()) {
- if ( connectionFactoryName.contains( "queue" )) {
- error("DestinationTopicContradiction", jmsBinding, connectionFactoryName );
- }
- }
- }
-
- // Connection factory and activation Specification are mutually exclusive.
- if (( connectionFactoryName != null ) && ( connectionFactoryName.length() > 0 )) {
- String activationSpecName = jmsBinding.getActivationSpecName();
- if ((activationSpecName != null) && (activationSpecName.length() > 0 )) {
- error("ConnectionFactoryActivationSpecContradiction", jmsBinding, connectionFactoryName, activationSpecName );
- }
- }
-
- // Given a response connection name attribute, there must not be a response element.
- // 156 • /binding.jms/@responseConnection – identifies a binding.jms element that is present in a
- // 157 definition document, whose response child element is used to define the values for this binding. In
- // 158 this case this binding.jms element MUST NOT contain a response element.
- QName responseConnectionName = jmsBinding.getResponseConnectionName();
- if (( responseConnectionName != null ) && ( responseConnectionName.getLocalPart().length() > 0 )) {
- String responseDestinationName = jmsBinding.getResponseDestinationName();
- if (( responseDestinationName != null ) && (responseDestinationName.length() > 0)) {
- error("ResponseAttrElement", jmsBinding, responseConnectionName, responseDestinationName );
- }
- }
-
- // Other jmsBinding model validation may be added here.
-
- }
-
- /**
- * Given a valid JMSBinding, write it as XML using the given XML writer.
- *
- * This high-level method handles binding.jms element and its attributes.
- * Sub elements have their own writer methods and are called from here.
- * <binding.jms
- * correlationScheme="string"?
- * initialContextFactory="xs:anyURI"?
- * jndiURL="xs:anyURI"?
- * requestConnection="QName"?
- * responseConnection="QName"?
- * operationProperties="QName"?
- * ...>
- *
- * @param jmsBinding JMSBinding model
- * @param writer an XMLStreamWriter that writes XML attributes and elements
- */
- public void write(JMSBinding jmsBinding, XMLStreamWriter writer) throws ContributionWriteException,
- XMLStreamException {
- // Write a <binding.jms>
- writeStart(writer, Constants.SCA10_NS, JMSBindingConstants.BINDING_JMS,
- new XAttr("requestConnection", jmsBinding.getRequestConnectionName()),
- new XAttr("responseConnection", jmsBinding.getResponseConnectionName()));
-
- if (jmsBinding.getName() != null) {
- writer.writeAttribute("name", jmsBinding.getName());
- }
-
- if (jmsBinding.getURI() != null) {
- writer.writeAttribute("uri", jmsBinding.getURI());
- }
-
- String dest = jmsBinding.getDestinationName();
- if (dest != null) {
- if ( dest != null ) {
- writer.writeAttribute("uri", "jms:" + jmsBinding.getDestinationName());
- }
- }
-
- String correlationScheme = jmsBinding.getCorrelationScheme();
- if ( correlationScheme != null ) {
- if ( !correlationScheme.equals(JMSBindingConstants.CORRELATE_MSG_ID) ) {
- writer.writeAttribute("correlationScheme", jmsBinding.getCorrelationScheme());
- }
- }
-
- if ( jmsBinding.getInitialContextFactoryName() != null ) {
- writer.writeAttribute("initialContextFactory", jmsBinding.getInitialContextFactoryName());
- }
-
- if ( jmsBinding.getJndiURL() != null ) {
- writer.writeAttribute("jndiURL", jmsBinding.getJndiURL());
- }
-
- if ( jmsBinding.containsHeaders() ) {
- writeHeaders( jmsBinding, writer);
- }
-
- writeOperationProperties( jmsBinding, writer );
-
- writeSubscriptionHeaders( jmsBinding, writer );
-
- writeDestinationProperties( jmsBinding, writer );
-
- writeConnectionFactoryProperties( jmsBinding, writer );
-
- writeActivationSpecProperties( jmsBinding, writer );
-
- // Write response info, if names are not defaults.
- String responseDestName = jmsBinding.getResponseDestinationName();
- String responseCFName = jmsBinding.getResponseConnectionFactoryName();
- String responseASName = jmsBinding.getResponseActivationSpecName();
- if ( responseDestName != null ||
- responseCFName != null ||
- responseASName != null ) {
-
- writer.writeStartElement("response");
- writeResponseDestinationProperties( jmsBinding, writer );
- writeResponseConnectionFactoryProperties( jmsBinding, writer );
- writeResponseActivationSpecProperties( jmsBinding, writer );
-
- if ((jmsBinding.getResponseWireFormat() != null) &&
- !(jmsBinding.getResponseWireFormat() instanceof WireFormatJMSTextXML)){
- writeWireFormat(jmsBinding.getResponseWireFormat(), writer);
- }
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters( " " );
- }
-
- writeResourceAdapterProperties( jmsBinding, writer );
-
- writeConfiguredOperations( jmsBinding, writer );
-
- if ((jmsBinding.getRequestWireFormat() != null) &&
- !(jmsBinding.getRequestWireFormat() instanceof WireFormatJMSTextXML)){
- writeWireFormat(jmsBinding.getRequestWireFormat(), writer);
- }
-
- if ((jmsBinding.getOperationSelector() != null) &&
- !(jmsBinding.getOperationSelector() instanceof OperationSelectorJMSDefault)){
- writeOperationSelector(jmsBinding.getOperationSelector(), writer);
- }
-
- writeEnd(writer);
- }
-
- /**
- * Writes headers element and its attributes.
- * <headers JMSType=”string”?
- * JMSCorrelationID=”string”?
- * JMSDeliveryMode=”PERSISTENT or NON_PERSISTENT”?
- * JMSTimeToLive=”long”?
- * JMSPriority=”0 .. 9”?>
- * <property name=”NMTOKEN” type=”NMTOKEN”?>*
- * </headers>?
- */
- private void writeHeaders( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
-
- writer.writeStartElement(JMSBindingConstants.HEADERS);
-
- String jmsType = jmsBinding.getJMSType();
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("JMSType", jmsType);
- }
-
- String jmsCorrelationId = jmsBinding.getJMSCorrelationId();
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- writer.writeAttribute("JMSCorrelationId", jmsCorrelationId);
- }
-
- Boolean jmsDeliveryMode = jmsBinding.isdeliveryModePersistent();
- if (jmsDeliveryMode != null) {
- if ( jmsDeliveryMode.booleanValue() )
- writer.writeAttribute("JMSDeliveryMode", "PERSISTENT");
- else
- writer.writeAttribute("JMSDeliveryMode", "NON_PERSISTENT");
- }
-
- Long jmsTimeToLive = jmsBinding.getJMSTimeToLive();
- if (jmsTimeToLive != null) {
- writer.writeAttribute("JMSTimeToLive", jmsTimeToLive.toString());
- }
-
- Integer jmsPriority = jmsBinding.getJMSPriority();
- if (jmsPriority != null) {
- writer.writeAttribute("JMSPriority", jmsPriority.toString());
- }
-
- Map<String, Object> properties = jmsBinding.getProperties();
- writeProperties( properties, writer );
- //writer.writeCharacters( " " );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters( " " );
- }
-
- /**
- * Writes a complete set of properties to the given XML stream writer.
- * If the value is of type string, the property will be output:
- * <property name="key">StringValue</property>
- * If the value is of type box (e.g.Integer, Long) or BindingProperty, the output will be
- * <property name="key" type="int">42</property>
- */
- private void writeProperties(Map<String, Object> properties, XMLStreamWriter writer) throws XMLStreamException {
- if (( properties == null ) || ( properties.size() == 0 )) {
- return;
- }
-
- // For both the keys and values of a map
- for (Iterator it=properties.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
-
- writer.writeStartElement( "property" );
- writer.writeAttribute("name", key.toString());
-
- if ( value instanceof String) {
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof BindingProperty ) {
- BindingProperty property = (BindingProperty) value;
- String type = property.getType();
- if ( type != null ) {
- writer.writeAttribute("type", type);
- }
- writer.writeCharacters( property.getValue().toString() );
- } else if ( value instanceof Boolean ) {
- writer.writeAttribute("type", "boolean");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Byte ) {
- writer.writeAttribute("type", "byte");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Short ) {
- writer.writeAttribute("type", "short");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Integer ) {
- writer.writeAttribute("type", "int");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Long ) {
- writer.writeAttribute("type", "long");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Float ) {
- writer.writeAttribute("type", "float");
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof Double ) {
- writer.writeAttribute("type", "double");
- writer.writeCharacters( value.toString() );
- } else {
- writer.writeCharacters( value.toString() );
- }
- writer.writeEndElement();
- }
- }
-
- /**
- * Writes operation properties if there are any.
- *
- * <operationProperties name="string" nativeOperation="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * <headers JMSType="string"?
- * JMSCorrelationId="string"?
- * JMSDeliveryMode="string"?
- * JMSTimeToLive="int"?
- * JMSPriority="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </headers>?
- * </operationProperties>*
- * </binding.jms>
- */
- private void writeOperationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- Set<String> operationNames = jmsBinding.getOperationNames();
- if (operationNames == null || (operationNames.size() < 1)) {
- return;
- }
-
- for(Iterator<String> it=operationNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
-
- writer.writeStartElement("operationProperties");
- writer.writeAttribute("name", opName);
-
- String nativeOperation = jmsBinding.getNativeOperationName(opName);
- if (nativeOperation != null && nativeOperation.length() > 0) {
- if ( !nativeOperation.equals( opName )) {
- writer.writeAttribute("nativeOperation", nativeOperation);
- }
- }
-
- Map<String, BindingProperty> operationPropertiesProperties =
- jmsBinding.getOperationPropertiesProperties(opName);
- writeBindingProperties( operationPropertiesProperties, writer );
-
- String jmsType = jmsBinding.getOperationJMSType(opName);
- String jmsCorrelationId = jmsBinding.getOperationJMSCorrelationId(opName);
- Boolean jmsDeliveryMode = jmsBinding.getOperationJMSDeliveryMode(opName);
- Long jmsTimeToLive = jmsBinding.getOperationJMSTimeToLive(opName);
- Integer jmsPriority = jmsBinding.getOperationJMSPriority(opName);
- Map<String, Object> operationProperties = jmsBinding.getOperationProperties(opName);
-
- if (jmsType != null || jmsCorrelationId != null || jmsDeliveryMode != null ||
- jmsTimeToLive != null || jmsPriority != null || operationProperties != null) {
-
- writer.writeStartElement(JMSBindingConstants.HEADERS);
-
- if (jmsType != null && jmsType.length() > 0) {
- writer.writeAttribute("JMSType", jmsType);
- }
-
- if (jmsCorrelationId != null && jmsCorrelationId.length() > 0) {
- writer.writeAttribute("JMSCorrelationId", jmsCorrelationId);
- }
-
- if (jmsDeliveryMode != null) {
- if (jmsDeliveryMode.booleanValue())
- writer.writeAttribute("JMSDeliveryMode", "PERSISTENT");
- else
- writer.writeAttribute("JMSDeliveryMode", "NON_PERSISTENT");
- }
-
- if (jmsTimeToLive != null) {
- writer.writeAttribute("JMSTimeToLive", jmsTimeToLive.toString());
- }
-
- if (jmsPriority != null) {
- writer.writeAttribute("JMSPriority", jmsPriority.toString());
- }
-
- writeProperties( operationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- // writer.writeCharacters( " " );
- }
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
- }
-
- /**
- * Writes a complete set of properties to the given XML stream writer.
- * If the value is of type string, the property will be output:
- * <property name="key">StringValue</property>
- * If the value is of type box (e.g.Integer, Long) or BindingProperty, the output will be
- * <property name="key" type="int">42</property>
- */
- private void writeBindingProperties(Map<String, BindingProperty> properties, XMLStreamWriter writer) throws XMLStreamException {
- if (( properties == null ) || ( properties.size() == 0 )) {
- return;
- }
-
- // For both the keys and values of a map
- for (Iterator it=properties.entrySet().iterator(); it.hasNext(); ) {
- Map.Entry entry = (Map.Entry)it.next();
- Object key = entry.getKey();
- Object value = entry.getValue();
-
- writer.writeStartElement( "property" );
- writer.writeAttribute("name", key.toString());
-
- if ( value instanceof String) {
- writer.writeCharacters( value.toString() );
- } else if ( value instanceof BindingProperty ) {
- BindingProperty property = (BindingProperty) value;
- String type = property.getType();
- if ( type != null ) {
- writer.writeAttribute("type", type);
- }
- writer.writeCharacters( property.getValue().toString() );
- } else {
- writer.writeCharacters( value.toString() );
- }
- writer.writeEndElement();
- }
- }
-
- /**
- * Writes subscription headers if there are any.
- * <complexType name="SubscriptionHeaders">
- * <attribute name="JMSSelector" type="string"/>
- * </complexType>
- *
- */
- private void writeSubscriptionHeaders( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String jmsSubscriptionHeaders = jmsBinding.getJMSSelector();
- if (jmsSubscriptionHeaders != null && jmsSubscriptionHeaders.length() > 0) {
- writer.writeStartElement("SubscriptionHeaders");
- writer.writeAttribute("JMSSelector", jmsSubscriptionHeaders);
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- // writer.writeCharacters( " " );
- }
- }
-
- /**
- * Writes destination properties if there are any.
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- */
- private void writeDestinationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String destinationName = jmsBinding.getDestinationName();
- if (destinationName == null || (destinationName.length() < 1)) {
- return;
- }
- if (destinationName == null) {
- return;
- }
-
- writer.writeStartElement("destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("name", destinationName);
- }
-
- // Type not handled yet
- // String destinationType = jmsBinding.getDestinationType();
- // if ( destinationType != null && destinationType.length() > 0) {
- // writer.writeAttribute("type", destinationType);
- // }
-
- String destinationCreate = jmsBinding.getDestinationCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> destinationProperties =
- jmsBinding.getDestinationProperties();
- writeBindingProperties( destinationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes connection factory properties if there are any.
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- */
- private void writeConnectionFactoryProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String cfName = jmsBinding.getConnectionFactoryName();
- if (cfName == null || (cfName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement("connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("name", cfName);
- }
-
- String destinationCreate = jmsBinding.getConnectionFactoryCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getConnectionFactoryProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes activation Spec properties if there are any.
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- */
- private void writeActivationSpecProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getActivationSpecName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement("activationSpec");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- String destinationCreate = jmsBinding.getActivationSpecCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getActivationSpecProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response destination properties if there are any.
- * <destination name="xs:anyURI" type="string"? create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </destination>?
- */
- private void writeResponseDestinationProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String destinationName = jmsBinding.getResponseDestinationName();
- if (destinationName == null || (destinationName.length() < 1)) {
- return;
- }
- if (destinationName == null) {
- return;
- }
-
- writer.writeStartElement("destination");
-
- if ( destinationName != null && destinationName.length() > 0) {
- writer.writeAttribute("name", destinationName);
- }
-
- // Type not handled yet
- // String destinationType = jmsBinding.getDestinationType();
- // if ( destinationType != null && destinationType.length() > 0) {
- // writer.writeAttribute("type", destinationType);
- // }
-
- String destinationCreate = jmsBinding.getResponseDestinationCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> destinationProperties =
- jmsBinding.getResponseDestinationProperties();
- writeBindingProperties( destinationProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response connection factory properties if there are any.
- * <connectionFactory name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </connectionFactory>?
- *
- */
- private void writeResponseConnectionFactoryProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String cfName = jmsBinding.getResponseConnectionFactoryName();
- if (cfName == null || (cfName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement("connectionFactory");
-
- if ( cfName != null && cfName.length() > 0) {
- writer.writeAttribute("name", cfName);
- }
-
- String destinationCreate = jmsBinding.getResponseConnectionFactoryCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResponseConnectionFactoryProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes response activation Spec properties if there are any.
- * <activationSpec name="xs:anyURI" create="string"?>
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </activationSpec>?
- *
- */
- private void writeResponseActivationSpecProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getResponseActivationSpecName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement("activationSpec");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- String destinationCreate = jmsBinding.getResponseActivationSpecCreate();
- if ( destinationCreate != null && destinationCreate.length() > 0) {
- writer.writeAttribute("create", destinationCreate);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResponseActivationSpecProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes resource adapter properties if there are any.
- * <resourceAdapter name="NMTOKEN">?
- * <property name="NMTOKEN" type="NMTOKEN">*
- * </resourceAdapter>?
- */
- private void writeResourceAdapterProperties( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException {
- String asName = jmsBinding.getResourceAdapterName();
- if (asName == null || (asName.length() < 1)) {
- return;
- }
-
- writer.writeStartElement("resourceAdapter");
-
- if ( asName != null && asName.length() > 0) {
- writer.writeAttribute("name", asName);
- }
-
- Map<String, BindingProperty> cfProperties =
- jmsBinding.getResourceAdapterProperties();
- writeBindingProperties( cfProperties, writer );
-
- writer.writeEndElement();
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Writes configured operations if there are any.
- * <binding.jms uri=\"jms:testQueue\" >"
- * <operationProperties name=\"op1\">"
- * </operationProperties >"
- * <operation name=\"op1\" requires=\"IntentOne IntentTwo\"/>"
- * </binding.jms>"
- */
- private void writeConfiguredOperations( JMSBinding jmsBinding, XMLStreamWriter writer) throws XMLStreamException, ContributionWriteException {
- List<ConfiguredOperation> configOps = jmsBinding.getConfiguredOperations();
- if (configOps == null || (configOps.size() < 1)) {
- return;
- }
-
- for( Iterator<ConfiguredOperation> it = configOps.iterator(); it.hasNext();) {
- configuredOperationProcessor.write(it.next(), writer);
- }
-
- // Strange bug. Without white space, headers end tag improperly read.
- writer.writeCharacters(" ");
- }
-
- /**
- * Wire out a request or response wire format element. Uses extension processors
- * to do this as wire format is an extension point
- *
- * @param wireFormat
- * @param writer
- */
- private void writeWireFormat(WireFormat wireFormat, XMLStreamWriter writer ) throws XMLStreamException, ContributionWriteException {
- extensionProcessor.write(wireFormat, writer);
- }
-
- /**
- * Wire out an operation selector element. Uses extension processors
- * to do this as operation selector is an extension point
- *
- * @param operationSeletor
- * @param writer
- */
- private void writeOperationSelector(OperationSelector operationSeletor, XMLStreamWriter writer ) throws XMLStreamException, ContributionWriteException{
- extensionProcessor.write(operationSeletor, writer);
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java
deleted file mode 100644
index 71d1298c9b..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefault.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jms.operationselector.jmsdefault;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.OperationSelector;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefault implements OperationSelector {
- public static final QName OPERATION_SELECTOR_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "operationSelector.JMSDefault");
-
- public QName getSchemaName() {
- return OPERATION_SELECTOR_JMS_DEFAULT_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java
deleted file mode 100644
index 4a8e4a1bd2..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/operationselector/jmsdefault/OperationSelectorJMSDefaultProcessor.java
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * 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.jms.operationselector.jmsdefault;
-
-
-import javax.xml.namespace.QName;
-import javax.xml.stream.XMLStreamException;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLStreamWriter;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class OperationSelectorJMSDefaultProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<OperationSelectorJMSDefault> {
-
- public QName getArtifactType() {
- return OperationSelectorJMSDefault.OPERATION_SELECTOR_JMS_DEFAULT_QNAME;
- }
-
- public OperationSelectorJMSDefaultProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public OperationSelectorJMSDefault read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- OperationSelectorJMSDefault wireFormat = new OperationSelectorJMSDefault();
-
- return wireFormat;
- }
-
- public void write(OperationSelectorJMSDefault wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<OperationSelectorJMSDefault> getModelType() {
- return OperationSelectorJMSDefault.class;
- }
-
- public void resolve(OperationSelectorJMSDefault arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java
deleted file mode 100644
index 84d1a2740f..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytes.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jms.wireformat.jmsbytes;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytes implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsBytes");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java
deleted file mode 100644
index 2d807d49cb..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsbytes/WireFormatJMSBytesProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.jms.wireformat.jmsbytes;
-
-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;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSBytesProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSBytes> {
-
- public QName getArtifactType() {
- return WireFormatJMSBytes.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSBytesProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSBytes read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSBytes wireFormat = new WireFormatJMSBytes();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSBytes wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSBytes> getModelType() {
- return WireFormatJMSBytes.class;
- }
-
- public void resolve(WireFormatJMSBytes arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java
deleted file mode 100644
index 7e39f696bd..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObject.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jms.wireformat.jmsobject;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObject implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsObject");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java
deleted file mode 100644
index 806b713931..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmsobject/WireFormatJMSObjectProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.jms.wireformat.jmsobject;
-
-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;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSObjectProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSObject> {
-
- public QName getArtifactType() {
- return WireFormatJMSObject.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSObjectProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSObject read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSObject wireFormat = new WireFormatJMSObject();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSObject wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSObject> getModelType() {
- return WireFormatJMSObject.class;
- }
-
- public void resolve(WireFormatJMSObject arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java
deleted file mode 100644
index fff33df1f4..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSText.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.jms.wireformat.jmstext;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- * Implementation for policies that could be injected as parameter
- * into the axis2config.
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSText implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_BYTES_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsText");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java
deleted file mode 100644
index 9b675df290..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstext/WireFormatJMSTextProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.jms.wireformat.jmstext;
-
-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;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSText> {
-
- public QName getArtifactType() {
- return WireFormatJMSText.WIRE_FORMAT_JMS_BYTES_QNAME;
- }
-
- public WireFormatJMSTextProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSText read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSText wireFormat = new WireFormatJMSText();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSText wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSText> getModelType() {
- return WireFormatJMSText.class;
- }
-
- public void resolve(WireFormatJMSText arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java
deleted file mode 100644
index 23a53b9d96..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXML.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * 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.jms.wireformat.jmstextxml;
-
-import javax.xml.namespace.QName;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.assembly.WireFormat;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXML implements WireFormat {
- public static final QName WIRE_FORMAT_JMS_DEFAULT_QNAME = new QName(Constants.SCA10_TUSCANY_NS, "wireFormat.jmsTextXML");
-
- public QName getSchemaName() {
- return WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public boolean isUnresolved() {
- return false;
- }
-
- public void setUnresolved(boolean unresolved) {
- }
-
- @Override
- public boolean equals(Object obj) {
- return this.getClass() == obj.getClass();
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java b/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java
deleted file mode 100644
index 8248fc771a..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/java/org/apache/tuscany/sca/binding/jms/wireformat/jmstextxml/WireFormatJMSTextXMLProcessor.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * 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.jms.wireformat.jmstextxml;
-
-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;
-
-import org.apache.tuscany.sca.assembly.xml.Constants;
-import org.apache.tuscany.sca.contribution.ModelFactoryExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.resolver.ModelResolver;
-import org.apache.tuscany.sca.contribution.service.ContributionReadException;
-import org.apache.tuscany.sca.contribution.service.ContributionResolveException;
-import org.apache.tuscany.sca.contribution.service.ContributionWriteException;
-import org.apache.tuscany.sca.monitor.Monitor;
-
-/**
- *
- * @version $Rev$ $Date$
- */
-public class WireFormatJMSTextXMLProcessor extends BaseStAXArtifactProcessor implements StAXArtifactProcessor<WireFormatJMSTextXML> {
-
- public QName getArtifactType() {
- return WireFormatJMSTextXML.WIRE_FORMAT_JMS_DEFAULT_QNAME;
- }
-
- public WireFormatJMSTextXMLProcessor(ModelFactoryExtensionPoint modelFactories, Monitor monitor) {
- }
-
-
- public WireFormatJMSTextXML read(XMLStreamReader reader) throws ContributionReadException, XMLStreamException {
- WireFormatJMSTextXML wireFormat = new WireFormatJMSTextXML();
-
- return wireFormat;
- }
-
- public void write(WireFormatJMSTextXML wireFormat, XMLStreamWriter writer)
- throws ContributionWriteException, XMLStreamException {
- String prefix = "tuscany";
- writer.writeStartElement(prefix,
- getArtifactType().getLocalPart(),
- getArtifactType().getNamespaceURI());
- writer.writeNamespace("tuscany", Constants.SCA10_TUSCANY_NS);
-
- writer.writeEndElement();
- }
-
- public Class<WireFormatJMSTextXML> getModelType() {
- return WireFormatJMSTextXML.class;
- }
-
- public void resolve(WireFormatJMSTextXML arg0, ModelResolver arg1) throws ContributionResolveException {
-
- }
-
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor b/branches/sca-java-1.5/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
deleted file mode 100644
index e5b8a96783..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/resources/META-INF/services/org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.
-
-# Implementation class for the artifact processor extension
-org.apache.tuscany.sca.binding.jms.impl.JMSBindingProcessor;qname=http://www.osoa.org/xmlns/sca/1.0#binding.jms,model=org.apache.tuscany.sca.binding.jms.impl.JMSBinding
-org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXMLProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsTextXML,model=org.apache.tuscany.sca.binding.jms.wireformat.jmstextxml.WireFormatJMSTextXML
-org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytesProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsBytes,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes
-org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSTextProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsText,model=org.apache.tuscany.sca.binding.jms.wireformat.jmstext.WireFormatJMSText
-org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObjectProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#wireFormat.jmsObject,model=org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject
-org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefaultProcessor;qname=http://tuscany.apache.org/xmlns/sca/1.0#operationSelector.jmsDefault,model=org.apache.tuscany.sca.binding.jms.operationselector.jmsdefault.OperationSelectorJMSDefault
-
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties b/branches/sca-java-1.5/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
deleted file mode 100644
index 75bf06df1f..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/main/resources/binding-jms-validation-messages.properties
+++ /dev/null
@@ -1,49 +0,0 @@
-#
-#
-# 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.
-#
-#
-DoesntProcessOperationProperties = JMS Binding doesn't process operationProperties yet
-DoesntProcessHeaders = JMS Binding doesn't process headers yet
-DoesntProcessResourceAdapter = JMS Binding doesn't process resourceAdapter yet
-DoesntProcessResponseConnectionFactory = JMS Binding doesn't process response connectionFactory yet
-DoesntProcessResponseActivationSpec = JMS Binding doesn't process response activationSpec yet
-DoesntProcessResponseDestinationType = JMS Binding doesn't process response destination type yet
-DoesntProcessActivationSpec = JMS Binding doesn't process activationSpec yet
-DoesntProcessDestinationType = JMS Binding doesn't process destination type yet
-MissingConnectionFactoryName = Missing ConnectionFactory Name
-MissingResponseConnectionFactory = Missing response connectionFactory name
-InvalidResponseDestinationType = Invalid response destination type: {0}
-InvalidDestinationType = Invalid destination type: {0}
-MissingActivationSpecName = Missing ActivationSpec Name
-MissingResponseActivationSpec = Missing response ActivationSpec name
-UnknownTokenInURI = Unknown token {0} in uri: {1}
-MustStartWithSchema = URI must start with the scheme 'jms:' for uri: {0}
-InvalidCorrelationScheme = Invalid correlationScheme: {0}
-UnexpectedElement = Incomplete binding.jms definition found unexpected element: {0}
-UnexpectedResponseElement = Incomplete binding.jms/response definition found unexpected element: {0}
-InvalidJMSDeliveryMode = Invalid JMSDeliveryMode: {0}
-InvalidJMSPriority = Invalid JMSPriority: {0}
-MissingJMSOperationPropertyName = Missing JMSOperationProperty Name
-InvalidOPJMSDeliveryMode = Invalid OPJMSDeliveryMode: {0}
-InvalidOPJMSPriority = Invalid OPJMSPriority: {0}
-DestinationQueueContradiction = Destination type queue contradicts connection factory name: {0}
-DestinationTopicContradiction = Destination type topic contradicts connection factory name: {0}
-ConnectionFactoryActivationSpecContradiction = Connection factory \"{0}\" and activation specification \"{0}\" are mutually exclusive
-ResponseAttrElement = Response connection \"{0}\" and response element \"{1}\" are mutually exclusive
-BindingNotFound = {0} refers to a binding definition {1} which is not found
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java b/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
deleted file mode 100644
index 7c294b645a..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorTestCase.java
+++ /dev/null
@@ -1,735 +0,0 @@
-/*
- * 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.jms.impl;
-
-import java.io.InputStream;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.ConfiguredOperation;
-import org.apache.tuscany.sca.assembly.OperationsConfigurator;
-import org.apache.tuscany.sca.assembly.WireFormat;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsbytes.WireFormatJMSBytes;
-import org.apache.tuscany.sca.binding.jms.wireformat.jmsobject.WireFormatJMSObject;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-
-/**
- * Tests for JMS binding xml
- */
-public class JMSBindingProcessorTestCase extends TestCase {
- // Note: If you are adding new JMS binding read test cases,
- // consider adding a similar test case to JMSBindingProcessorWriteTestCase.
- public static final String COMPOSITE =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" />"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String HEADERS1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers JMSType=\"myType\" JMSCorrelationID=\"myCorrelId\" JMSDeliveryMode=\"PERSISTENT\" JMSTimeToLive=\"54321\" JMSPriority=\"5\">"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <headers>"
- + " <property name=\"p1\">bla</property>"
- + " <property name=\"intProp\" type=\"int\">42</property>"
- + " </headers>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " <headers JMSType=\"op1Type\" >"
- + " <property name=\"p1\">bla</property>"
- + " <property name=\"intProp\" type=\"int\">42</property>"
- + " </headers>"
- + " </operationProperties >"
- + " <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\" >"
- + " <headers JMSType=\"op2Type\">"
- + " <property name=\"p2\">op2bla</property>"
- + " <property name=\"intProp\" type=\"int\">77</property>"
- + " </headers>"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_NAMES_NO_PROPERTIES1 =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " </operationProperties >"
- + " <operationProperties name=\"op2\" nativeOperation=\"nativeOp2\" >"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String SELECTOR =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <SubscriptionHeaders JMSSelector=\"prop1 = 2\" />"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String COMPOSITE_INVALID_URI =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"invalidjms:testQueue\" />"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- // Invalid: contains both a response attribute and a response element.
- public static final String COMPOSITE_INVALID_RESPONSE_ATTR_ELEMENT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" responseConnection=\"responseConnectionAttrName\">"
- + " <response>"
- + " <destination name=\"responseConnectionElementName\"/>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String DEST_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <destination name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </destination>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String CF_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <connectionFactory name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </connectionFactory>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String AS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <activationSpec name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </activationSpec>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_DEST_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <destination name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </destination>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_CF_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <connectionFactory name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </connectionFactory>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RESP_AS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <response>"
- + " <activationSpec name=\"foo\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </activationSpec>"
- + " </response>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String OP_PROPS_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <operationProperties name=\"op1\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </operationProperties >"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String RES_ADPT_PROPS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms>"
- + " <resourceAdapter name=\"r1\">"
- + " <property name=\"xxx\" type=\"yyy\">"
- + " some value text"
- + " </property>"
- + " <property name=\"two\">"
- + " bla"
- + " </property>"
- + " </resourceAdapter>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String CONFIGURED_OPERATIONS =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <operationProperties name=\"op1\">"
- + " </operationProperties >"
- + " <operation name=\"op1\" requires=\"IntentOne IntentTwo\"/>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- public static final String WIRE_FORMAT =
- "<?xml version=\"1.0\" encoding=\"ASCII\"?>"
- + "<composite xmlns=\"http://www.osoa.org/xmlns/sca/1.0\" targetNamespace=\"http://binding-jms\" xmlns:tuscany=\"http://tuscany.apache.org/xmlns/sca/1.0\" name=\"binding-jms\">"
- + " <component name=\"HelloWorldComponent\">"
- + " <implementation.java class=\"services.HelloWorld\"/>"
- + " <service name=\"HelloWorldService\">"
- + " <binding.jms uri=\"jms:testQueue\" >"
- + " <response>"
- + " <destination name=\"responseConnectionElementName\"/>"
- + " <tuscany:wireFormat.jmsBytes/>"
- + " </response>"
- + " <tuscany:wireFormat.jmsObject/>"
- + " </binding.jms>"
- + " </service>"
- + " </component>"
- + "</composite>";
-
- private XMLInputFactory inputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
-
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("testQueue", binding.getDestinationName());
- }
-
- public void testHeaders1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(HEADERS1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("myType", binding.getJMSType());
- assertEquals("myCorrelId", binding.getJMSCorrelationId());
- assertTrue(binding.isdeliveryModePersistent());
- assertEquals(54321, binding.getJMSTimeToLive().longValue());
- assertEquals(5, binding.getJMSPriority().intValue());
- }
-
- public void testProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("bla", binding.getProperty("p1"));
- assertEquals(42, ((Integer)binding.getProperty("intProp")).intValue());
- }
-
- public void testOpProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Map<String, Object> op1Props = binding.getOperationProperties("op1");
- assertEquals("op1Type", binding.getOperationJMSType("op1"));
- assertEquals("bla", op1Props.get("p1"));
- assertEquals(42, ((Integer)op1Props.get("intProp")).intValue());
-
- assertEquals("op2Type", binding.getOperationJMSType("op2"));
- Map<String, Object> op2Props = binding.getOperationProperties("op2");
- assertEquals("op2bla", op2Props.get("p2"));
- assertEquals(77, ((Integer)op2Props.get("intProp")).intValue());
- }
-
- public void testSubscriptionHeaders () throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(SELECTOR));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- assertEquals("prop1 = 2", binding.getJMSSelector());
- }
-
- /** Test various parsing validation requirements. */
- public void testParsingValidationErrors1() throws Exception {
- // Composite with malformed URI.
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID_URI));
-
- try {
- Composite composite = (Composite)staxProcessor.read(reader);
- } catch(Exception e) {
- // JMSBindingExceptions are expected with invalid composite.
- if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) )
- throw e;
- // Do assertion to make sure test registers results.
- assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) );
- }
- }
-
- /** Test various model validation requirements. */
- public void testValidationErrors1() throws Exception {
- // Composite with response connection attr and element.
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(COMPOSITE_INVALID_RESPONSE_ATTR_ELEMENT));
-
- try {
- Composite composite = (Composite)staxProcessor.read(reader);
- } catch(Exception e) {
- // JMSBindingExceptions are expected with invalid composite.
- if ( !e.getClass().isAssignableFrom( JMSBindingException.class ) )
- throw e;
- // Do assertion to make sure test registers results.
- assertTrue( e.getClass().isAssignableFrom( JMSBindingException.class ) );
- }
- }
-
- public void testDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(DEST_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getDestinationProperties());
- assertEquals(2, binding.getDestinationProperties().size());
- BindingProperty bp = binding.getDestinationProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getDestinationProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CF_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getConnectionFactoryProperties());
- assertEquals(2, binding.getConnectionFactoryProperties().size());
- BindingProperty bp = binding.getConnectionFactoryProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getConnectionFactoryProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(AS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getActivationSpecProperties());
- assertEquals(2, binding.getActivationSpecProperties().size());
- BindingProperty bp = binding.getActivationSpecProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getActivationSpecProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_DEST_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseDestinationProperties());
- assertEquals(2, binding.getResponseDestinationProperties().size());
- BindingProperty bp = binding.getResponseDestinationProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseDestinationProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_CF_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseConnectionFactoryProperties());
- assertEquals(2, binding.getResponseConnectionFactoryProperties().size());
- BindingProperty bp = binding.getResponseConnectionFactoryProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseConnectionFactoryProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResponseActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RESP_AS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getResponseActivationSpecProperties());
- assertEquals(2, binding.getResponseActivationSpecProperties().size());
- BindingProperty bp = binding.getResponseActivationSpecProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResponseActivationSpecProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testOperationPropertiesProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPS_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertNotNull(binding.getOperationPropertiesProperties("op1"));
- assertEquals(2, binding.getOperationPropertiesProperties("op1").size());
- BindingProperty bp = binding.getOperationPropertiesProperties("op1").get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getOperationPropertiesProperties("op1").get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
- public void testResouceAdapterProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(RES_ADPT_PROPS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
- assertEquals("r1", binding.getResourceAdapterName());
- assertNotNull(binding.getResourceAdapterProperties());
- assertEquals(2, binding.getResourceAdapterProperties().size());
- BindingProperty bp = binding.getResourceAdapterProperties().get("xxx");
- assertEquals("xxx", bp.getName());
- assertEquals("yyy", bp.getType());
- assertEquals("some value text", bp.getValue().toString().trim());
- BindingProperty bp2 = binding.getResourceAdapterProperties().get("two");
- assertEquals("two", bp2.getName());
- assertEquals(null, bp2.getType());
- assertEquals("bla", bp2.getValue().toString().trim());
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * public Object getOperationProperty(String opName, String propName );
- * @throws Exception
- */
- public void testOpProperties2() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Set<String> opNames = binding.getOperationNames();
- assertEquals( 2, opNames.size() );
- // Recall that order is not guaranteed iterating over a set.
- for (Iterator<String> it=opNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
- assertTrue( opName.equals( "op1") || opName.equals( "op2"));
- }
-
- Object value = binding.getOperationProperty( "op1", "p1" );
- assertEquals("bla", value);
- value = binding.getOperationProperty( "op1", "intProp" );
- assertEquals(42, ((Integer)value).intValue());
-
- value = binding.getOperationProperty( "op2", "p2" );
- assertEquals("op2bla", value);
- value = binding.getOperationProperty( "op2", "intProp" );
- assertEquals(77, ((Integer)value).intValue());
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * Provides no optional properties or sub elements
- * @throws Exception
- */
- public void testOpProperties3() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(OP_NAMES_NO_PROPERTIES1));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- assertNotNull(binding);
-
- Set<String> opNames = binding.getOperationNames();
- assertEquals( 2, opNames.size() );
- // Recall that order is not guaranteed iterating over a set.
- for (Iterator<String> it=opNames.iterator(); it.hasNext(); ) {
- String opName = it.next();
- assertTrue( opName.equals( "op1") || opName.equals( "op2"));
- }
- }
-
- /**
- * Tests the APIs:
- * public Set<String> getOperationNames();
- * Provides no optional properties or sub elements
- * @throws Exception
- */
- public void testConfiguredOperations1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(CONFIGURED_OPERATIONS));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- OperationsConfigurator opConfig = ((OperationsConfigurator)binding);
- assertEquals(opConfig.getConfiguredOperations().get(0).getRequiredIntents().size(), 2);
- }
-
- /**
- * Tests the APIs:
- * public WireFormat getRequstWireFormat();
- * public WireFormat getResponseWireFormat();
- *
- * @throws Exception
- */
- public void testWireFormat() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(WIRE_FORMAT));
-
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- WireFormat requestWireFormat = binding.getRequestWireFormat();
- assertEquals(WireFormatJMSObject.class, requestWireFormat.getClass());
-
- WireFormat responseWireFormat = binding.getResponseWireFormat();
- assertEquals(WireFormatJMSBytes.class, responseWireFormat.getClass());
- }
-}
diff --git a/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java b/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java
deleted file mode 100644
index d9427407e5..0000000000
--- a/branches/sca-java-1.5/modules/binding-jms/src/test/java/org/apache/tuscany/sca/binding/jms/impl/JMSBindingProcessorWriteTestCase.java
+++ /dev/null
@@ -1,385 +0,0 @@
-/*
- * 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.jms.impl;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.StringReader;
-import java.util.Iterator;
-import java.util.Map;
-import java.util.Set;
-
-import javax.xml.stream.XMLInputFactory;
-import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLOutputFactory;
-import javax.xml.stream.XMLStreamWriter;
-
-import junit.framework.TestCase;
-
-import org.apache.tuscany.sca.assembly.Binding;
-import org.apache.tuscany.sca.assembly.Component;
-import org.apache.tuscany.sca.assembly.Composite;
-import org.apache.tuscany.sca.assembly.Service;
-import org.apache.tuscany.sca.contribution.processor.DefaultStAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.contribution.processor.ExtensibleStAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessor;
-import org.apache.tuscany.sca.contribution.processor.StAXArtifactProcessorExtensionPoint;
-import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
-import org.apache.tuscany.sca.core.UtilityExtensionPoint;
-import org.apache.tuscany.sca.monitor.Monitor;
-import org.apache.tuscany.sca.monitor.MonitorFactory;
-import org.apache.tuscany.sca.monitor.impl.DefaultMonitorFactoryImpl;
-
-/**
- * Tests for JMS binding XML writes.
- * In general, for each JMS binding XML read test case, there
- * is a write test case.
- */
-public class JMSBindingProcessorWriteTestCase extends TestCase {
-
- private XMLInputFactory inputFactory;
- private XMLOutputFactory outputFactory;
- private StAXArtifactProcessor<Object> staxProcessor;
- private Monitor monitor;
-
- @Override
- protected void setUp() throws Exception {
- DefaultExtensionPointRegistry extensionPoints = new DefaultExtensionPointRegistry();
- inputFactory = XMLInputFactory.newInstance();
- outputFactory = XMLOutputFactory.newInstance();
- // Create a monitor
- UtilityExtensionPoint utilities = extensionPoints.getExtensionPoint(UtilityExtensionPoint.class);
- MonitorFactory monitorFactory = new DefaultMonitorFactoryImpl();
- if (monitorFactory != null) {
- monitor = monitorFactory.createMonitor();
- utilities.addUtility(monitorFactory);
- }
- StAXArtifactProcessorExtensionPoint staxProcessors = new DefaultStAXArtifactProcessorExtensionPoint(extensionPoints);
- staxProcessor = new ExtensibleStAXArtifactProcessor(staxProcessors, inputFactory, null, monitor);
- }
-
- /**
- * Test parsing valid composite definition. Valid composite populated with correct values expected.
- * @throws Exception
- */
- public void testLoadValidComposite() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.COMPOSITE));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2);
- }
-
- public void testHeaders1() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.HEADERS1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2 );
- }
-
- public void testProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.PROPERTIES1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals( binding, binding2 );
- }
-
- public void testOpProperties1() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.OP_PROPERTIES1));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testSubscriptionHeaders() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.SELECTOR));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.DEST_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.CF_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.AS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseDestinationProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_DEST_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseConnectionFactoryProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_CF_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResponseActivationSpecProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RESP_AS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testOperationPropertiesProperties() throws Exception {
- XMLStreamReader reader = inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.OP_PROPS_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding) composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testResouceAdapterProperties() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.RES_ADPT_PROPS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testConfiguredOperations() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.CONFIGURED_OPERATIONS));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-
- public void testWireFormat() throws Exception {
- XMLStreamReader reader =
- inputFactory.createXMLStreamReader(new StringReader(JMSBindingProcessorTestCase.WIRE_FORMAT));
- Composite composite = (Composite)staxProcessor.read(reader);
- JMSBinding binding = (JMSBinding)composite.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding);
-
- // Write out JMSBinding model to stream.
- ByteArrayOutputStream bos = new ByteArrayOutputStream();
- staxProcessor.write(composite, outputFactory.createXMLStreamWriter(bos));
-
- // Read written JMSBinding to a different JMSBinding model.
- XMLStreamReader reader2 = inputFactory.createXMLStreamReader(new StringReader(bos.toString()));
- Composite composite2 = (Composite)staxProcessor.read(reader2);
- JMSBinding binding2 = (JMSBinding)composite2.getComponents().get(0).getServices().get(0).getBindings().get(0);
- assertNotNull(binding2);
-
- // Compare initial binding to written binding.
- assertEquals(binding, binding2);
- }
-}