org.rhq.enterprise.server.operation
Class OperationManagerBean

java.lang.Object
  extended by org.rhq.enterprise.server.operation.OperationManagerBean
All Implemented Interfaces:
OperationManagerLocal, OperationManagerRemote

public class OperationManagerBean
extends Object
implements OperationManagerLocal, OperationManagerRemote


Constructor Summary
OperationManagerBean()
           
 
Method Summary
 void cancelOperationHistory(org.rhq.core.domain.auth.Subject subject, int historyId, boolean ignoreAgentErrors)
          Cancels a currently in-progress operation.
 void checkForCompletedGroupOperation(int historyId)
          Given the id of a history object, this will see if it has completed and if it is a resource history that is part of an overall group operation and if so will see if all of its peer resource histories are also complete.
 void checkForTimedOutOperations(org.rhq.core.domain.auth.Subject subject)
          Will check to see if any in progress operation jobs are taking too long to finish and if so marks their histories as failed.
 void deleteOperationHistory(org.rhq.core.domain.auth.Subject subject, int historyId, boolean purgeInProgress)
          Purges the history from the database.
 void deleteOperationScheduleEntity(org.rhq.core.domain.operation.ScheduleJobId jobId)
          This will delete an operation schedule entity identified with the given job ID.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findCompletedGroupOperationHistories(org.rhq.core.domain.auth.Subject subject, int groupId, org.rhq.core.domain.util.PageControl pc)
          Returns the list of completed operation histories for the group resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findCompletedResourceOperationHistories(org.rhq.core.domain.auth.Subject subject, int resourceId, Long beginDate, Long endDate, org.rhq.core.domain.util.PageControl pc)
          Returns the list of completed operation histories for the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.GroupOperationScheduleComposite> findCurrentlyScheduledGroupOperations(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.util.PageControl pageControl)
          Gets a list of all currently scheduled group operations (that is, scheduled but not yet invoked and/or completed).
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite> findCurrentlyScheduledResourceOperations(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.util.PageControl pageControl)
          Gets a list of all currently scheduled resource operations (that is, scheduled but not yet invoked and/or completed).
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findGroupOperationHistoriesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.GroupOperationHistoryCriteria criteria)
           
 List<org.rhq.core.domain.operation.OperationDefinition> findOperationDefinitionsByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.OperationDefinitionCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findPendingGroupOperationHistories(org.rhq.core.domain.auth.Subject subject, int groupId, org.rhq.core.domain.util.PageControl pc)
          Returns the list of pending operation histories for the group resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findPendingResourceOperationHistories(org.rhq.core.domain.auth.Subject subject, int resourceId, org.rhq.core.domain.util.PageControl pc)
          Returns the list of pending operation histories for the given resource.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.GroupOperationLastCompletedComposite> findRecentlyCompletedGroupOperations(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.util.PageControl pageControl)
          Gets a list of all recently completed group operations.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite> findRecentlyCompletedResourceOperations(org.rhq.core.domain.auth.Subject subject, Integer resourceId, org.rhq.core.domain.util.PageControl pageControl)
          Gets a list of all recently completed resource operations.
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findResourceOperationHistoriesByCriteria(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria criteria)
           
 org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findResourceOperationHistoriesByGroupHistoryId(org.rhq.core.domain.auth.Subject subject, int historyId, org.rhq.core.domain.util.PageControl pc)
          Get the paged resource operation histories for a given group history.
 List<org.rhq.core.domain.operation.bean.GroupOperationSchedule> findScheduledGroupOperations(org.rhq.core.domain.auth.Subject subject, int groupId)
          Returns the list of schedules for the group itself.
 List<org.rhq.core.domain.operation.bean.ResourceOperationSchedule> findScheduledResourceOperations(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Returns the list of scheduled operations for the given resource.
 List<org.rhq.core.domain.operation.OperationDefinition> findSupportedGroupOperations(org.rhq.core.domain.auth.Subject subject, int compatibleGroupId, boolean eagerLoaded)
          Returns the definitions of all the operations supported by the given group.
 List<org.rhq.core.domain.operation.OperationDefinition> findSupportedResourceOperations(org.rhq.core.domain.auth.Subject subject, int resourceId, boolean eagerLoaded)
          Returns the definitions of all the operations supported by the given resource.
 List<org.rhq.core.domain.operation.OperationDefinition> findSupportedResourceTypeOperations(org.rhq.core.domain.auth.Subject subject, int resourceTypeId, boolean eagerLoaded)
          Returns the definitions of all the operations supported by the given resource type.
 org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject whoami, int scheduleId)
          TODO
 org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject subject, org.quartz.JobDetail jobDetail)
          Given a group operation job's details, this returns a schedule POJO corresponding to that job.
 org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject subject, String jobId)
          Given a group job's id, this returns the schedule for that group job.
 org.rhq.core.domain.operation.ResourceOperationHistory getLatestCompletedResourceOperation(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Get the mostly recently run operation for the Resource with the given id, or null if the resource has had no operations performed against it yet (or if all previously performed operations have been deleted from the history).
 org.rhq.core.domain.operation.ResourceOperationHistory getOldestInProgressResourceOperation(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Get the oldest operation still in progress for the Resource with the given id, or null if the resource has no operations being performed against it.
 org.rhq.core.domain.operation.OperationDefinition getOperationDefinition(org.rhq.core.domain.auth.Subject subject, int operationId)
          Get the OperationDefinition object that corresponds to this operationId
 org.rhq.core.domain.operation.OperationDefinition getOperationDefinitionByResourceTypeAndName(int resourceTypeId, String operationName, boolean eagerLoaded)
           
 org.rhq.core.domain.operation.OperationHistory getOperationHistoryByHistoryId(org.rhq.core.domain.auth.Subject subject, int historyId)
          TODO
 org.rhq.core.domain.operation.OperationHistory getOperationHistoryByJobId(org.rhq.core.domain.auth.Subject subject, String historyJobId)
          TODO
 List<org.rhq.core.domain.common.composite.IntegerOptionItem> getResourceNameOptionItems(int groupId)
          TODO
 org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject whoami, int scheduleId)
          TODO
 org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject whoami, org.quartz.JobDetail jobDetail)
          Given a Resource operation job's details, this returns a schedule POJO corresponding to that job.
 org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject subject, String jobId)
          Given a resource job's id, this returns the schedule for that resource job.
 org.rhq.core.domain.operation.OperationDefinition getSupportedGroupOperation(org.rhq.core.domain.auth.Subject subject, int compatibleGroupId, String operationName, boolean eagerLoaded)
          Returns the definition of the named operation supported by the given group.
 org.rhq.core.domain.operation.OperationDefinition getSupportedResourceOperation(org.rhq.core.domain.auth.Subject subject, int resourceId, String operationName, boolean eagerLoaded)
          Returns the definition of the named operation supported by the given resource.
 boolean isGroupOperationSupported(org.rhq.core.domain.auth.Subject subject, int resourceGroupId)
          Determines if the given group has at least one operation.
 boolean isResourceOperationSupported(org.rhq.core.domain.auth.Subject subject, int resourceId)
          Determines if the given resource has at least one operation.
 int scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.operation.bean.GroupOperationSchedule schedule)
          Schedules a Resource group operation for execution.
 org.rhq.core.domain.operation.bean.GroupOperationSchedule scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject, int groupId, int[] executionOrderResourceIds, boolean haltOnFailure, String operationName, org.rhq.core.domain.configuration.Configuration parameters, long delay, long repeatInterval, int repeatCount, int timeout, String description)
          #see {@link OperationManagerRemote#scheduleGroupOperation
 org.rhq.core.domain.operation.bean.GroupOperationSchedule scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject, int compatibleGroupId, int[] executionOrderResourceIds, boolean haltOnFailure, String operationName, org.rhq.core.domain.configuration.Configuration parameters, org.quartz.Trigger trigger, String notes)
          Schedules an operation for execution on members of the given group.
 org.rhq.core.domain.operation.bean.ResourceOperationSchedule scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject, int resourceId, String operationName, org.rhq.core.domain.configuration.Configuration parameters, org.quartz.Trigger trigger, String notes)
          Schedules an operation for execution on the given resource.
 org.rhq.core.domain.operation.bean.ResourceOperationSchedule scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject, int resourceId, String operationName, long delay, long repeatInterval, int repeatCount, int timeout, org.rhq.core.domain.configuration.Configuration parameters, String notes)
          Schedules an operation for execution on the given resource.
 int scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.operation.bean.ResourceOperationSchedule schedule)
          Schedules a Resource operation for execution.
 void unscheduleGroupOperation(org.rhq.core.domain.auth.Subject subject, String jobId, int resourceGroupId)
          see OperationManagerRemote.unscheduleGroupOperation(org.rhq.core.domain.auth.Subject, String, int)
 void unscheduleResourceOperation(org.rhq.core.domain.auth.Subject subject, String jobId, int resourceId)
          Unschedules the resource operation identified with the given job ID.
 org.rhq.core.domain.operation.OperationHistory updateOperationHistory(org.rhq.core.domain.auth.Subject subject, org.rhq.core.domain.operation.OperationHistory history)
          This is called by the jobs so they can update the history.
 void updateOperationScheduleEntity(org.rhq.core.domain.operation.ScheduleJobId jobId, long nextFireTime)
          This allows you to update an operation schedule entity with a new next-fire-time.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OperationManagerBean

public OperationManagerBean()
Method Detail

getResourceNameOptionItems

public List<org.rhq.core.domain.common.composite.IntegerOptionItem> getResourceNameOptionItems(int groupId)
Description copied from interface: OperationManagerLocal
TODO

Specified by:
getResourceNameOptionItems in interface OperationManagerLocal
Returns:

scheduleResourceOperation

public org.rhq.core.domain.operation.bean.ResourceOperationSchedule scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                              int resourceId,
                                                                                              String operationName,
                                                                                              long delay,
                                                                                              long repeatInterval,
                                                                                              int repeatCount,
                                                                                              int timeout,
                                                                                              org.rhq.core.domain.configuration.Configuration parameters,
                                                                                              String notes)
                                                                                       throws ScheduleException
Description copied from interface: OperationManagerLocal
Schedules an operation for execution on the given resource.

Specified by:
scheduleResourceOperation in interface OperationManagerLocal
Specified by:
scheduleResourceOperation in interface OperationManagerRemote
Parameters:
subject - The logged in user's subject.
resourceId - the resource that is the target of the operation
operationName - the actual operation to invoke
delay - the number of milliseconds to delay this operation, 0 for immediate start.
repeatInterval - the number of milliseconds after completion to repeat this operation. 0 for no repeat.
repeatCount - the number of times to repeat this operation. -1 infinite, 0 for no repeat.
timeout - the number of seconds before this operation will fail due to timeout. 0 for no timeout.
parameters - the names parameters for the operation.
notes - user-entered description of the job to be scheduled
Returns:
the information on the new schedule
Throws:
ScheduleException - TODO

scheduleResourceOperation

public int scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                     org.rhq.core.domain.operation.bean.ResourceOperationSchedule schedule)
                              throws ScheduleException
Description copied from interface: OperationManagerLocal
Schedules a Resource operation for execution.

Specified by:
scheduleResourceOperation in interface OperationManagerLocal
Parameters:
subject - the user who is asking to schedule the job
schedule - the information describing the operation to be scheduled along with the schedule to be used
Returns:
the id of the ResourceOperationScheduleEntity created to track the scheduled operation
Throws:
ScheduleException

scheduleGroupOperation

public int scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject,
                                  org.rhq.core.domain.operation.bean.GroupOperationSchedule schedule)
                           throws ScheduleException
Description copied from interface: OperationManagerLocal
Schedules a Resource group operation for execution.

Specified by:
scheduleGroupOperation in interface OperationManagerLocal
Parameters:
subject - the user who is asking to schedule the job
schedule - the information describing the operation to be scheduled along with the schedule to be used
Returns:
the id of the GroupOperationScheduleEntity created to track the scheduled operation
Throws:
ScheduleException

scheduleResourceOperation

public org.rhq.core.domain.operation.bean.ResourceOperationSchedule scheduleResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                              int resourceId,
                                                                                              String operationName,
                                                                                              org.rhq.core.domain.configuration.Configuration parameters,
                                                                                              org.quartz.Trigger trigger,
                                                                                              String notes)
                                                                                       throws org.quartz.SchedulerException
Description copied from interface: OperationManagerLocal
Schedules an operation for execution on the given resource.

Specified by:
scheduleResourceOperation in interface OperationManagerLocal
Parameters:
subject - the user who is asking to schedule the job
resourceId - the resource that is the target of the operation
operationName - the actual operation to invoke
parameters - optional parameters to pass into the operation
trigger - the schedule of when the job runs (the names and group names in this trigger are ignored and reset by this method)
notes - user-entered description of the job to be scheduled
Returns:
the information on the new schedule
Throws:
org.quartz.SchedulerException - if failed to schedule the operation

scheduleGroupOperation

public org.rhq.core.domain.operation.bean.GroupOperationSchedule scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                        int compatibleGroupId,
                                                                                        int[] executionOrderResourceIds,
                                                                                        boolean haltOnFailure,
                                                                                        String operationName,
                                                                                        org.rhq.core.domain.configuration.Configuration parameters,
                                                                                        org.quartz.Trigger trigger,
                                                                                        String notes)
                                                                                 throws org.quartz.SchedulerException
Description copied from interface: OperationManagerLocal
Schedules an operation for execution on members of the given group.

Specified by:
scheduleGroupOperation in interface OperationManagerLocal
Parameters:
subject - the user who is asking to schedule the job
compatibleGroupId - the group whose member resources are the target of the operation
executionOrderResourceIds - optional order of exection - if notnull, these are group members resource IDs in the order in which the operations are invoked
haltOnFailure - if true, the group operation will halt whenever one individual resource fails to execute. When executing in order, this means once a failure occurs, the resources next in line to execute will abort and not attempt to execute. If not executing in any particular order, you are not guaranteed which will stop and which will continue since all are executed as fast as possible, but the group operation will attempt to stop as best it can.
operationName - the actual operation to invoke
parameters - optional parameters to pass into the operation
trigger - the schedule of when the job runs (the names and group names in this trigger are ignored and reset by this method)
notes - user-entered description of the job to be scheduled
Returns:
the information on the new schedule
Throws:
org.quartz.SchedulerException - if failed to schedule the operation

unscheduleResourceOperation

public void unscheduleResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                        String jobId,
                                        int resourceId)
                                 throws UnscheduleException
Description copied from interface: OperationManagerLocal
Unschedules the resource operation identified with the given job ID.

Specified by:
unscheduleResourceOperation in interface OperationManagerLocal
Specified by:
unscheduleResourceOperation in interface OperationManagerRemote
Parameters:
subject - the user who is asking to unschedule the operation
jobId - identifies the operation to unschedule
resourceId - the ID of the resource whose operation is getting unscheduled
Throws:
UnscheduleException - TODO

unscheduleGroupOperation

public void unscheduleGroupOperation(org.rhq.core.domain.auth.Subject subject,
                                     String jobId,
                                     int resourceGroupId)
                              throws UnscheduleException
Description copied from interface: OperationManagerLocal
see OperationManagerRemote.unscheduleGroupOperation(org.rhq.core.domain.auth.Subject, String, int)

Specified by:
unscheduleGroupOperation in interface OperationManagerLocal
Specified by:
unscheduleGroupOperation in interface OperationManagerRemote
Parameters:
subject - the user who is asking to unschedule the operation
jobId - identifies the operation to unschedule
resourceGroupId - the ID of the group whose operation is getting unscheduled
Throws:
UnscheduleException - TODO

deleteOperationScheduleEntity

public void deleteOperationScheduleEntity(org.rhq.core.domain.operation.ScheduleJobId jobId)
Description copied from interface: OperationManagerLocal
This will delete an operation schedule entity identified with the given job ID. Note that this does not actually unschedule the job - it merely removed our schedule tracking entity. This schedule tracking entity is really just used to provide some additional querying capabilities since it allows us to link a resource or group ID with a Quartz job directly within SQL.

This method is really just for the OperationJob objects to clean out the schedule tracking entity when the schedule has run its course and will no longer be triggered. The UI or other pieces of client code will usually not have to ever use this method; if you are thinking about having a need to call this method, please know what you are doing.

Specified by:
deleteOperationScheduleEntity in interface OperationManagerLocal

updateOperationScheduleEntity

public void updateOperationScheduleEntity(org.rhq.core.domain.operation.ScheduleJobId jobId,
                                          long nextFireTime)
Description copied from interface: OperationManagerLocal
This allows you to update an operation schedule entity with a new next-fire-time.

This method is really just for the OperationJob objects to update the schedule tracking entity. The UI or other pieces of client code will usually not have to ever use this method; if you are thinking about having a need to call this method, please know what you are doing.

Specified by:
updateOperationScheduleEntity in interface OperationManagerLocal
nextFireTime - the next time this job is due to be triggered

findScheduledResourceOperations

public List<org.rhq.core.domain.operation.bean.ResourceOperationSchedule> findScheduledResourceOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                          int resourceId)
                                                                                                   throws Exception
Description copied from interface: OperationManagerLocal
Returns the list of scheduled operations for the given resource. This only includes scheduled jobs on the individual resource - it will not include schedules from groups, even if the resource is a member of a group that has scheduled jobs.

Specified by:
findScheduledResourceOperations in interface OperationManagerLocal
Specified by:
findScheduledResourceOperations in interface OperationManagerRemote
Returns:
resource scheduled operations
Throws:
Exception - TODO

findScheduledGroupOperations

public List<org.rhq.core.domain.operation.bean.GroupOperationSchedule> findScheduledGroupOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                    int groupId)
                                                                                             throws Exception
Description copied from interface: OperationManagerLocal
Returns the list of schedules for the group itself. The returned schedules will only be for operations scheduled on the group; it will not include individually scheduled resource operations, even if the resource is a member of the group.

Specified by:
findScheduledGroupOperations in interface OperationManagerLocal
Specified by:
findScheduledGroupOperations in interface OperationManagerRemote
Returns:
group scheduled operations
Throws:
Exception - TODO

getResourceOperationSchedule

public org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject whoami,
                                                                                                 int scheduleId)
Description copied from interface: OperationManagerLocal
TODO

Specified by:
getResourceOperationSchedule in interface OperationManagerLocal
Returns:

getGroupOperationSchedule

public org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject whoami,
                                                                                           int scheduleId)
Description copied from interface: OperationManagerLocal
TODO

Specified by:
getGroupOperationSchedule in interface OperationManagerLocal
Returns:

getResourceOperationSchedule

public org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject whoami,
                                                                                                 org.quartz.JobDetail jobDetail)
Description copied from interface: OperationManagerLocal
Given a Resource operation job's details, this returns a schedule POJO corresponding to that job.

Specified by:
getResourceOperationSchedule in interface OperationManagerLocal
Returns:
the object that encapsulates the resource schedule, or null if the specified job is no longer scheduled

getResourceOperationSchedule

public org.rhq.core.domain.operation.bean.ResourceOperationSchedule getResourceOperationSchedule(org.rhq.core.domain.auth.Subject subject,
                                                                                                 String jobId)
                                                                                          throws org.quartz.SchedulerException
Description copied from interface: OperationManagerLocal
Given a resource job's id, this returns the schedule for that resource job.

Specified by:
getResourceOperationSchedule in interface OperationManagerLocal
Returns:
the object that encapsulates the resource schedule
Throws:
org.quartz.SchedulerException - if failed to find the schedule

getGroupOperationSchedule

public org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject subject,
                                                                                           org.quartz.JobDetail jobDetail)
Description copied from interface: OperationManagerLocal
Given a group operation job's details, this returns a schedule POJO corresponding to that job.

Specified by:
getGroupOperationSchedule in interface OperationManagerLocal
Returns:
the object that encapsulates the group schedule, , or null if the specified job is no longer scheduled

getGroupOperationSchedule

public org.rhq.core.domain.operation.bean.GroupOperationSchedule getGroupOperationSchedule(org.rhq.core.domain.auth.Subject subject,
                                                                                           String jobId)
                                                                                    throws org.quartz.SchedulerException
Description copied from interface: OperationManagerLocal
Given a group job's id, this returns the schedule for that group job.

Specified by:
getGroupOperationSchedule in interface OperationManagerLocal
Returns:
the object that encapsulates the group schedule
Throws:
org.quartz.SchedulerException - if failed to find the schedule

getOperationHistoryByHistoryId

public org.rhq.core.domain.operation.OperationHistory getOperationHistoryByHistoryId(org.rhq.core.domain.auth.Subject subject,
                                                                                     int historyId)
Description copied from interface: OperationManagerLocal
TODO

Specified by:
getOperationHistoryByHistoryId in interface OperationManagerLocal

findResourceOperationHistoriesByGroupHistoryId

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findResourceOperationHistoriesByGroupHistoryId(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                int historyId,
                                                                                                                                                org.rhq.core.domain.util.PageControl pc)
Description copied from interface: OperationManagerLocal
Get the paged resource operation histories for a given group history.

Specified by:
findResourceOperationHistoriesByGroupHistoryId in interface OperationManagerLocal
Parameters:
subject - the user that wants to see the history
historyId - ID of the history to retrieve
pc - the page control used for sorting and paging of results
Returns:
the requested page of sorted resource operation history results for the given group history

getOperationHistoryByJobId

public org.rhq.core.domain.operation.OperationHistory getOperationHistoryByJobId(org.rhq.core.domain.auth.Subject subject,
                                                                                 String historyJobId)
Description copied from interface: OperationManagerLocal
TODO

Specified by:
getOperationHistoryByJobId in interface OperationManagerLocal

findCompletedResourceOperationHistories

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findCompletedResourceOperationHistories(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                         int resourceId,
                                                                                                                                         Long beginDate,
                                                                                                                                         Long endDate,
                                                                                                                                         org.rhq.core.domain.util.PageControl pc)
Description copied from interface: OperationManagerLocal
Returns the list of completed operation histories for the given resource. This will return all items that are no longer INPROGRESS that were invoked as part of a group operation to which this resource belongs or on the resource directly.

Specified by:
findCompletedResourceOperationHistories in interface OperationManagerLocal
beginDate - filter used to show only results occurring after this epoch millis parameter, nullable
endDate - filter used to show only results occurring before this epoch millis parameter, nullable
Returns:
all operation histories for the given resource

findPendingResourceOperationHistories

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findPendingResourceOperationHistories(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                       int resourceId,
                                                                                                                                       org.rhq.core.domain.util.PageControl pc)
Description copied from interface: OperationManagerLocal
Returns the list of pending operation histories for the given resource. This will return all items that are still INPROGRESS that were invoked as part of a group operation to which this resource belongs or on the resource directly.

Specified by:
findPendingResourceOperationHistories in interface OperationManagerLocal
Returns:
all operation histories for the given resource

findCompletedGroupOperationHistories

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findCompletedGroupOperationHistories(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                   int groupId,
                                                                                                                                   org.rhq.core.domain.util.PageControl pc)
Description copied from interface: OperationManagerLocal
Returns the list of completed operation histories for the group resource. This will return all items that are no longer INPROGRESS that were invoked on this group. This only returns the group history item - not the individual resource operation histories for the group member invocation results. See OperationManagerLocal.findCompletedResourceOperationHistories(Subject, int, Long, Long, PageControl) for that.

Specified by:
findCompletedGroupOperationHistories in interface OperationManagerLocal
Returns:
all group histories

findPendingGroupOperationHistories

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findPendingGroupOperationHistories(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                 int groupId,
                                                                                                                                 org.rhq.core.domain.util.PageControl pc)
Description copied from interface: OperationManagerLocal
Returns the list of pending operation histories for the group resource. This will return all items that are still INPROGRESS that were invoked on this group. This only returns the group history item - not the individual resource operation histories for the group member invocation results. See OperationManagerLocal.findPendingResourceOperationHistories(Subject, int, PageControl) for that.

Specified by:
findPendingGroupOperationHistories in interface OperationManagerLocal
Returns:
all group histories

updateOperationHistory

public org.rhq.core.domain.operation.OperationHistory updateOperationHistory(org.rhq.core.domain.auth.Subject subject,
                                                                             org.rhq.core.domain.operation.OperationHistory history)
Description copied from interface: OperationManagerLocal
This is called by the jobs so they can update the history. The job will pass in an updated history object, this method just updates the database with the new data.

Every call to this method will trigger at least one check against the AlertConditionCacheManager. The first is against the passed history element itself, which captures the creation events (history element will be in the INPROGRESS state), as well as updated to ResourceOperationHistory elements (completed, failed, etc).

Furthermore, since ResourceOperationHistory elements are reused for execution of group operations, this method also checks to see if it is part of a larger group operation. If it is, and if it is the last member of that group to finish, the group status will be updated. This will trigger a second check against the AlertConditionCacheManager using that corresponding group history element.

Specified by:
updateOperationHistory in interface OperationManagerLocal
Parameters:
subject - the user that the job is executing under
history - the history with the data to be updated
Returns:
the updated history

cancelOperationHistory

public void cancelOperationHistory(org.rhq.core.domain.auth.Subject subject,
                                   int historyId,
                                   boolean ignoreAgentErrors)
Description copied from interface: OperationManagerLocal
Cancels a currently in-progress operation. Doing this will attempt to stop the invocation if it is currently running on the agent.

Note that this method will handle canceling a resource or group history - depending on what the given historyId refers to. If it refers to a group history, it will cancel all the resource invocations for that group invocation.

If the cancel request succeeds, the history element will be checked against the AlertConditionCacheManager.

Specified by:
cancelOperationHistory in interface OperationManagerLocal
Specified by:
cancelOperationHistory in interface OperationManagerRemote
Parameters:
subject - the user that wants to cancel the operation
historyId - the ID of the history item identifying the in-progress operation
ignoreAgentErrors - if true this will still flag the history items in the database as canceled, even if the method failed to notify the agent(s) that the operation should be canceled. If false, this method will not update the history status unless it could successfully tell the agent(s) to cancel the operation.

deleteOperationHistory

public void deleteOperationHistory(org.rhq.core.domain.auth.Subject subject,
                                   int historyId,
                                   boolean purgeInProgress)
Description copied from interface: OperationManagerLocal
Purges the history from the database. Doing this loses all audit trails of the invoked operation. This can handle deleting a group or resource history.

Note that this method will handle deleting a resource or group history - depending on what the given historyId refers to.

Specified by:
deleteOperationHistory in interface OperationManagerLocal
Specified by:
deleteOperationHistory in interface OperationManagerRemote
Parameters:
subject - the user that wants to delete the history
historyId - the ID of the history to be deleted
purgeInProgress - if true, even if the operation is in progress, the history entity will be deleted. You normally do not want to purge operation histories until they are completed, so you normally pass in false, but a user might want to force it to be purged, in which case the UI will want to pass in true

findSupportedResourceOperations

public List<org.rhq.core.domain.operation.OperationDefinition> findSupportedResourceOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                               int resourceId,
                                                                                               boolean eagerLoaded)
Description copied from interface: OperationManagerLocal
Returns the definitions of all the operations supported by the given resource.

Specified by:
findSupportedResourceOperations in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the operation definitions for the resource

findSupportedResourceTypeOperations

public List<org.rhq.core.domain.operation.OperationDefinition> findSupportedResourceTypeOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                   int resourceTypeId,
                                                                                                   boolean eagerLoaded)
Description copied from interface: OperationManagerLocal
Returns the definitions of all the operations supported by the given resource type.

Specified by:
findSupportedResourceTypeOperations in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the operation definitions for the resource type

findSupportedGroupOperations

public List<org.rhq.core.domain.operation.OperationDefinition> findSupportedGroupOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                            int compatibleGroupId,
                                                                                            boolean eagerLoaded)
Description copied from interface: OperationManagerLocal
Returns the definitions of all the operations supported by the given group.

Specified by:
findSupportedGroupOperations in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the operation definitions for the group

getSupportedResourceOperation

public org.rhq.core.domain.operation.OperationDefinition getSupportedResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                       int resourceId,
                                                                                       String operationName,
                                                                                       boolean eagerLoaded)
Description copied from interface: OperationManagerLocal
Returns the definition of the named operation supported by the given resource. If the operation is not valid for the resource, an exception is thrown.

Specified by:
getSupportedResourceOperation in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the named operation definition for the resource

getSupportedGroupOperation

public org.rhq.core.domain.operation.OperationDefinition getSupportedGroupOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                    int compatibleGroupId,
                                                                                    String operationName,
                                                                                    boolean eagerLoaded)
Description copied from interface: OperationManagerLocal
Returns the definition of the named operation supported by the given group. If the operation is not valid for the group, an exception is thrown.

Specified by:
getSupportedGroupOperation in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the named operation definition for the group

isResourceOperationSupported

public boolean isResourceOperationSupported(org.rhq.core.domain.auth.Subject subject,
                                            int resourceId)
Description copied from interface: OperationManagerLocal
Determines if the given resource has at least one operation.

Specified by:
isResourceOperationSupported in interface OperationManagerLocal
Returns:
true if the resource has at least one operation

isGroupOperationSupported

public boolean isGroupOperationSupported(org.rhq.core.domain.auth.Subject subject,
                                         int resourceGroupId)
Description copied from interface: OperationManagerLocal
Determines if the given group has at least one operation.

Specified by:
isGroupOperationSupported in interface OperationManagerLocal
Returns:
true if the group has at least one operation

checkForTimedOutOperations

public void checkForTimedOutOperations(org.rhq.core.domain.auth.Subject subject)
Description copied from interface: OperationManagerLocal
Will check to see if any in progress operation jobs are taking too long to finish and if so marks their histories as failed. This method will be perodically called by the JON Server.

Calls to this method could trigger a number of checks against the AlertConditionCacheManager. The first set of checks would be against any and all resource operations that have timed out. Then, for any of these timeouts, since ResourceOperationHistory elements are reused for execution of group operations, this method also checks to see if it is part of a larger group operation. If it is, and if it is the last member of that group to finish, the group status will be updated. This will trigger another check against the AlertConditionCacheManager using that corresponding group history element.

Specified by:
checkForTimedOutOperations in interface OperationManagerLocal
Parameters:
subject - only the overlord may execute this system operation

findRecentlyCompletedResourceOperations

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.ResourceOperationLastCompletedComposite> findRecentlyCompletedResourceOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                                  Integer resourceId,
                                                                                                                                                                  org.rhq.core.domain.util.PageControl pageControl)
Description copied from interface: OperationManagerLocal
Gets a list of all recently completed resource operations. This is used to support the dashboard operations portlet. WARNING: Do not send in a page control that asks for an unlimited page list - depending on the number of operations in the system's history, that kind of request could blow up.

Only resource operations are returned (group operations are ignored by this method). However, if a group operation was executed, all of the resource executions that occurred as part of it will be returned (that is, the resources in that group will have its resource operations returned.

Specified by:
findRecentlyCompletedResourceOperations in interface OperationManagerLocal
Parameters:
subject - the user asking for the data; the returned list is limited to what this user can see
resourceId - if non-null, will only result recent completed operations for this resource
pageControl - limits the number of composite objects returned
Returns:
the list of recently completed resource operations

findRecentlyCompletedGroupOperations

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.GroupOperationLastCompletedComposite> findRecentlyCompletedGroupOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                            org.rhq.core.domain.util.PageControl pageControl)
Description copied from interface: OperationManagerLocal
Gets a list of all recently completed group operations. This is used to support the dashboard operations portlet. WARNING: Do not send in a page control that asks for an unlimited page list - depending on the number of operations in the system's history, that kind of request could blow up.

Specified by:
findRecentlyCompletedGroupOperations in interface OperationManagerLocal
Parameters:
subject - the user asking for the data; the returned list is limited to what this user can see
pageControl - limits the number of composite objects returned
Returns:
the list of recently completed group operations

findCurrentlyScheduledResourceOperations

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.ResourceOperationScheduleComposite> findCurrentlyScheduledResourceOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                              org.rhq.core.domain.util.PageControl pageControl)
Description copied from interface: OperationManagerLocal
Gets a list of all currently scheduled resource operations (that is, scheduled but not yet invoked and/or completed).

Specified by:
findCurrentlyScheduledResourceOperations in interface OperationManagerLocal
Parameters:
subject - the user asking for the data; the returned list is limited to what this user can see
pageControl - limits the number of composite objects returned
Returns:
the list of scheduled resource operations

findCurrentlyScheduledGroupOperations

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.composite.GroupOperationScheduleComposite> findCurrentlyScheduledGroupOperations(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                                        org.rhq.core.domain.util.PageControl pageControl)
Description copied from interface: OperationManagerLocal
Gets a list of all currently scheduled group operations (that is, scheduled but not yet invoked and/or completed).

Specified by:
findCurrentlyScheduledGroupOperations in interface OperationManagerLocal
Parameters:
subject - the user asking for the data; the returned list is limited to what this user can see
pageControl - limits the number of composite objects returned
Returns:
the list of scheduled group operations

checkForCompletedGroupOperation

public void checkForCompletedGroupOperation(int historyId)
Given the id of a history object, this will see if it has completed and if it is a resource history that is part of an overall group operation and if so will see if all of its peer resource histories are also complete. If the group members are all done, the group history object will have its status updated to reflect that the group itself is done.

Specified by:
checkForCompletedGroupOperation in interface OperationManagerLocal
Parameters:
historyId - id of a history object

getLatestCompletedResourceOperation

@Nullable
public org.rhq.core.domain.operation.ResourceOperationHistory getLatestCompletedResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                                           int resourceId)
Description copied from interface: OperationManagerLocal
Get the mostly recently run operation for the Resource with the given id, or null if the resource has had no operations performed against it yet (or if all previously performed operations have been deleted from the history). Returns the result of the operation as it is known on the server-side in the database.

Specified by:
getLatestCompletedResourceOperation in interface OperationManagerLocal
Parameters:
subject - the user who wants to see the information
resourceId - a Resource id
Returns:
the most recent operation performed against the Resource with the given id, or null if the resource has had no operations performed against it yet.

getOldestInProgressResourceOperation

@Nullable
public org.rhq.core.domain.operation.ResourceOperationHistory getOldestInProgressResourceOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                                            int resourceId)
Description copied from interface: OperationManagerLocal
Get the oldest operation still in progress for the Resource with the given id, or null if the resource has no operations being performed against it. Returns the INPROCESS element with empty results.

Specified by:
getOldestInProgressResourceOperation in interface OperationManagerLocal
Parameters:
subject - the user who wants to see the information
resourceId - a Resource id
Returns:
the oldest operation still in progress for the Resource with the given id, or null if the resource has no operations being performed against it.

getOperationDefinition

public org.rhq.core.domain.operation.OperationDefinition getOperationDefinition(org.rhq.core.domain.auth.Subject subject,
                                                                                int operationId)
Description copied from interface: OperationManagerLocal
Get the OperationDefinition object that corresponds to this operationId

Specified by:
getOperationDefinition in interface OperationManagerLocal
Parameters:
subject - the user who wants to see the information
Returns:
the OperationDefinition object that corresponds to this operationId

getOperationDefinitionByResourceTypeAndName

public org.rhq.core.domain.operation.OperationDefinition getOperationDefinitionByResourceTypeAndName(int resourceTypeId,
                                                                                                     String operationName,
                                                                                                     boolean eagerLoaded)
                                                                                              throws OperationDefinitionNotFoundException
Specified by:
getOperationDefinitionByResourceTypeAndName in interface OperationManagerLocal
eagerLoaded - if true the parametersConfigurationDefinition, resultsConfigurationDefinition, and resourceType fields are eagerly loaded, otherwise they are left as null references
Returns:
the operation definition
Throws:
OperationDefinitionNotFoundException

scheduleGroupOperation

public org.rhq.core.domain.operation.bean.GroupOperationSchedule scheduleGroupOperation(org.rhq.core.domain.auth.Subject subject,
                                                                                        int groupId,
                                                                                        int[] executionOrderResourceIds,
                                                                                        boolean haltOnFailure,
                                                                                        String operationName,
                                                                                        org.rhq.core.domain.configuration.Configuration parameters,
                                                                                        long delay,
                                                                                        long repeatInterval,
                                                                                        int repeatCount,
                                                                                        int timeout,
                                                                                        String description)
                                                                                 throws ScheduleException
Description copied from interface: OperationManagerLocal
#see {@link OperationManagerRemote#scheduleGroupOperation

Specified by:
scheduleGroupOperation in interface OperationManagerLocal
Specified by:
scheduleGroupOperation in interface OperationManagerRemote
Returns:
Throws:
ScheduleException

findOperationDefinitionsByCriteria

public List<org.rhq.core.domain.operation.OperationDefinition> findOperationDefinitionsByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                  org.rhq.core.domain.criteria.OperationDefinitionCriteria criteria)
Specified by:
findOperationDefinitionsByCriteria in interface OperationManagerLocal
Specified by:
findOperationDefinitionsByCriteria in interface OperationManagerRemote

findResourceOperationHistoriesByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.ResourceOperationHistory> findResourceOperationHistoriesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                          org.rhq.core.domain.criteria.ResourceOperationHistoryCriteria criteria)
Specified by:
findResourceOperationHistoriesByCriteria in interface OperationManagerLocal
Specified by:
findResourceOperationHistoriesByCriteria in interface OperationManagerRemote

findGroupOperationHistoriesByCriteria

public org.rhq.core.domain.util.PageList<org.rhq.core.domain.operation.GroupOperationHistory> findGroupOperationHistoriesByCriteria(org.rhq.core.domain.auth.Subject subject,
                                                                                                                                    org.rhq.core.domain.criteria.GroupOperationHistoryCriteria criteria)
Specified by:
findGroupOperationHistoriesByCriteria in interface OperationManagerLocal
Specified by:
findGroupOperationHistoriesByCriteria in interface OperationManagerRemote


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.