geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jdil...@apache.org
Subject svn commit: r701776 - in /geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta: MetaFileData.java MetaFileObject.java MetaFileProvider.java
Date Sun, 05 Oct 2008 11:16:25 GMT
Author: jdillon
Date: Sun Oct  5 04:16:24 2008
New Revision: 701776

URL: http://svn.apache.org/viewvc?rev=701776&view=rev
Log:
Allow meta files to contain read-only generated content, to allow files to provide dynamic
information similar to the linux /proc fs

Modified:
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileData.java
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileObject.java
    geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileProvider.java

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileData.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/MetaFileData.java?rev=701776&r1=701775&r2=701776&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileData.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileData.java
Sun Oct  5 04:16:24 2008
@@ -70,6 +70,10 @@
         return type;
     }
 
+    public byte[] getBuffer() {
+        return null;
+    }
+
     public void updateLastModified() {
         lastModified = System.currentTimeMillis();
     }

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileObject.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/MetaFileObject.java?rev=701776&r1=701775&r2=701776&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileObject.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileObject.java
Sun Oct  5 04:16:24 2008
@@ -24,6 +24,7 @@
 import org.apache.commons.vfs.provider.AbstractFileObject;
 
 import java.io.InputStream;
+import java.io.ByteArrayInputStream;
 import java.util.Map;
 
 /**
@@ -62,14 +63,23 @@
     }
 
     @Override
+    protected boolean doIsReadable() throws Exception {
+        return data.getBuffer() != null;
+    }
+
+    @Override
     protected long doGetContentSize() throws Exception {
-        // Meta file is always empty
-        return 0;
+        byte[] bytes = data.getBuffer();
+        return bytes != null ? bytes.length : 0;
     }
 
     @Override
     protected InputStream doGetInputStream() throws Exception {
-        // No contents thus no input stream
+        byte[] bytes = data.getBuffer();
+        if (bytes != null) {
+            return new ByteArrayInputStream(bytes);
+        }
+
         return null;
     }
 

Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileProvider.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/MetaFileProvider.java?rev=701776&r1=701775&r2=701776&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileProvider.java
(original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileProvider.java
Sun Oct  5 04:16:24 2008
@@ -45,6 +45,7 @@
 
     public static final Collection<Capability> CAPABILITIES = Collections.unmodifiableCollection(Arrays.asList(
         Capability.ATTRIBUTES,
+        Capability.READ_CONTENT,
         Capability.GET_TYPE,
         Capability.GET_LAST_MODIFIED,
         Capability.LAST_MODIFIED,



Mime
View raw message