Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.grouping.critters
Class BaseCritterType

java.lang.Object
  extended by org.hyperic.hq.grouping.critters.BaseCritterType
All Implemented Interfaces:
CritterType
Direct Known Subclasses:
AvailabilityCritterType, CompatGroupTypeCritterType, DescendantProtoCritterType, GroupMembershipCritterType, MixedGroupTypeCritterType, NonSystemCritterType, OwnedCritterType, ProtoCritterType, ProtoNameCritterType, ResourceNameCritterType, ResourceTypeCritterType

public abstract class BaseCritterType
extends java.lang.Object
implements CritterType

BaseCritterType provides common routines for setting up type descriptions, getting localized strings, and validating creation parameters. Subclasses should call initialize() in the constructor.


Constructor Summary
BaseCritterType()
           
 
Method Summary
protected  void addEnumPropDescription(java.lang.String propId, java.lang.Class enumClass, boolean required)
           
protected  void addPropDescription(java.lang.String propId, CritterPropType type)
           
protected  void addPropDescription(java.lang.String propId, CritterPropType type, boolean required)
          Adds a prop description which will get returned via getPropDescriptions().
 java.util.ResourceBundle getBundle()
           
 java.lang.String getDescription()
          Returns a localized description 'Matches resource names against a regular expression' 'Matches resources modified before or after a date'
 java.text.MessageFormat getInstanceConfig()
          Returns a localized MessageFormat, useful for returning the critter config.
 java.lang.String getName()
          Returns a localized name of this critter 'Resource Name' 'Modified Time'
 java.util.List getPropDescriptions()
          Returns a list of CritterPropDescriptions, describing the order and constitution of the props "What arguments do I need to configure this critter?"
protected  java.lang.String getResourceProperty(java.lang.String propSuffix)
           
protected  void initialize(java.lang.String bundleName, java.lang.String propPrefix)
          Initialize the name and description of the critter as well as internal storage for prop descriptions.
protected  void validate(java.util.Map props)
          Validate a list of CritterPropDescriptions against the previously defined descriptions.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.hyperic.hq.grouping.CritterType
compose, decompose, isSystem, isUserVisible, newInstance
 

Constructor Detail

BaseCritterType

public BaseCritterType()
Method Detail

getResourceProperty

protected java.lang.String getResourceProperty(java.lang.String propSuffix)

initialize

protected void initialize(java.lang.String bundleName,
                          java.lang.String propPrefix)
Initialize the name and description of the critter as well as internal storage for prop descriptions.

Parameters:
bundleName - Name of the resource bundle (org.hyperc.hq...Resources)
propPrefix - Prefix to use before all properties. The BaseCritterType will load properties for in the following form: propPrefix.critter.name= propPrefix.critter.desc= propPrefix.critterProp.propId.name= propPrefix.critterProp.propId.purpose= Where propId can be specified for all the different properties a resource supports. propId must match the value returned from CritterProp.getId()

addPropDescription

protected void addPropDescription(java.lang.String propId,
                                  CritterPropType type,
                                  boolean required)
Adds a prop description which will get returned via getPropDescriptions().

Parameters:
propName - The property name to use when looking up the localized value.
type - The critter prop type
required - If true, the property is required to create the critter propName is used in conjunction with the propPrefix (from initialize()) The properties loaded from the resource bundle will be of the following form: propPrefix.critterProp.propName.name propPrefix.critterProp.propName.purpose Each call to addPropDescription adds a new property, and thus will require 2 more localized properties.

addEnumPropDescription

protected void addEnumPropDescription(java.lang.String propId,
                                      java.lang.Class enumClass,
                                      boolean required)

addPropDescription

protected void addPropDescription(java.lang.String propId,
                                  CritterPropType type)

getPropDescriptions

public java.util.List getPropDescriptions()
Description copied from interface: CritterType
Returns a list of CritterPropDescriptions, describing the order and constitution of the props "What arguments do I need to configure this critter?"

Specified by:
getPropDescriptions in interface CritterType

getDescription

public java.lang.String getDescription()
Description copied from interface: CritterType
Returns a localized description 'Matches resource names against a regular expression' 'Matches resources modified before or after a date'

Specified by:
getDescription in interface CritterType

getName

public java.lang.String getName()
Description copied from interface: CritterType
Returns a localized name of this critter 'Resource Name' 'Modified Time'

Specified by:
getName in interface CritterType

getBundle

public java.util.ResourceBundle getBundle()

validate

protected void validate(java.util.Map props)
                 throws GroupException
Validate a list of CritterPropDescriptions against the previously defined descriptions. Calls to addPropDescription() pre-populate the critter type with the props that are valid. This method ensures that a list of CritterPropDescriptions match the valid types.

Parameters:
props - a map of propIds onto CritterProps
Throws:
GroupException

getInstanceConfig

public java.text.MessageFormat getInstanceConfig()
Returns a localized MessageFormat, useful for returning the critter config.

See Also:
Critter.getConfig()

Hyperic HQ Plugin API v. 4.4.0.2

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