org.objectweb.jonas_lib.loader.locator
Class JarFileLocator

java.lang.Object
  extended by org.objectweb.jonas_lib.loader.locator.Locator
      extended by org.objectweb.jonas_lib.loader.locator.JarFileLocator

public class JarFileLocator
extends Locator

A JarfileLocator is used to look up for a file inside a Jar archive. Works only for local jars.

Author:
Guillaume Sauthier

Constructor Summary
JarFileLocator(java.net.URL jar)
          Construct a new JarFileLocator from an URL representing a Jar.
 
Method Summary
 boolean hasDirectory(java.lang.String path)
          Returns true when directory was found.
 boolean hasFile(java.lang.String path)
          Returns true when file was found.
 java.util.List listContent(java.lang.String path)
          Returns a list of filename stored in path.
 
Methods inherited from class org.objectweb.jonas_lib.loader.locator.Locator
getLocator
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JarFileLocator

public JarFileLocator(java.net.URL jar)
               throws java.io.IOException
Construct a new JarFileLocator from an URL representing a Jar.

Parameters:
jar - URL pointing to a Jar file
Throws:
java.io.IOException - When URL is not a JarFile.
Method Detail

hasFile

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

Specified by:
hasFile in class Locator
Parameters:
path - the path to the file to look up
Returns:
true when file was found, otherwise false.

hasDirectory

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

Specified by:
hasDirectory in class Locator
Parameters:
path - the path to the directory to look up
Returns:
true when directory was found, otherwise false.

listContent

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

Specified by:
listContent in class Locator
Parameters:
path - the path to the directory where looking for files
Returns:
a list of filename stored in path.