Hyperic HQ Plugin API v. 4.4.0.2

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

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.ApplicationManagerEJBImpl
All Implemented Interfaces:
java.io.Serializable, javax.ejb.EnterpriseBean, javax.ejb.SessionBean

public class ApplicationManagerEJBImpl
extends AppdefSessionEJB
implements javax.ejb.SessionBean

This class is responsible for managing Application objects in appdef and their relationships

See Also:
Serialized Form

Field Summary
protected  org.apache.commons.logging.Log log
           
protected  java.lang.String VALUE_PROCESSOR
           
 
Fields inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionEJB
_ctx, _ic
 
Constructor Summary
ApplicationManagerEJBImpl()
           
 
Method Summary
 Application createApplication(AuthzSubject subject, ApplicationValue newApp, java.util.Collection services)
          Create a Application of a specified type
 void ejbActivate()
           
 void ejbCreate()
          Create a service manager session bean.
 void ejbPassivate()
           
 void ejbRemove()
           
 Application findApplicationById(AuthzSubject subject, java.lang.Integer id)
          Get application pojo by id.
 Application findApplicationByName(AuthzSubject subject, java.lang.String name)
          Find application by name
 ApplicationType findApplicationType(java.lang.Integer id)
          Get ApplicationType by ID
 java.util.Collection findDeletedApplications()
           
 PageList getAllApplications(AuthzSubject subject, PageControl pc)
          Get all applications.
 java.util.List getAllApplicationTypes(AuthzSubject who)
          Get all Application types
 java.lang.Number getApplicationCount()
          Get the # of applications within HQ inventory
 java.lang.Integer[] getApplicationIDsByResource(AppdefEntityID resource)
          Get all application IDs that use the specified resource.
 java.util.List getApplicationResources(AuthzSubject subject, java.lang.Integer appId)
           
 PageList getApplicationsByResource(AuthzSubject subject, AppdefEntityID resource, PageControl pc)
          Get all applications for a resource.
 java.util.List getApplicationServices(AuthzSubject subject, java.lang.Integer appId)
          Get all the application services for this application
protected  ApplicationTypeDAO getApplicationTypeDAO()
           
static org.hyperic.hq.appdef.shared.ApplicationManagerLocal getOne()
           
 ResourceTree getResourceTree(AuthzSubject subject, AppdefEntityID[] resources, int traversal)
          Generate a resource tree based on the root resources and the traversal (one of ResourceTreeGenerator.TRAVERSE_*)
 DependencyTree getServiceDepsForApp(AuthzSubject subject, java.lang.Integer pk)
          Get the service dependency map for an application
 void handleResourceDelete(Resource resource)
           
 boolean isApplicationMember(AppdefEntityID application, AppdefEntityID service)
           
 void removeApplication(AuthzSubject subject, java.lang.Integer id)
          Remove an application
 void removeAppService(AuthzSubject caller, java.lang.Integer appId, java.lang.Integer appServiceId)
          Remove an application service.
 void setApplicationServices(AuthzSubject subject, java.lang.Integer appId, java.util.List entityIds)
          Set the application services for this application
 void setServiceDepsForApp(AuthzSubject subject, DependencyTree depTree)
          Set the dependency map for an application
 void startup()
           
 ApplicationValue updateApplication(AuthzSubject subject, ApplicationValue newValue)
          Update the basic properties of an application.
 
Methods inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionEJB
changeOwner, checkAIScanPermission, 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

log

protected org.apache.commons.logging.Log log

VALUE_PROCESSOR

protected final java.lang.String VALUE_PROCESSOR
See Also:
Constant Field Values
Constructor Detail

ApplicationManagerEJBImpl

public ApplicationManagerEJBImpl()
Method Detail

getAllApplicationTypes

public java.util.List getAllApplicationTypes(AuthzSubject who)
                                      throws javax.ejb.FinderException
Get all Application types

Returns:
list of ApplicationTypeValue objects
Throws:
javax.ejb.FinderException

findApplicationType

public ApplicationType findApplicationType(java.lang.Integer id)
Get ApplicationType by ID


createApplication

public Application createApplication(AuthzSubject subject,
                                     ApplicationValue newApp,
                                     java.util.Collection services)
                              throws ValidationException,
                                     PermissionException,
                                     javax.ejb.CreateException,
                                     AppdefDuplicateNameException
Create a Application of a specified type

Parameters:
subject - - who
newApp - - the new application to create
services - - A collection of ServiceValue objects that will be the initial set of services for the application. This can be null if you are creating an empty application.
Throws:
ValidationException
PermissionException
javax.ejb.CreateException
AppdefDuplicateNameException

updateApplication

public ApplicationValue updateApplication(AuthzSubject subject,
                                          ApplicationValue newValue)
                                   throws ApplicationNotFoundException,
                                          PermissionException,
                                          UpdateException,
                                          AppdefDuplicateNameException,
                                          javax.ejb.FinderException
Update the basic properties of an application. Will NOT update service dependencies, etc.

Throws:
ApplicationNotFoundException
PermissionException
UpdateException
AppdefDuplicateNameException
javax.ejb.FinderException

removeApplication

public void removeApplication(AuthzSubject subject,
                              java.lang.Integer id)
                       throws ApplicationNotFoundException,
                              PermissionException,
                              javax.ejb.RemoveException,
                              VetoException
Remove an application

Throws:
ApplicationNotFoundException
PermissionException
javax.ejb.RemoveException
VetoException

removeAppService

public void removeAppService(AuthzSubject caller,
                             java.lang.Integer appId,
                             java.lang.Integer appServiceId)
                      throws ApplicationException,
                             ApplicationNotFoundException,
                             PermissionException
Remove an application service.

Parameters:
caller - - Valid spider subject of caller.
appId - - The application identifier.
appServiceId - - The service identifier
Throws:
ApplicationException - when unable to perform remove
ApplicationNotFoundException - - when the app can't be found
PermissionException - - when caller is not authorized to remove.

handleResourceDelete

public void handleResourceDelete(Resource resource)

getServiceDepsForApp

public DependencyTree getServiceDepsForApp(AuthzSubject subject,
                                           java.lang.Integer pk)
                                    throws ApplicationNotFoundException,
                                           PermissionException
Get the service dependency map for an application

Parameters:
subject -
appId -
Throws:
ApplicationNotFoundException
PermissionException

getApplicationCount

public java.lang.Number getApplicationCount()
Get the # of applications within HQ inventory


setServiceDepsForApp

public void setServiceDepsForApp(AuthzSubject subject,
                                 DependencyTree depTree)
                          throws ApplicationNotFoundException,
                                 javax.ejb.RemoveException,
                                 PermissionException,
                                 javax.ejb.CreateException
Set the dependency map for an application

Parameters:
depTree -
subject -
Throws:
ApplicationNotFoundException
javax.ejb.RemoveException
PermissionException
javax.ejb.CreateException

findApplicationByName

public Application findApplicationByName(AuthzSubject subject,
                                         java.lang.String name)
                                  throws ApplicationNotFoundException,
                                         PermissionException
Find application by name

Parameters:
subject - - who
name - - name of app
Throws:
ApplicationNotFoundException
PermissionException

findApplicationById

public Application findApplicationById(AuthzSubject subject,
                                       java.lang.Integer id)
                                throws ApplicationNotFoundException,
                                       PermissionException
Get application pojo by id.

Throws:
ApplicationNotFoundException
PermissionException

findDeletedApplications

public java.util.Collection findDeletedApplications()

getAllApplications

public PageList getAllApplications(AuthzSubject subject,
                                   PageControl pc)
                            throws javax.ejb.FinderException,
                                   PermissionException
Get all applications.

Parameters:
subject - The subject trying to list applications.
Returns:
A List of ApplicationValue objects representing all of the applications that the given subject is allowed to view.
Throws:
javax.ejb.FinderException
PermissionException

getApplicationResources

public java.util.List getApplicationResources(AuthzSubject subject,
                                              java.lang.Integer appId)
                                       throws ApplicationNotFoundException,
                                              PermissionException
Returns:
List of Resource
Throws:
ApplicationNotFoundException
PermissionException

getApplicationServices

public java.util.List getApplicationServices(AuthzSubject subject,
                                             java.lang.Integer appId)
                                      throws ApplicationNotFoundException,
                                             PermissionException
Get all the application services for this application

Parameters:
subject -
appId -
Throws:
ApplicationNotFoundException
PermissionException

setApplicationServices

public void setApplicationServices(AuthzSubject subject,
                                   java.lang.Integer appId,
                                   java.util.List entityIds)
                            throws ApplicationNotFoundException,
                                   javax.ejb.CreateException,
                                   AppdefGroupNotFoundException,
                                   PermissionException
Set the application services for this application

Parameters:
subject -
map - key: Integer service ID value: Boolean indicating that the service is an entry point
Throws:
ApplicationNotFoundException
javax.ejb.CreateException
AppdefGroupNotFoundException
PermissionException

getApplicationsByResource

public PageList getApplicationsByResource(AuthzSubject subject,
                                          AppdefEntityID resource,
                                          PageControl pc)
                                   throws ApplicationNotFoundException,
                                          PermissionException
Get all applications for a resource.

Throws:
ApplicationNotFoundException
PermissionException

getApplicationIDsByResource

public java.lang.Integer[] getApplicationIDsByResource(AppdefEntityID resource)
                                                throws ApplicationNotFoundException
Get all application IDs that use the specified resource.

Parameters:
subject - The subject trying to get the app list
resource - Server ID.
pagenum - The page number to start listing. First page is zero.
pagesize - The size of the page (the number of items to return).
sort - The sort order.
Returns:
A List of ApplicationValue objects which use the specified resource.
Throws:
ApplicationNotFoundException

isApplicationMember

public boolean isApplicationMember(AppdefEntityID application,
                                   AppdefEntityID service)

getResourceTree

public ResourceTree getResourceTree(AuthzSubject subject,
                                    AppdefEntityID[] resources,
                                    int traversal)
                             throws AppdefEntityNotFoundException,
                                    PermissionException
Generate a resource tree based on the root resources and the traversal (one of ResourceTreeGenerator.TRAVERSE_*)

Throws:
AppdefEntityNotFoundException
PermissionException

startup

public void startup()

getOne

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

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Create a service manager session bean.

Throws:
javax.ejb.CreateException - If an error occurs creating the pager for the 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

getApplicationTypeDAO

protected ApplicationTypeDAO getApplicationTypeDAO()

Hyperic HQ Plugin API v. 4.4.0.2

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