public class PackageManager extends BaseManager
Modifier and Type | Field and Description |
---|---|
static java.lang.String[] |
DEPENDENCY_TYPES |
static java.lang.String |
RHNCFG |
static java.lang.String |
RHNCFG_ACTIONS |
static java.lang.String |
RHNCFG_CLIENT |
Constructor and Description |
---|
PackageManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addChannelPackagesFromSet(User user,
java.lang.Long cid,
RhnSet set)
Add packages to channel whos package_ids are in a set
|
static java.lang.String |
buildPackageNevra(java.lang.Long nameId,
java.lang.Long evrId,
java.lang.Long archId)
build package nevra out of the name, evr, arch identifiers
|
static java.lang.String |
buildPackageNevra(PackageName name,
PackageEvr evr,
PackageArch arch)
build package nevra out of the name, evr, arch identifiers
|
static DataResult |
comparePackagesBetweenChannels(java.lang.Long thisCid,
java.lang.Long otherCid)
Lookup package differences between thisCid and otherCid channels.
|
static DataResult |
comparePackagesBetweenChannelsPreview(java.lang.Long thisCid,
java.lang.Long otherCid,
java.lang.String cmpType)
Lookup which packages add/remove to make thisCid equal to otherCid channel.
|
static int |
countUpgradable(java.lang.Long sid)
Returns a count of packages that can be upgraded on the given server.
|
static void |
createRepoEntrys(java.lang.Long cid)
Create all repoentries for a channel's packages if needed
|
static void |
deletePackages(java.util.Set<java.lang.Long> ids,
User user)
This deletes a package completely from the satellite including the
physical rpm on the disk
|
static void |
deleteSourcePackages(java.util.Set<java.lang.Long> ids,
User user)
This deletes a source packages completely including the
physical rpm on the disk
|
static Package |
findDebugInfo(User user,
Package pack)
Find a debuginfo package for a given package
|
static Package |
findDebugSource(User user,
Package pack)
Find a debugsource package for a given package
|
static java.lang.String |
generateFtpDebugPath(Package pack)
Guess the package URL for a debugInfo rpm
|
static java.lang.String |
getDependencyModifier(java.lang.Long sense,
java.lang.String version)
Helper method to figure out the dependency modifier.
|
static java.lang.String |
getPackageChangeLog(Package pkg)
Gets a package changelog from the file system
|
static DataResult |
getRepoData(java.lang.Long packageId)
utility method for getting the repodata for a package
|
static java.lang.Long |
getServerNeededUpdatePackageByName(java.lang.Long sid,
java.lang.String packageName)
Get the ID of the package that needs updating based on the name.
|
static Package |
guestimatePackageByChannel(java.lang.Long channelId,
java.lang.Long nameId,
java.lang.Long evrId,
Org org)
guestimate a package based on channel id, name and evr
|
static Package |
guestimatePackageBySystem(java.lang.Long systemId,
java.lang.Long nameId,
java.lang.Long evrId,
java.lang.Long archId,
Org org)
guestimate a package based on system id, name and evr
|
static boolean |
isPackageInChannel(java.lang.Long cid,
java.lang.Long nameid,
java.lang.Long evrid)
Returns true if the package whose name and evr id are passed in exists
in the given channel whose id is cid.
|
static DataResult |
listCustomPackageForChannel(java.lang.Long cid,
java.lang.Long orgId,
boolean source)
list custom packages contained in a channel
|
static DataResult |
listCustomPackages(java.lang.Long orgId,
boolean source)
List all custom packages for an org
|
static DataResult |
listOrphanPackages(java.lang.Long orgId,
boolean source)
List orphaned custom packages for an org
|
static DataResult |
listPackagesInChannelForList(java.lang.Long cid)
List the package in a channel (for the web UI lists)
|
static Package |
lookupByIdAndUser(java.lang.Long id,
User user)
Finds a package by using the id column of rhnPackage
|
static DataResult |
lookupCustomPackagesForChannel(java.lang.Long cid,
java.lang.Long orgId)
Lookup custom packages (packages with org_id of the current user) that can
be pushed into the a channel (cid).
|
static java.util.Map |
lookupEvrIdByPackageName(java.lang.Long sid,
java.lang.String name)
Find the most up to date package with the given name accessible to a system with
the given system id.
|
static DataResult |
lookupPackageForChannelFromChannel(java.lang.Long fromCid,
java.lang.Long toCid)
Lookup packages contained in fromCid that are eligable to be put in toCid.
|
static PackageName |
lookupPackageName(java.lang.String name)
Lookup a package name.
|
static DataResult |
lookupPackageNameOverview(Org org,
java.lang.String packageName)
Returns package metadata for all packages named 'packageName' and exist
in the channels which which the orgId is subscribed.
|
static DataResult |
lookupPackageNameOverview(Org org,
java.lang.String packageName,
java.lang.String[] channelarches)
Returns package metadata for all packages named 'packageName' and exist
in the channels whose arch is one of the 'channelArches'.
|
static DataResult |
lookupPackageNameOverviewInChannel(Org org,
java.lang.String packageName,
java.lang.Long channelID)
Returns package metadata for all packages named 'packageName' and exist
in passed in channelID if the ORG has access..
|
static PackageEvr |
lookupReleasePackageEvrFor(Server server)
Given a server this method returns the redhat-release package evr info.
|
static java.lang.String |
lookupSystemReleaseReleaseVersionFor(Server s)
Given an assumed-RHEL7-Server, get the OS_version the rest of Sat5 code relies on
("7Server", "7Workstation", etc)
|
static java.lang.String |
lookupSystemReleaseReleaseVersionFor(Server s,
PackageEvr pevr)
Given a Server and a PackageEvr, return the OS-version ("6Workstation", "7Server",
etc) for that Server
|
static void |
mergeChannelPackagesFromSet(User user,
java.lang.Long cid,
RhnSet set)
Merge packages to channel whos package_ids are in a set
|
static DataResult |
mergePackagesFromSet(User user,
java.lang.String label)
Returns a DataResult containing PackageMergeDtos
|
static DataResult<java.util.Map<java.lang.String,java.lang.Object>> |
obsoletingPackages(User user,
java.lang.Long pid)
Return information related to packages that are udpates to this one
|
static DataResult |
orgPackageChannels(java.lang.Long orgId,
java.lang.Long pid)
Runs Channel_queries.org_pkg_channels query.
|
static DataResult |
packageConflicts(java.lang.Long pid)
Runs Package_queries.package_conflicts query, which returns dependencies of the
conflicts type.
|
static DataResult |
packageEnhances(java.lang.Long pid)
Runs Package_queries.package_enhances query, which returns dependencies of the
enhances type.
|
static DataResult<PackageFileDto> |
packageFiles(java.lang.Long pid)
Returns the files associated with a given package
|
static DataResult |
packageIdsInSet(User user,
java.lang.String label)
Returns a DataResult containing PackageOverview dto's representing the
package_ids_in_set query
|
static DataResult |
packageIdsInSet(User user,
java.lang.String label,
PageControl pc)
Returns a DataResult containing PackageOverview dto's representing the
package_ids_in_set query
|
static DataResult |
packageObsoletes(java.lang.Long pid)
Runs Package_queries.package_obsoletes query, which returns dependencies of the
obsolete type.
|
static DataResult |
packageProvides(java.lang.Long pid)
Runs Package_queries.package_provides query, which returns dependencies of the
provides type.
|
static DataResult |
packageRecommends(java.lang.Long pid)
Runs Package_queries.package_recommends query, which returns dependencies of the
recommends type.
|
static DataResult |
packageRequires(java.lang.Long pid)
Runs Package_queries.package_requires query, which returns dependencies of the
requires type.
|
static DataResult |
packagesAvailableToErrata(Errata errata)
Returns a dataResult containing all of the packages available to an
errata.
|
static DataResult |
packagesAvailableToErrataInChannel(Errata errata,
java.lang.Long cid,
User user)
Returns a data result containing all of the packages available to an errata
in the channel specified by cid.
|
static DataResult |
packagesFromServerSet(User user)
Returns the list of packages installed on at least one system in the SSM, along with
the count of how many systems each package is installed on.
|
static DataResult |
packagesInErrata(Errata errata,
PageControl pc)
Returns a data result containing PackageOverview dto's representing the
packages that are currently associated with this errata.
|
static DataResult |
packageSuggests(java.lang.Long pid)
Runs Package_queries.package_suggests query, which returns dependencies of the
suggests type.
|
static DataResult |
packageSupplements(java.lang.Long pid)
Runs Package_queries.package_supplements query, which returns dependencies of the
supplements type.
|
static DataResult |
possiblePackagesForPushingIntoChannel(java.lang.Long cid,
java.lang.Long eid,
PageControl pc)
Looks at a published errata and a channel and returns a list of PackageComparisons
containing the packages that the errata has more recent versions of and may
be pushed into the channel by the user
|
static DataResult |
providingChannels(User user,
java.lang.Long pid)
Returns the providing channels for a package that the given user has access to
|
static DataResult |
providingErrata(java.lang.Long orgId,
java.lang.Long pid)
Returns the erratas providing a given package
|
static void |
schedulePackageRemoval(User user,
Package pkg)
Deletes a package from the system
|
static void |
schedulePackageSourceRemoval(User user,
PackageSource pkg)
Deletes a source package from the system
|
static DataResult |
sourcePackageIdsInSet(User user,
java.lang.String label,
PageControl pc)
Returns a DataResult containing PackageSourceOverview dto's representing the
source_package_ids_in_set query
|
static DataResult |
systemAvailablePackages(java.lang.Long sid,
PageControl pc)
Returns list of package for given server
|
static DataResult |
systemPackageList(java.lang.Long sid,
PageControl pc)
Returns list of package for given server
|
static void |
updateRepoFileList(java.lang.Long packageId,
java.lang.String filelistXml) |
static void |
updateRepoOther(java.lang.Long packageId,
java.lang.String otherXml) |
static void |
updateRepoPrimary(java.lang.Long packageId,
java.lang.String primaryXml)
Update the primary XML for a package
|
static DataResult<UpgradablePackageListItem> |
upgradable(java.lang.Long sid,
PageControl pc)
Returns a list of upgradable packages for the given server id.
|
static DataResult |
upgradablePackagesFromServerSet(User user)
Returns the list of packages that are on at least one system in the SSM that can
be upgraded, along with a count of how many systems each package is installed on.
|
static int |
verCmp(java.lang.String epoch1,
java.lang.String version1,
java.lang.String release1,
java.lang.String epoch2,
java.lang.String version2,
java.lang.String release2)
Compares an evr to another evr.
|
static void |
verifyPackagesChannelArchCompatAndOrgAccess(User user,
Channel channel,
java.util.List<java.lang.Long> packageIds,
boolean checkArchCompat)
Throw exception, if any of the packages aren't accessible by user or
aren't compatible with provided channel arch
|
makeDataResult, makeDataResult, makeDataResult, makeDataResult, makeDataResultNoPagination, makeDataResultNoPagination, processListControl, processPageControl
public static final java.lang.String RHNCFG
public static final java.lang.String RHNCFG_CLIENT
public static final java.lang.String RHNCFG_ACTIONS
public static final java.lang.String[] DEPENDENCY_TYPES
public static DataResult packageObsoletes(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageConflicts(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageProvides(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageRequires(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageRecommends(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageSuggests(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageSupplements(java.lang.Long pid)
pid
- The package in questionpublic static DataResult packageEnhances(java.lang.Long pid)
pid
- The package in questionpublic static DataResult listPackagesInChannelForList(java.lang.Long cid)
cid
- the channel idpublic static DataResult orgPackageChannels(java.lang.Long orgId, java.lang.Long pid)
orgId
- The id of the org for the logged in userpid
- The id of the package in questionpublic static DataResult providingErrata(java.lang.Long orgId, java.lang.Long pid)
orgId
- The id of the org for the logged in userpid
- The package id for the package in questionpublic static DataResult<PackageFileDto> packageFiles(java.lang.Long pid)
pid
- The package id for the package in questionpublic static DataResult<java.util.Map<java.lang.String,java.lang.Object>> obsoletingPackages(User user, java.lang.Long pid)
user
- The user in questionpid
- The package in questionpublic static DataResult providingChannels(User user, java.lang.Long pid)
user
- The user requesting the channelspid
- The package in questionpublic static DataResult systemPackageList(java.lang.Long sid, PageControl pc)
sid
- Server Idpc
- PageControl can also be null.public static DataResult systemAvailablePackages(java.lang.Long sid, PageControl pc)
sid
- Server Idpc
- PageControl can also be null.public static DataResult<UpgradablePackageListItem> upgradable(java.lang.Long sid, PageControl pc)
sid
- Server Idpc
- PageControl to limit page size, maybe null for all
upgradable packages.public static int countUpgradable(java.lang.Long sid)
sid
- identifies the serverpublic static Package lookupByIdAndUser(java.lang.Long id, User user)
id
- The package iduser
- The user performing the lookuppublic static DataResult packagesAvailableToErrata(Errata errata)
errata
- The errata in questionpublic static DataResult packagesAvailableToErrataInChannel(Errata errata, java.lang.Long cid, User user)
errata
- The errata in questioncid
- The channel id, we want packages in this channeluser
- The user requesting the listpublic static DataResult packageIdsInSet(User user, java.lang.String label, PageControl pc)
user
- The Userlabel
- The label of the set we wantpc
- The page control for the userpublic static DataResult sourcePackageIdsInSet(User user, java.lang.String label, PageControl pc)
user
- The Userlabel
- The label of the set we wantpc
- The page control for the userpublic static DataResult packageIdsInSet(User user, java.lang.String label)
user
- The Userlabel
- The label of the set we wantpublic static DataResult packagesInErrata(Errata errata, PageControl pc)
errata
- The errata in questionpc
- The page control for the logged in userpublic static boolean isPackageInChannel(java.lang.Long cid, java.lang.Long nameid, java.lang.Long evrid)
cid
- Channel idevrid
- package evr idnameid
- package name idpublic static java.lang.Long getServerNeededUpdatePackageByName(java.lang.Long sid, java.lang.String packageName)
sid
- of systempackageName
- of system - up2date for examplepublic static java.util.Map lookupEvrIdByPackageName(java.lang.Long sid, java.lang.String name)
sid
- The id of a system to which the package must be accessible.name
- The exact name of the package sought for.public static PackageName lookupPackageName(java.lang.String name)
name
- Package name to lookup.public static int verCmp(java.lang.String epoch1, java.lang.String version1, java.lang.String release1, java.lang.String epoch2, java.lang.String version2, java.lang.String release2)
epoch1
- Epoch 1version1
- Version 1release1
- Release 1epoch2
- Epoch 2version2
- Version 2release2
- Release 2public static void schedulePackageRemoval(User user, Package pkg) throws PermissionCheckFailureException
user
- calling userpkg
- package to deletePermissionCheckFailureException
- - caller is not an org admin,
the package is in one of the RH owned channels, or is in different orgpublic static void schedulePackageSourceRemoval(User user, PackageSource pkg) throws PermissionCheckFailureException
user
- calling userpkg
- source package to deletePermissionCheckFailureException
- - caller is not an org admin,
the package is in one of the RH owned channels, or is in different orgpublic static DataResult possiblePackagesForPushingIntoChannel(java.lang.Long cid, java.lang.Long eid, PageControl pc)
cid
- channel ideid
- errata idpc
- PageControl object needed to handle pagination issues.public static PackageEvr lookupReleasePackageEvrFor(Server server)
server
- the server object who has to be queriedpublic static java.lang.String lookupSystemReleaseReleaseVersionFor(Server s, PackageEvr pevr)
s
- Server we care aboutpevr
- Package-evr of the redhat-release package on that serverpublic static java.lang.String lookupSystemReleaseReleaseVersionFor(Server s)
s
- Server we care aboutpublic static DataResult lookupPackageNameOverview(Org org, java.lang.String packageName, java.lang.String[] channelarches)
org
- The users Org.packageName
- Name of package being sought.channelarches
- list of valid channel arches. i.e.
public static DataResult lookupPackageNameOverview(Org org, java.lang.String packageName)
org
- The users Org.packageName
- Name of package being sought.public static DataResult lookupPackageNameOverviewInChannel(Org org, java.lang.String packageName, java.lang.Long channelID)
org
- The users Org.packageName
- Name of package being sought.channelID
- Id of the channel to lookup package inpublic static DataResult lookupPackageForChannelFromChannel(java.lang.Long fromCid, java.lang.Long toCid)
fromCid
- channel id to pull packages fromtoCid
- channel id of channel that you will be pushing packges to (later on)public static DataResult lookupCustomPackagesForChannel(java.lang.Long cid, java.lang.Long orgId)
cid
- channel id of channel that you will be pushing packges to (later on)orgId
- the org of the custom packagespublic static DataResult comparePackagesBetweenChannels(java.lang.Long thisCid, java.lang.Long otherCid)
thisCid
- channel id we want to updateotherCid
- channel id which we compare topublic static DataResult comparePackagesBetweenChannelsPreview(java.lang.Long thisCid, java.lang.Long otherCid, java.lang.String cmpType)
thisCid
- channel id we want to updateotherCid
- channel id which we compare tocmpType
- compare typepublic static DataResult mergePackagesFromSet(User user, java.lang.String label)
user
- The Userlabel
- The label of the set we wantpublic static void mergeChannelPackagesFromSet(User user, java.lang.Long cid, RhnSet set)
user
- the user doing the pushingcid
- the channel to push packages toset
- the set of packagespublic static void addChannelPackagesFromSet(User user, java.lang.Long cid, RhnSet set)
user
- the user doing the pushingcid
- the channel to push packages toset
- the set of packagespublic static DataResult listOrphanPackages(java.lang.Long orgId, boolean source)
orgId
- the orgsource
- list source packages instead of regularpublic static DataResult listCustomPackages(java.lang.Long orgId, boolean source)
orgId
- the orgsource
- list source packages instead of regularpublic static DataResult listCustomPackageForChannel(java.lang.Long cid, java.lang.Long orgId, boolean source)
cid
- the channel idorgId
- the org idsource
- list source packages instead of regularpublic static void deletePackages(java.util.Set<java.lang.Long> ids, User user)
ids
- the set of package idsuser
- the user doing the deletingpublic static void deleteSourcePackages(java.util.Set<java.lang.Long> ids, User user)
ids
- the set of source package idsuser
- the user doing the deletingpublic static Package guestimatePackageByChannel(java.lang.Long channelId, java.lang.Long nameId, java.lang.Long evrId, Org org)
channelId
- the channelnameId
- the nameevrId
- the evr idorg
- the orgpublic static Package guestimatePackageBySystem(java.lang.Long systemId, java.lang.Long nameId, java.lang.Long evrId, java.lang.Long archId, Org org)
systemId
- the channelnameId
- the nameevrId
- the evr idarchId
- the arch idorg
- the orgpublic static DataResult packagesFromServerSet(User user)
user
- userSsmRemovePackageListItem
public static DataResult upgradablePackagesFromServerSet(User user)
user
- userSsmUpgradablePackageListItem
public static void createRepoEntrys(java.lang.Long cid)
cid
- the channel idpublic static void updateRepoPrimary(java.lang.Long packageId, java.lang.String primaryXml)
packageId
- the package idprimaryXml
- the raw xmlpublic static void updateRepoFileList(java.lang.Long packageId, java.lang.String filelistXml)
packageId
- the package idfilelistXml
- the raw xmlpublic static void updateRepoOther(java.lang.Long packageId, java.lang.String otherXml)
packageId
- the package idotherXml
- the raw xmlpublic static DataResult getRepoData(java.lang.Long packageId)
packageId
- the package idpublic static Package findDebugInfo(User user, Package pack)
user
- The User doing the searchpack
- the package we need a debug info forpublic static Package findDebugSource(User user, Package pack)
user
- The User doing the searchpack
- the package we need a debug source forpublic static java.lang.String generateFtpDebugPath(Package pack)
pack
- the package to guess a debugInfo rpm url forpublic static java.lang.String getPackageChangeLog(Package pkg)
pkg
- the package to getpublic static void verifyPackagesChannelArchCompatAndOrgAccess(User user, Channel channel, java.util.List<java.lang.Long> packageIds, boolean checkArchCompat)
user
- userchannel
- channelpackageIds
- package idscheckArchCompat
- optionally arch compatibility doesn't have to be checked
(f.e. when removing packages, only orgt access is important)public static java.lang.String buildPackageNevra(java.lang.Long nameId, java.lang.Long evrId, java.lang.Long archId)
nameId
- name idevrId
- evr idarchId
- arch idpublic static java.lang.String buildPackageNevra(PackageName name, PackageEvr evr, PackageArch arch)
name
- nameevr
- evrarch
- archpublic static java.lang.String getDependencyModifier(java.lang.Long sense, java.lang.String version)
sense
- A number whose number can tell us what kind of modifier is neededversion
- The version of the dependency we're investigating