[jboss-cvs] JBossAS SVN: r95277 - in projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual: plugins/context/vfs and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Oct 21 07:45:34 EDT 2009
Author: alesj
Date: 2009-10-21 07:45:34 -0400 (Wed, 21 Oct 2009)
New Revision: 95277
Modified:
projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java
projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
Log:
Use vfs context registry for assembled.
Modified: projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java
===================================================================
--- projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java 2009-10-21 11:44:46 UTC (rev 95276)
+++ projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/AssembledDirectory.java 2009-10-21 11:45:34 UTC (rev 95277)
@@ -22,19 +22,19 @@
package org.jboss.virtual;
import java.io.IOException;
+import java.net.URISyntaxException;
import java.net.URL;
-import java.net.URISyntaxException;
import java.util.List;
import java.util.regex.Pattern;
import org.jboss.virtual.plugins.context.jar.JarUtils;
-import org.jboss.virtual.plugins.context.vfs.AssembledContext;
+import org.jboss.virtual.plugins.context.vfs.AssembledContextFactory;
import org.jboss.virtual.plugins.context.vfs.AssembledDirectoryHandler;
import org.jboss.virtual.plugins.context.vfs.AssembledFileHandler;
import org.jboss.virtual.plugins.context.vfs.ByteArrayHandler;
import org.jboss.virtual.plugins.vfs.helpers.FilterVirtualFileVisitor;
+import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
import org.jboss.virtual.plugins.vfs.helpers.SuffixesExcludeFilter;
-import org.jboss.virtual.plugins.vfs.helpers.PathTokenizer;
/**
* Extension of VirtualFile that represents a virtual directory that can be composed of arbitrary files and resources
@@ -68,11 +68,20 @@
*/
public static AssembledDirectory createAssembledDirectory(String name, String rootName) throws IOException, URISyntaxException
{
- AssembledContext context = new AssembledContext(name, rootName);
- return context.getRoot().getVirtualFile();
+ return AssembledContextFactory.getInstance().create(name, rootName);
}
/**
+ * Remove assembled directory.
+ *
+ * @param directory the directory to remove
+ */
+ public static void removeAssembledDirectory(AssembledDirectory directory)
+ {
+ AssembledContextFactory.getInstance().remove(directory);
+ }
+
+ /**
* Add files recursively from root, using the no jars filter.
*
* @param root the root
Modified: projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java
===================================================================
--- projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java 2009-10-21 11:44:46 UTC (rev 95276)
+++ projects/vfs/branches/Branch_2_2/src/main/java/org/jboss/virtual/plugins/context/vfs/AssembledContextFactory.java 2009-10-21 11:45:34 UTC (rev 95277)
@@ -21,9 +21,10 @@
*/
package org.jboss.virtual.plugins.context.vfs;
+import java.io.IOException;
+import java.net.URISyntaxException;
+import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
-import java.net.URISyntaxException;
-import java.io.IOException;
import org.jboss.virtual.AssembledDirectory;
@@ -31,13 +32,14 @@
* Factory for creating AssembledDirectory.
*
* @author <a href="bill at jboss.com">Bill Burke</a>
+ * @author <a href="ales.justin at jboss.com">Ales Justin</a>
* @version $Revision: 1.1 $
*/
public class AssembledContextFactory
{
private static AssembledContextFactory instance = new AssembledContextFactory();
- private ConcurrentHashMap<String, AssembledDirectory> registry = new ConcurrentHashMap<String, AssembledDirectory>();
+ private Map<String, AssembledDirectory> registry = new ConcurrentHashMap<String, AssembledDirectory>();
private volatile int count;
/**
@@ -56,7 +58,7 @@
try
{
AssembledContext context = new AssembledContext(name, rootName);
- AssembledDirectory directory = (AssembledDirectory)context.getRoot().getVirtualFile();
+ AssembledDirectory directory = context.getRoot().getVirtualFile();
registry.put(name, directory);
return directory;
}
@@ -73,8 +75,8 @@
/**
* Find an assembly. Usually used only by the URL protocol handlers.
*
- * @param name
- * @return
+ * @param name the name
+ * @return assembled directory if found, null otherwise
*/
public AssembledDirectory find(String name)
{
More information about the jboss-cvs-commits
mailing list