org.ow2.petals.system.classloader.locator
Class LocatorAbstract

java.lang.Object
  extended by org.ow2.petals.system.classloader.locator.LocatorAbstract
Direct Known Subclasses:
DirLocator, JarFileLocator

public abstract class LocatorAbstract
extends java.lang.Object

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

Author:
Guillaume Sauthier

Constructor Summary
LocatorAbstract()
           
 
Method Summary
static LocatorAbstract 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<java.lang.String> 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

LocatorAbstract

public LocatorAbstract()
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<java.lang.String> 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 LocatorAbstract 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.


Copyright © 2005-2011 Petals Link (EBM Websourcing). All Rights Reserved.