[jboss-svn-commits] JBL Code SVN: r6485 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message

jboss-svn-commits at lists.jboss.org jboss-svn-commits at lists.jboss.org
Sat Sep 30 18:59:31 EDT 2006


Author: mark.little at jboss.com
Date: 2006-09-30 18:59:26 -0400 (Sat, 30 Sep 2006)
New Revision: 6485

Added:
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Attachment.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Context.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Fault.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Header.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Message.java
   labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Properties.java
Log:


Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Attachment.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Attachment.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Attachment.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,110 @@
+package org.jboss.soa.esb.message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/**
+ * Messages may contain attachments that do not appear in the main payload body.
+ * For example, binary document formats, zip files etc.
+ * <br/>Handles both 'named' attachment and a list of 'unnamed' attachments
+ * 
+ * @author Mark Little
+ */
+
+public interface Attachment
+{
+	/**
+	 * Returns the attachment to which this object maps the specified key. 
+	 * Returns null if the there's no value mapped for this key.
+	 * @param name String - The name of the attachment to get
+	 * @return Object - the value mapped to arg0 or &lt;null&gt; if none
+	 */
+	Object get(String name);
+	/**
+	 * Associates the specified value with the specified name
+	 * If there was already a mapping for this name, the old value is replaced by 
+	 * arg1
+	 * @param name String - the name for the object to be stored
+	 * @param value Object - the object to be associated with the name (arg0)
+	 * @return Object - previous value associated with specified name,
+	 * or null  if there was none
+	 */
+	Object put(String name, Object value);
+	/**
+	 * Removes the mapping for this name if it was present
+	 * @param name String - the name of the object to be removed
+	 * @return the value previously associated the name, or null if there was none
+	 */
+	Object remove(String name);
+	/**
+	 * @return String[] - the list of names of the named Objects
+	 */
+	String[] getNames();
+
+	/**
+     * get the item at the specified position in the list of unnamed objects
+     * @param index int - index of element to return
+     * @return Object the element at the specified position in the list of unnamed objects
+     * @throws IndexOutOfBoundsException - if the index is out of range
+     */
+	Object itemAt 		(int index) throws IndexOutOfBoundsException;
+	/**
+	 * Removes the element at the specified position in the list of unnamed objects
+	 * Shifts any subsequent elements to the left 
+	 * @param index int - index of element to remove
+	 * @return Object - the element that was removed from the list
+	 * @throws IndexOutOfBoundsException - if the index is out of range
+	 */
+	Object removeItemAt	(int index) throws IndexOutOfBoundsException;
+	/**
+	 * Replaces the element at the specified position in the list of unnamed objects 
+	 * with the value supplied
+	 * @param index int - index of element to be replaced
+	 * @param  value Object - the object to replace the one previously stored at that index
+	 * @return Object - previous value at that index
+	 * @throws IndexOutOfBoundsException - if the index is out of range
+	 */
+	Object replaceItemAt(int index, Object value) throws IndexOutOfBoundsException;
+	/**
+	 * Appends the specified element to the end of the list of unnamed objects
+	 * <br/>null values are allowed 
+	 * @param value Object - the object to be appended
+	 */
+	void addItem		(Object value);
+	/**
+	 * Replaces the element at the specified position in the list of unnamed objects
+	 * <br/> allows null values
+	 * @param index int - index where to insert the value - Shifts any subsequent elements to the right
+	 * @param value Object - value to be stored at the specified position
+	 * @throws IndexOutOfBoundsException
+	 */
+	void addItemAt	(int index, Object value) throws IndexOutOfBoundsException;
+	/**
+	 * getUnnamedCount()
+	 * @return the count of unnamed objects
+	 */
+	int	getUnnamedCount();
+	/**
+	 * getNamedCount()
+	 * @return the count of named objects
+	 */
+	public int getNamedCount(); 
+}

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Body.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,100 @@
+package org.jboss.soa.esb.message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+/*
+ * The message body holds arbitrary information which represents the
+ * payload as far as clients and services are concerned. A body may contain:
+ * 
+ * (i) a byte array for arbitrary data. How that array is interpreted by the
+ * service is implementation specific and outside the scope of the ESB to
+ * enforce.
+ * 
+ * (ii) a list of Objects of arbitrary types. How these objects are serialized
+ * to/from the message body when it is transmitted is up to the specific
+ * Object type. The plan is to add support for various TYPES of Object and the message
+ * implementation will use external adapters to externalize/internalize the Objects.
+ * Currently we only support Serializable objects.
+ */
+
+public interface Body
+{
+	// TODO error handling exceptions
+	
+	/**
+	 * Add the specified Object to the body.
+	 * 
+	 * @param name the name of the object. MUST be unique within this body.
+	 * @param value the Object to add.
+	 */
+	
+	public void add (String name, Object value);
+	
+	/**
+	 * Get the specified Object, or <code>null</code> if not present.
+	 * 
+	 * @param name the name of the Object to retrieve.
+	 * @return the Object.
+	 */
+	
+	public Object get (String name);
+	
+	/**
+	 * Remove the specified Object and return it, or <code>null</code> if not present.
+	 * 
+	 * @param name the name of the Object to remove.
+	 * @return the Object removed.
+	 */
+	
+	public Object remove (String name);
+	
+	/**
+	 * Set the byte content of the body.
+	 * 
+	 * @param content the message bytes
+	 */
+	
+	public void setContents (byte[] content);
+	
+	/**
+	 * @return the byte content of the body.
+	 */
+	
+	public byte[] getContents ();
+
+	/**
+	 * Replace this body instance with the one given.
+	 * 
+	 * @param b the body to be replaced with.
+	 */
+	
+	public void replace (Body b);
+	
+	/**
+	 * Merge two bodies.
+	 * 
+	 * @param b the body to be merged with.
+	 */
+	
+	public void merge (Body b);
+
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Context.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Context.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Context.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,27 @@
+package org.jboss.soa.esb.message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+public interface Context
+{
+	// TODO add some methods!
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Fault.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Fault.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Fault.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,33 @@
+package org.jboss.soa.esb.message;
+
+import java.net.URI;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+public interface Fault
+{
+	public URI getCode ();
+	public void setCode (URI code);
+	
+	public String getReason ();
+	public void setReason (String reason);
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Header.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Header.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Header.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,34 @@
+package org.jboss.soa.esb.message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+import org.jboss.soa.esb.addressing.Call;
+
+/**
+ * The message header. Contains such things as routing information.
+ */
+
+public interface Header
+{
+	public Call getCall ();
+	public void setCall (Call call);
+}
\ No newline at end of file

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Message.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Message.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Message.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,91 @@
+package org.jboss.soa.esb.message;
+
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author mark.little at jboss.com
+ */
+
+import java.net.URI;
+
+/**
+ * This is the basic internal core message abstraction. A message consists of the following
+ * components:
+ * 
+ * Header: the header information contains information such as the destination EPR, the
+ * sender EPR, where the reply goes etc, i.e., general message-level functional information.
+ * Context: additional information to contextualise the message; for example, transaction or
+ * security data, the identity of the ultimate receiver, or HTTP-cookie like information.
+ * Body: the actual payload of the message.
+ * Fault: any fault information associated with the message.
+ * Attachment: any attachments associated with the message.
+ * 
+ * Each message, once created, has a corresponding element for these 5 components. That element
+ * may be empty (<b>NOT NULL</b>). The object representing the element can then be used to act
+ * on the corresponding data item in the message.
+ * 
+ * @author Mark Little
+ *
+ */
+
+public interface Message
+{
+	/**
+	 * @return get the header component of the message.
+	 */
+	
+	public Header getHeader ();
+
+	/**
+	 * @return get the context component of the message.
+	 */
+	
+	public Context getContext ();
+	
+	/**
+	 * @return get the body component of the message.
+	 */
+	
+	public Body getBody ();
+
+	/**
+	 * @return get any faults associated with the message. These should not
+	 * be application level faults, but comms level.
+	 */
+	
+	public Fault getFault ();
+	
+	/**
+	 * @return get any message attachments.
+	 */
+	
+	public Attachment getAttachment ();
+	
+	/**
+	 * @return the type of this message.
+	 */
+	
+	public URI getType ();
+	
+	/**
+	 * @return Properties - any message properties.
+	 */
+	
+	public Properties getProperties ();
+	
+}

Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Properties.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Properties.java	2006-09-30 22:58:50 UTC (rev 6484)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/Properties.java	2006-09-30 22:59:26 UTC (rev 6485)
@@ -0,0 +1,68 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2006, 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) 2005-2006,
+ * @author schifest at heuristica.com.ar
+ */
+
+package org.jboss.soa.esb.message;
+
+/**
+ * The message properties hold arbitrary information  in the form
+ * of &lt;String,Object&gt; pairs
+ * 
+ */
+
+public interface Properties {
+	/**
+	 * getProperty(name)
+	 * @param name String - name of property
+	 * @return Object - the value stored under the specified name
+	 */
+	public Object getProperty(String name);
+	/**
+	 * getProperty(name,defaultVal)
+	 * @param name String - name of property
+	 * @param defaultVal Object - value to return if no value found
+	 * @return Object - the value stored under the specified name
+	 */
+	public Object getProperty(String name, Object defaultVal);
+	/**
+	 * setProperty(name,value)
+	 * @param name String - name of property to store
+	 * @param value Object - value of property to store under specified name
+	 * @return Object - the previous value of the specified name, or null if it did not have one
+	 */
+	public Object setProperty(String name, Object value);
+	/**
+	 * remove(name)
+	 * @param name String - name of property to remove
+	 * @return Object - the previous value of the specified name, or null if it did not have one
+	 */
+	public Object remove(String name);
+	/**
+	 * size()
+	 * @return int - Returns the number of properties in this object
+	 */
+	public int size();
+	/**
+	 * getNames()
+	 * @return String[] - containing the names of all properties
+	 */
+	public String[] getNames();
+
+}




More information about the jboss-svn-commits mailing list