Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.appdef.server.session
Class AIQueueManagerEJBImpl

java.lang.Object
  extended by org.hyperic.hq.appdef.server.session.AppdefSessionUtil
      extended by org.hyperic.hq.appdef.server.session.AppdefSessionEJB
          extended by org.hyperic.hq.appdef.server.session.AIQueueManagerEJBImpl
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class AIQueueManagerEJBImpl
extends AppdefSessionEJB
implements javax.ejb.SessionBean

This class is responsible for managing the various autoinventory queues.

See Also:
Serialized Form

Field Summary
protected  java.lang.String AIPLATFORM_PROCESSOR
           
protected  java.lang.String AIPLATFORM_PROCESSOR_NOPLACEHOLDERS
           
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionEJB
_ctx, _ic
 
Constructor Summary
AIQueueManagerEJBImpl()
           
 
Method Summary
 void checkAIScanPermission(AuthzSubject subject, AppdefEntityID id)
          Check to see if the subject can perform an autoinventory scan on the specified resource.
 void ejbActivate()
           
 void ejbCreate()
          Create an AI queue manager session bean.
 void ejbPassivate()
           
 void ejbRemove()
           
 AIIpValue findAIIpByAddress(AuthzSubject subject, java.lang.String address)
          Get an AIIpValue by address.
 AIIpValue findAIIpById(AuthzSubject subject, int ipID)
          Get an AIIp by id.
 AIPlatformValue findAIPlatformByFqdn(AuthzSubject subject, java.lang.String fqdn)
          Get an AIPlatformValue by FQDN.
 AIPlatformValue findAIPlatformById(AuthzSubject subject, int aiplatformID)
          Get an AIPlatformValue by id.
 AIServerValue findAIServerById(AuthzSubject subject, int serverID)
          Get an AIServerValue by Id.
 AIServerValue findAIServerByName(AuthzSubject subject, java.lang.String name)
          Get an AIServerValue by name.
protected  AIIpDAO getAIIpDAO()
           
 AIPlatformValue getAIPlatformByPlatformID(AuthzSubject subject, java.lang.Integer platformID)
          Get a platform given an AI platform, returns null if none found
protected  AIPlatformDAO getAIPlatformDAO()
           
protected  AIServerDAO getAIServerDAO()
           
static org.hyperic.hq.appdef.shared.AIQueueManagerLocal getOne()
           
 Platform getPlatformByAI(AuthzSubject subject, AIPlatform aipLocal)
          Find an AI platform given an platform
 PlatformValue getPlatformByAI(AuthzSubject subject, int aiPlatformID)
          Find a platform given an AI platform id
 PageList getQueue(AuthzSubject subject, boolean showIgnored, boolean showPlaceholders, boolean showAlreadyProcessed, PageControl pc)
          Retrieve the contents of the AI queue.
 java.util.List processQueue(AuthzSubject subject, java.util.List platformList, java.util.List serverList, java.util.List ipList, int action)
          Process resources in the AI queue.
 AIPlatformValue queue(AuthzSubject subject, AIPlatformValue aiplatform, boolean updateServers, boolean isApproval, boolean isReport)
          Try to queue a candidate platform discovered via autoinventory.
 void removeAssociatedAIPlatform(Platform platform)
           
 void removeFromQueue(AIPlatform aiplatform)
          Remove an AI platform from the queue.
 
Methods inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionEJB
changeOwner, checkAlertingPermission, checkAlertingScope, checkControlPermission, checkCreateChildPermission, checkCreatePlatformPermission, checkModifyPermission, checkMonitorPermission, checkPermission, checkPermission, checkRemovePermission, checkViewPermission, createAuthzResource, createAuthzResource, deleteCustomProperties, filterResourceTypes, filterViewableServers, getApplicationPrototypeResourceType, getApplicationResourceType, getAuthzResourceType, getGroupResourceType, getInitialContext, getOperationByName, getOverlord, getPlatformPrototypeResourceType, getPlatformResourceType, getResourcePermissions, getResourceType, getRootResourceType, getServerPrototypeResourceType, getServerResourceType, getServiceCluster, getServicePrototypeResourceType, getServiceResourceType, getSessionContext, getViewableApplications, getViewableGroups, getViewablePlatformPKs, getViewablePlatforms, getViewableServers, getViewableServiceInventory, getViewableServices, removeAuthzResource, rollback, setSessionContext
 
Methods inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionUtil
findResourceType, findResourceType, getAgentDAO, getAIQManagerLocal, getApplicationDAO, getApplicationManager, getConfigManager, getConfigResponseDAO, getCPropManager, getPlatformDAO, getPlatformManager, getPlatformTypeDAO, getResourceManager, getServerDAO, getServerManager, getServerTypeDAO, getServiceDAO, getServiceManager, getServiceTypeDAO
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.ejb.SessionBean
setSessionContext
 

Field Detail

AIPLATFORM_PROCESSOR

protected final java.lang.String AIPLATFORM_PROCESSOR
See Also:
Constant Field Values

AIPLATFORM_PROCESSOR_NOPLACEHOLDERS

protected final java.lang.String AIPLATFORM_PROCESSOR_NOPLACEHOLDERS
See Also:
Constant Field Values

log

protected org.apache.commons.logging.Log log
Constructor Detail

AIQueueManagerEJBImpl

public AIQueueManagerEJBImpl()
Method Detail

queue

public AIPlatformValue queue(AuthzSubject subject,
                             AIPlatformValue aiplatform,
                             boolean updateServers,
                             boolean isApproval,
                             boolean isReport)
Try to queue a candidate platform discovered via autoinventory.

Parameters:
aiplatform - The platform that we got from the recent autoinventory data that we are wanting to queue. This may return null if the appdef platform was removed because the AI platform had a qstat of "remove" that was approved.

getQueue

public PageList getQueue(AuthzSubject subject,
                         boolean showIgnored,
                         boolean showPlaceholders,
                         boolean showAlreadyProcessed,
                         PageControl pc)
Retrieve the contents of the AI queue.

Parameters:
showIgnored - If true, even resources in the AI queue that have the 'ignored' flag set will be returned. By default, resources with the 'ignored' flag set are excluded when the queue is retrieved.
showPlaceholders - If true, even resources in the AI queue that are unchanged with respect to appdef will be returned. By default, resources that are unchanged with respect to appdef are excluded when the queue is retrieved.
showAlreadyProcessed - If true, even resources that have already been processed (approved or not approved) will be shown.
Returns:
A List of AIPlatformValue objects representing the contents of the autoinventory queue.

findAIPlatformById

public AIPlatformValue findAIPlatformById(AuthzSubject subject,
                                          int aiplatformID)
Get an AIPlatformValue by id.

Returns:
An AIPlatformValue with the given id, or null if that platform id is not present in the queue.

findAIPlatformByFqdn

public AIPlatformValue findAIPlatformByFqdn(AuthzSubject subject,
                                            java.lang.String fqdn)
Get an AIPlatformValue by FQDN.

Returns:
The AIPlatformValue with the given FQDN, or null if that FQDN does not exist in the queue.

findAIServerById

public AIServerValue findAIServerById(AuthzSubject subject,
                                      int serverID)
Get an AIServerValue by Id.

Returns:
The AIServerValue with the given id, or null if that server id does not exist in the queue.

removeAssociatedAIPlatform

public void removeAssociatedAIPlatform(Platform platform)
                                throws VetoException
Throws:
VetoException

findAIServerByName

public AIServerValue findAIServerByName(AuthzSubject subject,
                                        java.lang.String name)
Get an AIServerValue by name.

Returns:
The AIServerValue with the given id, or null if that server name does not exist in the queue.

findAIIpById

public AIIpValue findAIIpById(AuthzSubject subject,
                              int ipID)
Get an AIIp by id.

Returns:
The AIIp with the given id, or null if that ip does not exist.

findAIIpByAddress

public AIIpValue findAIIpByAddress(AuthzSubject subject,
                                   java.lang.String address)
Get an AIIpValue by address.

Returns:
The AIIpValue with the given address, or null if an ip with that address does not exist in the queue.

processQueue

public java.util.List processQueue(AuthzSubject subject,
                                   java.util.List platformList,
                                   java.util.List serverList,
                                   java.util.List ipList,
                                   int action)
                            throws javax.ejb.FinderException,
                                   PermissionException,
                                   ValidationException,
                                   javax.ejb.RemoveException,
                                   AIQApprovalException
Process resources in the AI queue. This can be used to approve resources for inclusion into appdef, to ignore or unignore resources in the queue, or to purge resources from the queue.

Parameters:
platformList - A List of aiplatform IDs. This may be null, in which case it is ignored.
ipList - A List of aiip IDs. This may be null, in which case it is ignored.
serverList - A List of aiserver IDs. This may be null, in which case it is ignored.
action - One of the AIQueueConstants.Q_DECISION_XXX constants indicating what to do with the platforms, ips and servers.
Returns:
A List of AppdefResource's that were created as a result of processing the queue.
Throws:
javax.ejb.FinderException
PermissionException
ValidationException
javax.ejb.RemoveException
AIQApprovalException

removeFromQueue

public void removeFromQueue(AIPlatform aiplatform)
Remove an AI platform from the queue.


getPlatformByAI

public PlatformValue getPlatformByAI(AuthzSubject subject,
                                     int aiPlatformID)
                              throws javax.ejb.FinderException,
                                     PermissionException,
                                     PlatformNotFoundException
Find a platform given an AI platform id

Throws:
javax.ejb.FinderException
PermissionException
PlatformNotFoundException

getAIPlatformByPlatformID

public AIPlatformValue getAIPlatformByPlatformID(AuthzSubject subject,
                                                 java.lang.Integer platformID)
Get a platform given an AI platform, returns null if none found


getPlatformByAI

public Platform getPlatformByAI(AuthzSubject subject,
                                AIPlatform aipLocal)
                         throws PermissionException,
                                PlatformNotFoundException
Find an AI platform given an platform

Throws:
PermissionException
PlatformNotFoundException

checkAIScanPermission

public void checkAIScanPermission(AuthzSubject subject,
                                  AppdefEntityID id)
                           throws PermissionException,
                                  GroupNotCompatibleException
Check to see if the subject can perform an autoinventory scan on the specified resource. This is another hack to publicly expose this method in AppdefSessionEJB as an EJB interface method.

Overrides:
checkAIScanPermission in class AppdefSessionEJB
Parameters:
subject - The user to check permissions on.
id - An ID of a platform or a group of platforms.
Throws:
GroupNotCompatibleException - If the group is not a compatible group.
PermissionException

getOne

public static org.hyperic.hq.appdef.shared.AIQueueManagerLocal getOne()

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Create an AI queue manager session bean.

Throws:
javax.ejb.CreateException - If an error occurs creating bean.

ejbRemove

public void ejbRemove()
Specified by:
ejbRemove in interface javax.ejb.SessionBean

ejbActivate

public void ejbActivate()
Specified by:
ejbActivate in interface javax.ejb.SessionBean

ejbPassivate

public void ejbPassivate()
Specified by:
ejbPassivate in interface javax.ejb.SessionBean

getAIPlatformDAO

protected AIPlatformDAO getAIPlatformDAO()

getAIIpDAO

protected AIIpDAO getAIIpDAO()

getAIServerDAO

protected AIServerDAO getAIServerDAO()

Hyperic HQ Plugin API v. 4.4.0.2

Copyright © 2004-2006 Hyperic, Inc. support@hyperic.net, All Rights Reserved.