You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@activemq.apache.org by ch...@apache.org on 2007/05/02 16:23:17 UTC

svn commit: r534477 - in /activemq/camel/trunk: camel-core/src/main/java/org/apache/camel/spi/ camel-eclipse/camel.routing.editor/ camel-eclipse/camel.routing.generator/ camel-eclipse/camel.routing/ camel-jms/ camel-mail/ camel-rmi/

Author: chirino
Date: Wed May  2 07:23:16 2007
New Revision: 534477

URL: http://svn.apache.org/viewvc?view=rev&rev=534477
Log:
Added a few base classes for Marshalling/Unmarshalling

Added:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java
Modified:
    activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java
    activemq/camel/trunk/camel-eclipse/camel.routing/   (props changed)
    activemq/camel/trunk/camel-eclipse/camel.routing.editor/   (props changed)
    activemq/camel/trunk/camel-eclipse/camel.routing.generator/   (props changed)
    activemq/camel/trunk/camel-jms/   (props changed)
    activemq/camel/trunk/camel-mail/   (props changed)
    activemq/camel/trunk/camel-rmi/   (props changed)

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java?view=auto&rev=534477
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Marshaller.java Wed May  2 07:23:16 2007
@@ -0,0 +1,31 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.spi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+/**
+ * @version $Revision: 520124 $
+ */
+public interface Marshaller {
+	
+	/**
+     * Marshals the object to the given Stream.
+     */
+	void marshal(Object graph, OutputStream stream) throws IOException;
+}

Modified: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java?view=diff&rev=534477&r1=534476&r2=534477
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java (original)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Policy.java Wed May  2 07:23:16 2007
@@ -17,7 +17,6 @@
  */
 package org.apache.camel.spi;
 
-import org.apache.camel.impl.ServiceSupport;
 import org.apache.camel.Processor;
 
 /**

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java?view=auto&rev=534477
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/Unmarshaller.java Wed May  2 07:23:16 2007
@@ -0,0 +1,32 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+/**
+ * @version $Revision: 520124 $
+ */
+public interface Unmarshaller {
+	
+	/**
+     * Unmarshals the given stream into an object.
+     */
+    Object unmarshal(InputStream stream) throws IOException;
+
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java?view=auto&rev=534477
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlMarshaller.java Wed May  2 07:23:16 2007
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.spi;
+
+import java.io.IOException;
+import java.io.OutputStream;
+
+import javax.xml.transform.Result;
+import javax.xml.transform.stream.StreamResult;
+
+/**
+ * Marshallers that marshall to XML should extend this base class.
+ *
+ * @version $Revision: 520124 $
+ */
+public abstract class XmlMarshaller implements Marshaller{
+	
+	/**
+     * Marshals the object to the given Stream.
+     */
+	public void marshal(Object object, OutputStream result) throws IOException {
+		marshal(object, new StreamResult(result));
+	}
+
+	abstract public void marshal(Object object, Result result);
+}

Added: activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java
URL: http://svn.apache.org/viewvc/activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java?view=auto&rev=534477
==============================================================================
--- activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java (added)
+++ activemq/camel/trunk/camel-core/src/main/java/org/apache/camel/spi/XmlUnmarshaller.java Wed May  2 07:23:16 2007
@@ -0,0 +1,44 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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.camel.spi;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import javax.xml.transform.Source;
+import javax.xml.transform.stream.StreamSource;
+
+/**
+ * Unmarshallers that unmarshall to XML should extend this base class.
+ * 
+ * @version $Revision: 520124 $
+ */
+public abstract class XmlUnmarshaller implements Unmarshaller {
+	
+	/**
+     * Unmarshals the given stream into an object.
+     */
+    public Object unmarshal(InputStream stream) throws IOException {
+    	return unmarshal(new StreamSource(stream));
+    }
+
+	/**
+     * Unmarshals the given stream into an object.
+     */
+    abstract public Object unmarshal(Source stream) throws IOException;
+    
+}

Propchange: activemq/camel/trunk/camel-eclipse/camel.routing/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -0,0 +1 @@
+bin

Propchange: activemq/camel/trunk/camel-eclipse/camel.routing.editor/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -0,0 +1 @@
+bin

Propchange: activemq/camel/trunk/camel-eclipse/camel.routing.generator/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -0,0 +1 @@
+bin

Propchange: activemq/camel/trunk/camel-jms/
------------------------------------------------------------------------------
--- svn:ignore (original)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -1,5 +1,6 @@
-eclipse-classes
-.project
-.classpath
-target
-.settings
+eclipse-classes
+.project
+.classpath
+target
+.settings
+activemq-data

Propchange: activemq/camel/trunk/camel-mail/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -0,0 +1,3 @@
+target
+.classpath
+.project

Propchange: activemq/camel/trunk/camel-rmi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Wed May  2 07:23:16 2007
@@ -0,0 +1,4 @@
+target
+.classpath
+.project
+eclipse-classes