org.esa.beam.util
Class ResourceScanner

java.lang.Object
  extended by org.esa.beam.util.ResourceScanner

public class ResourceScanner
extends Object

This scanner can be used to retrieve resources, e.g. auxillary data. The scanner searches for all resources in the given locations.

Version:
$Revision$ $Date$
Author:
Marco Peters

Constructor Summary
ResourceScanner(URL[] locations, String relPath)
          Creates an instance of this class with the given locations.
 
Method Summary
 String getRelativePath(URL resourceURL)
          Returns the relative path of the given resource url
 URL getResource(String relPath)
          Gets the resource with the given relative path.
 URL[] getResourcesByPattern(String patternString)
          Retrieves all resource matching the given pattern.
 void scan(com.bc.ceres.core.ProgressMonitor pm)
          Scans recursivley for resources in the location given by the constructor.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceScanner

public ResourceScanner(URL[] locations,
                       String relPath)
Creates an instance of this class with the given locations.

Parameters:
locations - the locations used for scanning
relPath -
Method Detail

scan

public void scan(com.bc.ceres.core.ProgressMonitor pm)
Scans recursivley for resources in the location given by the constructor. Afterwards you can retrieve the resource by the multiple getter methods


getResource

public URL getResource(String relPath)
Gets the resource with the given relative path.

Parameters:
relPath - the relative path to the resource.
Returns:
the url to the resource found. Can be null if no resource was found.

getRelativePath

public String getRelativePath(URL resourceURL)
Returns the relative path of the given resource url

Parameters:
resourceURL -
Returns:
the realtive path, may be null

getResourcesByPattern

public URL[] getResourcesByPattern(String patternString)
Retrieves all resource matching the given pattern. For an explanation of the pattern syntax see Pattern.

Parameters:
patternString - the pattern given as a regular expression
Returns:
all resources matching the given pattern. Never null.


Copyright © 2002-2012 Brockmann Consult GmbH. All Rights Reserved.