org.jboss.soa.esb.listeners.deployers.mc.util
Class VfsUtil

java.lang.Object
  extended by org.jboss.soa.esb.listeners.deployers.mc.util.VfsUtil

public final class VfsUtil
extends java.lang.Object

Util methods for interacting with JBoss VFS

Author:
Daniel Bevenius

Method Summary
static org.jboss.virtual.VirtualFile addFile(java.net.URL rootUrl, java.lang.String filePath, byte[] fileContent)
          Will add the fileContent to the in-memory rootUrl a the location specified by filePath.
static void addFiles(java.util.List<org.jboss.virtual.VirtualFile> files, java.net.URL destUrl, java.lang.String subPath)
           
static void addFiles(java.util.List<org.jboss.virtual.VirtualFile> files, java.net.URL destUrl, java.lang.String subPath, java.lang.String pathPrefix)
           
static void addFiles(java.util.Map<org.jboss.virtual.VirtualFile,java.lang.String> filesToNamesMap, java.net.URL destUrl, java.lang.String pathPrefix)
           
static org.jboss.virtual.VirtualFile createInMemoryFs(java.net.URL rootUrl)
          Creates a new in-memory virtual file system or returns an already existing one..
static java.net.URL createInMemUrl(java.lang.String root)
          A simple method that creates a new url with a protocol of 'vfsmemory'.
static java.net.URL createInMemUrl(java.lang.String root, java.lang.String path)
           
static java.net.URL createInMemUrl(java.net.URL root, java.lang.String path)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

createInMemoryFs

public static org.jboss.virtual.VirtualFile createInMemoryFs(java.net.URL rootUrl)
                                                      throws java.io.IOException
Creates a new in-memory virtual file system or returns an already existing one..

Parameters:
url - The url which of which this host property will be the root of the fs.
Returns:
VirtualFile The VirtualFile that represents the root of the fs.
Throws:
java.io.IOException

addFile

public static org.jboss.virtual.VirtualFile addFile(java.net.URL rootUrl,
                                                    java.lang.String filePath,
                                                    byte[] fileContent)
                                             throws java.net.MalformedURLException
Will add the fileContent to the in-memory rootUrl a the location specified by filePath.

Parameters:
rootUrl - The root of the in-memory fs.
filePath - The path relative to the rootUrl.
fileContent - The contents of the file to add.
Returns:
VirtualFile A reference to the newly created file in the in-memory file system.
Throws:
java.net.MalformedURLException

createInMemUrl

public static java.net.URL createInMemUrl(java.lang.String root)
                                   throws java.net.MalformedURLException
A simple method that creates a new url with a protocol of 'vfsmemory'.

Parameters:
root - Will be the name (hostname) of the root in-memory file system.
Returns:
URL An url that represents a root of an in-memory file system.
Throws:
java.net.MalformedURLException

createInMemUrl

public static java.net.URL createInMemUrl(java.lang.String root,
                                          java.lang.String path)
                                   throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

createInMemUrl

public static java.net.URL createInMemUrl(java.net.URL root,
                                          java.lang.String path)
                                   throws java.net.MalformedURLException
Throws:
java.net.MalformedURLException

addFiles

public static void addFiles(java.util.List<org.jboss.virtual.VirtualFile> files,
                            java.net.URL destUrl,
                            java.lang.String subPath)
                     throws java.io.IOException,
                            java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

addFiles

public static void addFiles(java.util.List<org.jboss.virtual.VirtualFile> files,
                            java.net.URL destUrl,
                            java.lang.String subPath,
                            java.lang.String pathPrefix)
                     throws java.io.IOException,
                            java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException

addFiles

public static void addFiles(java.util.Map<org.jboss.virtual.VirtualFile,java.lang.String> filesToNamesMap,
                            java.net.URL destUrl,
                            java.lang.String pathPrefix)
                     throws java.io.IOException,
                            java.net.URISyntaxException
Throws:
java.io.IOException
java.net.URISyntaxException