org.ow2.jonas.lib.loader.factory
Class URLFactory

java.lang.Object
  extended by org.ow2.jonas.lib.loader.factory.URLFactory
Direct Known Subclasses:
DirURLFactory, JarURLFactory

public abstract class URLFactory
extends Object

An URLFactory is used to create a URL from a base URL.

Author:
Guillaume Sauthier

Constructor Summary
URLFactory()
           
 
Method Summary
static URLFactory getFactory(URL url)
          Return a new URLFactory in function of the URL type.
abstract  URL getURL(String path)
          Returns a new URL basically adding path to the base URL.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

URLFactory

public URLFactory()
Method Detail

getURL

public abstract URL getURL(String path)
                    throws IOException
Returns a new URL basically adding path to the base URL.

Parameters:
path - the path to add to the URL.
Returns:
a new URL.
Throws:
IOException - when created URL is invalid.

getFactory

public static URLFactory getFactory(URL url)
                             throws IOException
Return a new URLFactory in function of the URL type. an URL pointing to a jar file will return a JarURLFactory and an URL pointing to a directory file will return a DirURLFactory.

Parameters:
url - the base URL
Returns:
a new URLFactory in function of the URL type.
Throws:
IOException - when cannot find a specialized factory for the given URL.


Copyright © 2010 OW2 Consortium. All Rights Reserved.