org.ow2.jonas.lib.loader.locator
Class JarFileLocator

java.lang.Object
  extended by org.ow2.jonas.lib.loader.locator.Locator
      extended by org.ow2.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(URL jar)
          Construct a new JarFileLocator from an URL representing a Jar.
 
Method Summary
 boolean hasDirectory(String path)
          Returns true when directory was found.
 boolean hasFile(String path)
          Returns true when file was found.
 List listContent(String path)
          Returns a list of filename stored in path.
 
Methods inherited from class org.ow2.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(URL jar)
               throws IOException
Construct a new JarFileLocator from an URL representing a Jar.

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

hasFile

public boolean hasFile(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(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 List listContent(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.


Copyright © 2010 OW2 Consortium. All Rights Reserved.