org.apache.avalon.excalibur.extension
Class DefaultPackageRepository

java.lang.Object
  |
  +--org.apache.avalon.excalibur.extension.DefaultPackageRepository
All Implemented Interfaces:
PackageRepository

public class DefaultPackageRepository
extends java.lang.Object
implements PackageRepository

Interface used to contain "Optional Packages" (formerly known as "Standard Extensions"). It is assumed that each "Optional Package" is represented by a single file on the file system. This Repository searches a path to find the Optional Packages.

Version:
$Revision: 1.9 $ $Date: 2001/12/11 09:53:34 $
Author:
Peter Donald
See Also:
OptionalPackage, PackageRepository

Constructor Summary
DefaultPackageRepository(java.io.File[] path)
          Construct a package repository with path.
 
Method Summary
protected  void cacheOptionalPackage(OptionalPackage optionalPackage)
          Add OptionalPackage to internal cache of Optional Packages.
protected  void clearCache()
          Clear internal cache of optional packages.
protected  void debug(java.lang.String message)
           
 OptionalPackage[] getOptionalPackages(Extension extension)
          Return all the OptionalPackages that satisfy specified Extension.
protected  void scanPath()
          Scan the path for this repository and reload all the "Optional Packages" found in the path.
protected  void setPath(java.io.File[] path)
          Set the path for the Repository.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultPackageRepository

public DefaultPackageRepository(java.io.File[] path)
Construct a package repository with path.
Parameters:
path - The set of directories in which to look for Optional Packages
Method Detail

getOptionalPackages

public OptionalPackage[] getOptionalPackages(Extension extension)
Return all the OptionalPackages that satisfy specified Extension. It is expected that this Extension object will be one retrieved via getLocalExtension() method. If the specified Extension is not local then null is returned.
Specified by:
getOptionalPackages in interface PackageRepository
Parameters:
extension - Description of the optional package
See Also:
#isLocal()

setPath

protected void setPath(java.io.File[] path)
Set the path for the Repository.
Parameters:
path - the list of directories in which to search

scanPath

protected final void scanPath()
Scan the path for this repository and reload all the "Optional Packages" found in the path.

clearCache

protected final void clearCache()
Clear internal cache of optional packages.

cacheOptionalPackage

protected final void cacheOptionalPackage(OptionalPackage optionalPackage)
Add OptionalPackage to internal cache of Optional Packages. Note that this method is only protected so that unit tests can sub-class and add entries to PackageRepository by calling this method.
Parameters:
optionalPackage - the OptionalPackage to be added to repository

debug

protected void debug(java.lang.String message)


Copyright 2001 Apache Jakarta Project. All Rights Reserved.