org.xnap.pkg
Class PackageManager

java.lang.Object
  extended by org.xnap.pkg.PackageManager
Direct Known Subclasses:
XNapPackageManager

public class PackageManager
extends java.lang.Object


Constructor Summary
PackageManager()
           
 
Method Summary
 void add(PackageInfo info)
          Adds a package.
 PackageInfo[] getConflicts(PackageInfo info)
           
 java.lang.String getDefaultSources()
          Returns a list of urls.
 PackageInfo[] getDependencies(PackageInfo info)
           
 PackageInfo getPackage(java.lang.String packageName)
          Returns a package by name.
 int getPackageCount()
          Returns the number of packages.
 PackageInfo[] getProviders(java.lang.String packageName)
          Returns an array of packages that provide packageName.
 void markAllUnavailable()
          Marks all packages that are not installed as unavailable.
 java.util.Iterator packages()
          Returns an iterator over all PackageInfo objects.
 void read(java.io.File file)
           
 void read(java.io.File file, java.util.Properties table)
          Reads package information from a control file.
 void read(java.io.InputStream inStream, java.util.Properties flags)
          Reads package information from a stream.
 void read(java.lang.String location, java.util.Properties table)
          Reads package information from a url.
 void remove(PackageInfo info)
           
 void removeUnavailable()
          Removes all packages that are marked as unavailable.
 java.util.SortedSet tailSet(java.lang.String packageName)
           
 void write(java.io.File file, java.util.Properties flags)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PackageManager

public PackageManager()
Method Detail

add

public void add(PackageInfo info)
Adds a package. If info is not valid or a package with the same name and version already exists the package is not added.


getConflicts

public PackageInfo[] getConflicts(PackageInfo info)
                           throws ParseException
Throws:
ParseException

getDefaultSources

public java.lang.String getDefaultSources()
Returns a list of urls.

Returns:
the empty string

getDependencies

public PackageInfo[] getDependencies(PackageInfo info)
                              throws ParseException,
                                     UnsatisfiedDependenciesException
Throws:
ParseException - thrown, if package file is invalid
UnsatisfiedDependenciesException - thrown, if dependencies are not satisfied

markAllUnavailable

public void markAllUnavailable()
Marks all packages that are not installed as unavailable. Marks all packages as not new.


read

public void read(java.io.File file,
                 java.util.Properties table)
          throws java.io.IOException
Reads package information from a control file.

Parameters:
file - the control file
Throws:
java.io.IOException

read

public void read(java.io.File file)
          throws java.io.IOException
Throws:
java.io.IOException

read

public void read(java.lang.String location,
                 java.util.Properties table)
          throws java.io.IOException
Reads package information from a url.

Parameters:
location - the package file url
downloadUrl - the base location of the package files
Throws:
java.io.IOException

read

public void read(java.io.InputStream inStream,
                 java.util.Properties flags)
          throws java.io.IOException
Reads package information from a stream.

Parameters:
inStream - the stream
flags - additional flags that are added to the PackageInfo record; if null, flags are ignored
Throws:
java.io.IOException

remove

public void remove(PackageInfo info)

removeUnavailable

public void removeUnavailable()
Removes all packages that are marked as unavailable.


packages

public java.util.Iterator packages()
Returns an iterator over all PackageInfo objects.


getPackageCount

public int getPackageCount()
Returns the number of packages.


getPackage

public PackageInfo getPackage(java.lang.String packageName)
Returns a package by name.


tailSet

public java.util.SortedSet tailSet(java.lang.String packageName)

getProviders

public PackageInfo[] getProviders(java.lang.String packageName)
Returns an array of packages that provide packageName.


write

public void write(java.io.File file,
                  java.util.Properties flags)
           throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2001-2005 XNap Team. All Rights Reserved.