You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by jd...@apache.org on 2008/10/07 11:34:15 UTC
svn commit: r702410 - in
/geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta:
./ data/ data/support/
Author: jdillon
Date: Tue Oct 7 02:34:15 2008
New Revision: 702410
URL: http://svn.apache.org/viewvc?rev=702410&view=rev
Log:
Add support for content-type and content-encoding for MetaDataContent
Added:
geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileContentInfoFactory.java (with props)
Modified:
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/MetaFileSystem.java
geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaData.java
geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataContent.java
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/MetaFileContentInfoFactory.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/MetaFileContentInfoFactory.java?rev=702410&view=auto
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileContentInfoFactory.java (added)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileContentInfoFactory.java Tue Oct 7 02:34:15 2008
@@ -0,0 +1,45 @@
+/*
+ * 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;
+
+import org.apache.commons.vfs.FileContent;
+import org.apache.commons.vfs.FileContentInfo;
+import org.apache.commons.vfs.FileContentInfoFactory;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.impl.DefaultFileContentInfo;
+import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaData;
+
+/**
+ * Meta file content info factory.
+ *
+ * @version $Rev$ $Date$
+ */
+public class MetaFileContentInfoFactory
+ implements FileContentInfoFactory
+{
+ public FileContentInfo create(final FileContent content) throws FileSystemException {
+ assert content != null;
+
+ MetaFileObject file = (MetaFileObject)content.getFile();
+ MetaData data = file.getData();
+
+ return new DefaultFileContentInfo(data.getContentType(), data.getContentEncoding());
+ }
+}
\ 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/MetaFileContentInfoFactory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileContentInfoFactory.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/MetaFileContentInfoFactory.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
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=702410&r1=702409&r2=702410&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 Tue Oct 7 02:34:15 2008
@@ -21,6 +21,9 @@
import org.apache.commons.vfs.FileName;
import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.FileContent;
+import org.apache.commons.vfs.FileSystemException;
+import org.apache.commons.vfs.FileContentInfoFactory;
import org.apache.commons.vfs.provider.AbstractFileObject;
import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaData;
@@ -76,6 +79,11 @@
}
@Override
+ protected FileContentInfoFactory getFileContentInfoFactory() {
+ return fileSystem.getFileContentInfoFactory();
+ }
+
+ @Override
protected long doGetContentSize() throws Exception {
byte[] bytes = data.getBuffer();
return bytes != null ? bytes.length : 0;
Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileSystem.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/MetaFileSystem.java?rev=702410&r1=702409&r2=702410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileSystem.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/MetaFileSystem.java Tue Oct 7 02:34:15 2008
@@ -24,6 +24,7 @@
import org.apache.commons.vfs.FileSystemException;
import org.apache.commons.vfs.FileSystemOptions;
import org.apache.commons.vfs.FileType;
+import org.apache.commons.vfs.FileContentInfoFactory;
import org.apache.commons.vfs.provider.AbstractFileSystem;
import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaData;
import org.apache.geronimo.gshell.vfs.provider.meta.data.MetaDataRegistry;
@@ -42,6 +43,8 @@
{
private final MetaDataRegistry registry;
+ private FileContentInfoFactory fileContentInfoFactory;
+
public MetaFileSystem(final MetaDataRegistry registry, final FileName rootName, final FileSystemOptions options) {
super(rootName, null, options);
@@ -88,4 +91,11 @@
return names.toArray(new String[names.size()]);
}
+
+ FileContentInfoFactory getFileContentInfoFactory() {
+ if (fileContentInfoFactory == null) {
+ fileContentInfoFactory = new MetaFileContentInfoFactory();
+ }
+ return fileContentInfoFactory;
+ }
}
\ No newline at end of file
Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaData.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/MetaData.java?rev=702410&r1=702409&r2=702410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaData.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaData.java Tue Oct 7 02:34:15 2008
@@ -100,6 +100,14 @@
this.lastModified = lastModified;
}
+ public String getContentType() {
+ return content != null ? content.getType() : null;
+ }
+
+ public String getContentEncoding() {
+ return content != null ? content.getEncoding() : null;
+ }
+
public Map<String,Object> getAttributes() {
return attributes;
}
Modified: geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataContent.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/MetaDataContent.java?rev=702410&r1=702409&r2=702410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataContent.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/MetaDataContent.java Tue Oct 7 02:34:15 2008
@@ -26,9 +26,9 @@
*/
public interface MetaDataContent
{
- byte[] getBuffer();
+ String getType();
+
+ String getEncoding();
- //
- // TODO: Expose the content-type and encoding? Need to provide custom handling of FileContent and FileContentInfo stuff to use.
- //
+ byte[] getBuffer();
}
\ No newline at end of file
Modified: 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=702410&r1=702409&r2=702410&view=diff
==============================================================================
--- geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java (original)
+++ geronimo/gshell/trunk/gshell-support/gshell-vfs-meta/src/main/java/org/apache/geronimo/gshell/vfs/provider/meta/data/support/TextMetaDataContentSupport.java Tue Oct 7 02:34:15 2008
@@ -44,5 +44,13 @@
return writer.toString().getBytes();
}
+ public String getType() {
+ return "text/plain";
+ }
+
+ public String getEncoding() {
+ return "UTF-8";
+ }
+
protected abstract void fillBuffer(PrintWriter out);
}
\ No newline at end of file