[jboss-cvs] JBossAS SVN: r105947 - in projects/vfs/trunk/src/main: java/org/jboss/vfs/protocol and 3 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Jun 10 21:50:27 EDT 2010


Author: johnbailey
Date: 2010-06-10 21:50:27 -0400 (Thu, 10 Jun 2010)
New Revision: 105947

Added:
   projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VfsUrlStreamHandlerFactory.java
   projects/vfs/trunk/src/main/resources/
   projects/vfs/trunk/src/main/resources/META-INF/
   projects/vfs/trunk/src/main/resources/META-INF/services/
   projects/vfs/trunk/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory
Modified:
   projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/FileURLStreamHandler.java
   projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java
Log:
Added java.net.URLStreamHandlerFactory service for VFS

Modified: projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/FileURLStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/FileURLStreamHandler.java	2010-06-10 21:59:37 UTC (rev 105946)
+++ projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/FileURLStreamHandler.java	2010-06-11 01:50:27 UTC (rev 105947)
@@ -22,7 +22,6 @@
 package org.jboss.vfs.protocol;
 
 import java.io.IOException;
-import java.net.Proxy;
 import java.net.URL;
 import java.net.URLConnection;
 

Added: projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VfsUrlStreamHandlerFactory.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VfsUrlStreamHandlerFactory.java	                        (rev 0)
+++ projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VfsUrlStreamHandlerFactory.java	2010-06-11 01:50:27 UTC (rev 105947)
@@ -0,0 +1,51 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2010, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt in the distribution for a
+ * full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.vfs.protocol;
+
+
+import java.net.URLStreamHandler;
+import java.net.URLStreamHandlerFactory;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * URLStreamHandlerFactory providing URLStreamHandlers for VFS based URLS.
+ *
+ * @author John Bailey
+ */
+public class VfsUrlStreamHandlerFactory implements URLStreamHandlerFactory {
+
+
+   private static Map<String, URLStreamHandler> handlerMap = new HashMap<String, URLStreamHandler>(2);
+
+   static {
+      handlerMap.put("file", new FileURLStreamHandler());
+      handlerMap.put("vfs", new VirtualFileURLStreamHandler());
+   }
+
+
+   @Override
+   public URLStreamHandler createURLStreamHandler(final String protocol)
+   {
+      return handlerMap.get(protocol);
+   }
+}

Modified: projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java
===================================================================
--- projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java	2010-06-10 21:59:37 UTC (rev 105946)
+++ projects/vfs/trunk/src/main/java/org/jboss/vfs/protocol/VirtualFileURLStreamHandler.java	2010-06-11 01:50:27 UTC (rev 105947)
@@ -22,18 +22,14 @@
 
 package org.jboss.vfs.protocol;
 
-import java.net.URLStreamHandler;
 import java.net.URLConnection;
 import java.net.URL;
-import java.net.Proxy;
 import java.io.IOException;
-import java.util.Set;
-import java.util.HashSet;
 
 /**
  * The VFS URL stream handler.
  */
-public abstract class VirtualFileURLStreamHandler extends AbstractLocalURLStreamHandler {
+public class VirtualFileURLStreamHandler extends AbstractLocalURLStreamHandler {
 
     @Override
     protected URLConnection openConnection(URL url) throws IOException {

Added: projects/vfs/trunk/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory
===================================================================
--- projects/vfs/trunk/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory	                        (rev 0)
+++ projects/vfs/trunk/src/main/resources/META-INF/services/java.net.URLStreamHandlerFactory	2010-06-11 01:50:27 UTC (rev 105947)
@@ -0,0 +1 @@
+org.jboss.vfs.protocol.VfsUrlStreamHandlerFactory
\ No newline at end of file



More information about the jboss-cvs-commits mailing list