[overlord-commits] Overlord SVN: r776 - in cdl/trunk/runtime/jbossesb/src: main/java/org/jboss/savara and 6 other directories.
overlord-commits at lists.jboss.org
overlord-commits at lists.jboss.org
Thu Aug 20 03:01:21 EDT 2009
Author: jeff.yuchang
Date: 2009-08-20 03:01:20 -0400 (Thu, 20 Aug 2009)
New Revision: 776
Added:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/LogicalCourier.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/ClassLoaderUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/MessageUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/NameSpaceUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/StringUtils.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/XMLUtils.java
Removed:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/ClassLoaderUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/LogicalCourier.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/MessageUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/NameSpaceUtil.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/StringUtils.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/XMLUtils.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/soa/
Modified:
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/IfAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/ReceiveMessageAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SendMessageAction.java
cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SwitchAction.java
cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/savara/jbossesb/util/XMLUtilsTest.java
Log:
* Package renaming. move Util classes to its internal package.
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/LogicalCourier.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/LogicalCourier.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/LogicalCourier.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,77 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ */
+package org.jboss.savara.internal.jbossesb;
+
+import org.jboss.soa.esb.addressing.MalformedEPRException;
+import org.jboss.soa.esb.couriers.CourierException;
+import org.jboss.soa.esb.message.Message;
+import org.jboss.soa.esb.addressing.eprs.*;
+import org.jboss.soa.esb.client.ServiceInvoker;
+import org.jboss.soa.esb.listeners.message.MessageDeliverException;
+
+/**
+ * This class providers the courier implementation associated
+ * with a LogicalEPR.
+ *
+ * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
+ */
+public class LogicalCourier implements org.jboss.soa.esb.couriers.Courier {
+
+ private ServiceInvoker serviceInvoker=null;
+
+ /**
+ * The constructor, supplied the logical EPR represented
+ * by the courier.
+ *
+ * @param epr The logical EPR
+ * @throws MessageDeliverException
+ */
+ public LogicalCourier(LogicalEPR epr)
+ throws MessageDeliverException {
+ serviceInvoker = epr.getServiceInvoker();
+ }
+
+ /**
+ * This method delivers the supplied message to the EPR
+ * associated with the logical courier.
+ *
+ * @param mesg The message
+ */
+ public boolean deliver(Message mesg) throws CourierException,
+ MalformedEPRException {
+
+ try {
+ serviceInvoker.deliverAsync(mesg);
+ } catch(MessageDeliverException e) {
+ throw new CourierException("Failed to deliver message", e);
+ }
+
+ return(true);
+ }
+
+ /**
+ * This method cleans up after the courier implementation
+ * is no longer required.
+ */
+ public void cleanup() {
+ serviceInvoker = null;
+ }
+
+}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/ClassLoaderUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/ClassLoaderUtil.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/ClassLoaderUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,33 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ */
+package org.jboss.savara.internal.jbossesb.utils;
+
+/**
+ *
+ * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
+ *
+ */
+public class ClassLoaderUtil {
+
+ public static Class<?> loadClass(String className) throws ClassNotFoundException {
+ return Thread.currentThread().getContextClassLoader().loadClass(className);
+ }
+
+}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/MessageUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/MessageUtil.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/MessageUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,96 @@
+/*
+ * Copyright 2005-6 Pi4 Technologies Ltd
+ *
+ * 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.
+ *
+ *
+ * Change History:
+ * Mar 21, 2006 : Initial version created by gary
+ */
+package org.jboss.savara.internal.jbossesb.utils;
+
+import java.util.logging.Logger;
+
+import org.w3c.dom.Node;
+
+
+/**
+ * This class represents utility functions for processing
+ * messages.
+ *
+ * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
+ * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
+ */
+public class MessageUtil {
+
+ private static Logger logger = Logger.getLogger(MessageUtil.class.getName());
+
+ /**
+ * This method returns the message type associated with the
+ * supplied value.
+ *
+ * @param value The value
+ * @return The message type
+ */
+ public static String getMessageType(Object value) {
+ String ret=null;
+
+ if (value instanceof org.w3c.dom.Node) {
+ String namespace=((org.w3c.dom.Node)value).getNamespaceURI();
+ String localpart=((org.w3c.dom.Node)value).getLocalName();
+
+ if (value instanceof org.w3c.dom.Element &&
+ ((org.w3c.dom.Element)value).hasAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type")) {
+ String type=((org.w3c.dom.Element)value).getAttributeNS(
+ "http://www.w3.org/2001/XMLSchema-instance", "type");
+
+ String prefix= XMLUtils.getPrefix(type);
+
+ localpart = XMLUtils.getLocalname(type);
+
+ if (prefix == null) {
+ namespace = null;
+ } else {
+ namespace = ((org.w3c.dom.Element)value).
+ getAttribute("xmlns:"+prefix);
+ if (!NameSpaceUtil.isNotNull(namespace)) {
+ namespace = null;
+ }
+ }
+ }
+
+ if (namespace == null) {
+ ret = localpart;
+ } else {
+ ret = NameSpaceUtil.getFullyQualifiedName(namespace,
+ localpart);
+ }
+ } else if (value instanceof String) {
+ ret = String.class.getName();
+
+ try {
+ Node node=XMLUtils.getNode((String)value);
+ ret = getMessageType(node);
+ } catch(Exception e) {
+ logger.warning("Failed to obtain message type from value: "+value);
+ }
+
+ } else {
+ ret = value.getClass().getName();
+ }
+
+ return(ret);
+ }
+
+}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/NameSpaceUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/NameSpaceUtil.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/NameSpaceUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,140 @@
+/*
+ * Copyright 2005 Pi4 Technologies Ltd
+ *
+ * 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.
+ *
+ *
+ * Change History:
+ * Jul 28, 2005 : Initial version created by gary
+ */
+package org.jboss.savara.internal.jbossesb.utils;
+
+/**
+ * This class provides helper functiions for manipulating fully
+ * qualified names (with local parts and namespaces).
+ *
+ * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
+ * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
+ */
+public class NameSpaceUtil {
+
+ public static final String NAMESPACE_PREFIX="{";
+ public static final String NAMESPACE_SUFFIX="}";
+
+ /**
+ * This method checks whether the supplied name is a
+ * fully qualified name, with the name space contained
+ * in braces, followed by a localpart.
+ *
+ * @param name The name
+ * @return Whether the name is a fully qualified name
+ */
+ public static boolean isFullyQualifiedName(String name) {
+ boolean ret=false;
+ int pos=0;
+
+ if (name != null && name.startsWith("{") &&
+ (pos=name.indexOf('}')) != -1 &&
+ name.length() != pos+1) {
+ ret = true;
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the fully qualified name associated
+ * with the supplied namespace and local part. If the namespace
+ * is null, or an empty string, then only the local part
+ * will be returned.
+ *
+ * @param namespace The namespace
+ * @param localpart The local part
+ * @return The fully qualified name
+ */
+ public static String getFullyQualifiedName(String namespace,
+ String localpart) {
+ String ret=null;
+
+ if (namespace != null && namespace.trim().length() > 0) {
+ ret = NAMESPACE_PREFIX+namespace+NAMESPACE_SUFFIX;
+ }
+
+ if (localpart != null) {
+ if (ret == null) {
+ ret = localpart;
+ } else {
+ ret += localpart;
+ }
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the namespace component of a fully
+ * qualified name. If the supplied name does not have the
+ * namespace prefix, then a null will be returned. If the
+ * supplied name does not have the suffix, then the contents
+ * following the prefix, to the end of the name, will be
+ * returned.
+ *
+ * @param qname The fully qualified name
+ * @return The namespace
+ */
+ public static String getNamespace(String qname) {
+ String ret=null;
+ int index=0;
+
+ if (qname != null &&
+ (index=qname.indexOf(NAMESPACE_PREFIX)) != -1) {
+ int endindex=qname.indexOf(NAMESPACE_SUFFIX);
+
+ if (endindex == -1) {
+ endindex = qname.length();
+ }
+
+ ret = qname.substring(index+1, endindex);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method extracts the local part from the supplied
+ * fully qualified name. If the namespace suffix cannot
+ * be found, then the fully supplied name will be
+ * returned.
+ *
+ * @param qname The fully qualified name
+ * @return The local part
+ */
+ public static String getLocalPart(String qname) {
+ String ret=null;
+ int index=0;
+
+ if (qname != null &&
+ (index=qname.indexOf(NAMESPACE_SUFFIX)) != -1) {
+ ret = qname.substring(index+1);
+ } else {
+ ret = qname;
+ }
+
+ return(ret);
+ }
+
+ public static boolean isNotNull(String value) {
+ return(value != null && value.trim().length() > 0);
+ }
+
+}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/StringUtils.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/StringUtils.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/StringUtils.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,42 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ */
+package org.jboss.savara.internal.jbossesb.utils;
+
+/**
+ * This utility class for keeping some common used methods to deal with String.
+ *
+ * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
+ *
+ */
+public class StringUtils {
+
+ public static final boolean isNull(String string) {
+ if (string == null || "".equals(string.trim())) {
+ return true;
+ }
+ return false;
+ }
+
+ public static final boolean isNotNull(String string) {
+ return !isNull(string);
+ }
+
+
+}
Added: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/XMLUtils.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/XMLUtils.java (rev 0)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/internal/jbossesb/utils/XMLUtils.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -0,0 +1,130 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2008, JBoss Inc., and others contributors as indicated
+ * by the @authors tag. All rights reserved.
+ * See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ * This copyrighted material is made available to anyone wishing to use,
+ * modify, copy, or redistribute it subject to the terms and conditions
+ * of the GNU Lesser General Public License, v. 2.1.
+ * This program is distributed in the hope that it will be useful, but WITHOUT A
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public License,
+ * v.2.1 along with this distribution; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
+ * MA 02110-1301, USA.
+ *
+ * (C) 2008,
+ */
+package org.jboss.savara.internal.jbossesb.utils;
+
+import java.io.ByteArrayInputStream;
+import java.io.InputStream;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+
+/**
+ *
+ * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
+ * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
+ */
+
+public class XMLUtils {
+
+ /**
+ * This method converts the supplied text representation
+ * of an XML document into a DOM Node.
+ *
+ * @param text The text
+ * @return The node
+ * @throws XMLException Failed to convert the text
+ */
+ public static Node getNode(String text) throws Exception {
+ Node ret=null;
+
+ try {
+ // Transform the text representation to DOM
+ DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
+ fact.setNamespaceAware(true);
+
+ InputStream xmlstr= new ByteArrayInputStream(text.getBytes());
+
+ DocumentBuilder builder=fact.newDocumentBuilder();
+ org.w3c.dom.Document doc=builder.parse(xmlstr);
+
+ ret = doc.getDocumentElement();
+
+ } catch(Exception e) {
+ throw new Exception("Failed to transform text " +
+ "into DOM representation", e);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the prefix part of the supplied
+ * qualified name.
+ *
+ * @param qname The qualified name
+ * @return The prefix
+ */
+ public static String getPrefix(String qname) {
+ String ret=null;
+ int pos=0;
+
+ if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
+ ret = qname.substring(0, pos);
+ }
+
+ return(ret);
+ }
+
+ /**
+ * This method returns the localname part of the supplied
+ * qualified name.
+ *
+ * @param qname The qualified name
+ * @return The localname part
+ */
+ public static String getLocalname(String qname) {
+ String ret=qname;
+ int pos=0;
+
+ if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
+ ret = qname.substring(pos+1);
+ }
+
+ return(ret);
+ }
+
+ /**
+ *
+ * @param object
+ * @param expression: xpath expression
+ * @return
+ * @throws Exception
+ */
+ public static String executeXpath(Object object, String expression) throws Exception {
+ XPathFactory factory = XPathFactory.newInstance();
+ XPath theXpath = factory.newXPath();
+
+ if (object instanceof String) {
+ String xmlMessage = (String)object;
+ Node node = getNode(xmlMessage);
+ return theXpath.evaluate(expression, node);
+ } else if (object instanceof Element) {
+ return theXpath.evaluate(expression, object);
+ }
+
+ return null;
+ }
+
+}
\ No newline at end of file
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/ClassLoaderUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/ClassLoaderUtil.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/ClassLoaderUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,33 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2008,
- */
-package org.jboss.savara.jbossesb;
-
-/**
- *
- * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
- *
- */
-public class ClassLoaderUtil {
-
- public static Class<?> loadClass(String className) throws ClassNotFoundException {
- return Thread.currentThread().getContextClassLoader().loadClass(className);
- }
-
-}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/LogicalCourier.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/LogicalCourier.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/LogicalCourier.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,77 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2008,
- */
-package org.jboss.savara.jbossesb;
-
-import org.jboss.soa.esb.addressing.MalformedEPRException;
-import org.jboss.soa.esb.couriers.CourierException;
-import org.jboss.soa.esb.message.Message;
-import org.jboss.soa.esb.addressing.eprs.*;
-import org.jboss.soa.esb.client.ServiceInvoker;
-import org.jboss.soa.esb.listeners.message.MessageDeliverException;
-
-/**
- * This class providers the courier implementation associated
- * with a LogicalEPR.
- *
- * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
- */
-public class LogicalCourier implements org.jboss.soa.esb.couriers.Courier {
-
- private ServiceInvoker serviceInvoker=null;
-
- /**
- * The constructor, supplied the logical EPR represented
- * by the courier.
- *
- * @param epr The logical EPR
- * @throws MessageDeliverException
- */
- public LogicalCourier(LogicalEPR epr)
- throws MessageDeliverException {
- serviceInvoker = epr.getServiceInvoker();
- }
-
- /**
- * This method delivers the supplied message to the EPR
- * associated with the logical courier.
- *
- * @param mesg The message
- */
- public boolean deliver(Message mesg) throws CourierException,
- MalformedEPRException {
-
- try {
- serviceInvoker.deliverAsync(mesg);
- } catch(MessageDeliverException e) {
- throw new CourierException("Failed to deliver message", e);
- }
-
- return(true);
- }
-
- /**
- * This method cleans up after the courier implementation
- * is no longer required.
- */
- public void cleanup() {
- serviceInvoker = null;
- }
-
-}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/MessageUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/MessageUtil.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/MessageUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,96 +0,0 @@
-/*
- * Copyright 2005-6 Pi4 Technologies Ltd
- *
- * 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.
- *
- *
- * Change History:
- * Mar 21, 2006 : Initial version created by gary
- */
-package org.jboss.savara.jbossesb;
-
-import java.util.logging.Logger;
-
-import org.w3c.dom.Node;
-
-
-/**
- * This class represents utility functions for processing
- * messages.
- *
- * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
- * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
- */
-public class MessageUtil {
-
- private static Logger logger = Logger.getLogger(MessageUtil.class.getName());
-
- /**
- * This method returns the message type associated with the
- * supplied value.
- *
- * @param value The value
- * @return The message type
- */
- public static String getMessageType(Object value) {
- String ret=null;
-
- if (value instanceof org.w3c.dom.Node) {
- String namespace=((org.w3c.dom.Node)value).getNamespaceURI();
- String localpart=((org.w3c.dom.Node)value).getLocalName();
-
- if (value instanceof org.w3c.dom.Element &&
- ((org.w3c.dom.Element)value).hasAttributeNS(
- "http://www.w3.org/2001/XMLSchema-instance", "type")) {
- String type=((org.w3c.dom.Element)value).getAttributeNS(
- "http://www.w3.org/2001/XMLSchema-instance", "type");
-
- String prefix= XMLUtils.getPrefix(type);
-
- localpart = XMLUtils.getLocalname(type);
-
- if (prefix == null) {
- namespace = null;
- } else {
- namespace = ((org.w3c.dom.Element)value).
- getAttribute("xmlns:"+prefix);
- if (!NameSpaceUtil.isNotNull(namespace)) {
- namespace = null;
- }
- }
- }
-
- if (namespace == null) {
- ret = localpart;
- } else {
- ret = NameSpaceUtil.getFullyQualifiedName(namespace,
- localpart);
- }
- } else if (value instanceof String) {
- ret = String.class.getName();
-
- try {
- Node node=XMLUtils.getNode((String)value);
- ret = getMessageType(node);
- } catch(Exception e) {
- logger.warning("Failed to obtain message type from value: "+value);
- }
-
- } else {
- ret = value.getClass().getName();
- }
-
- return(ret);
- }
-
-}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/NameSpaceUtil.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/NameSpaceUtil.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/NameSpaceUtil.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,140 +0,0 @@
-/*
- * Copyright 2005 Pi4 Technologies Ltd
- *
- * 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.
- *
- *
- * Change History:
- * Jul 28, 2005 : Initial version created by gary
- */
-package org.jboss.savara.jbossesb;
-
-/**
- * This class provides helper functiions for manipulating fully
- * qualified names (with local parts and namespaces).
- *
- * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
- * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
- */
-public class NameSpaceUtil {
-
- public static final String NAMESPACE_PREFIX="{";
- public static final String NAMESPACE_SUFFIX="}";
-
- /**
- * This method checks whether the supplied name is a
- * fully qualified name, with the name space contained
- * in braces, followed by a localpart.
- *
- * @param name The name
- * @return Whether the name is a fully qualified name
- */
- public static boolean isFullyQualifiedName(String name) {
- boolean ret=false;
- int pos=0;
-
- if (name != null && name.startsWith("{") &&
- (pos=name.indexOf('}')) != -1 &&
- name.length() != pos+1) {
- ret = true;
- }
-
- return(ret);
- }
-
- /**
- * This method returns the fully qualified name associated
- * with the supplied namespace and local part. If the namespace
- * is null, or an empty string, then only the local part
- * will be returned.
- *
- * @param namespace The namespace
- * @param localpart The local part
- * @return The fully qualified name
- */
- public static String getFullyQualifiedName(String namespace,
- String localpart) {
- String ret=null;
-
- if (namespace != null && namespace.trim().length() > 0) {
- ret = NAMESPACE_PREFIX+namespace+NAMESPACE_SUFFIX;
- }
-
- if (localpart != null) {
- if (ret == null) {
- ret = localpart;
- } else {
- ret += localpart;
- }
- }
-
- return(ret);
- }
-
- /**
- * This method returns the namespace component of a fully
- * qualified name. If the supplied name does not have the
- * namespace prefix, then a null will be returned. If the
- * supplied name does not have the suffix, then the contents
- * following the prefix, to the end of the name, will be
- * returned.
- *
- * @param qname The fully qualified name
- * @return The namespace
- */
- public static String getNamespace(String qname) {
- String ret=null;
- int index=0;
-
- if (qname != null &&
- (index=qname.indexOf(NAMESPACE_PREFIX)) != -1) {
- int endindex=qname.indexOf(NAMESPACE_SUFFIX);
-
- if (endindex == -1) {
- endindex = qname.length();
- }
-
- ret = qname.substring(index+1, endindex);
- }
-
- return(ret);
- }
-
- /**
- * This method extracts the local part from the supplied
- * fully qualified name. If the namespace suffix cannot
- * be found, then the fully supplied name will be
- * returned.
- *
- * @param qname The fully qualified name
- * @return The local part
- */
- public static String getLocalPart(String qname) {
- String ret=null;
- int index=0;
-
- if (qname != null &&
- (index=qname.indexOf(NAMESPACE_SUFFIX)) != -1) {
- ret = qname.substring(index+1);
- } else {
- ret = qname;
- }
-
- return(ret);
- }
-
- public static boolean isNotNull(String value) {
- return(value != null && value.trim().length() > 0);
- }
-
-}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/StringUtils.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/StringUtils.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/StringUtils.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,42 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2008,
- */
-package org.jboss.savara.jbossesb;
-
-/**
- * This utility class for keeping some common used methods to deal with String.
- *
- * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
- *
- */
-public class StringUtils {
-
- public static final boolean isNull(String string) {
- if (string == null || "".equals(string.trim())) {
- return true;
- }
- return false;
- }
-
- public static final boolean isNotNull(String string) {
- return !isNull(string);
- }
-
-
-}
Deleted: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/XMLUtils.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/XMLUtils.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/XMLUtils.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -1,130 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source
- * Copyright 2008, JBoss Inc., and others contributors as indicated
- * by the @authors tag. All rights reserved.
- * See the copyright.txt in the distribution for a
- * full listing of individual contributors.
- * This copyrighted material is made available to anyone wishing to use,
- * modify, copy, or redistribute it subject to the terms and conditions
- * of the GNU Lesser General Public License, v. 2.1.
- * This program is distributed in the hope that it will be useful, but WITHOUT A
- * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
- * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
- * You should have received a copy of the GNU Lesser General Public License,
- * v.2.1 along with this distribution; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
- * MA 02110-1301, USA.
- *
- * (C) 2008,
- */
-package org.jboss.savara.jbossesb;
-
-import java.io.ByteArrayInputStream;
-import java.io.InputStream;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.xpath.XPath;
-import javax.xml.xpath.XPathFactory;
-
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-
-/**
- *
- * @author <a href="mailto:gary.brown at hattricksoftware.com">Gary Brown</a>
- * @author <a href="mailto:cyu at redhat.com">Jeff Yu</a>
- */
-
-public class XMLUtils {
-
- /**
- * This method converts the supplied text representation
- * of an XML document into a DOM Node.
- *
- * @param text The text
- * @return The node
- * @throws XMLException Failed to convert the text
- */
- public static Node getNode(String text) throws Exception {
- Node ret=null;
-
- try {
- // Transform the text representation to DOM
- DocumentBuilderFactory fact=DocumentBuilderFactory.newInstance();
- fact.setNamespaceAware(true);
-
- InputStream xmlstr= new ByteArrayInputStream(text.getBytes());
-
- DocumentBuilder builder=fact.newDocumentBuilder();
- org.w3c.dom.Document doc=builder.parse(xmlstr);
-
- ret = doc.getDocumentElement();
-
- } catch(Exception e) {
- throw new Exception("Failed to transform text " +
- "into DOM representation", e);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the prefix part of the supplied
- * qualified name.
- *
- * @param qname The qualified name
- * @return The prefix
- */
- public static String getPrefix(String qname) {
- String ret=null;
- int pos=0;
-
- if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
- ret = qname.substring(0, pos);
- }
-
- return(ret);
- }
-
- /**
- * This method returns the localname part of the supplied
- * qualified name.
- *
- * @param qname The qualified name
- * @return The localname part
- */
- public static String getLocalname(String qname) {
- String ret=qname;
- int pos=0;
-
- if (qname != null && ((pos=qname.indexOf(':')) != -1)) {
- ret = qname.substring(pos+1);
- }
-
- return(ret);
- }
-
- /**
- *
- * @param object
- * @param expression: xpath expression
- * @return
- * @throws Exception
- */
- public static String executeXpath(Object object, String expression) throws Exception {
- XPathFactory factory = XPathFactory.newInstance();
- XPath theXpath = factory.newXPath();
-
- if (object instanceof String) {
- String xmlMessage = (String)object;
- Node node = getNode(xmlMessage);
- return theXpath.evaluate(expression, node);
- } else if (object instanceof Element) {
- return theXpath.evaluate(expression, object);
- }
-
- return null;
- }
-
-}
\ No newline at end of file
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/IfAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/IfAction.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/IfAction.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -23,9 +23,9 @@
import java.util.List;
import org.apache.log4j.Logger;
-import org.jboss.savara.jbossesb.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.utils.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.utils.StringUtils;
import org.jboss.savara.jbossesb.Decision;
-import org.jboss.savara.jbossesb.StringUtils;
import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.helpers.ConfigTree;
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/ReceiveMessageAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/ReceiveMessageAction.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/ReceiveMessageAction.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -20,10 +20,10 @@
package org.jboss.savara.jbossesb.actions;
import org.apache.log4j.Logger;
-import org.jboss.savara.jbossesb.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.utils.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.utils.MessageUtil;
+import org.jboss.savara.internal.jbossesb.utils.StringUtils;
import org.jboss.savara.jbossesb.EPRStore;
-import org.jboss.savara.jbossesb.MessageUtil;
-import org.jboss.savara.jbossesb.StringUtils;
import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.helpers.ConfigTree;
import org.jboss.soa.esb.message.Message;
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SendMessageAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SendMessageAction.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SendMessageAction.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -21,11 +21,11 @@
import org.apache.log4j.Logger;
import org.jboss.internal.soa.esb.addressing.helpers.EPRHelper;
-import org.jboss.savara.jbossesb.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.LogicalCourier;
+import org.jboss.savara.internal.jbossesb.utils.ClassLoaderUtil;
+import org.jboss.savara.internal.jbossesb.utils.MessageUtil;
+import org.jboss.savara.internal.jbossesb.utils.StringUtils;
import org.jboss.savara.jbossesb.EPRStore;
-import org.jboss.savara.jbossesb.LogicalCourier;
-import org.jboss.savara.jbossesb.MessageUtil;
-import org.jboss.savara.jbossesb.StringUtils;
import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.addressing.EPR;
import org.jboss.soa.esb.addressing.eprs.LogicalEPR;
Modified: cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SwitchAction.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SwitchAction.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/main/java/org/jboss/savara/jbossesb/actions/SwitchAction.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -22,7 +22,7 @@
import java.util.LinkedList;
import java.util.List;
-import org.jboss.savara.jbossesb.MessageUtil;
+import org.jboss.savara.internal.jbossesb.utils.MessageUtil;
import org.jboss.soa.esb.actions.AbstractActionLifecycle;
import org.jboss.soa.esb.client.ServiceInvoker;
import org.jboss.soa.esb.helpers.ConfigTree;
Modified: cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/savara/jbossesb/util/XMLUtilsTest.java
===================================================================
--- cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/savara/jbossesb/util/XMLUtilsTest.java 2009-08-20 05:58:57 UTC (rev 775)
+++ cdl/trunk/runtime/jbossesb/src/test/java/org/jboss/savara/jbossesb/util/XMLUtilsTest.java 2009-08-20 07:01:20 UTC (rev 776)
@@ -20,7 +20,7 @@
package org.jboss.savara.jbossesb.util;
import org.w3c.dom.Element;
-import org.jboss.savara.jbossesb.XMLUtils;
+import org.jboss.savara.internal.jbossesb.utils.XMLUtils;
import org.junit.Test;
import junit.framework.Assert;
More information about the overlord-commits
mailing list