[jboss-svn-commits] JBL Code SVN: r6486 - labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Sat Sep 30 19:02:19 EDT 2006
Author: mark.little at jboss.com
Date: 2006-09-30 19:02:16 -0400 (Sat, 30 Sep 2006)
New Revision: 6486
Added:
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageFactory.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessagePlugin.java
labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageType.java
Log:
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageFactory.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageFactory.java 2006-09-30 22:59:26 UTC (rev 6485)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageFactory.java 2006-09-30 23:02:16 UTC (rev 6486)
@@ -0,0 +1,77 @@
+package org.jboss.soa.esb.message.format;
+
+import org.jboss.soa.esb.message.Message;
+
+import org.jboss.internal.soa.esb.message.format.MessageFactoryImpl;
+
+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
+ */
+
+/**
+ * You get a message of a specific type when you need it. Obviously that type may not be
+ * suitable for the service (hopefully you've got that contractual information a priori, but
+ * maybe not) and in which case some translation/transformation may be necessary.
+ *
+ * @author Mark Little
+ *
+ */
+
+public abstract class MessageFactory
+{
+ /**
+ * @return some default implementation.
+ */
+
+ public abstract Message getMessage ();
+
+ /**
+ * @param type the unique identifier representing the type of this message.
+ * @return the message, or <code>null</code> if no suitable plugin is available.
+ */
+
+ public abstract Message getMessage (URI type);
+
+ /**
+ * @param msg the message to convert.
+ * @param type the type of the message we want to convert to.
+ * @return a translated message, or <code>null</code> if no suitable plugin is available.
+ */
+
+ public abstract Message getMessage (Message msg, URI type);
+
+ /**
+ * Reload the plugins.
+ */
+
+ public abstract void reset ();
+
+ // TODO setters/getters for the plugin programmatically too.
+
+ public static MessageFactory getInstance ()
+ {
+ return theFactory;
+ }
+
+ private static final MessageFactory theFactory = new MessageFactoryImpl();
+
+}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessagePlugin.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessagePlugin.java 2006-09-30 22:59:26 UTC (rev 6485)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessagePlugin.java 2006-09-30 23:02:16 UTC (rev 6486)
@@ -0,0 +1,52 @@
+package org.jboss.soa.esb.message.format;
+
+import org.jboss.soa.esb.message.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
+ */
+
+/**
+ * Used to plug in new message formats dynamically. Each plugin is responsible for
+ * returning a message implementation that knows how to serialize its state in a
+ * specific manner, e.g., XML or ASN.1.
+ *
+ * @author Mark Little
+ *
+ */
+
+public interface MessagePlugin
+{
+ public static final String MESSAGE_PLUGIN = "org.jboss.soa.esb.message.format.plugin";
+
+ /**
+ * @return the message instance.
+ */
+
+ public Message getMessage ();
+
+ /**
+ * @return the unique identifier for this message plugin.
+ */
+
+ public URI getType ();
+}
Added: labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageType.java
===================================================================
--- labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageType.java 2006-09-30 22:59:26 UTC (rev 6485)
+++ labs/jbossesb/trunk/product/core/rosetta/src/org/jboss/soa/esb/message/format/MessageType.java 2006-09-30 23:02:16 UTC (rev 6486)
@@ -0,0 +1,62 @@
+package org.jboss.soa.esb.message.format;
+
+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
+ */
+
+/**
+ * You get a message of a specific type when you need it. Obviously that type may not be
+ * suitable for the service (hopefully you've got that contractual information a priori, but
+ * maybe not) and in which case some translation/transformation may be necessary.
+ *
+ * @author Mark Little
+ *
+ */
+
+public abstract class MessageType
+{
+ /*
+ * DO NOT reorder this list. New types may be added as required.
+ */
+
+ public static URI JBOSS_XML = null;
+ public static URI JAVA_SERIALIZED = null;
+
+ public static URI DEFAULT_TYPE = null;
+
+ static
+ {
+ try
+ {
+ JBOSS_XML = new URI("urn:jboss:esb:message:type:JBOSS_XML");
+ JAVA_SERIALIZED = new URI("urn:jboss:esb:message:type:JAVA_SERIALIZED");
+
+ DEFAULT_TYPE = JBOSS_XML;
+ }
+ catch (Exception ex)
+ {
+ throw new ExceptionInInitializerError(ex.toString());
+ }
+
+ }
+
+}
More information about the jboss-svn-commits
mailing list