[jboss-svn-commits] JBL Code SVN: r6273 - in labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format: . serialized
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Mon Sep 18 10:52:55 EDT 2006
Author: mark.little at jboss.com
Date: 2006-09-18 10:52:52 -0400 (Mon, 18 Sep 2006)
New Revision: 6273
Added:
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/AttachmentImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/ContextImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/FaultImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/HeaderImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java
labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/SerializedMessagePlugin.java
Log:
added Java serializable message support.
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/AttachmentImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/AttachmentImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/AttachmentImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,36 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import org.jboss.soa.esb.message.Attachment;
+
+/*
+ * 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.
+ *
+ * @author Mark Little
+ */
+
+public class AttachmentImpl implements Attachment, java.io.Serializable
+{
+
+}
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/BodyImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,85 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import java.security.InvalidParameterException;
+
+import org.jboss.soa.esb.message.Body;
+
+/*
+ * 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
+ */
+
+/*
+ * Placeholder class. Just enough to do the initial POC.
+ */
+
+public class BodyImpl implements Body, java.io.Serializable
+{
+ public BodyImpl ()
+ {
+ _content = null;
+ }
+
+ public void setContents (byte[] content)
+ {
+ _content = content;
+ }
+
+ public byte[] getContents ()
+ {
+ return _content;
+ }
+
+ public void replace (Body b)
+ {
+ if (b == null)
+ throw new InvalidParameterException();
+
+ setContents(b.getContents());
+ }
+
+ public void merge (Body b)
+ {
+ if (b == null)
+ throw new InvalidParameterException();
+
+ byte[] toAdd = b.getContents();
+
+ if ((toAdd != null) && (toAdd.length > 0))
+ {
+ if ((_content == null) || (_content.length == 0))
+ {
+ _content = toAdd;
+ }
+ else
+ {
+ int newSize = _content.length + toAdd.length;
+ byte[] buffer = new byte[newSize];
+
+ for (int i = 0; i < _content.length; i++)
+ buffer[i] = _content[i];
+
+ for (int j = 0; j < toAdd.length; j++)
+ buffer[_content.length+j] = toAdd[j];
+ }
+ }
+ }
+
+ private byte[] _content;
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/ContextImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/ContextImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/ContextImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,29 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import org.jboss.soa.esb.message.Context;
+
+/*
+ * 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 class ContextImpl implements Context, java.io.Serializable
+{
+
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/FaultImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/FaultImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/FaultImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,29 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import org.jboss.soa.esb.message.Fault;
+
+/*
+ * 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 class FaultImpl implements Fault, java.io.Serializable
+{
+
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/HeaderImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/HeaderImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/HeaderImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,91 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+/*
+ * 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.message.Header;
+import org.jboss.soa.esb.addressing.Call;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+/**
+ * The message header. Contains such things as routing information.
+ */
+
+public class HeaderImpl implements Header
+{
+ public HeaderImpl ()
+ {
+ _call = null;
+ }
+
+ // TODO add other setters/getters for artibitrary attributes
+
+ public Call getCall ()
+ {
+ return _call;
+ }
+
+ public void setCall (Call call)
+ {
+ _call = call;
+ }
+
+ public Element toXML (Document doc, Element envelope)
+ {
+ // TODO remove MAGIC strings!!
+
+ Element headerElement = doc.createElement("header");
+
+ envelope.appendChild(headerElement);
+
+ return _call.toXML(doc, headerElement);
+ }
+
+ public void fromXML (Element envelope)
+ {
+ _call = new Call();
+
+ NodeList nl = envelope.getChildNodes();
+ Element headerElement = null;
+
+ for (int i = 0; i < nl.getLength(); i++)
+ {
+ Node n = nl.item(i);
+
+ if (n.getNodeName().equals("header"))
+ {
+ headerElement = (Element) n;
+ break;
+ }
+ }
+
+ // TODO error handling!!
+
+ if (headerElement != null)
+ _call.fromXML(headerElement);
+ }
+
+ private Call _call;
+}
\ No newline at end of file
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/MessageImpl.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,112 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import org.jboss.soa.esb.message.*;
+import org.jboss.soa.esb.message.format.MessageType;
+
+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
+ */
+
+/**
+ * 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 class MessageImpl implements Message, java.io.Serializable
+{
+ /**
+ * @return get the header component of the message.
+ */
+
+ public Header getHeader ()
+ {
+ return _theHeader;
+ }
+
+ /**
+ * @return get the context component of the message.
+ */
+
+ public Context getContext ()
+ {
+ return _theContext;
+ }
+
+ /**
+ * @return get the body component of the message.
+ */
+
+ public Body getBody ()
+ {
+ return _theBody;
+ }
+
+ /**
+ * @return get any faults associated with the message. These should not
+ * be application level faults, but comms level.
+ */
+
+ public Fault getFault ()
+ {
+ return _theFault;
+ }
+
+ /**
+ * @return get any message attachments.
+ */
+
+ public Attachment getAttachment ()
+ {
+ return _theAttachment;
+ }
+
+ /**
+ * @return the type of this message format.
+ */
+
+ public URI getType ()
+ {
+ return MessageType.JAVA_SERIALIZED;
+ }
+
+ private HeaderImpl _theHeader = new HeaderImpl();
+ private ContextImpl _theContext = new ContextImpl();
+ private BodyImpl _theBody = new BodyImpl();
+ private FaultImpl _theFault = new FaultImpl();
+ private AttachmentImpl _theAttachment = new AttachmentImpl();
+
+}
Added: labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/SerializedMessagePlugin.java
===================================================================
--- labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/SerializedMessagePlugin.java 2006-09-18 14:42:27 UTC (rev 6272)
+++ labs/jbossesb/workspace/rearchitecture/product/core/rosetta/src/org/jboss/internal/soa/esb/message/format/serialized/SerializedMessagePlugin.java 2006-09-18 14:52:52 UTC (rev 6273)
@@ -0,0 +1,49 @@
+package org.jboss.internal.soa.esb.message.format.serialized;
+
+import org.jboss.soa.esb.message.Message;
+
+import org.jboss.soa.esb.message.format.MessagePlugin;
+import org.jboss.soa.esb.message.format.MessageType;
+
+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
+ */
+
+/**
+ * Used to plug in new message formats dynamically.
+ *
+ * @author Mark Little
+ *
+ */
+
+public class SerializedMessagePlugin implements MessagePlugin
+{
+ public Message getMessage ()
+ {
+ return new MessageImpl();
+ }
+
+ public URI getType ()
+ {
+ return MessageType.JAVA_SERIALIZED;
+ }
+}
More information about the jboss-svn-commits
mailing list