summaryrefslogtreecommitdiffstats
path: root/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype
diff options
context:
space:
mode:
Diffstat (limited to 'branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype')
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeInfo.java49
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRule.java43
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleFactory.java74
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleSet.java64
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/DefaultRule.java37
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/MessageTypeRule.java39
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/PropertyRule.java39
-rw-r--r--branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/package-info.java23
8 files changed, 0 insertions, 368 deletions
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeInfo.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeInfo.java
deleted file mode 100644
index 2b415df64d..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeInfo.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-/**
- * Class encapsulating the content type information for a given message.
- */
-public class ContentTypeInfo {
- private final String propertyName;
- private final String contentType;
-
- public ContentTypeInfo(String propertyName, String contentType) {
- this.propertyName = propertyName;
- this.contentType = contentType;
- }
-
- /**
- * Get the name of the message property from which the content type
- * has been extracted.
- *
- * @return the property name or null if the content type was not determined
- * by extracting it from a message property
- */
- public String getPropertyName() {
- return propertyName;
- }
-
- /**
- * Get the content type of the message.
- *
- * @return The content type of the message. The return value is never null.
- */
- public String getContentType() {
- return contentType;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRule.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRule.java
deleted file mode 100644
index 0dba93356f..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRule.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-/**
- * Interface implemented by content type rules.
- */
-public interface ContentTypeRule {
- /**
- * Attempt to determine the content type of the given JMS message.
- *
- * @param message the message
- * @return If the rule matches, the return value encapsulates the content type of the
- * message and the message property name from which is was extracted
- * (if applicable). If the rule doesn't match, the method returns null.
- * @throws JMSException
- */
- ContentTypeInfo getContentType(Message message) throws JMSException;
-
- /**
- * Get the name of the message property used to extract the content type from,
- * if applicable.
- *
- * @return the property name or null if not applicable
- */
- String getExpectedContentTypeProperty();
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleFactory.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleFactory.java
deleted file mode 100644
index a9fd25ef1b..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleFactory.java
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import java.util.Iterator;
-
-import javax.jms.BytesMessage;
-import javax.jms.TextMessage;
-
-import org.apache.axiom.om.OMElement;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.description.Parameter;
-
-/**
- * Utility class to create content type rules and rule sets from XML.
- */
-public class ContentTypeRuleFactory {
- private ContentTypeRuleFactory() {}
-
- public static ContentTypeRule parse(OMElement element) throws AxisFault {
- String name = element.getLocalName();
- String value = element.getText();
- if (name.equals("jmsProperty")) {
- return new PropertyRule(value);
- } else if (name.equals("textMessage")) {
- return new MessageTypeRule(TextMessage.class, value);
- } else if (name.equals("bytesMessage")) {
- return new MessageTypeRule(BytesMessage.class, value);
- } else if (name.equals("default")) {
- return new DefaultRule(value);
- } else {
- throw new AxisFault("Unknown content rule type '" + name + "'");
- }
- }
-
- public static ContentTypeRuleSet parse(Parameter param) throws AxisFault {
- ContentTypeRuleSet ruleSet = new ContentTypeRuleSet();
- Object value = param.getValue();
- if (value instanceof OMElement) {
- OMElement element = (OMElement)value;
-
- // DescriptionBuilder#processParameters actually sets the parameter element
- // itself as the value. We need to support this case.
- // TODO: seems like a bug in Axis2 and is inconsistent with Synapse's way of parsing parameter in proxy definitions
- if (element == param.getParameterElement()) {
- element = element.getFirstElement();
- }
-
- if (element.getLocalName().equals("rules")) {
- for (Iterator it = element.getChildElements(); it.hasNext(); ) {
- ruleSet.addRule(parse((OMElement)it.next()));
- }
- } else {
- throw new AxisFault("Expected <rules> element");
- }
- } else {
- ruleSet.addRule(new DefaultRule((String)value));
- }
- return ruleSet;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleSet.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleSet.java
deleted file mode 100644
index 90383a42f8..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/ContentTypeRuleSet.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-/**
- * A set of content type rules.
- */
-public class ContentTypeRuleSet {
- private final List<ContentTypeRule> rules = new ArrayList<ContentTypeRule>();
- private String defaultContentTypeProperty;
-
- /**
- * Add a content type rule to this set.
- *
- * @param rule the rule to add
- */
- public void addRule(ContentTypeRule rule) {
- rules.add(rule);
- if (defaultContentTypeProperty == null) {
- defaultContentTypeProperty = rule.getExpectedContentTypeProperty();
- }
- }
-
- /**
- * Determine the content type of the given message.
- * This method will try the registered rules in turn until the first rule matches.
- *
- * @param message the message
- * @return the content type information for the message or null if none of the rules matches
- * @throws JMSException
- */
- public ContentTypeInfo getContentTypeInfo(Message message) throws JMSException {
- for (ContentTypeRule rule : rules) {
- ContentTypeInfo contentTypeInfo = rule.getContentType(message);
- if (contentTypeInfo != null) {
- return contentTypeInfo;
- }
- }
- return null;
- }
-
- public String getDefaultContentTypeProperty() {
- return defaultContentTypeProperty;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/DefaultRule.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/DefaultRule.java
deleted file mode 100644
index a158f6ec74..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/DefaultRule.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import javax.jms.Message;
-
-/**
- * Content type rule that always matches and that returns a fixed (default) content type.
- */
-public class DefaultRule implements ContentTypeRule {
- private final String contentType;
-
- public DefaultRule(String contentType) {
- this.contentType = contentType;
- }
-
- public ContentTypeInfo getContentType(Message message) {
- return new ContentTypeInfo(null, contentType);
- }
-
- public String getExpectedContentTypeProperty() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/MessageTypeRule.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/MessageTypeRule.java
deleted file mode 100644
index cb25ab93d4..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/MessageTypeRule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import javax.jms.Message;
-
-/**
- * Content type rule that matches a given message type and returns a fixed content type.
- */
-public class MessageTypeRule implements ContentTypeRule {
- private final Class<? extends Message> messageType;
- private final String contentType;
-
- public MessageTypeRule(Class<? extends Message> messageType, String contentType) {
- this.messageType = messageType;
- this.contentType = contentType;
- }
-
- public ContentTypeInfo getContentType(Message message) {
- return messageType.isInstance(message) ? new ContentTypeInfo(null, contentType) : null;
- }
-
- public String getExpectedContentTypeProperty() {
- return null;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/PropertyRule.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/PropertyRule.java
deleted file mode 100644
index c8d13ba462..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/PropertyRule.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype;
-
-import javax.jms.JMSException;
-import javax.jms.Message;
-
-/**
- * Content type rule that attempts to extract the content type from a message property.
- */
-public class PropertyRule implements ContentTypeRule {
- private final String propertyName;
-
- public PropertyRule(String propertyName) {
- this.propertyName = propertyName;
- }
-
- public ContentTypeInfo getContentType(Message message) throws JMSException {
- String value = message.getStringProperty(propertyName);
- return value == null ? null : new ContentTypeInfo(propertyName, value);
- }
-
- public String getExpectedContentTypeProperty() {
- return propertyName;
- }
-}
diff --git a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/package-info.java b/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/package-info.java
deleted file mode 100644
index 750170edd7..0000000000
--- a/branches/sca-java-1.x/modules/binding-ws-axis2-jms/src/main/java/org/apache/tuscany/sca/binding/ws/axis2/jms/ctype/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* 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.
-*/
-
-/**
- * Provides classes and interfaces to define content type rules.
- *
- * Content type rules are used to determine the content type of a
- * received message based on JMS properties, message type, etc.
- */
-package org.apache.tuscany.sca.binding.ws.axis2.jms.ctype; \ No newline at end of file