Author: thomas.diesler(a)jboss.com
Date: 2010-03-04 05:56:59 -0500 (Thu, 04 Mar 2010)
New Revision: 101812
Modified:
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSUtils.java
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
Log:
Add close() and vfs30 autmount
Modified:
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSUtils.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSUtils.java 2010-03-04
10:55:32 UTC (rev 101811)
+++
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VFSUtils.java 2010-03-04
10:56:59 UTC (rev 101812)
@@ -42,9 +42,7 @@
VirtualFile manifest = archive.getChild(JarFile.MANIFEST_NAME);
if (manifest == null)
- {
return null;
- }
InputStream stream = manifest.openStream();
try
Modified:
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-04
10:55:32 UTC (rev 101811)
+++
projects/jboss-osgi/projects/vfs/trunk/api/src/main/java/org/jboss/osgi/vfs/VirtualFile.java 2010-03-04
10:56:59 UTC (rev 101812)
@@ -124,4 +124,9 @@
* @throws IllegalStateException if the file is closed
*/
InputStream openStream() throws IOException;
+
+ /**
+ * Close the file resources (stream, etc.)
+ */
+ void close();
}
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-04
10:55:32 UTC (rev 101811)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs21/src/main/java/org/jboss/osgi/vfs21/VirtualFileAdaptor21.java 2010-03-04
10:56:59 UTC (rev 101812)
@@ -43,7 +43,7 @@
{
private org.jboss.virtual.VirtualFile delegate;
- public VirtualFileAdaptor21(org.jboss.virtual.VirtualFile delegate)
+ VirtualFileAdaptor21(org.jboss.virtual.VirtualFile delegate)
{
this.delegate = delegate;
}
@@ -73,6 +73,11 @@
return delegate.toURL();
}
+ public void close()
+ {
+ delegate.close();
+ }
+
public VirtualFile getChild(String path) throws IOException
{
org.jboss.virtual.VirtualFile child = delegate.getChild(path);
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-04
10:55:32 UTC (rev 101811)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VFSAdaptor30.java 2010-03-04
10:56:59 UTC (rev 101812)
@@ -28,6 +28,7 @@
import org.jboss.osgi.vfs.VFSAdaptor;
import org.jboss.osgi.vfs.VirtualFile;
import org.jboss.osgi.vfs.VirtualFileAssembly;
+import org.jboss.vfs.util.automount.Automounter;
/**
* An adaptor to the jboss-vfs-3.0.x VFS.
@@ -48,6 +49,9 @@
{
throw new IOException(ex);
}
+
+ Automounter.mount(root);
+
return new VirtualFileAdaptor30(root);
}
Modified:
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java
===================================================================
---
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-04
10:55:32 UTC (rev 101811)
+++
projects/jboss-osgi/projects/vfs/trunk/vfs30/src/main/java/org/jboss/osgi/vfs30/VirtualFileAdaptor30.java 2010-03-04
10:56:59 UTC (rev 101812)
@@ -32,6 +32,7 @@
import java.util.List;
import org.jboss.osgi.vfs.VirtualFile;
+import org.jboss.vfs.util.automount.Automounter;
/**
* An adaptor to the jboss-vfs-3.0.x VirtualFile.
@@ -42,8 +43,8 @@
class VirtualFileAdaptor30 implements VirtualFile
{
private org.jboss.vfs.VirtualFile delegate;
-
- public VirtualFileAdaptor30(org.jboss.vfs.VirtualFile delegate)
+
+ VirtualFileAdaptor30(org.jboss.vfs.VirtualFile delegate)
{
this.delegate = delegate;
}
@@ -52,12 +53,12 @@
{
return delegate;
}
-
+
public String getName()
{
return delegate.getName();
}
-
+
public String getPathName()
{
return delegate.getPathName();
@@ -78,7 +79,7 @@
org.jboss.vfs.VirtualFile child = delegate.getChild(path);
if (child == null)
return null;
-
+
return new VirtualFileAdaptor30(child);
}
@@ -87,7 +88,7 @@
List<VirtualFile> files = new ArrayList<VirtualFile>();
for (org.jboss.vfs.VirtualFile child : delegate.getChildrenRecursively())
files.add(new VirtualFileAdaptor30(child));
-
+
return Collections.unmodifiableList(files);
}
@@ -105,5 +106,10 @@
{
return delegate.openStream();
}
+
+ public void close()
+ {
+ if (Automounter.isMounted(delegate))
+ Automounter.cleanup(delegate);
+ }
}
-