Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.ui.util
Class BizappUtils

java.lang.Object
  extended by org.hyperic.hq.ui.util.BizappUtils

public class BizappUtils
extends java.lang.Object

Utilities class that provides convenience methods for operating on bizapp objects.


Constructor Summary
BizappUtils()
           
 
Method Summary
static java.util.List buildAIResourceIds(AIAppdefResourceValue[] aiResources, boolean ignored)
          builds a list of ids of ai resources for resources which are not ignored.
static java.util.List buildAppdefEntityIds(java.util.List entityIds)
          This method builds a list of AppdefEntityID objects from [entityType]:[resourceTypeId] strings
static PageList buildAppdefOptionList(java.util.List resourceTypes, boolean useHyphen)
          builds the value objects in the form: [entity type id]:[resource type id]
static java.util.List buildAppdefResources(int sessionId, org.hyperic.hq.bizapp.shared.AppdefBoss boss, AppdefEntityID[] entities)
          This method builds a list of AppdefResourceValue objects from a list of AppdefEntityID.
static AppdefResourceTypeValue[] buildfilteredAIServerTypes(AppdefResourceTypeValue[] supportedResTypes, AIServerValue[] sValues)
          build a list of server types extracted from the ai server list
static PageList buildGroupResources(org.hyperic.hq.bizapp.shared.AppdefBoss boss, int sessionId, AppdefGroupValue group, PageControl pc)
          builds a list of AppdefResourceValue objects from a list of AppdefEntityID objects stored in the group.
static java.util.List buildGroupTypes(javax.servlet.http.HttpServletRequest request)
          build group types and its corresponding resource string respresentations from the ApplicationResources.properties file.
static java.util.List buildLoadConfigOptions(ConfigSchema config, ConfigResponse oldResponse)
          build a list of UI option using a list of ConfigOptions
static java.util.List buildLoadConfigOptions(java.lang.String prefix, ConfigSchema config, ConfigResponse oldResponse)
          build a list of UI option using a list of ConfigOptions
static ConfigResponse buildSaveConfigOptions(javax.servlet.http.HttpServletRequest request, ConfigResponse oldResponse, ConfigSchema config, org.apache.struts.action.ActionErrors errors)
           
static ConfigResponse buildSaveConfigOptions(java.lang.String prefix, javax.servlet.http.HttpServletRequest request, ConfigResponse oldResponse, ConfigSchema config, org.apache.struts.action.ActionErrors errors)
           
static java.util.List buildServerTypesFromServerSig(AppdefResourceTypeValue[] sTypes, java.util.Iterator sigIterator)
          builds a list of server types from ServerSignature objects
static AppdefResourceTypeValue[] buildSupportedAIServerTypes(javax.servlet.ServletContext ctx, javax.servlet.http.HttpServletRequest request, java.lang.String platType)
          build a list of supported server types for ai subsystem
static boolean canAdminHQ(java.lang.Integer sessionId, org.hyperic.hq.bizapp.shared.AuthzBoss boss)
          Check in the permissions map to see if the user can administer HQ.
static java.util.List filterAIResourcesByServerType(java.util.List resources, java.lang.String name)
          filter on a list of AIAppdefResourceValue by Server Type.
static java.util.List filterAIResourcesByStatus(java.util.List resources, java.lang.Integer status)
          filter on a list of AIAppdefResourceValue.
static StringifiedException findLastError(ScanStateCore scanState)
           
static AppdefResourceTypeValue findResourceTypeValue(AppdefResourceTypeValue[] resourceTypes, java.lang.String name)
          find a ResourceTypeValue object from a list of ResourceTypeValue obects.
static Agent getAgentConnection(int sessionId, org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss, javax.servlet.http.HttpServletRequest request, PlatformForm form)
           
static java.lang.String getBaselineText(java.lang.String baselineOption, Measurement m)
           
static java.util.List grepSubjects(java.util.List all, java.util.List matches)
          Return a List of AuthzSubjectValue objects from a list that do not appear in a list of matches.
static boolean isAutoApprovedServer(int sessionId, org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss, AIServerValue aiServer)
           
static java.lang.String makeSubjectFullName(AuthzSubject subject)
          Return the full name of the subject.
static java.lang.String makeSubjectFullName(java.lang.String fname, java.lang.String lname)
          Return the full name of the subject.
static double parseMeasurementValue(java.lang.String value, java.lang.String unit)
          Parse a measurement value and units string.
static void populateAgentConnections(int sessionId, org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss, javax.servlet.http.HttpServletRequest request, PlatformForm form, java.lang.String usedIpPort)
           
static java.lang.Boolean populateConfig(javax.servlet.http.HttpServletRequest request, java.lang.String prefix, ConfigSchema schema, ConfigResponse config, ConfigResponse oldConfig)
          Populate a config response with values.
static java.lang.String replacePlatform(java.lang.String inStr, AppdefEntityID id)
          Replace the word 'platform' in the input string with the correct object type as specified by the entity ID.
static void setRuntimeAIMessage(int sessionId, javax.servlet.http.HttpServletRequest request, ServerValue server, org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss)
          When displaying the config options (both in the ViewXXX and EditXXX tiles), we display a message "Auto-Discover foo, bar, and other services?" next to the checkbox.
static java.util.List sortAIResource(java.util.List resource)
           
static java.util.List sortAppdefResource(java.util.List appdefList, PageControl pc)
          This method sorts list of AppdefResourceValue objects
static java.util.List sortAppdefResourceType(java.util.List resourceType)
           
static void startAutoScan(javax.servlet.ServletContext ctx, int sessionId, AppdefEntityID entityId)
           
static java.lang.String[] stringifyEntityIds(AppdefEntityID[] eids)
          Gut the String[] appdef key values for the passed-in entity ids.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BizappUtils

public BizappUtils()
Method Detail

replacePlatform

public static java.lang.String replacePlatform(java.lang.String inStr,
                                               AppdefEntityID id)
Replace the word 'platform' in the input string with the correct object type as specified by the entity ID. For instance, if the string is "events.config.platform", and id specifies a server, the result will be "events.config.server"


makeSubjectFullName

public static java.lang.String makeSubjectFullName(java.lang.String fname,
                                                   java.lang.String lname)
Return the full name of the subject.

Parameters:
fname - the subject's first name
lname - the subject's last name

filterAIResourcesByStatus

public static java.util.List filterAIResourcesByStatus(java.util.List resources,
                                                       java.lang.Integer status)
filter on a list of AIAppdefResourceValue. Either get the ignored resources or non-ignored.

Parameters:
resources - List of AIAppdefResources to filter

filterAIResourcesByServerType

public static java.util.List filterAIResourcesByServerType(java.util.List resources,
                                                           java.lang.String name)
filter on a list of AIAppdefResourceValue by Server Type.


setRuntimeAIMessage

public static void setRuntimeAIMessage(int sessionId,
                                       javax.servlet.http.HttpServletRequest request,
                                       ServerValue server,
                                       org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss)
                                throws SessionTimeoutException,
                                       SessionNotFoundException,
                                       java.rmi.RemoteException
When displaying the config options (both in the ViewXXX and EditXXX tiles), we display a message "Auto-Discover foo, bar, and other services?" next to the checkbox. The "foo, bar, and other" part is what gets generated here and stuck in the request attributes as the Constants.SERVICE_TYPE_EXAMPLE_LIST attribute.

Throws:
SessionTimeoutException
SessionNotFoundException
java.rmi.RemoteException

buildAIResourceIds

public static java.util.List buildAIResourceIds(AIAppdefResourceValue[] aiResources,
                                                boolean ignored)
builds a list of ids of ai resources for resources which are not ignored.


buildSupportedAIServerTypes

public static AppdefResourceTypeValue[] buildSupportedAIServerTypes(javax.servlet.ServletContext ctx,
                                                                    javax.servlet.http.HttpServletRequest request,
                                                                    java.lang.String platType)
                                                             throws java.lang.Exception
build a list of supported server types for ai subsystem

Throws:
java.lang.Exception

buildfilteredAIServerTypes

public static AppdefResourceTypeValue[] buildfilteredAIServerTypes(AppdefResourceTypeValue[] supportedResTypes,
                                                                   AIServerValue[] sValues)
build a list of server types extracted from the ai server list


sortAppdefResourceType

public static java.util.List sortAppdefResourceType(java.util.List resourceType)

sortAIResource

public static java.util.List sortAIResource(java.util.List resource)

buildServerTypesFromServerSig

public static java.util.List buildServerTypesFromServerSig(AppdefResourceTypeValue[] sTypes,
                                                           java.util.Iterator sigIterator)
builds a list of server types from ServerSignature objects


findResourceTypeValue

public static AppdefResourceTypeValue findResourceTypeValue(AppdefResourceTypeValue[] resourceTypes,
                                                            java.lang.String name)
find a ResourceTypeValue object from a list of ResourceTypeValue obects.

Returns:
a ResourceTypeValue or null

buildAppdefResources

public static java.util.List buildAppdefResources(int sessionId,
                                                  org.hyperic.hq.bizapp.shared.AppdefBoss boss,
                                                  AppdefEntityID[] entities)
                                           throws ObjectNotFoundException,
                                                  java.rmi.RemoteException,
                                                  SessionTimeoutException,
                                                  SessionNotFoundException,
                                                  PermissionException
This method builds a list of AppdefResourceValue objects from a list of AppdefEntityID. This function should be moved into bizapp layer if possible later. I am leaving it until I have an api which provides similar functionality.

Returns:
a list of AppdefResourceValue objects
Throws:
ObjectNotFoundException
java.rmi.RemoteException
SessionTimeoutException
SessionNotFoundException
PermissionException

sortAppdefResource

public static java.util.List sortAppdefResource(java.util.List appdefList,
                                                PageControl pc)
This method sorts list of AppdefResourceValue objects

Returns:
a list of AppdefResourceValue objects

buildAppdefEntityIds

public static java.util.List buildAppdefEntityIds(java.util.List entityIds)
This method builds a list of AppdefEntityID objects from [entityType]:[resourceTypeId] strings

Parameters:
entityIds - list of [entityType]:[resourceTypeId] strings

buildAppdefOptionList

public static PageList buildAppdefOptionList(java.util.List resourceTypes,
                                             boolean useHyphen)
                                      throws InvalidAppdefTypeException
builds the value objects in the form: [entity type id]:[resource type id]

Parameters:
resourceTypes -
Returns:
List
Throws:
InvalidAppdefTypeException

makeSubjectFullName

public static java.lang.String makeSubjectFullName(AuthzSubject subject)
Return the full name of the subject.

Parameters:
subject - the subject

buildGroupTypes

public static java.util.List buildGroupTypes(javax.servlet.http.HttpServletRequest request)
build group types and its corresponding resource string respresentations from the ApplicationResources.properties file.

Returns:
a list

buildGroupResources

public static PageList buildGroupResources(org.hyperic.hq.bizapp.shared.AppdefBoss boss,
                                           int sessionId,
                                           AppdefGroupValue group,
                                           PageControl pc)
                                    throws ObjectNotFoundException,
                                           java.rmi.RemoteException,
                                           SessionTimeoutException,
                                           SessionNotFoundException
builds a list of AppdefResourceValue objects from a list of AppdefEntityID objects stored in the group.

Parameters:
group - AppdefGroupValue which contains the list of resources
pc - TODO
Returns:
a list of AppdefResourceValue objects
Throws:
ObjectNotFoundException
java.rmi.RemoteException
SessionTimeoutException
SessionNotFoundException

canAdminHQ

public static boolean canAdminHQ(java.lang.Integer sessionId,
                                 org.hyperic.hq.bizapp.shared.AuthzBoss boss)
Check in the permissions map to see if the user can administer HQ.

Returns:
Whether or not the admin cam is contained in the type map.

grepSubjects

public static java.util.List grepSubjects(java.util.List all,
                                          java.util.List matches)
Return a List of AuthzSubjectValue objects from a list that do not appear in a list of matches.

Parameters:
all - the list to operate on
matches - the list to grep out

getBaselineText

public static java.lang.String getBaselineText(java.lang.String baselineOption,
                                               Measurement m)

buildLoadConfigOptions

public static java.util.List buildLoadConfigOptions(ConfigSchema config,
                                                    ConfigResponse oldResponse)
build a list of UI option using a list of ConfigOptions


buildLoadConfigOptions

public static java.util.List buildLoadConfigOptions(java.lang.String prefix,
                                                    ConfigSchema config,
                                                    ConfigResponse oldResponse)
build a list of UI option using a list of ConfigOptions


findLastError

public static StringifiedException findLastError(ScanStateCore scanState)
Returns:
the last error stored in the scan state

buildSaveConfigOptions

public static ConfigResponse buildSaveConfigOptions(javax.servlet.http.HttpServletRequest request,
                                                    ConfigResponse oldResponse,
                                                    ConfigSchema config,
                                                    org.apache.struts.action.ActionErrors errors)
                                             throws InvalidOptionException,
                                                    InvalidOptionValueException,
                                                    InvalidOptionValsFoundException
Throws:
InvalidOptionException
InvalidOptionValueException
InvalidOptionValsFoundException

buildSaveConfigOptions

public static ConfigResponse buildSaveConfigOptions(java.lang.String prefix,
                                                    javax.servlet.http.HttpServletRequest request,
                                                    ConfigResponse oldResponse,
                                                    ConfigSchema config,
                                                    org.apache.struts.action.ActionErrors errors)
                                             throws InvalidOptionException,
                                                    InvalidOptionValueException,
                                                    InvalidOptionValsFoundException
Throws:
InvalidOptionException
InvalidOptionValueException
InvalidOptionValsFoundException

stringifyEntityIds

public static java.lang.String[] stringifyEntityIds(AppdefEntityID[] eids)
Gut the String[] appdef key values for the passed-in entity ids.

Parameters:
eids - the appdef entity ids
Returns:
String[] of appdef keys (type:rid)

populateConfig

public static java.lang.Boolean populateConfig(javax.servlet.http.HttpServletRequest request,
                                               java.lang.String prefix,
                                               ConfigSchema schema,
                                               ConfigResponse config,
                                               ConfigResponse oldConfig)
                                        throws InvalidOptionException,
                                               InvalidOptionValueException
Populate a config response with values. The config is populated with values by looking at all the schema keys, and pulling their corresponding values out of the requestParams. The oldConfig is supplied so that we can tell if anything has actually changed.

Parameters:
request - The servlet request
prefix - Only parameters with this prefix will be considered. The prefix will be stripped before inserting it as a key into the config.
schema - The config schema that will supply the keys we'll look for in the requestParams
config - The ConfigResponse to populate with values
oldConfig - The existing configuration, used for comparison to see if anything has changed.
Returns:
True if there were actually changes to the config, False if there were not any changes to the config, or null if the schema has no keys, so the concept of changes might not make sense.
Throws:
InvalidOptionException
InvalidOptionValueException

parseMeasurementValue

public static double parseMeasurementValue(java.lang.String value,
                                           java.lang.String unit)
                                    throws java.text.ParseException
Parse a measurement value and units string. For example: "30MB" = 31,457,280.0

Parameters:
value - The string to parse
mtv - The measurement template being parsed
Returns:
the measurement as parsed based on a number and its units
Throws:
java.text.ParseException

isAutoApprovedServer

public static boolean isAutoApprovedServer(int sessionId,
                                           org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss,
                                           AIServerValue aiServer)

populateAgentConnections

public static void populateAgentConnections(int sessionId,
                                            org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss,
                                            javax.servlet.http.HttpServletRequest request,
                                            PlatformForm form,
                                            java.lang.String usedIpPort)
                                     throws java.rmi.RemoteException,
                                            SessionTimeoutException,
                                            SessionNotFoundException
Throws:
java.rmi.RemoteException
SessionTimeoutException
SessionNotFoundException

getAgentConnection

public static Agent getAgentConnection(int sessionId,
                                       org.hyperic.hq.bizapp.shared.AppdefBoss appdefBoss,
                                       javax.servlet.http.HttpServletRequest request,
                                       PlatformForm form)
                                throws java.rmi.RemoteException,
                                       SessionTimeoutException,
                                       SessionNotFoundException,
                                       AgentNotFoundException
Throws:
java.rmi.RemoteException
SessionTimeoutException
SessionNotFoundException
AgentNotFoundException

startAutoScan

public static void startAutoScan(javax.servlet.ServletContext ctx,
                                 int sessionId,
                                 AppdefEntityID entityId)

Hyperic HQ Plugin API v. 4.4.0.2

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