public class ActionFactory extends HibernateFactory
Modifier and Type | Field and Description |
---|---|
static ActionStatus |
STATUS_COMPLETED
The constant representing the Action Status COMPLETED
|
static ActionStatus |
STATUS_FAILED
The constant representing the Action Status FAILED
|
static ActionStatus |
STATUS_PICKEDUP
The constant representing the Action Status PICKEDUP
|
static ActionStatus |
STATUS_QUEUED
The constant representing the Action Status QUEUED
|
static java.lang.String |
TXN_OPERATION_DELETE |
static java.lang.String |
TXN_OPERATION_INSERT |
static ActionType |
TYPE_ACTIVATION_SCHEDULE_DEPLOY
The constant representing "Schedule a config deploy for activation key" [ID:22]
|
static ActionType |
TYPE_ACTIVATION_SCHEDULE_PKG_INSTALL
The constant representing "Schedule a package install for activation key".
|
static ActionType |
TYPE_CLIENTCERT_UPDATE_CLIENT_CERT |
static ActionType |
TYPE_CONFIGFILES_DEPLOY
The constant representing "Deploy config files to system".
|
static ActionType |
TYPE_CONFIGFILES_DIFF
The constant representing
"Show differences between profiled config files and deployed config files" [ID:18]
|
static ActionType |
TYPE_CONFIGFILES_MTIME_UPLOAD
The constant representing
"Upload config file data based upon mtime to server" [ID:23]
|
static ActionType |
TYPE_CONFIGFILES_UPLOAD
The constant representing "Import config file data from system".
|
static ActionType |
TYPE_CONFIGFILES_VERIFY
The constant representing "Verify deployed config files" [ID:17]
|
static ActionType |
TYPE_DAEMON_CONFIG
The constant representing "RHN Daemon Configuration".
|
static ActionType |
TYPE_DEPLOY_IMAGE
The constant representing Image deploy action.
|
static ActionType |
TYPE_ERRATA
The constant representing Errata action.
|
static ActionType |
TYPE_HARDWARE_REFRESH_LIST
The constant representing Hardware Refreshlist action.
|
static ActionType |
TYPE_KICKSTART_INITIATE
The constant representing "Initiate a kickstart".
|
static ActionType |
TYPE_KICKSTART_INITIATE_GUEST
The constant representing "Initiate a kickstart for a guest".
|
static ActionType |
TYPE_KICKSTART_SCHEDULE_SYNC
The constant representing "Schedule a package sync for kickstarts".
|
static ActionType |
TYPE_PACKAGES_AUTOUPDATE
The constant representing "Automatic package installation".
|
static ActionType |
TYPE_PACKAGES_DELTA
The constant representing Package Delta action.
|
static ActionType |
TYPE_PACKAGES_REFRESH_LIST
The constant representing Package Refresh List action.
|
static ActionType |
TYPE_PACKAGES_REMOVE
The constant representing Package Remove action.
|
static ActionType |
TYPE_PACKAGES_RUNTRANSACTION
The constant representing "Package Synchronization".
|
static ActionType |
TYPE_PACKAGES_UPDATE
The constant representing Package Update action.
|
static ActionType |
TYPE_PACKAGES_VERIFY
The constant representing "Verify deployed packages" [ID:33]
|
static ActionType |
TYPE_REBOOT
The constant representing Reboot action.
|
static ActionType |
TYPE_RHN_APPLET_USE_SATELLITE
The constant representing "Allows for rhn-applet use with an PRODUCTNAME" [ID:34]
|
static ActionType |
TYPE_ROLLBACK_CONFIG
The constant representing Rollback Config action.
|
static ActionType |
TYPE_ROLLBACK_LISTTRANSACTIONS
The constant representing "Refresh server-side transaction list" [ID:11]
|
static ActionType |
TYPE_ROLLBACK_ROLLBACK
The constant representing "Rollback a transaction".
|
static ActionType |
TYPE_SCAP_XCCDF_EVAL |
static ActionType |
TYPE_SCRIPT_RUN
The constant representing "Run an arbitrary script".
|
static ActionType |
TYPE_UP2DATE_CONFIG_GET
The constant representing RHN Get server up2date config action.
|
static ActionType |
TYPE_UP2DATE_CONFIG_UPDATE
The constant representing RHN Update server up2date config action.
|
static ActionType |
TYPE_VIRTIZATION_HOST_SUBSCRIBE_TO_TOOLS_CHANNEL
The constant representing "Subscribes a server to the RHN Tools channel
associated with its base channel." [ID:46]
|
static ActionType |
TYPE_VIRTUALIZATION_DESTROY
The constant representing "Destroys a Xen Domain." [ID:41]
|
static ActionType |
TYPE_VIRTUALIZATION_GUEST_PACKAGE_INSTALL
The constant representing "Schedule a package install of guest specific
functionality." [ID:45]
|
static ActionType |
TYPE_VIRTUALIZATION_GUEST_SUBSCRIBE_TO_TOOLS_CHANNEL
The constant represting "Subscribes a virtualization guest to the RHN Tools channel
associated with its base channel." [ID: 47]
|
static ActionType |
TYPE_VIRTUALIZATION_HOST_PACKAGE_INSTALL
The constant representing "Schedule a package install of host specific
functionality." [ID:44]
|
static ActionType |
TYPE_VIRTUALIZATION_REBOOT
The constant representing "Reboots a Xen domain." [ID:40]
|
static ActionType |
TYPE_VIRTUALIZATION_RESUME
The constant representing "Resumes a Xen domain." [ID:39]
|
static ActionType |
TYPE_VIRTUALIZATION_SCHEDULE_POLLER
The constant representing "Sets when the poller should run." [ID:43]
|
static ActionType |
TYPE_VIRTUALIZATION_SET_MEMORY
The constant representing "Sets the maximum memory usage for a Xen domain." [ID:42]
|
static ActionType |
TYPE_VIRTUALIZATION_SET_VCPUS
The constant representing "Sets the Vcpu usage for a Xen domain." [ID:48]
|
static ActionType |
TYPE_VIRTUALIZATION_SHUTDOWN
The constant representing "Shuts down a Xen domain." [ID:36]
|
static ActionType |
TYPE_VIRTUALIZATION_START
The constant representing "Starts up a Xen domain." [ID:37]
|
static ActionType |
TYPE_VIRTUALIZATION_SUSPEND
The constant representing "Suspends a Xen domain." [ID:38]
|
Modifier and Type | Method and Description |
---|---|
static void |
addConfigRevisionToAction(ConfigRevision revision,
Server server,
ConfigAction parent)
Create a ConfigRevisionAction for the given server and add it to the parent action.
|
static void |
addServerToAction(java.lang.Long sid,
Action parent)
Creates a ServerAction and adds it to an Action
|
static void |
addServerToAction(Server server,
Action parent)
Creates a ServerAction and adds it to an Action
|
static void |
cancelPendingForSystem(java.lang.Long serverId)
Remove pending action for system
|
static boolean |
checkActionArchType(Action actionCheck,
java.lang.String actionStyle)
Check the ActionType against the ActionArchType to see
|
static Action |
createAction(ActionType typeIn)
Create a new Action from scratch.
|
static Action |
createAction(ActionType typeIn,
java.util.Date earliest)
Create a new Action from scratch
with the given earliest execution.
|
static ScriptActionDetails |
createScriptActionDetails(java.lang.String username,
java.lang.String groupname,
java.lang.Long timeout,
java.lang.String script)
Creates a ScriptActionDetails which contains an arbitrary script to be
run by a ScriptRunAction.
|
static void |
deleteServerActionsByParent(java.util.Set parentActions)
Delete the server actions associated with the given set of parent actions.
|
static boolean |
doesServerHaveKickstartScheduled(java.lang.Long serverId)
Check to see if a server has a pending kickstart scheduled
|
protected org.apache.log4j.Logger |
getLogger()
Get the Logger for the derived class so log messages
show up on the correct class
|
static java.lang.Integer |
getServerActionCountByStatus(Org org,
Action action,
ActionStatus status)
Lookup the number of server actions for a particular action that have
a certain status
|
static ServerAction |
getServerActionForServerAndAction(Server serverIn,
Action actionIn)
Lookup ServerAction object for given Server/Action pair.
|
static java.util.List |
listActionsForServer(User user,
Server serverIn)
Lookup a List of Action objects for a given Server.
|
static java.util.List |
listServerActionsForServer(Server serverIn)
Lookup a List of ServerAction objects for a given Server.
|
static ActionType |
lookupActionTypeByLabel(java.lang.String label)
Helper method to get a ActionType by label
|
static ActionType |
lookupActionTypeByName(java.lang.String name)
Helper method to get a ActionType by name
|
static Action |
lookupById(java.lang.Long id)
Lookup a Action by their id
|
static Action |
lookupByUserAndId(User user,
java.lang.Long id)
Lookup an Action by the id, assuming that it is in the same Org as
the user doing the search.
|
static ConfigRevisionActionResult |
lookupConfigActionResult(java.lang.Long actionConfigRevisionId)
Helper method to get a ConfigRevisionActionResult by
Action Config Revision Id
|
static ConfigRevisionAction |
lookupConfigRevisionAction(java.lang.Long id)
Helper method to get a ConfigRevisionAction by
Action Config Revision Id
|
static java.util.Set |
lookupDependentActions(Action parentAction)
Recursively query the hierarchy of actions dependent on a given
parent.
|
static ServerHistoryEvent |
lookupHistoryEventById(java.lang.Long aid) |
static Action |
lookupLastCompletedAction(User user,
ActionType type,
Server server)
Lookup the last completed Action on a Server
given the user, action type and server.
|
static void |
remove(Action actionIn)
Remove a Action from the DB
|
static int |
removeAction(java.lang.Long actionId)
Removes an action from all its associated systems
|
static void |
removeActionForSystem(java.lang.Number actionId,
java.lang.Number sid)
Remove the system from the passed in Action.
|
static int |
removeActionForSystemSet(java.lang.Number actionId,
java.lang.String setLabel,
User user)
Remove an action for an rhnset of system ids with the given label
|
static void |
removeInvalidResults(Action action)
Removes results of queued action.
|
static void |
rescheduleAllServerActions(Action action,
java.lang.Long tries)
Reschedule All Server Actions associated with an action
|
static void |
rescheduleFailedServerActions(Action action,
java.lang.Long tries)
Reschedule All Failed Server Actions associated with an action
|
static void |
rescheduleSingleServerAction(Action action,
java.lang.Long tries,
java.lang.Long server)
Reschedule Server Action associated with an action and system
|
static Action |
save(Action actionIn)
Insert or Update a Action.
|
addConfigurator, blobToByteArray, byteArrayToBlob, closeSession, closeSessionFactory, commitTransaction, createSessionFactory, createSessionFactory, executeCallableMode, executeSelectMode, getBlobContents, getByteArrayContents, getObject, getSession, initialize, inTransaction, isClosed, isInitialized, listObjectsByNamedQuery, listObjectsByNamedQuery, listObjectsByNamedQuery, lockObject, lookupObjectByNamedQuery, lookupObjectByNamedQuery, reload, removeObject, rollbackTransaction, saveObject, saveObject, stringToByteArray
public static final ActionStatus STATUS_QUEUED
public static final ActionStatus STATUS_COMPLETED
public static final ActionStatus STATUS_FAILED
public static final ActionStatus STATUS_PICKEDUP
public static final ActionType TYPE_PACKAGES_REFRESH_LIST
public static final ActionType TYPE_HARDWARE_REFRESH_LIST
public static final ActionType TYPE_PACKAGES_UPDATE
public static final ActionType TYPE_PACKAGES_REMOVE
public static final ActionType TYPE_ERRATA
public static final ActionType TYPE_UP2DATE_CONFIG_GET
public static final ActionType TYPE_UP2DATE_CONFIG_UPDATE
public static final ActionType TYPE_PACKAGES_DELTA
public static final ActionType TYPE_REBOOT
public static final ActionType TYPE_ROLLBACK_CONFIG
public static final ActionType TYPE_ROLLBACK_LISTTRANSACTIONS
public static final ActionType TYPE_PACKAGES_AUTOUPDATE
public static final ActionType TYPE_PACKAGES_RUNTRANSACTION
public static final ActionType TYPE_CONFIGFILES_UPLOAD
public static final ActionType TYPE_CONFIGFILES_DEPLOY
public static final ActionType TYPE_CONFIGFILES_VERIFY
public static final ActionType TYPE_CONFIGFILES_DIFF
public static final ActionType TYPE_KICKSTART_INITIATE
public static final ActionType TYPE_KICKSTART_INITIATE_GUEST
public static final ActionType TYPE_KICKSTART_SCHEDULE_SYNC
public static final ActionType TYPE_ACTIVATION_SCHEDULE_PKG_INSTALL
public static final ActionType TYPE_ACTIVATION_SCHEDULE_DEPLOY
public static final ActionType TYPE_CONFIGFILES_MTIME_UPLOAD
public static final ActionType TYPE_SCRIPT_RUN
public static final ActionType TYPE_DAEMON_CONFIG
public static final ActionType TYPE_PACKAGES_VERIFY
public static final ActionType TYPE_RHN_APPLET_USE_SATELLITE
public static final ActionType TYPE_ROLLBACK_ROLLBACK
public static final ActionType TYPE_VIRTUALIZATION_SHUTDOWN
public static final ActionType TYPE_VIRTUALIZATION_START
public static final ActionType TYPE_VIRTUALIZATION_SUSPEND
public static final ActionType TYPE_VIRTUALIZATION_RESUME
public static final ActionType TYPE_VIRTUALIZATION_REBOOT
public static final ActionType TYPE_VIRTUALIZATION_DESTROY
public static final ActionType TYPE_VIRTUALIZATION_SET_MEMORY
public static final ActionType TYPE_VIRTUALIZATION_SET_VCPUS
public static final ActionType TYPE_VIRTUALIZATION_SCHEDULE_POLLER
public static final ActionType TYPE_VIRTUALIZATION_HOST_PACKAGE_INSTALL
public static final ActionType TYPE_VIRTUALIZATION_GUEST_PACKAGE_INSTALL
public static final ActionType TYPE_VIRTIZATION_HOST_SUBSCRIBE_TO_TOOLS_CHANNEL
public static final ActionType TYPE_VIRTUALIZATION_GUEST_SUBSCRIBE_TO_TOOLS_CHANNEL
public static final ActionType TYPE_SCAP_XCCDF_EVAL
public static final ActionType TYPE_CLIENTCERT_UPDATE_CLIENT_CERT
public static final java.lang.String TXN_OPERATION_INSERT
public static final java.lang.String TXN_OPERATION_DELETE
public static final ActionType TYPE_DEPLOY_IMAGE
public static int removeAction(java.lang.Long actionId)
actionId
- action to removepublic static int removeActionForSystemSet(java.lang.Number actionId, java.lang.String setLabel, User user)
actionId
- the action to removesetLabel
- the set label to pull the ids fromuser
- the user witht he setpublic static void cancelPendingForSystem(java.lang.Long serverId)
serverId
- the server idpublic static void removeActionForSystem(java.lang.Number actionId, java.lang.Number sid)
actionId
- to processsid
- to remove from Actionprotected org.apache.log4j.Logger getLogger()
getLogger
in class HibernateFactory
public static void addServerToAction(java.lang.Long sid, Action parent)
sid
- The server idparent
- The parent actionpublic static void addServerToAction(Server server, Action parent)
server
- The serverparent
- The parent actionpublic static void addConfigRevisionToAction(ConfigRevision revision, Server server, ConfigAction parent)
revision
- The config revision to add to the action.server
- The server for the actionparent
- The parent actionpublic static ScriptActionDetails createScriptActionDetails(java.lang.String username, java.lang.String groupname, java.lang.Long timeout, java.lang.String script)
username
- Username of scriptgroupname
- Group script runs asscript
- Script contentstimeout
- script timeoutpublic static boolean doesServerHaveKickstartScheduled(java.lang.Long serverId)
serverId
- serverpublic static Action createAction(ActionType typeIn)
typeIn
- the type of Action we want to createpublic static Action createAction(ActionType typeIn, java.util.Date earliest)
typeIn
- the type of Action we want to createearliest
- The earliest time that this action can occur.public static Action lookupByUserAndId(User user, java.lang.Long id)
user
- the user doing the searchid
- of the Action to search forpublic static java.lang.Integer getServerActionCountByStatus(Org org, Action action, ActionStatus status)
org
- the org to lookstatus
- the status you wantaction
- the action idpublic static Action lookupLastCompletedAction(User user, ActionType type, Server server)
user
- the user doing the search (needed for permssion checking)type
- the action type of the action to be queried.server
- the server who's latest completed action is desired.public static Action lookupById(java.lang.Long id)
id
- the id to search forpublic static ActionType lookupActionTypeByLabel(java.lang.String label)
label
- the Action to lookuppublic static ActionType lookupActionTypeByName(java.lang.String name)
name
- the Action to lookuppublic static ConfigRevisionActionResult lookupConfigActionResult(java.lang.Long actionConfigRevisionId)
actionConfigRevisionId
- the id of the ActionConfigRevision
for whom we want to lookup the resultpublic static ConfigRevisionAction lookupConfigRevisionAction(java.lang.Long id)
id
- the id of the ActionConfigRevision
for whom we want to lookup the resultpublic static Action save(Action actionIn)
actionIn
- Action to be stored in database.public static void remove(Action actionIn)
actionIn
- Action to be removed from database.public static boolean checkActionArchType(Action actionCheck, java.lang.String actionStyle)
actionCheck
- the Action we want to see if the type matches againstactionStyle
- the String type we want to checkpublic static java.util.Set lookupDependentActions(Action parentAction)
parentAction
- Parent action.public static void deleteServerActionsByParent(java.util.Set parentActions)
parentActions
- Set of parent actions.public static java.util.List listActionsForServer(User user, Server serverIn)
user
- the user doing the searchserverIn
- you want to limit the list of Actions topublic static java.util.List listServerActionsForServer(Server serverIn)
serverIn
- you want to limit the list of Actions topublic static ServerAction getServerActionForServerAndAction(Server serverIn, Action actionIn)
serverIn
- the server who's ServerAction you are searching foractionIn
- the action who's ServerAction you are searching forpublic static void rescheduleFailedServerActions(Action action, java.lang.Long tries)
action
- the action who's server actions you are reschedulingtries
- the number of tries to set (should be set to 5)public static void rescheduleAllServerActions(Action action, java.lang.Long tries)
action
- the action who's server actions you are reschedulingtries
- the number of tries to set (should be set to 5)public static void rescheduleSingleServerAction(Action action, java.lang.Long tries, java.lang.Long server)
action
- the action who's server actions you are reschedulingtries
- the number of tries to set (should be set to 5)server
- system id of action we want reschedulepublic static ServerHistoryEvent lookupHistoryEventById(java.lang.Long aid)
aid
- history event id to look up forpublic static void removeInvalidResults(Action action)
action
- results of which action to remove