Hyperic HQ Plugin API v. 4.4.0.2

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

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

public class ServerManagerEJBImpl
extends AppdefSessionEJB
implements javax.ejb.SessionBean

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

See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.hyperic.hq.appdef.server.session.AppdefSessionEJB
_ctx, _ic
 
Constructor Summary
ServerManagerEJBImpl()
           
 
Method Summary
 Server cloneServer(AuthzSubject subject, Platform targetPlatform, Server serverToClone)
          Clone a Server to a target Platform
 Server createServer(AuthzSubject subject, java.lang.Integer platformId, java.lang.Integer serverTypeId, ServerValue sValue)
          Create a Server on the given platform.
 Server createVirtualServer(AuthzSubject subject, Platform platform, ServerType st)
          Create a virtual server
 void deleteServerType(ServerType serverType, AuthzSubject overlord, org.hyperic.hq.authz.shared.ResourceGroupManagerLocal resGroupMan, org.hyperic.hq.authz.shared.ResourceManagerLocal resMan)
           
 void ejbActivate()
           
 void ejbCreate()
          Create a server manager session bean.
 void ejbPassivate()
           
 void ejbRemove()
           
 java.util.Collection findDeletedServers()
           
 Server findServerByAIID(AuthzSubject subject, Platform platform, java.lang.String aiid)
           
 Server findServerById(java.lang.Integer id)
          Find a Server by Id.
 java.util.List findServersByType(Platform p, ServerType st)
           
 ServerType findServerType(java.lang.Integer id)
          Find a ServerType by id
 ServerType findServerTypeByName(java.lang.String name)
          Find a server type by name
 PageList getAllServers(AuthzSubject subject, PageControl pc)
          Get all servers.
 PageList getAllServerTypes(AuthzSubject subject, PageControl pc)
          Find all server types
static org.hyperic.hq.appdef.shared.ServerManagerLocal getOne()
           
 Server getServerById(AuthzSubject subject, java.lang.Integer id)
          Get server lite value by id.
 Server getServerById(java.lang.Integer id)
          Get a Server by Id.
 Server getServerByName(Platform host, java.lang.String name)
           
 ServerValue getServerByService(AuthzSubject subject, java.lang.Integer sID)
          Get server by service.
 java.lang.Number getServerCount()
          Get the # of servers within HQ inventory.
 java.lang.Integer[] getServerIds(AuthzSubject subject, java.lang.Integer servTypeId)
          Get server IDs by server type.
 java.lang.Integer[] getServerIdsByApplication(AuthzSubject subject, java.lang.Integer appId, java.lang.Integer servTypeId)
          Get server IDs by application and serverType.
 java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject, java.lang.Integer platId)
          Get non-virtual server IDs by server type and platform.
 java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject, java.lang.Integer platId, java.lang.Integer servTypeId)
          Get non-virtual server IDs by server type and platform.
 java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject, java.lang.Integer platId, java.lang.Integer servTypeId, boolean excludeVirtual)
          Get server IDs by server type and platform.
 PageList getServersByApplication(AuthzSubject subject, java.lang.Integer appId, java.lang.Integer servTypeId, PageControl pc)
          Get servers by application and serverType.
 PageList getServersByApplication(AuthzSubject subject, java.lang.Integer appId, PageControl pc)
          Get servers by application.
 PageList getServersByPlatform(AuthzSubject subject, java.lang.Integer platId, boolean excludeVirtual, PageControl pc)
          Get servers by platform.
 PageList getServersByPlatform(AuthzSubject subject, java.lang.Integer platId, java.lang.Integer servTypeId, boolean excludeVirtual, PageControl pc)
          Get servers by server type and platform.
 PageList getServersByPlatformServiceType(AuthzSubject subject, java.lang.Integer platId, java.lang.Integer svcTypeId)
          Get servers by server type and platform.
 PageList getServersByServices(AuthzSubject subject, java.util.List sIDs)
          Get server by service.
 java.util.List getServersByType(AuthzSubject subject, java.lang.String name)
          Get servers by server type and platform.
 java.util.List getServerTypeCounts()
          Returns a list of 2 element arrays.
 PageList getServerTypesByPlatform(AuthzSubject subject, java.lang.Integer platId, boolean excludeVirtual, PageControl pc)
          Find viewable server types for a platform
 PageList getServerTypesByPlatform(AuthzSubject subject, java.lang.Integer platId, PageControl pc)
          Find viewable server non-virtual types for a platform
 PageList getServerTypesByPlatformType(AuthzSubject subject, java.lang.Integer platformTypeId, PageControl pc)
          Find all ServerTypes for a givent PlatformType id.
 java.util.Collection getViewableServers(AuthzSubject subject, Platform platform)
           
 PageList getViewableServerTypes(AuthzSubject subject, PageControl pc)
          Find viewable server types
 void handleResourceDelete(Resource resource)
           
 void moveServer(AuthzSubject subject, Server target, Platform destination)
          Move a Server to the given Platform
 void removeServer(AuthzSubject subject, Server server)
          A removeServer method that takes a ServerLocal.
 void setAutodiscoveryZombie(Server server, boolean zombie)
           
 Server updateServer(AuthzSubject subject, ServerValue existing)
          Update a server
 void updateServerTypes(java.lang.String plugin, ServerTypeInfo[] infos)
          Update server types
 
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
 

Constructor Detail

ServerManagerEJBImpl

public ServerManagerEJBImpl()
Method Detail

cloneServer

public Server cloneServer(AuthzSubject subject,
                          Platform targetPlatform,
                          Server serverToClone)
                   throws ValidationException,
                          PermissionException,
                          javax.ejb.RemoveException,
                          VetoException,
                          javax.ejb.CreateException,
                          javax.ejb.FinderException
Clone a Server to a target Platform

Throws:
ValidationException
PermissionException
javax.ejb.RemoveException
VetoException
javax.ejb.CreateException
javax.ejb.FinderException

moveServer

public void moveServer(AuthzSubject subject,
                       Server target,
                       Platform destination)
                throws VetoException,
                       PermissionException
Move a Server to the given Platform

Parameters:
subject - The user initiating the move.
target - The target Server to move.
destination - The destination Platform.
Throws:
PermissionException - If the passed user does not have permission to move the Server.
VetoException - If the operation canot be performed due to incompatible types.

createServer

public Server createServer(AuthzSubject subject,
                           java.lang.Integer platformId,
                           java.lang.Integer serverTypeId,
                           ServerValue sValue)
                    throws javax.ejb.CreateException,
                           ValidationException,
                           PermissionException,
                           PlatformNotFoundException,
                           AppdefDuplicateNameException
Create a Server on the given platform.

Returns:
ServerValue - the saved value object
Throws:
javax.ejb.CreateException - - if it fails to add the server
ValidationException
PermissionException
PlatformNotFoundException
AppdefDuplicateNameException

createVirtualServer

public Server createVirtualServer(AuthzSubject subject,
                                  Platform platform,
                                  ServerType st)
                           throws PermissionException,
                                  javax.ejb.CreateException,
                                  javax.ejb.FinderException
Create a virtual server

Throws:
javax.ejb.FinderException
javax.ejb.CreateException
PermissionException

removeServer

public void removeServer(AuthzSubject subject,
                         Server server)
                  throws javax.ejb.RemoveException,
                         PermissionException,
                         VetoException
A removeServer method that takes a ServerLocal. Used by PlatformManager.removePlatform when cascading removal to servers.

Throws:
javax.ejb.RemoveException
PermissionException
VetoException

handleResourceDelete

public void handleResourceDelete(Resource resource)

getAllServerTypes

public PageList getAllServerTypes(AuthzSubject subject,
                                  PageControl pc)
                           throws javax.ejb.FinderException
Find all server types

Returns:
list of serverTypeValues
Throws:
javax.ejb.FinderException

getServerByName

public Server getServerByName(Platform host,
                              java.lang.String name)

getViewableServerTypes

public PageList getViewableServerTypes(AuthzSubject subject,
                                       PageControl pc)
                                throws javax.ejb.FinderException,
                                       PermissionException
Find viewable server types

Returns:
list of serverTypeValues
Throws:
javax.ejb.FinderException
PermissionException

getServerTypesByPlatform

public PageList getServerTypesByPlatform(AuthzSubject subject,
                                         java.lang.Integer platId,
                                         PageControl pc)
                                  throws PermissionException,
                                         PlatformNotFoundException,
                                         ServerNotFoundException
Find viewable server non-virtual types for a platform

Returns:
list of serverTypeValues
Throws:
PermissionException
PlatformNotFoundException
ServerNotFoundException

getServerTypesByPlatform

public PageList getServerTypesByPlatform(AuthzSubject subject,
                                         java.lang.Integer platId,
                                         boolean excludeVirtual,
                                         PageControl pc)
                                  throws PermissionException,
                                         PlatformNotFoundException,
                                         ServerNotFoundException
Find viewable server types for a platform

Returns:
list of serverTypeValues
Throws:
PermissionException
PlatformNotFoundException
ServerNotFoundException

getServerTypesByPlatformType

public PageList getServerTypesByPlatformType(AuthzSubject subject,
                                             java.lang.Integer platformTypeId,
                                             PageControl pc)
                                      throws PlatformNotFoundException
Find all ServerTypes for a givent PlatformType id. This can go once we begin passing POJOs to the UI layer.

Returns:
A list of ServerTypeValue objects for thie PlatformType.
Throws:
PlatformNotFoundException

findServerByAIID

public Server findServerByAIID(AuthzSubject subject,
                               Platform platform,
                               java.lang.String aiid)
                        throws PermissionException
Throws:
PermissionException

findServerById

public Server findServerById(java.lang.Integer id)
                      throws ServerNotFoundException
Find a Server by Id.

Throws:
ServerNotFoundException

getServerById

public Server getServerById(java.lang.Integer id)
Get a Server by Id.

Returns:
The Server with the given id, or null if not found.

findServerType

public ServerType findServerType(java.lang.Integer id)
Find a ServerType by id


findServerTypeByName

public ServerType findServerTypeByName(java.lang.String name)
                                throws javax.ejb.FinderException
Find a server type by name

Parameters:
name - - the name of the server
Returns:
ServerTypeValue
Throws:
javax.ejb.FinderException

findServersByType

public java.util.List findServersByType(Platform p,
                                        ServerType st)

findDeletedServers

public java.util.Collection findDeletedServers()

getServerById

public Server getServerById(AuthzSubject subject,
                            java.lang.Integer id)
                     throws ServerNotFoundException,
                            PermissionException
Get server lite value by id. Does not check permission.

Throws:
ServerNotFoundException
PermissionException

getServerIds

public java.lang.Integer[] getServerIds(AuthzSubject subject,
                                        java.lang.Integer servTypeId)
                                 throws PermissionException
Get server IDs by server type.

Parameters:
subject - The subject trying to list servers.
servTypeId - server type id.
Returns:
An array of Server IDs.
Throws:
PermissionException

getServerByService

public ServerValue getServerByService(AuthzSubject subject,
                                      java.lang.Integer sID)
                               throws ServerNotFoundException,
                                      ServiceNotFoundException,
                                      PermissionException
Get server by service.

Throws:
ServerNotFoundException
ServiceNotFoundException
PermissionException

getServersByServices

public PageList getServersByServices(AuthzSubject subject,
                                     java.util.List sIDs)
                              throws PermissionException,
                                     ServerNotFoundException
Get server by service. The virtual servers are not filtere out of returned list.

Throws:
PermissionException
ServerNotFoundException

getAllServers

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

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

getViewableServers

public java.util.Collection getViewableServers(AuthzSubject subject,
                                               Platform platform)

getServersByPlatform

public PageList getServersByPlatform(AuthzSubject subject,
                                     java.lang.Integer platId,
                                     boolean excludeVirtual,
                                     PageControl pc)
                              throws ServerNotFoundException,
                                     PlatformNotFoundException,
                                     PermissionException
Get servers by platform.

Parameters:
subject - The subject trying to list servers.
platId - platform id.
excludeVirtual - true if you dont want virtual (fake container) servers in the returned list
pc - The page control.
Returns:
A PageList of ServerValue objects representing servers on the specified platform that the subject is allowed to view.
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServersByPlatform

public PageList getServersByPlatform(AuthzSubject subject,
                                     java.lang.Integer platId,
                                     java.lang.Integer servTypeId,
                                     boolean excludeVirtual,
                                     PageControl pc)
                              throws ServerNotFoundException,
                                     PlatformNotFoundException,
                                     PermissionException
Get servers by server type and platform.

Parameters:
subject - The subject trying to list servers.
servTypeId - server type id.
platId - platform id.
pc - The page control.
Returns:
A PageList of ServerValue objects representing servers on the specified platform that the subject is allowed to view.
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServersByPlatformServiceType

public PageList getServersByPlatformServiceType(AuthzSubject subject,
                                                java.lang.Integer platId,
                                                java.lang.Integer svcTypeId)
                                         throws ServerNotFoundException,
                                                PlatformNotFoundException,
                                                PermissionException
Get servers by server type and platform.

Parameters:
subject - The subject trying to list servers.
platId - platform id.
Returns:
A PageList of ServerValue objects representing servers on the specified platform that the subject is allowed to view.
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServersByType

public java.util.List getServersByType(AuthzSubject subject,
                                       java.lang.String name)
                                throws PermissionException,
                                       InvalidAppdefTypeException
Get servers by server type and platform.

Parameters:
subject - The subject trying to list servers.
typeId - server type id.
Returns:
A PageList of ServerValue objects representing servers on the specified platform that the subject is allowed to view.
Throws:
PermissionException
InvalidAppdefTypeException

getServerIdsByPlatform

public java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject,
                                                  java.lang.Integer platId)
                                           throws ServerNotFoundException,
                                                  PlatformNotFoundException,
                                                  PermissionException
Get non-virtual server IDs by server type and platform.

Parameters:
subject - The subject trying to list servers.
platId - platform id.
Returns:
An array of Integer[] which represent the ServerIds specified platform that the subject is allowed to view.
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServerIdsByPlatform

public java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject,
                                                  java.lang.Integer platId,
                                                  java.lang.Integer servTypeId)
                                           throws ServerNotFoundException,
                                                  PlatformNotFoundException,
                                                  PermissionException
Get non-virtual server IDs by server type and platform.

Parameters:
subject - The subject trying to list servers.
servTypeId - server type id.
platId - platform id.
Returns:
An array of Integer[] which represent the ServerIds
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServerIdsByPlatform

public java.lang.Integer[] getServerIdsByPlatform(AuthzSubject subject,
                                                  java.lang.Integer platId,
                                                  java.lang.Integer servTypeId,
                                                  boolean excludeVirtual)
                                           throws ServerNotFoundException,
                                                  PlatformNotFoundException,
                                                  PermissionException
Get server IDs by server type and platform.

Parameters:
subject - The subject trying to list servers.
servTypeId - server type id.
platId - platform id.
Returns:
A PageList of ServerValue objects representing servers on the specified platform that the subject is allowed to view.
Throws:
ServerNotFoundException
PlatformNotFoundException
PermissionException

getServersByApplication

public PageList getServersByApplication(AuthzSubject subject,
                                        java.lang.Integer appId,
                                        PageControl pc)
                                 throws ServerNotFoundException,
                                        ApplicationNotFoundException,
                                        PermissionException
Get servers by application.

Parameters:
subject - The subject trying to list servers.
appId - Application id.
pc - The page control for this page list.
Returns:
A List of ServerValue objects representing servers that support the given application that the subject is allowed to view.
Throws:
ServerNotFoundException
ApplicationNotFoundException
PermissionException

getServersByApplication

public PageList getServersByApplication(AuthzSubject subject,
                                        java.lang.Integer appId,
                                        java.lang.Integer servTypeId,
                                        PageControl pc)
                                 throws ServerNotFoundException,
                                        ApplicationNotFoundException,
                                        PermissionException
Get servers by application and serverType.

Parameters:
subject - The subject trying to list servers.
appId - Application id.
pc - The page control for this page list.
Returns:
A List of ServerValue objects representing servers that support the given application that the subject is allowed to view.
Throws:
ServerNotFoundException
ApplicationNotFoundException
PermissionException

getServerIdsByApplication

public java.lang.Integer[] getServerIdsByApplication(AuthzSubject subject,
                                                     java.lang.Integer appId,
                                                     java.lang.Integer servTypeId)
                                              throws ServerNotFoundException,
                                                     ApplicationNotFoundException,
                                                     PermissionException
Get server IDs by application and serverType.

Parameters:
subject - The subject trying to list servers.
appId - Application id.
Returns:
A List of ServerValue objects representing servers that support the given application that the subject is allowed to view.
Throws:
ServerNotFoundException
ApplicationNotFoundException
PermissionException

updateServer

public Server updateServer(AuthzSubject subject,
                           ServerValue existing)
                    throws PermissionException,
                           UpdateException,
                           AppdefDuplicateNameException,
                           ServerNotFoundException
Update a server

Parameters:
existing -
Throws:
PermissionException
UpdateException
AppdefDuplicateNameException
ServerNotFoundException

updateServerTypes

public void updateServerTypes(java.lang.String plugin,
                              ServerTypeInfo[] infos)
                       throws javax.ejb.CreateException,
                              javax.ejb.FinderException,
                              javax.ejb.RemoveException,
                              VetoException
Update server types

Throws:
javax.ejb.CreateException
javax.ejb.FinderException
javax.ejb.RemoveException
VetoException

deleteServerType

public void deleteServerType(ServerType serverType,
                             AuthzSubject overlord,
                             org.hyperic.hq.authz.shared.ResourceGroupManagerLocal resGroupMan,
                             org.hyperic.hq.authz.shared.ResourceManagerLocal resMan)
                      throws VetoException,
                             javax.ejb.RemoveException
Throws:
VetoException
javax.ejb.RemoveException

setAutodiscoveryZombie

public void setAutodiscoveryZombie(Server server,
                                   boolean zombie)

getServerTypeCounts

public java.util.List getServerTypeCounts()
Returns a list of 2 element arrays. The first element is the name of the server type, the second element is the # of servers of that type in the inventory.


getServerCount

public java.lang.Number getServerCount()
Get the # of servers within HQ inventory. This method ingores virtual server types.


getOne

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

ejbCreate

public void ejbCreate()
               throws javax.ejb.CreateException
Create a server 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

Hyperic HQ Plugin API v. 4.4.0.2

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