geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r703779 - in /geronimo/gshell/trunk: gshell-model/ gshell-model/src/main/java/org/apache/geronimo/gshell/model/ gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ gshell-model/src/main/java/org/apache/geronimo/gshell/m...
Date Sun, 12 Oct 2008 10:31:08 GMT
Author: jdillon
Date: Sun Oct 12 03:31:07 2008
New Revision: 703779

URL: http://svn.apache.org/viewvc?rev=703779&view=rev
Log:
Moved marshalling bits from gshell-model to gshell-marshal

Added:
    geronimo/gshell/trunk/gshell-support/gshell-marshal/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml   (with props)
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
  (contents, props changed)
      - copied, changed from r703515, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
  (with props)
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
  (contents, props changed)
      - copied, changed from r703515, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/org/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/resources/org/apache/geronimo/gshell/marshal/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/org/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/java/org/apache/geronimo/gshell/marshal/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/org/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/org/apache/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/org/apache/geronimo/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/org/apache/geronimo/gshell/
    geronimo/gshell/trunk/gshell-support/gshell-marshal/src/test/resources/org/apache/geronimo/gshell/marshal/
Removed:
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/
Modified:
    geronimo/gshell/trunk/gshell-model/pom.xml
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModelMarshaller.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
    geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/SettingsModelMarshaller.java

Modified: geronimo/gshell/trunk/gshell-model/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/pom.xml?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/pom.xml (original)
+++ geronimo/gshell/trunk/gshell-model/pom.xml Sun Oct 12 03:31:07 2008
@@ -58,17 +58,19 @@
             <groupId>org.apache.geronimo.gshell.support</groupId>
             <artifactId>gshell-interpolation</artifactId>
         </dependency>
+        
+        <dependency>
+            <groupId>org.apache.geronimo.gshell.support</groupId>
+            <artifactId>gshell-marshal</artifactId>
+        </dependency>
 
+        <!--
+        NOTE: Used for StringUtils.capitalise() only.
+        -->
         <dependency>
             <groupId>org.codehaus.plexus</groupId>
             <artifactId>plexus-utils</artifactId>
         </dependency>
-        
-        <dependency>
-            <groupId>com.thoughtworks.xstream</groupId>
-            <artifactId>xstream</artifactId>
-            <version>1.3</version>
-        </dependency>
     </dependencies>
 
 </project>
\ No newline at end of file

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/Model.java
Sun Oct 12 03:31:07 2008
@@ -19,7 +19,8 @@
 
 package org.apache.geronimo.gshell.model;
 
-import org.apache.geronimo.gshell.model.marshal.Marshaller;
+import org.apache.geronimo.gshell.marshal.Marshaller;
+import org.apache.geronimo.gshell.marshal.MarshallerAware;
 
 /**
  * Base class for root model elements.
@@ -28,6 +29,7 @@
  */
 public abstract class Model
     extends Element
+    implements MarshallerAware
 {
     private transient Marshaller marshaller;
 

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModel.java
Sun Oct 12 03:31:07 2008
@@ -20,8 +20,6 @@
 package org.apache.geronimo.gshell.model.application;
 
 import com.thoughtworks.xstream.annotations.XStreamAlias;
-import org.apache.geronimo.gshell.model.application.DependencyArtifact;
-import org.apache.geronimo.gshell.model.application.DependencyGroup;
 import org.apache.geronimo.gshell.model.common.DescriptorSupport;
 import org.apache.geronimo.gshell.model.common.LocalRepository;
 import org.apache.geronimo.gshell.model.common.RemoteRepository;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModelMarshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModelMarshaller.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModelMarshaller.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/ApplicationModelMarshaller.java
Sun Oct 12 03:31:07 2008
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.model.application;
 
-import org.apache.geronimo.gshell.model.marshal.MarshallerSupport;
+import org.apache.geronimo.gshell.marshal.MarshallerSupport;
 
 /**
  * Marshaller for {@link ApplicationModel} models.

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/application/Branding.java
Sun Oct 12 03:31:07 2008
@@ -53,6 +53,8 @@
 
     private String sharedDirectory;
 
+    // TODO: Need stateDirectory (${gshell.home}/var/<name>
+
     private String profileScriptName;
 
     private String historyFileName;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/common/Artifact.java
Sun Oct 12 03:31:07 2008
@@ -20,12 +20,14 @@
 package org.apache.geronimo.gshell.model.common;
 
 import com.thoughtworks.xstream.annotations.XStreamOmitField;
+import com.thoughtworks.xstream.annotations.XStreamAlias;
 
 /**
  * Defines an artifact (groupId, artifactId, version, etc).
  *
  * @version $Rev$ $Date$
  */
+@XStreamAlias("artifact")
 public class Artifact
     extends ArtifactSupport
 {

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/interpolate/InterpolatorSupport.java
Sun Oct 12 03:31:07 2008
@@ -20,7 +20,7 @@
 package org.apache.geronimo.gshell.model.interpolate;
 
 import org.apache.geronimo.gshell.model.Model;
-import org.apache.geronimo.gshell.model.marshal.Marshaller;
+import org.apache.geronimo.gshell.marshal.Marshaller;
 import org.codehaus.plexus.interpolation.InterpolationException;
 import org.codehaus.plexus.interpolation.RecursionInterceptor;
 import org.codehaus.plexus.interpolation.RegexBasedInterpolator;

Modified: geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/SettingsModelMarshaller.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/SettingsModelMarshaller.java?rev=703779&r1=703778&r2=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/SettingsModelMarshaller.java
(original)
+++ geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/settings/SettingsModelMarshaller.java
Sun Oct 12 03:31:07 2008
@@ -19,7 +19,7 @@
 
 package org.apache.geronimo.gshell.model.settings;
 
-import org.apache.geronimo.gshell.model.marshal.MarshallerSupport;
+import org.apache.geronimo.gshell.marshal.MarshallerSupport;
 
 /**
  * Marshaller for {@link SettingsModel} models.

Added: geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml?rev=703779&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml Sun Oct 12 03:31:07 2008
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    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.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    
+    <modelVersion>4.0.0</modelVersion>
+    
+    <parent>
+        <groupId>org.apache.geronimo.gshell.support</groupId>
+        <artifactId>gshell-support</artifactId>
+        <version>1.0-alpha-2-SNAPSHOT</version>
+    </parent>
+    
+    <artifactId>gshell-marshal</artifactId>
+    <name>GShell Support :: Marshal</name>
+    
+    <description>
+        XML Marshalling support.
+    </description>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-api</artifactId>
+        </dependency>
+        
+        <dependency>
+            <groupId>org.slf4j</groupId>
+            <artifactId>slf4j-log4j12</artifactId>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+            <groupId>com.thoughtworks.xstream</groupId>
+            <artifactId>xstream</artifactId>
+            <version>1.3</version>
+        </dependency>
+    </dependencies>
+
+</project>
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Copied: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
(from r703515, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java?p2=geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java&r1=703515&r2=703779&rev=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/Marshaller.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
Sun Oct 12 03:31:07 2008
@@ -17,21 +17,22 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.model.marshal;
-
-import org.apache.geronimo.gshell.model.Model;
+package org.apache.geronimo.gshell.marshal;
 
+import java.io.File;
+import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
 import java.io.Reader;
 import java.io.Writer;
+import java.net.URL;
 
 /**
- * Model marshaller interface.
+ * Marshaller interface.
  *
  * @version $Rev$ $Date$
  */
-public interface Marshaller<T extends Model>
+public interface Marshaller<T>
 {
     void marshal(T root, OutputStream output);
 
@@ -39,9 +40,15 @@
 
     String marshal(T root);
 
+    void marshal(T root, File file) throws IOException;
+
     T unmarshal(InputStream input);
 
     T unmarshal(Reader reader);
 
     T unmarshal(String xml);
+
+    T unmarshal(URL url) throws IOException;
+
+    T unmarshal(File file) throws IOException;
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/Marshaller.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java?rev=703779&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
Sun Oct 12 03:31:07 2008
@@ -0,0 +1,30 @@
+/*
+ * 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.geronimo.gshell.marshal;
+
+/**
+ * Allows marshelled objects to beome aware of their {@link Marshaller}.
+ *
+ * @version $Rev$ $Date$
+ */
+public interface MarshallerAware
+{
+    void setMarshaller(Marshaller marshaller);
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerAware.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
(from r703515, geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java)
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java?p2=geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java&p1=geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java&r1=703515&r2=703779&rev=703779&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-model/src/main/java/org/apache/geronimo/gshell/model/marshal/MarshallerSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
Sun Oct 12 03:31:07 2008
@@ -17,14 +17,18 @@
  * under the License.
  */
 
-package org.apache.geronimo.gshell.model.marshal;
+package org.apache.geronimo.gshell.marshal;
 
 import com.thoughtworks.xstream.XStream;
 import com.thoughtworks.xstream.io.xml.DomDriver;
-import org.apache.geronimo.gshell.model.Model;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
+import java.io.BufferedReader;
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileReader;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.OutputStream;
@@ -34,18 +38,18 @@
 import java.net.URL;
 
 /**
- * Support for model {@link Marshaller} implementations.
+ * Support for {@link Marshaller} implementations.
  *
  * @version $Rev$ $Date$
  */
-public class MarshallerSupport<T extends Model>
+public class MarshallerSupport<T>
     implements Marshaller<T>
 {
 	private final Logger log = LoggerFactory.getLogger(getClass());
 	
     private final Class rootType;
 
-    protected MarshallerSupport(final Class rootType) {
+    public MarshallerSupport(final Class rootType) {
         assert rootType != null;
 
         this.rootType = rootType;
@@ -106,7 +110,9 @@
 
         T model = (T)createXStream().fromXML(input);
 
-        model.setMarshaller(this);
+        if (model instanceof MarshallerAware) {
+            ((MarshallerAware)model).setMarshaller(this);
+        }
 
         log.trace("Unmarshalled: {}", model);
 
@@ -119,7 +125,9 @@
 
         T model = (T)createXStream().fromXML(reader);
 
-        model.setMarshaller(this);
+        if (model instanceof MarshallerAware) {
+            ((MarshallerAware)model).setMarshaller(this);
+        }
 
         log.trace("Unmarshalled: {}", model);
         
@@ -144,4 +152,31 @@
             input.close();
         }
     }
+
+    public void marshal(final T root, final File file) throws IOException {
+        assert root != null;
+        assert file != null;
+
+        BufferedWriter writer = new BufferedWriter(new FileWriter(file));
+        try {
+            marshal(root, writer);
+        }
+        finally {
+            writer.close();
+        }
+    }
+
+    public T unmarshal(final File file) throws IOException {
+        assert file != null;
+
+        BufferedReader reader = new BufferedReader(new FileReader(file));
+
+        try {
+            return unmarshal(reader);
+        }
+        finally {
+            reader.close();
+        }
+    }
+
 }
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-marshal/src/main/java/org/apache/geronimo/gshell/marshal/MarshallerSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message