org.apache.avalon.excalibur.extension
Class PackageManager

java.lang.Object
  |
  +--org.apache.avalon.excalibur.extension.PackageManager

public class PackageManager
extends java.lang.Object

Basic Implementation Of PackageManager Interface used to manage "Optional Packages" (formerly known as "Standard Extensions"). The "Optional Packages" are stored on file system in a number of directories.

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

Constructor Summary
PackageManager(PackageRepository repository)
          Construct a PackageManager for a repositories.
 
Method Summary
 OptionalPackage getOptionalPackage(Extension extension)
          Return the OptionalPackage that provides specified Extension.
 OptionalPackage[] scanDependencies(Extension[] required, Extension[] available)
          Build a list of dependencies based on specified Extension.
 void scanDependencies(Extension[] required, Extension[] available, java.util.List dependencies, java.util.List unsatisfied)
          Build a list of dependencies based on specified Extensions.
 OptionalPackage[] scanDependencies(Extension required, Extension[] available)
          Build a list of dependencies based on specified Extensions.
 void scanDependencies(Extension required, Extension[] available, java.util.List dependencies, java.util.List unsatisfied)
          Build a list of dependencies based on specified Extension.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageManager

public PackageManager(PackageRepository repository)
Construct a PackageManager for a repositories.
Parameters:
repository - the repository to use in PackageManager
Method Detail

getOptionalPackage

public OptionalPackage getOptionalPackage(Extension extension)
Return the OptionalPackage that provides specified Extension. If the specified Extension can not be found then null is returned. If there is multiple implementations that satisfy Extension, then an OptionalPackage returned is based on the following heristic;

Return the first Optional Package. (This heuristic will be replaced in time).

Parameters:
extension - Description of the extension that needs to be provided by optional package
See Also:
OptionalPackage, Extension

scanDependencies

public OptionalPackage[] scanDependencies(Extension required,
                                          Extension[] available)
                                   throws UnsatisfiedExtensionException
Build a list of dependencies based on specified Extensions. Each specified Extension is expected to be a required extension of another "Optional Package".

If the required Extension can not be found locally then an UnsatisfiedPackageException is thrown. if an OptionalPackage is found locally that satisfies specified required Extension then it is returned in the array of OptionalPackages. scanDependencies() is then recursively called on all of the candidates required extensions.

Parameters:
required - the array of required Extensions.
available - the array of Extensions already available to caller.
Returns:
the list of OptionalPackages that satisfy required Extensions
Throws:
UnsatisfiedPackageException - if unable to satisfy all extensions
See Also:
scanDependencies(org.apache.avalon.excalibur.extension.Extension, org.apache.avalon.excalibur.extension.Extension[])

scanDependencies

public OptionalPackage[] scanDependencies(Extension[] required,
                                          Extension[] available)
                                   throws UnsatisfiedExtensionException
Build a list of dependencies based on specified Extension. The specified Extension is expected to be a required extension of another "Optional Package".

If the required Extension can not be found locally then an UnsatisfiedPackageException is thrown. if an OptionalPackage is found locally that satisfies specified required Extension then it is returned in the array of OptionalPackages. scanDependencies() is then recursively called on all of the candidates required extensions.

Parameters:
required - the array of required Extensions.
available - the array of Extensions already available to caller.
Returns:
the list of OptionalPackages that satisfy required Extensions
Throws:
UnsatisfiedPackageException - if unable to satisfy all extensions
See Also:
scanDependencies(org.apache.avalon.excalibur.extension.Extension, org.apache.avalon.excalibur.extension.Extension[])

scanDependencies

public void scanDependencies(Extension[] required,
                             Extension[] available,
                             java.util.List dependencies,
                             java.util.List unsatisfied)
Build a list of dependencies based on specified Extensions. Each specified Extension is expected to be a required extension of another "Optional Package".

If the required Extension can not be found locally then it is placed in list of unsatisfied Extensions. If a candidate Extension is found locally that satisfies specified required Extension then it is added to list of dependencies. scanDependencies() is then recursively called on all of the candidates required extensions.

Parameters:
required - the array of required Extensions.
available - the array of Extensions already available to caller.
dependencies - the list of dependencies.
unsatisfied - the list of unsatisfied (ie non-local) dependencies.
See Also:
scanDependencies(org.apache.avalon.excalibur.extension.Extension, org.apache.avalon.excalibur.extension.Extension[])

scanDependencies

public void scanDependencies(Extension required,
                             Extension[] available,
                             java.util.List dependencies,
                             java.util.List unsatisfied)
Build a list of dependencies based on specified Extension. The specified Extension is expected to be a required extension of another "Optional Package".

If the required Extension can not be found locally then it is placed in list of unsatisfied Extensions. If a candidate OptionalPackage is found locally that satisfies specified required Extension then it is added to list of dependencies. scanDependencies() is then recursively called on all of the candidates required extensions.

Parameters:
required - the required Extension.
available - the array of Extensions already available to caller.
dependencies - the list of OptionalPackages required to satisfy extension.
unsatisfied - the list of unsatisfied (ie non-local) dependencies.
See Also:
scanDependencies(org.apache.avalon.excalibur.extension.Extension, org.apache.avalon.excalibur.extension.Extension[])


Copyright © 2001 Apache Jakarta Project. All Rights Reserved.