geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r701926 - in /geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support: CollectionMetaDataContentSupport.java MapMetaDataContentSupport.java TextMetaDataContentSupport.java
Date Mon, 06 Oct 2008 03:34:52 GMT
Author: jdillon
Date: Sun Oct  5 20:34:51 2008
New Revision: 701926

URL: http://svn.apache.org/viewvc?rev=701926&view=rev
Log:
Add general textual support

Added:
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
  (with props)
Modified:
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/CollectionMetaDataContentSupport.java
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/MapMetaDataContentSupport.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/CollectionMetaDataContentSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/CollectionMetaDataContentSupport.java?rev=701926&r1=701925&r2=701926&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/CollectionMetaDataContentSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/CollectionMetaDataContentSupport.java
Sun Oct  5 20:34:51 2008
@@ -22,7 +22,6 @@
 import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataContent;
 
 import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.Collection;
 
 /**
@@ -31,20 +30,12 @@
  * @version $Rev$ $Date$
  */
 public abstract class CollectionMetaDataContentSupport<T>
-    implements MetaDataContent
+    extends TextMetaDataContentSupport
 {
-    public byte[] getBuffer() {
-        StringWriter writer = new StringWriter();
-        PrintWriter out = new PrintWriter(writer);
-
+    protected void fillBuffer(final PrintWriter out) {
         for (T element : getCollection()) {
             out.println(element);
         }
-
-        out.flush();
-        out.close();
-
-        return writer.toString().getBytes();
     }
 
     protected abstract Collection<T> getCollection();

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/MapMetaDataContentSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/MapMetaDataContentSupport.java?rev=701926&r1=701925&r2=701926&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/MapMetaDataContentSupport.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/MapMetaDataContentSupport.java
Sun Oct  5 20:34:51 2008
@@ -22,7 +22,6 @@
 import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataContent;
 
 import java.io.PrintWriter;
-import java.io.StringWriter;
 import java.util.Map;
 
 /**
@@ -31,22 +30,14 @@
  * @version $Rev$ $Date$
  */
 public abstract class MapMetaDataContentSupport<K,V>
-    implements MetaDataContent
+    extends TextMetaDataContentSupport
 {
-    public byte[] getBuffer() {
-        StringWriter writer = new StringWriter();
-        PrintWriter out = new PrintWriter(writer);
-
+    protected void fillBuffer(final PrintWriter out) {
         for (Map.Entry<K,V> entry : getMap().entrySet()) {
             out.print(entry.getKey());
             out.print("=");
             out.println(entry.getValue());
         }
-
-        out.flush();
-        out.close();
-
-        return writer.toString().getBytes();
     }
 
     protected abstract Map<K,V> getMap();

Added: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
URL: http://svn.apache.org/viewvc/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java?rev=701926&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
(added)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
Sun Oct  5 20:34:51 2008
@@ -0,0 +1,48 @@
+/*
+ * 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.vfs.provider.meta.data.support;
+
+import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataContent;
+
+import java.io.PrintWriter;
+import java.io.StringWriter;
+
+/**
+ * Support for text-based {@link MetaDataContent}.
+ *
+ * @version $Rev$ $Date$
+ */
+public abstract class TextMetaDataContentSupport
+    implements MetaDataContent
+{
+    public byte[] getBuffer() {
+        StringWriter writer = new StringWriter();
+        PrintWriter out = new PrintWriter(writer);
+
+        fillBuffer(out);
+
+        out.flush();
+        out.close();
+
+        return writer.toString().getBytes();
+    }
+
+    protected abstract void fillBuffer(PrintWriter out);
+}
\ No newline at end of file

Propchange: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain



Mime
View raw message