org.objectweb.jonas_lib.loader.locator
Class Locator

java.lang.Object
  extended by org.objectweb.jonas_lib.loader.locator.Locator
Direct Known Subclasses:
DirLocator, JarFileLocator

public abstract class Locator
extends java.lang.Object

A Locator is used to hide System specific when looking for a file.

Author:
Guillaume Sauthier

Constructor Summary
Locator()
           
 
Method Summary
static Locator getLocator(java.net.URL url)
          Return a new Locator in function of the URL type.
abstract  boolean hasDirectory(java.lang.String path)
          Returns true when directory was found.
abstract  boolean hasFile(java.lang.String path)
          Returns true when file was found.
abstract  java.util.List listContent(java.lang.String path)
          Returns a list of filename stored in path.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Locator

public Locator()
Method Detail

hasFile

public abstract boolean hasFile(java.lang.String path)
Returns true when file was found.

Parameters:
path - the path to the file to look up
Returns:
true when file was found, otherwise false.

hasDirectory

public abstract boolean hasDirectory(java.lang.String path)
Returns true when directory was found.

Parameters:
path - the path to the directory to look up
Returns:
true when directory was found, otherwise false.

listContent

public abstract java.util.List listContent(java.lang.String path)
Returns a list of filename stored in path.

Parameters:
path - the path to the directory where looking for files
Returns:
a list of filename stored in path.

getLocator

public static Locator getLocator(java.net.URL url)
                          throws java.io.IOException
Return a new Locator in function of the URL type. an URL pointing to a jar file will return a JarFileLocator and an URL pointing to a directory file will return a DirFileLocator.

Parameters:
url - the base URL
Returns:
a new Locator in function of the URL type.
Throws:
java.io.IOException - when cannot find a specialized locator for the given URL.