com.android.repository.impl.meta
Class RepositoryPackages

java.lang.Object
  extended by com.android.repository.impl.meta.RepositoryPackages

public final class RepositoryPackages
extends java.lang.Object

Store of currently-known local and remote packages, in convenient forms. TODO: some of the functionality of this class may no longer be needed. Reevaluate once adoption has progressed further.


Constructor Summary
RepositoryPackages()
           
RepositoryPackages(java.util.Map<java.lang.String,LocalPackage> localPkgs, java.util.Map<java.lang.String,RemotePackage> remotePkgs)
           
 
Method Summary
 java.util.Map<java.lang.String,UpdatablePackage> getConsolidatedPkgs()
          Returns a map of package install ids to UpdatablePackages representing all known local and remote packages.
 java.util.Map<java.lang.String,? extends LocalPackage> getLocalPackages()
          Returns a map of path (the unique ID of a package) to LocalPackage, for all packages currently installed.
 java.util.Collection<? extends LocalPackage> getLocalPackagesForPrefix(java.lang.String pathPrefix)
           
 java.util.Set<RemotePackage> getNewPkgs()
          Returns the set of new remote packages that are not locally present and that the user could install.
 java.util.Map<java.lang.String,RemotePackage> getRemotePackages()
          Returns a Map from path (the unique ID of a package) to RemotePackage.
 long getTimestampMs()
          Returns the timestamp (in System.currentTimeMillis() time) when this object was created.
 java.util.Set<UpdatablePackage> getUpdatedPkgs()
          Returns the set of packages that have local updates available.
 void setLocalPkgInfos(java.util.Map<java.lang.String,? extends LocalPackage> packages)
          Sets the collection of known LocalPackages, and recomputes the list of updates and new packages, if RemotePackages have been set.
 void setRemotePkgInfos(java.util.Map<java.lang.String,RemotePackage> packages)
          Sets the collection of known RemotePackages, and recomputes the list of updates and new packages, if LocalPackages have been set.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RepositoryPackages

public RepositoryPackages()

RepositoryPackages

public RepositoryPackages(@NonNull
                          java.util.Map<java.lang.String,LocalPackage> localPkgs,
                          @NonNull
                          java.util.Map<java.lang.String,RemotePackage> remotePkgs)
Method Detail

getTimestampMs

public long getTimestampMs()
Returns the timestamp (in System.currentTimeMillis() time) when this object was created.


getUpdatedPkgs

@NonNull
public java.util.Set<UpdatablePackage> getUpdatedPkgs()
Returns the set of packages that have local updates available.

Returns:
A non-null, possibly empty Set of update candidates.

getNewPkgs

@NonNull
public java.util.Set<RemotePackage> getNewPkgs()
Returns the set of new remote packages that are not locally present and that the user could install.

Returns:
A non-null, possibly empty Set of new install candidates.

getConsolidatedPkgs

@NonNull
public java.util.Map<java.lang.String,UpdatablePackage> getConsolidatedPkgs()
Returns a map of package install ids to UpdatablePackages representing all known local and remote packages. Remote packages corresponding to local packages will be represented by a single item containing both the local and remote info. IPkgDesc#getInstallId()


getLocalPackages

@NonNull
public java.util.Map<java.lang.String,? extends LocalPackage> getLocalPackages()
Returns a map of path (the unique ID of a package) to LocalPackage, for all packages currently installed.


getRemotePackages

@NonNull
public java.util.Map<java.lang.String,RemotePackage> getRemotePackages()
Returns a Map from path (the unique ID of a package) to RemotePackage.


getLocalPackagesForPrefix

@NonNull
public java.util.Collection<? extends LocalPackage> getLocalPackagesForPrefix(@Nullable
                                                                                      java.lang.String pathPrefix)

setLocalPkgInfos

public void setLocalPkgInfos(@NonNull
                             java.util.Map<java.lang.String,? extends LocalPackage> packages)
Sets the collection of known LocalPackages, and recomputes the list of updates and new packages, if RemotePackages have been set.


setRemotePkgInfos

public void setRemotePkgInfos(@NonNull
                              java.util.Map<java.lang.String,RemotePackage> packages)
Sets the collection of known RemotePackages, and recomputes the list of updates and new packages, if LocalPackages have been set.