com.redhat.rhn.manager.configuration
Class ConfigurationManager

java.lang.Object
  extended by com.redhat.rhn.manager.BaseManager
      extended by com.redhat.rhn.manager.configuration.ConfigurationManager

public class ConfigurationManager
extends BaseManager

ConfigurationManager


Field Summary
static java.lang.String ARG0
           
static java.lang.String ARG1
           
static int DIRECTORIES
           
static int ENABLE_ERROR_PACKAGES
           
static int ENABLE_ERROR_PROVISIONING
           
static int ENABLE_ERROR_RHNTOOLS
           
static int ENABLE_NEED_ORG_ADMIN
           
static int ENABLE_SUCCESS
           
static java.lang.String FEATURE_CONFIG
           
static int FILES
           
static java.lang.String KEY
           
 
Method Summary
 boolean accessToChannel(java.lang.Long uid, java.lang.Long ccid)
           
 void copyConfigFile(ConfigRevision revision, ConfigChannel channel, User user)
          Copies a config file.
 ConfigFileCount countAllActionPaths(Server server, Action action)
          Returns the number of files, and directories that were on a applied to server by a given config action This is method is mainly used to show the number of files and directories that were deployed/diff'd Note this method doesnot check whether the Action is visible to the user.
 ConfigFileCount countCentrallyDeployablePaths(Server server, User user)
          Returns the sum of all the 'Deployable' files, and directories that are present in the all the centrally managed channels in a given server.
 ConfigFileCount countCentrallyManagedPaths(Server server, User user)
          Returns the sum of files, and directories that are present in the all the centrally managed channels in a given server.
 ConfigFileCount countDifferingPaths(Server server, Action action)
          Returns the number of files on the server that differed in content from the files in RHN - Managed Note this method doesnot check whether the Action is visible to the user.
 ConfigFileCount countLocallyManagedPaths(Server server, User user, ConfigChannelType cct)
          Returns the number of files, and directories that are managed in the local override channel or Sandbox channel of a given server..
 ConfigFileCount countSuccessfulCompares(Server server, Action action)
          Returns the number of files, and directories that were SUCCESSFULLY applied to server by a given config action This is method is mainly used to show the number of files and directories that were scheduled for comparison Returns the number of files that were selected successfully for comparison in a config DIFF action.
 ConfigRevision createNewRevision(User user, java.io.InputStream input, ConfigFile file, java.lang.Long size)
          Creates a new config revision object.
 ConfigRevision createNewRevision(User user, java.io.InputStream input, java.lang.Long cfid, java.lang.Long size)
          Creates a new config revision object.
 void deleteConfigChannel(User user, ConfigChannel channel)
          Deletes a config channel.
 void deleteConfigFile(User user, ConfigFile file)
          Deletes a config file.
 boolean deleteConfigRevision(User user, ConfigRevision revision)
          Deletes a config revision.
 void deployConfiguration(User user, java.util.Collection<Server> servers, java.util.Date datePicked)
          Schedules deploys of all the configuration files or dirs associated to a list of servers
 java.util.Map deployFiles(User usr, java.util.Set fileIds, java.util.Set systemIds, java.util.Date datePicked)
          Deploy revisions to systems.
 void enableSystems(RhnSetDecl set, User user, java.util.Date earliest)
          Enable the set of systems given for configuration management.
 void ensureConfigManageable(Server server)
          Method to ensure config management features are available for a given system are available..
 ChannelSummary getChannelSummary(User user, ConfigChannel channel)
          Return ChannelSummary info - see ChannelOverview
 java.lang.Long getDeployableRevisionForFileName(java.lang.Long cfnid, java.lang.Long sid)
          Returns the config revision id for a config file with the given config file name id.
 int getDirCount(User user, ConfigChannel channel)
          Return the number of Directories in this config-channel
 DataResult getEnableSummary(User user, PageControl pc, java.lang.String set)
          Get a summary of configuration enablement.
 int getFileCount(User user, ConfigChannel channel)
          Return the number of Files in this config-channel
 DataResult getFileInfo(User user, ConfigChannel channel)
          List files controlled by this channel, sorted by date-modified (descending)
 int getFileStorage(User user, ConfigFile file)
          Return the number of bytes used for all revisions of the specified ConfigFile
static ConfigurationManager getInstance()
           
 java.util.Map getOverviewSummary(User user)
          Returns a map of summary information.
 DataResult getRecentConfigDeployActions(User user, java.lang.Integer results)
          Lists the last n most recent config deploy actions visible by a user where n is the results param and user is the user param.
 DataResult getRecentlyModifiedConfigFiles(User user, java.lang.Integer results)
          Lists the last n most recently modified configuration files visible by a user where n is the results param and user is the user param.
 java.lang.Long getServerIdFor(ConfigChannel cc, User user)
          Returns the server id associated to a local/sandbox channel
 DataResult getSuccesfulDeploysTo(User usr, ConfigFileName cfn, Server srv)
          For a given filename and server, find all the successful deploys of a file with that name
 int getSystemCount(User user, ConfigChannel channel)
          Return the number of systems subscribed to the specified channel.
 DataResult getSystemInfo(User user, ConfigChannel channel)
          List systems subscribed to this channel, sorted by date-modified (descending)
 boolean isConfigEnabled(Server server, User user)
          Returns the given system is config enabled.
 boolean isDuplicated(java.lang.String label, ConfigChannelType cct, Org org)
          Returns true if there already exists a config channel with the same label, cc type and org.
 DataResult listAllFilesWithTotalSize(User user, PageControl pc)
          Lists all of the configuration files in RHN for a single org.
 DataResult listAlternateFilesForCompare(User user, ConfigFile current, PageControl pc)
          Lists all the alternatives for a given file in other config channels.
 DataResult listAvailableFilesNotInChannel(User usr, ConfigChannel cc, PageControl pc)
          For a specified channel, return info about all systems that the user has access to that are NOT already in that channel
 java.util.List listChannelsForCopy(User user, ConfigChannel cc, java.lang.String ccType)
          List cfg-channels OTHER THAN the specified one, that are of the specified type, and are accessible to the specified user
 DataResult listChannelsForFileCompare(User user, PageControl pc)
          Lists all the other channels in this org.
 DataResult listChannelsForFileCopy(User user, ConfigFile current, java.lang.String type, PageControl pc)
          Lists all global config channels in this user's org except the one that contains the given config file.
 DataResult listChannelsForSystem(User user, Server server, PageControl pc)
          List global config channels for a system.
 DataResult listChannelSystems(User user, ConfigChannel channel, PageControl pc)
          List systems subscribed to this channel, sorted by date added (descending)
 DataResult listConfigChannelsForSystem(User user, Server server, PageControl pc)
          Lists the config channels in the user's config channel set to which the given server is subscribed.
 DataResult<ConfigFileDto> listCurrentFiles(User user, ConfigChannel channel, PageControl pc)
          List current files for channel withOUT using a set
 DataResult listCurrentFiles(User user, ConfigChannel channel, PageControl pc, java.lang.String setLabel)
          List latest revisions controlled by this channel, sorted by date-modified (descending), optionally constrained by the specified set
 DataResult listFileNamesForSsm(User user, PageControl pc)
          Lists the file names of all files subscribed to by systems in the given user's system_list set.
 DataResult<ConfigFileNameDto> listFileNamesForSystem(User user, Server server, PageControl pc)
          Lists the file names to which the given server is subscribed Finds the deployable revisions for each file name.
 DataResult listFileNamesInSet(User user, Server server, java.lang.String setLabel, PageControl pc)
          Lists the file names in the user's config file name set whether or not they are relevant to the given server.
 DataResult listFileNamesInSetForSystem(User user, Server server, PageControl pc)
          Lists the file names in the user's config file name set relevant to the given server.
 DataResult listFilesInChannel(User user, ConfigChannel channel, PageControl pc)
          Gets a list of files (not directories) in the given config channel.
 DataResult listFilesNotInChannel(User usr, ConfigChannel cc, PageControl pc)
          For a specified channel, return info about all config-files that the user has access to that are NOT already in that channel
 DataResult listGlobalChannels(User user, PageControl pc)
          List all of the global channels a given user can see.
 DataResult listGlobalChannelsForSystemSubscriptions(Server server, User user, PageControl pc)
          This query basically lists all the global channels a user can see along with info on whether the channels are subscribed to a given server Basically used in SDC Subscribe Channels page
 DataResult listGlobalConfigFiles(User user, PageControl pc)
          Lists all global config files in this user's org that this user can view along with system count and overridden count.
 DataResult listGlobalFileDeployInfo(User usr, ConfigChannel cc, ConfigFile cf, PageControl pc)
          List the info for the systems subscribed to the specified channel, for which we might want to schedule a deploy of the specified file, without being constrained by a selected set of systems
 DataResult listGlobalFileDeployInfo(User usr, ConfigChannel cc, ConfigFile cf, PageControl pc, java.lang.String setLabel)
          List the info for the systems subscribed to the specified channel, for which we might want to schedule a deploy of the specified file, optionally constrained by a selected set of systems
 DataResult listLocalConfigFiles(User user, PageControl pc)
          Lists all local config files in this user's org that this user can view.
 java.util.List<? extends ConfigFileNameDto> listManagedPathsFor(Server server, User user, ConfigChannelType type)
          Provides a list of 'Unique' paths (ConfigFileNameDto's) for a given server and channel type.
 DataResult listManagedSystemsAndFiles(User user, PageControl pc)
          Lists all configuration managed systems along with counts for how many files and channels they are managed by.
 DataResult listNonManagedSystems(User user, PageControl pc)
          Lists all systems visible to a user that are not configuration managed.
 DataResult listNonManagedSystemsInSet(User user, PageControl pc, java.lang.String set)
          Lists all systems visible to a user that are not configuration managed that are in the given set.
 DataResult listNonManagedSystemsInSetElaborate(User user, java.lang.String set)
          Lists all systems visible to a user that are not configuration managed that are in the given set.
 DataResult listRevisionsForCompare(User user, ConfigFile file, ConfigRevision current, PageControl pc)
          Lists all the revisions of the given file other than the given revision.
 DataResult listRevisionsForFile(User user, ConfigFile file, PageControl pc)
          List revisions for the given file
 DataResult listSystemInfoForChannel(User usr, ConfigChannel cc, PageControl pc)
          For a specified ConfigChannel, return overview info for the systems that are subscribed to that channel.
 DataResult listSystemInfoForChannel(User usr, ConfigChannel cc, PageControl pc, boolean useSet)
          For a specified ConfigChannel, return overview info for the systems that are subscribed to that channel.
 DataResult listSystemsForConfigAction(User user, PageControl pc, java.lang.String feature)
          Lists the systems in the user's system_list set that are subscribed to files whose names are in the user's config file name set.
 DataResult listSystemsForConfigChannel(User user, java.lang.Long ccid, PageControl pc)
          Lists the systems in the given user's system_list set that are subscribed to a config channel with the given config channel id.
 DataResult listSystemsForCopy(User user, PageControl pc)
          List systems accessible to the specified user
 DataResult listSystemsForFileCompare(User user, java.lang.Long cfnid, PageControl pc)
          Get a list of systems for a config file diff action.
 DataResult listSystemsForFileCopy(User user, java.lang.Long cfnid, ConfigChannelType chnlType, PageControl pc)
          Get a list of systems to whose local or sandbox channel one could copy a cfg-file
 DataResult listSystemsForFileName(User user, java.lang.Long cfnid, PageControl pc)
          Lists the systems in the given user's system_list set that are subscribed to a config channel that contains a config file with the given config file name id.
 DataResult listSystemsNotInChannel(User user, ConfigChannel channel, PageControl pc)
          List systems NOT subscribed to this channel, sorted by name
 ConfigChannel lookupConfigChannel(User user, java.lang.Long id)
          Looks up a config channel, if the given user has access to it.
 ConfigChannel lookupConfigChannel(User user, java.lang.String label, ConfigChannelType cct)
          Looks up a config channel, if the given user has access to it.
 ConfigFile lookupConfigFile(User user, java.lang.Long id)
          Looks up a config file, if the given user has access to it.
 ConfigFile lookupConfigFile(User user, java.lang.Long ccid, java.lang.String path)
          Look up a config-file with a specified name in a specified cfg-channel.
 ConfigRevision lookupConfigRevision(User user, java.lang.Long id)
          Looks up a config revision, if the given user has access to it.
 DataResult ssmChannelList(User user, PageControl pc)
          List all of the global channels to which systems in the current user's system_list are subscribed.
 DataResult ssmChannelListForSubscribe(User user, PageControl pc)
          List all the global channels to which the given user can subscribe systems.
 java.util.List ssmChannelsInSetForSubscribe(User user)
          List all the global channels to which the given user can subscribe systems.
 DataResult ssmSystemListForChannels(User user, PageControl pc)
          List all systems in the given user's system_list subscribed to at least one channel in the user's config channel set
 java.util.List ssmSystemsForSubscribe(User user)
          List the systems in your system set along with the number of channels selected to which they are already subscribed.
 
Methods inherited from class com.redhat.rhn.manager.BaseManager
makeDataResult, makeDataResult, makeDataResultNoPagination, processListControl, processPageControl
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

KEY

public static final java.lang.String KEY
See Also:
Constant Field Values

ARG0

public static final java.lang.String ARG0
See Also:
Constant Field Values

ARG1

public static final java.lang.String ARG1
See Also:
Constant Field Values

ENABLE_SUCCESS

public static final int ENABLE_SUCCESS
See Also:
Constant Field Values

ENABLE_ERROR_PROVISIONING

public static final int ENABLE_ERROR_PROVISIONING
See Also:
Constant Field Values

ENABLE_ERROR_RHNTOOLS

public static final int ENABLE_ERROR_RHNTOOLS
See Also:
Constant Field Values

ENABLE_ERROR_PACKAGES

public static final int ENABLE_ERROR_PACKAGES
See Also:
Constant Field Values

ENABLE_NEED_ORG_ADMIN

public static final int ENABLE_NEED_ORG_ADMIN
See Also:
Constant Field Values

FILES

public static final int FILES
See Also:
Constant Field Values

DIRECTORIES

public static final int DIRECTORIES
See Also:
Constant Field Values

FEATURE_CONFIG

public static final java.lang.String FEATURE_CONFIG
See Also:
Constant Field Values
Method Detail

getInstance

public static ConfigurationManager getInstance()
Returns:
the static object of this class.

listGlobalChannels

public DataResult listGlobalChannels(User user,
                                     PageControl pc)
List all of the global channels a given user can see.

Parameters:
user - The user looking at channels.
pc - A page control for this user.
Returns:
A list of the channels in DTO format.

listGlobalChannelsForSystemSubscriptions

public DataResult listGlobalChannelsForSystemSubscriptions(Server server,
                                                           User user,
                                                           PageControl pc)
This query basically lists all the global channels a user can see along with info on whether the channels are subscribed to a given server Basically used in SDC Subscribe Channels page

Parameters:
server - the server to check the channels subscriptions on
user - The user looking at channels.
pc - A page control for this user.
Returns:
A list of the channels in DTO format.

listAllFilesWithTotalSize

public DataResult listAllFilesWithTotalSize(User user,
                                            PageControl pc)
Lists all of the configuration files in RHN for a single org.

Parameters:
user - The user requesting to view configuration files.
pc - A page control for this user.
Returns:
A list of configuration files in DTO format.

listManagedSystemsAndFiles

public DataResult listManagedSystemsAndFiles(User user,
                                             PageControl pc)
Lists all configuration managed systems along with counts for how many files and channels they are managed by.

Parameters:
user - The user requesting to view managed systems
pc - A page control for this user.
Returns:
A list of configged systems in DTO format.

isConfigEnabled

public boolean isConfigEnabled(Server server,
                               User user)
Returns the given system is config enabled.

Parameters:
server - The system we care abt finding config capability info on
user - The user requesting to view target systems
Returns:
true of the system is config capable.

listNonManagedSystems

public DataResult listNonManagedSystems(User user,
                                        PageControl pc)
Lists all systems visible to a user that are not configuration managed. Also includes whether the system is currently capable for configuration management.

Parameters:
user - The user requesting to view target systems
pc - A page control for this user.
Returns:
A list of non config managed systems in DTO format.

listNonManagedSystemsInSet

public DataResult listNonManagedSystemsInSet(User user,
                                             PageControl pc,
                                             java.lang.String set)
Lists all systems visible to a user that are not configuration managed that are in the given set. Also includes whether the system is currently capable for configuration management and what actions are needed in order to make it so.

Parameters:
user - The user requesting to view target systems
pc - A page control for this user.
set - The label for the desired RhnSet
Returns:
A list of non config managed systems in DTO format.

listNonManagedSystemsInSetElaborate

public DataResult listNonManagedSystemsInSetElaborate(User user,
                                                      java.lang.String set)
Lists all systems visible to a user that are not configuration managed that are in the given set. Elaborates all of them so that the required actions for enabling config management are given in the list.

Parameters:
user - The user about to enable things
set - The name of the set.
Returns:
An elaborated list of non-configuration managed systems in the given set.

listRevisionsForCompare

public DataResult listRevisionsForCompare(User user,
                                          ConfigFile file,
                                          ConfigRevision current,
                                          PageControl pc)
Lists all the revisions of the given file other than the given revision.

Parameters:
user - The user requesting a list of revisions.
file - The file that the revisions should be for.
current - The current revision that should not be included in the list.
pc - A PageControl for this user
Returns:
A list of revisions.

listAlternateFilesForCompare

public DataResult listAlternateFilesForCompare(User user,
                                               ConfigFile current,
                                               PageControl pc)
Lists all the alternatives for a given file in other config channels.

Parameters:
user - The user requesting a list of alternate files.
current - The current file that should not be included in the list.
pc - A PageControl for this user
Returns:
A list of alternate files.

listChannelsForFileCompare

public DataResult listChannelsForFileCompare(User user,
                                             PageControl pc)
Lists all the other channels in this org.

Parameters:
user - The user requesting a list of channels.
pc - A PageControl for this user
Returns:
A list of channels.

listFilesInChannel

public DataResult listFilesInChannel(User user,
                                     ConfigChannel channel,
                                     PageControl pc)
Gets a list of files (not directories) in the given config channel.

Parameters:
user - The user requesting a list of files.
channel - The config channel
pc - A page control for the user.
Returns:
a list of config files in DTO format

listSystemsForFileCompare

public DataResult listSystemsForFileCompare(User user,
                                            java.lang.Long cfnid,
                                            PageControl pc)
Get a list of systems for a config file diff action.

Parameters:
user - The user requesting a list of systems.
cfnid - The config file name identifier for the file to diff.
pc - A PageControl for this user.
Returns:
A list of systems in DTO format

listSystemsForFileCopy

public DataResult listSystemsForFileCopy(User user,
                                         java.lang.Long cfnid,
                                         ConfigChannelType chnlType,
                                         PageControl pc)
Get a list of systems to whose local or sandbox channel one could copy a cfg-file

Parameters:
user - The user requesting a list of systems.
cfnid - The config file name identifier for the file to diff.
chnlType - ConfigChannelType to look for (LOCAL or SANDBOX)
pc - A PageControl for this user.
Returns:
A list of systems in DTO format

listFileNamesForSsm

public DataResult listFileNamesForSsm(User user,
                                      PageControl pc)
Lists the file names of all files subscribed to by systems in the given user's system_list set.

Parameters:
user - The user requesting the list of file names.
pc - A PageControl for this user.
Returns:
A list of config file names in DTO format.

listSystemsForFileName

public DataResult listSystemsForFileName(User user,
                                         java.lang.Long cfnid,
                                         PageControl pc)
Lists the systems in the given user's system_list set that are subscribed to a config channel that contains a config file with the given config file name id.

Parameters:
user - The user requesting a list of systems.
cfnid - The identifier of the config file name
pc - A PageControl for this user.
Returns:
A list of systems in DTO format.

listSystemsForConfigChannel

public DataResult listSystemsForConfigChannel(User user,
                                              java.lang.Long ccid,
                                              PageControl pc)
Lists the systems in the given user's system_list set that are subscribed to a config channel with the given config channel id.

Parameters:
user - The user requesting a list of systems.
ccid - The identifier of the config channel
pc - A PageControl for this user.
Returns:
A list of systems in DTO format.

listFileNamesInSetForSystem

public DataResult listFileNamesInSetForSystem(User user,
                                              Server server,
                                              PageControl pc)
Lists the file names in the user's config file name set relevant to the given server. Finds the deployable revisions for each file name.

Parameters:
user - The user requesting a list of file names
server - The server to which these files must be relevant
pc - A PageControl for this user
Returns:
A list of config file names in DTO format.

listFileNamesInSet

public DataResult listFileNamesInSet(User user,
                                     Server server,
                                     java.lang.String setLabel,
                                     PageControl pc)
Lists the file names in the user's config file name set whether or not they are relevant to the given server. Finds the deployable revisions for each file name for the given server.

Parameters:
user - The user requesting a list of file names
server - The server to which these files may be relevant
setLabel - The DB label of the config file name set.
pc - A PageControl for this user
Returns:
A list of config file names in DTO format.

listFileNamesForSystem

public DataResult<ConfigFileNameDto> listFileNamesForSystem(User user,
                                                            Server server,
                                                            PageControl pc)
Lists the file names to which the given server is subscribed Finds the deployable revisions for each file name.

Parameters:
user - The user requesting a list of file names
server - The server to which these files must be relevant
pc - A PageControl for this user
Returns:
A list of config file names in DTO format.

listConfigChannelsForSystem

public DataResult listConfigChannelsForSystem(User user,
                                              Server server,
                                              PageControl pc)
Lists the config channels in the user's config channel set to which the given server is subscribed. Finds the deployable files for each channel.

Parameters:
user - The user requesting a list of config channels
server - The server subscribed to these channels
pc - A PageControl for this user
Returns:
A list of config channels in DTO format.

listSystemsForConfigAction

public DataResult listSystemsForConfigAction(User user,
                                             PageControl pc,
                                             java.lang.String feature)
Lists the systems in the user's system_list set that are subscribed to files whose names are in the user's config file name set.

Parameters:
user - The user requesting the list of file names.
pc - A PageControl for this user.
feature - acl off the list by selecting a config mgmt specific feature like (configfiles.deploy/configfiles.diff)
Returns:
A list of systems in DTO format.

ssmChannelList

public DataResult ssmChannelList(User user,
                                 PageControl pc)
List all of the global channels to which systems in the current user's system_list are subscribed.

Parameters:
user - The user looking at channels.
pc - A page control for this user.
Returns:
A list of the channels in DTO format.

ssmChannelListForSubscribe

public DataResult ssmChannelListForSubscribe(User user,
                                             PageControl pc)
List all the global channels to which the given user can subscribe systems.

Parameters:
user - The user looking at channels.
pc - A page control for this user.
Returns:
A list of the channels in DTO format.

ssmChannelsInSetForSubscribe

public java.util.List ssmChannelsInSetForSubscribe(User user)
List all the global channels to which the given user can subscribe systems.

Parameters:
user - The user looking at channels.
Returns:
A list of the channels in DTO format.

ssmSystemsForSubscribe

public java.util.List ssmSystemsForSubscribe(User user)
List the systems in your system set along with the number of channels selected to which they are already subscribed.

Parameters:
user - The user looking at channels.
Returns:
A list of the systems in DTO format.

ssmSystemListForChannels

public DataResult ssmSystemListForChannels(User user,
                                           PageControl pc)
List all systems in the given user's system_list subscribed to at least one channel in the user's config channel set

Parameters:
user - The user requested a list of systems
pc - A PageControl for this user
Returns:
A list of systems in DTO format

getEnableSummary

public DataResult getEnableSummary(User user,
                                   PageControl pc,
                                   java.lang.String set)
Get a summary of configuration enablement.

Parameters:
user - The user asking for a summary
pc - A PageControl object for this user.
set - The label for the RhnSet where the summary is located.
Returns:
The summary for each system in Dto format.

listGlobalConfigFiles

public DataResult listGlobalConfigFiles(User user,
                                        PageControl pc)
Lists all global config files in this user's org that this user can view along with system count and overridden count.

Parameters:
user - The user requesting to view config files
pc - A page control for this user.
Returns:
A list of global config files that this user can view in DTO format.

listLocalConfigFiles

public DataResult listLocalConfigFiles(User user,
                                       PageControl pc)
Lists all local config files in this user's org that this user can view.

Parameters:
user - The user requesting to view config files
pc - A page control for this user.
Returns:
A list of local config files that this user can view in DTO format.

listChannelsForFileCopy

public DataResult listChannelsForFileCopy(User user,
                                          ConfigFile current,
                                          java.lang.String type,
                                          PageControl pc)
Lists all global config channels in this user's org except the one that contains the given config file. Includes information about files with the same path as the given file in the channels listed.

Parameters:
user - The user requesting to view config files
current - The file to be copied for which we should look for alternatives in the listed channels. The list will exclude the channel that this file is in.
type - The database type for the channel. A label from ConfigurationFactory.CONFIG_CHANNEL_TYPE_*
pc - A page control for this user.
Returns:
A list of global config channels in this org in DTO format.

listChannelsForCopy

public java.util.List listChannelsForCopy(User user,
                                          ConfigChannel cc,
                                          java.lang.String ccType)
List cfg-channels OTHER THAN the specified one, that are of the specified type, and are accessible to the specified user

Parameters:
user - user making the request
cc - config-channel of interest
ccType - channel-type of interest
Returns:
DataResult of ConfigChannelDto's

listSystemsForCopy

public DataResult listSystemsForCopy(User user,
                                     PageControl pc)
List systems accessible to the specified user

Parameters:
user - user making the request
pc - page-control
Returns:
DataResult of ConfigSystemDto's

getSystemCount

public int getSystemCount(User user,
                          ConfigChannel channel)
Return the number of systems subscribed to the specified channel.

Parameters:
user - user making the request
channel - channel of interest
Returns:
number of systems subscribed to channel

getFileStorage

public int getFileStorage(User user,
                          ConfigFile file)
Return the number of bytes used for all revisions of the specified ConfigFile

Parameters:
user - User making the request
file - File of interest
Returns:
total bytes of all ConfigRevisions (0 for directories)

getDirCount

public int getDirCount(User user,
                       ConfigChannel channel)
Return the number of Directories in this config-channel

Parameters:
user - user making the request
channel - channel of interest
Returns:
number of directories in this channel

getFileCount

public int getFileCount(User user,
                        ConfigChannel channel)
Return the number of Files in this config-channel

Parameters:
user - user making the request
channel - channel of interest
Returns:
number of files in this channel

getSystemInfo

public DataResult getSystemInfo(User user,
                                ConfigChannel channel)
List systems subscribed to this channel, sorted by date-modified (descending)

Parameters:
user - user making the request
channel - channel of interest
Returns:
List of Maps with keys ('id','name','modified')

getFileInfo

public DataResult getFileInfo(User user,
                              ConfigChannel channel)
List files controlled by this channel, sorted by date-modified (descending)

Parameters:
user - user making the request
channel - channel of interest
Returns:
List of Maps with keys ('id','path','modified')

getRecentlyModifiedConfigFiles

public DataResult getRecentlyModifiedConfigFiles(User user,
                                                 java.lang.Integer results)
Lists the last n most recently modified configuration files visible by a user where n is the results param and user is the user param.

Parameters:
user - The user listing files
results - The number of files to list
Returns:
List of recently modified files in DTO format.

getRecentConfigDeployActions

public DataResult getRecentConfigDeployActions(User user,
                                               java.lang.Integer results)
Lists the last n most recent config deploy actions visible by a user where n is the results param and user is the user param.

Parameters:
user - The user listing deploy actions
results - The number of actions to list
Returns:
List of recently config deploy actions in DTO format.

getChannelSummary

public ChannelSummary getChannelSummary(User user,
                                        ConfigChannel channel)
Return ChannelSummary info - see ChannelOverview

Parameters:
user - user making the request
channel - channel of interest
Returns:
summary information for this channel

listCurrentFiles

public DataResult<ConfigFileDto> listCurrentFiles(User user,
                                                  ConfigChannel channel,
                                                  PageControl pc)
List current files for channel withOUT using a set

Parameters:
user - user making the request
channel - channel of interest
pc - pagination control (if any)
Returns:
list of com.redhat.rhn.frontend.dto.ConfigFileDto

listCurrentFiles

public DataResult listCurrentFiles(User user,
                                   ConfigChannel channel,
                                   PageControl pc,
                                   java.lang.String setLabel)
List latest revisions controlled by this channel, sorted by date-modified (descending), optionally constrained by the specified set

Parameters:
user - user making the request
channel - channel of interest
pc - controller/elaborator for the list
setLabel - label of set we care about, or NULL if we don't want to use a set
Returns:
list of com.redhat.rhn.frontend.dto.ConfigFileDto

listRevisionsForFile

public DataResult listRevisionsForFile(User user,
                                       ConfigFile file,
                                       PageControl pc)
List revisions for the given file

Parameters:
user - user making the request
file - config file for which we are listing revisions
pc - controller/elaborator for the list
Returns:
List of revisions in dto format.

listChannelSystems

public DataResult listChannelSystems(User user,
                                     ConfigChannel channel,
                                     PageControl pc)
List systems subscribed to this channel, sorted by date added (descending)

Parameters:
user - user making the request
channel - channel of interest
pc - controller/elaborator for the list
Returns:
List of Maps with keys ('id', 'name', 'modified')

listChannelsForSystem

public DataResult listChannelsForSystem(User user,
                                        Server server,
                                        PageControl pc)
List global config channels for a system. Used in the sdc

Parameters:
user - The user requesting for a list of config channels
server - The server subscribed to the config channels
pc - A PageControl for this user
Returns:
A list of config channels in DTO format.

getOverviewSummary

public java.util.Map getOverviewSummary(User user)
Returns a map of summary information. The keys of this map are as follows:
  1. systems - The number of configuration managed systems viewable by this user.
  2. channels - The number central configuration channels viewable by this user.
  3. global_files - The number of centrally-managed configuration files viewable by this user.
  4. local_files - The number of locally-managed configuration files viewable by this user.
  5. quota - The amount of unused quota available for configuration files. This is returned as a localized string with units.

Parameters:
user - The user requesting information
Returns:
A map with the keys {systems,channels, global_files,local_files,quota}

listSystemsNotInChannel

public DataResult listSystemsNotInChannel(User user,
                                          ConfigChannel channel,
                                          PageControl pc)
List systems NOT subscribed to this channel, sorted by name

Parameters:
user - user making the request
channel - channel of interest
pc - controller/elaborator for the list
Returns:
List of Maps with keys ('id', 'name')

deleteConfigChannel

public void deleteConfigChannel(User user,
                                ConfigChannel channel)
Deletes a config channel. Performs checking to determine whether the user actually can delete the config channel

Parameters:
user - The user requesting to delete the channel
channel - The channel to be deleted.
Throws:
java.lang.IllegalArgumentException - if user is not allowed to delete this config channel (different org or not config admin).

createNewRevision

public ConfigRevision createNewRevision(User user,
                                        java.io.InputStream input,
                                        java.lang.Long cfid,
                                        java.lang.Long size)
Creates a new config revision object. Looks up the config file from the id given and decides if the user given has access to that file. If both those steps go ok, it creates a new revision and makes it the newest for the file.

Parameters:
user - The user requesting to create the revision
input - The stream containing the revision's content
cfid - The identifier for the parent config file.
size - The size of the given input stream
Returns:
The newly created config revision object

createNewRevision

public ConfigRevision createNewRevision(User user,
                                        java.io.InputStream input,
                                        ConfigFile file,
                                        java.lang.Long size)
Creates a new config revision object. Looks up the config file from the id given and decides if the user given has access to that file. If both those steps go ok, it creates a new revision and makes it the newest for the file.

Parameters:
user - The user requesting to create the revision
input - The stream containing the revision's content
file - The parent config file.
size - The size of the given input stream
Returns:
The newly created config revision object

deleteConfigRevision

public boolean deleteConfigRevision(User user,
                                    ConfigRevision revision)
Deletes a config revision. Performs checking to determine whether the user actually can delete the config revision

Parameters:
user - The user requesting to delete the revision
revision - The revision to be deleted.
Returns:
whether the parent file was also deleted.
Throws:
java.lang.IllegalArgumentException - if user is not allowed to delete this config revision (different org or not config admin).

deleteConfigFile

public void deleteConfigFile(User user,
                             ConfigFile file)
Deletes a config file. Performs checking to determine whether the user actually can delete the config file

Parameters:
user - The user requesting to delete the file
file - The file to be deleted.
Throws:
java.lang.IllegalArgumentException - if user is not allowed to delete this config file (different org or not config admin).

copyConfigFile

public void copyConfigFile(ConfigRevision revision,
                           ConfigChannel channel,
                           User user)
Copies a config file. Performs checking to determine whether the user actually can delete the config file. Only copies the revision of the file given. Puts the revision into a config file with the same deploy path in the new channel, or creates a config file if a candidate file does not exist.

Parameters:
revision - The revision of the file to be copied.
channel - The channel to which to copy.
user - The user requesting to copy the file
Throws:
java.lang.IllegalArgumentException - if user is not allowed to copy this config file (different org or not config admin).

getSuccesfulDeploysTo

public DataResult getSuccesfulDeploysTo(User usr,
                                        ConfigFileName cfn,
                                        Server srv)
For a given filename and server, find all the successful deploys of a file with that name

Parameters:
usr - User making the request
cfn - name of interest
srv - server of interest
Returns:
list of LastDeployDtos

listFilesNotInChannel

public DataResult listFilesNotInChannel(User usr,
                                        ConfigChannel cc,
                                        PageControl pc)
For a specified channel, return info about all config-files that the user has access to that are NOT already in that channel

Parameters:
usr - User making the request
cc - ConfigChannel of interest
pc - A page control for this user.
Returns:
DataResult; entities are cfid, path, ccid, name, and modified

listSystemInfoForChannel

public DataResult listSystemInfoForChannel(User usr,
                                           ConfigChannel cc,
                                           PageControl pc)
For a specified ConfigChannel, return overview info for the systems that are subscribed to that channel.

Parameters:
usr - User making the request
cc - ConfigChannel of interest
pc - PageControl (if we're paginating)
Returns:
DataResult of ConfigSystemDtos, with id,name,outrankedCount and overriddenCount filled in

listSystemInfoForChannel

public DataResult listSystemInfoForChannel(User usr,
                                           ConfigChannel cc,
                                           PageControl pc,
                                           boolean useSet)
For a specified ConfigChannel, return overview info for the systems that are subscribed to that channel.

Parameters:
usr - User making the request
cc - ConfigChannel of interest
pc - PageControl (if we're paginating)
useSet - true if we should limit by set_label, false if we want ALL systems in the channel
Returns:
DataResult of ConfigSystemDtos, with id,name,outrankedCount and overriddenCount filled in

listAvailableFilesNotInChannel

public DataResult listAvailableFilesNotInChannel(User usr,
                                                 ConfigChannel cc,
                                                 PageControl pc)
For a specified channel, return info about all systems that the user has access to that are NOT already in that channel

Parameters:
usr - User making the request
cc - ConfigChannel of interest
pc - A page control for this user.
Returns:
DataResult; entities are

listManagedPathsFor

public java.util.List<? extends ConfigFileNameDto> listManagedPathsFor(Server server,
                                                                       User user,
                                                                       ConfigChannelType type)
Provides a list of 'Unique' paths (ConfigFileNameDto's) for a given server and channel type. The returned list takes care of the channel priority ordering and stuff like that.. This is mainly used in the View/Modify files page of the SDC.

Parameters:
server - the server who's paths are to be retrieved
user - the user needed for permission checking
type - config channel type that holds the files
Returns:
a list of unique'ly named paths sorted by the name of type com.redhat.rhn.frontend.dto.ConfigFileNameDto

countAllActionPaths

public ConfigFileCount countAllActionPaths(Server server,
                                           Action action)
Returns the number of files, and directories that were on a applied to server by a given config action This is method is mainly used to show the number of files and directories that were deployed/diff'd Note this method doesnot check whether the Action is visible to the user. It is assumed that whomever is calling this has already ensured that the Action is visible to the user.

Parameters:
server - The server for whom the count of files is desired.
action - the action for whom the number of files and dirs are desired.
Returns:
ConfigFileCount object holding the files and dirs

countSuccessfulCompares

public ConfigFileCount countSuccessfulCompares(Server server,
                                               Action action)
Returns the number of files, and directories that were SUCCESSFULLY applied to server by a given config action This is method is mainly used to show the number of files and directories that were scheduled for comparison Returns the number of files that were selected successfully for comparison in a config DIFF action. In other words this method subtracts the missing files from the total for a given diff action.. Note this method doesnot check whether the Action is visible to the user. It is assumed that whomever is calling this has already ensured that the Action is visible to the user.

Parameters:
server - The server for whom the count of files is desired.
action - the action for whom the number of files and dirs are desired.
Returns:
ConfigFileCount object holding the number of NON Missing files/dirs that were selected for comparison

countDifferingPaths

public ConfigFileCount countDifferingPaths(Server server,
                                           Action action)
Returns the number of files on the server that differed in content from the files in RHN - Managed Note this method doesnot check whether the Action is visible to the user. It is assumed that whomever is calling this has already ensured that the Action is visible to the user.

Parameters:
server - The server for whom the count of files is desired.
action - the action for whom the number of files and dirs are desired.
Returns:
ConfigFileCount object holding the files and dirs

countLocallyManagedPaths

public ConfigFileCount countLocallyManagedPaths(Server server,
                                                User user,
                                                ConfigChannelType cct)
Returns the number of files, and directories that are managed in the local override channel or Sandbox channel of a given server..

Parameters:
server - The server for whom the count of files is desired.
user - The user required for permission purposes
cct - The local channel type of the to look at (local/sandbox)
Returns:
ConfigFileCount object holding the files and dirs

countCentrallyManagedPaths

public ConfigFileCount countCentrallyManagedPaths(Server server,
                                                  User user)
Returns the sum of files, and directories that are present in the all the centrally managed channels in a given server. This method strips out all the duplicate file paths before counting, and accounts for channel priorities.. For example if a path /tmp/foo is a file in channel A and a directory in channel B and our Server subscribes to both channels, Then this method would take into account the priority of the channels before incrementing File count or Directory count.

Parameters:
server - The server for whom the count of files is desired.
user - The user required for permission purposes
Returns:
a ConfigFileCount object holding the files and dirs

countCentrallyDeployablePaths

public ConfigFileCount countCentrallyDeployablePaths(Server server,
                                                     User user)
Returns the sum of all the 'Deployable' files, and directories that are present in the all the centrally managed channels in a given server. This is similar to 'countCentrallyManagedPaths' except that it also takes into account the file/directory path intersections between the local override channel and all the centrally managed channels (basically subtracting them from the central list). In clearer terms, for a system A num_of_centrally_deployable_files(A) = countCentrallyManagedPaths (A) - count( centrallyManagedPaths(A) ^ locallyManagedPaths(A) )

Parameters:
server - The server for whom the count of files is desired.
user - The user required for permission purposes
Returns:
ConfigFileCount object holding the files and dirs

lookupConfigChannel

public ConfigChannel lookupConfigChannel(User user,
                                         java.lang.Long id)
Looks up a config channel, if the given user has access to it.

Parameters:
user - The user requesting to lookup a config channel.
id - The identifier for the config channel
Returns:
The sought for config channel.

lookupConfigChannel

public ConfigChannel lookupConfigChannel(User user,
                                         java.lang.String label,
                                         ConfigChannelType cct)
Looks up a config channel, if the given user has access to it.

Parameters:
user - The user requesting to lookup a config channel.
label - The label for the ConfigChannel
cct - the config channel type of the config channel.
Returns:
The sought for config channel.

lookupConfigFile

public ConfigFile lookupConfigFile(User user,
                                   java.lang.Long id)
Looks up a config file, if the given user has access to it.

Parameters:
user - The user requesting to lookup a config file.
id - The identifier for the config file.
Returns:
The sought for config file.

lookupConfigFile

public ConfigFile lookupConfigFile(User user,
                                   java.lang.Long ccid,
                                   java.lang.String path)
Look up a config-file with a specified name in a specified cfg-channel. If the specified path is not yet in the system, it will be created as a ConfigFileName (under the assumption that if we're asking this, chances are good we're going to want to create a ConfigFile with this path Real Soon Now...)

Parameters:
user - User making the request
ccid - ID of tyhe cohnfig-channel of interest
path - file-path of interest
Returns:
ConfigFile if found, or null if it doesn't exist or if the user doesn't have sufficient access

lookupConfigRevision

public ConfigRevision lookupConfigRevision(User user,
                                           java.lang.Long id)
Looks up a config revision, if the given user has access to it.

Parameters:
user - The user requesting to lookup a config revision.
id - The identifier for the config revision.
Returns:
The sought for config revision.

accessToChannel

public boolean accessToChannel(java.lang.Long uid,
                               java.lang.Long ccid)
Parameters:
uid - The user id
ccid - The config channel id
Returns:
whether the user with the given id can view the config channel with the given id.

getDeployableRevisionForFileName

public java.lang.Long getDeployableRevisionForFileName(java.lang.Long cfnid,
                                                       java.lang.Long sid)
Returns the config revision id for a config file with the given config file name id. The config revision is one is the highest priority config channel for the server with the given id.

Parameters:
cfnid - The config file name id
sid - The server id
Returns:
The deployable config revision for the given server with the given name.

enableSystems

public void enableSystems(RhnSetDecl set,
                          User user,
                          java.util.Date earliest)
Enable the set of systems given for configuration management.

Parameters:
set - The set that contains systems selected for enablement
user - The user requesting to enable systems
earliest - The earliest time package actions will be scheduled.

listGlobalFileDeployInfo

public DataResult listGlobalFileDeployInfo(User usr,
                                           ConfigChannel cc,
                                           ConfigFile cf,
                                           PageControl pc)
List the info for the systems subscribed to the specified channel, for which we might want to schedule a deploy of the specified file, without being constrained by a selected set of systems

Parameters:
usr - logged-in user
cc - cfg-channel of interest
cf - cfg=file of interest
pc - paging control for UI control
Returns:
list of ConfigGlobalDeployDtos

listGlobalFileDeployInfo

public DataResult listGlobalFileDeployInfo(User usr,
                                           ConfigChannel cc,
                                           ConfigFile cf,
                                           PageControl pc,
                                           java.lang.String setLabel)
List the info for the systems subscribed to the specified channel, for which we might want to schedule a deploy of the specified file, optionally constrained by a selected set of systems

Parameters:
usr - User making the request
cc - Config Channel File is in
cf - ConfigFile of interest
pc - page-control for UI paging
setLabel - label of limiting set, or NULL if not set-limited
Returns:
DataResult of ConfigGlobalDeployDtos

deployConfiguration

public void deployConfiguration(User user,
                                java.util.Collection<Server> servers,
                                java.util.Date datePicked)
Schedules deploys of all the configuration files or dirs associated to a list of servers

Parameters:
user - User needed for authentication purposes..
servers - The list of servers, to whom the deploy action needs to be scheduled
datePicked - date to deploy or null for the earliest date

deployFiles

public java.util.Map deployFiles(User usr,
                                 java.util.Set fileIds,
                                 java.util.Set systemIds,
                                 java.util.Date datePicked)
Deploy revisions to systems. For each system, make sure the specified revisions are all the top-priority files - if they're not, flag an error and continue.

Parameters:
usr - User requesting the deploy
fileIds - Revisions to be deployed
systemIds - Systems to deploy to
datePicked - Date to schedule the deploy for
Returns:
Map describing "success"|"override"|"failure"

ensureConfigManageable

public void ensureConfigManageable(Server server)
Method to ensure config management features are available for a given system are available..

Parameters:
server - the server to check.

getServerIdFor

public java.lang.Long getServerIdFor(ConfigChannel cc,
                                     User user)
Returns the server id associated to a local/sandbox channel

Parameters:
cc - the local or sandbox channel
user - the logged in user.
Returns:
the server id associated to a local/sandbox channel

isDuplicated

public boolean isDuplicated(java.lang.String label,
                            ConfigChannelType cct,
                            Org org)
Returns true if there already exists a config channel with the same label, cc type and org.

Parameters:
label - Label of the config channel
cct - the contig channel type
org - the org of the current user
Returns:
true if there already exists such a channel/false otherwise.