org.rhq.core.domain.resource
Class ResourceType

java.lang.Object
  extended by org.rhq.core.domain.resource.ResourceType
All Implemented Interfaces:
Externalizable, Serializable, Comparable<ResourceType>

public class ResourceType
extends Object
implements Externalizable, Comparable<ResourceType>

Defines a type of Resource (e.g. a Linux platform, a JBossAS server, or a Datasource service). Unique business key (and therefore equals/hashCode basis) is the (String name, String plugin) combination. This will keep plugin writers from stepping on each other's toes.

See Also:
Serialized Form

Field Summary
static ResourceType ANY_PLATFORM_TYPE
           
static String FIND_ALL_TEMPLATE_COUNT_COMPOSITES
           
static String FIND_CHILDREN_BY_PARENT
          find child resource types for the resource type passed in :resourceType
static String MAPPING_FIND_CHILDREN_BY_CATEGORY
           
static String QUERY_FIND_ALL
           
static String QUERY_FIND_BY_CATEGORY
           
static String QUERY_FIND_BY_ID_WITH_ALL_OPERATIONS
           
static String QUERY_FIND_BY_NAME
           
static String QUERY_FIND_BY_NAME_AND_PLUGIN
           
static String QUERY_FIND_BY_PARENT_AND_NAME
           
static String QUERY_FIND_BY_PLUGIN
           
static String QUERY_FIND_BY_RESOURCE_GROUP
           
static String QUERY_FIND_BY_RESOURCE_GROUP_admin
           
static String QUERY_FIND_BY_SUBCATEGORY
           
static String QUERY_FIND_CHILDREN
           
static String QUERY_FIND_CHILDREN_admin
           
static String QUERY_FIND_CHILDREN_BY_CATEGORY
          find child resource types for resource :parentResource and category :category
static String QUERY_FIND_CHILDREN_BY_CATEGORY_admin
           
static String QUERY_FIND_DUPLICATE_TYPE_NAMES
           
static String QUERY_FIND_RESOURCE_FACETS
           
static String QUERY_FIND_UTILIZED_BY_CATEGORY
           
static String QUERY_FIND_UTILIZED_BY_CATEGORY_admin
           
static String QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY
          find utilized (i.e. represented in inventory) child resource types for resource :parentResource and category :category
static String QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY_admin
           
static String QUERY_GET_EXPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP
           
static String QUERY_GET_IMPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP
           
 
Constructor Summary
ResourceType()
           
ResourceType(String name, String plugin, ResourceCategory category, ResourceType parentResourceType)
           
 
Method Summary
 void addChildResourceType(ResourceType childResourceType)
          Makes this resource type a parent of the given child resource type.
 void addChildSubCategory(ResourceSubCategory subCategory)
          Adds a child ResourceSubCategory to the List which has been defined on this ResourceType.
 void addEventDefinition(EventDefinition eventDefinition)
           
 boolean addMetricDefinition(MeasurementDefinition metricDef)
           
 boolean addOperationDefinition(OperationDefinition operationDefinition)
           
 void addPackageType(PackageType packageType)
           
 void addParentResourceType(ResourceType parentResourceType)
          Makes this resource type a child of the given parent resource type.
 boolean addProcessScan(ProcessScan processMatch)
           
 int compareTo(ResourceType that)
           
 boolean equals(Object obj)
           
 ResourceCategory getCategory()
           
 Set<ResourceType> getChildResourceTypes()
           
 List<ResourceSubCategory> getChildSubCategories()
          Returns the List of child ResourceSubCategorys which have been defined on this ResourceType.
 ClassLoaderType getClassLoaderType()
           
 CreateDeletePolicy getCreateDeletePolicy()
           
 ResourceCreationDataType getCreationDataType()
           
 long getCtime()
           
 String getDescription()
           
 Set<EventDefinition> getEventDefinitions()
           
 String getHelpText()
           
 int getId()
           
 Set<MeasurementDefinition> getMetricDefinitions()
           
 long getMtime()
           
 String getName()
           
 Set<OperationDefinition> getOperationDefinitions()
           
 Set<PackageType> getPackageTypes()
           
 Set<ResourceType> getParentResourceTypes()
           
 String getPlugin()
           
 ConfigurationDefinition getPluginConfigurationDefinition()
           
 Set<ProcessScan> getProcessScans()
           
 ConfigurationDefinition getResourceConfigurationDefinition()
           
 List<Resource> getResources()
           
 ResourceSubCategory getSubCategory()
          Returns the ResourceSubCategory, if any, which this ResourceType has been tagged with.
 int hashCode()
           
 boolean isCreatable()
           
 boolean isDeletable()
           
 boolean isSingleton()
          If true, this resource may only ever have one discovered instance per parent resource.
 boolean isSupportsManualAdd()
           
 void readExternal(ObjectInput in)
           
 void readExternalAgent(ObjectInput in)
           
 void readExternalRemote(ObjectInput in)
           
 void removeChildResourceType(ResourceType oldChildResourceType)
          Removes the given resource type as a child of this resource type.
 void removePackageType(PackageType packageType)
           
 void removeParentResourceType(ResourceType oldParentResourceType)
          Removes the given resource type as a parent of this resource type.
 void setCategory(ResourceCategory category)
           
 void setChildResourceTypes(Set<ResourceType> childResourceTypes)
           
 void setChildSubCategories(List<ResourceSubCategory> subCategories)
          Sets the List of child ResourceSubCategorys for this ResourceType.
 void setClassLoaderType(ClassLoaderType classLoaderType)
           
 void setCreateDeletePolicy(CreateDeletePolicy createDeletePolicy)
           
 void setCreationDataType(ResourceCreationDataType creationDataType)
           
 void setDescription(String description)
           
 void setEventDefinitions(Set<EventDefinition> eventDefinitions)
           
 void setHelpText(String helpText)
           
 void setId(int id)
           
 void setMetricDefinitions(Set<MeasurementDefinition> metricDefinitions)
           
 void setName(String name)
           
 void setPackageTypes(Set<PackageType> packageTypes)
           
 void setParentResourceTypes(Set<ResourceType> parentResourceTypes)
           
 void setPlugin(String plugin)
           
 void setPluginConfigurationDefinition(ConfigurationDefinition pluginConfigurationDefinition)
           
 void setProcessScans(Set<ProcessScan> processScans)
           
 void setResourceConfigurationDefinition(ConfigurationDefinition resourceConfigurationDefinition)
           
 void setResources(List<Resource> resources)
           
 void setSingleton(boolean singleton)
           
 void setSubCategory(ResourceSubCategory subcategory)
          Tags this ResourceType as being part of the specified ResourceSubCategory
 void setSupportsManualAdd(boolean supportsManualAdd)
           
 String toString()
           
 void writeExternal(ObjectOutput out)
           
 void writeExternalAgent(ObjectOutput out)
           
 void writeExternalRemote(ObjectOutput out)
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

ANY_PLATFORM_TYPE

public static final ResourceType ANY_PLATFORM_TYPE

QUERY_FIND_BY_NAME

public static final String QUERY_FIND_BY_NAME
See Also:
Constant Field Values

QUERY_GET_EXPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP

public static final String QUERY_GET_EXPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP
See Also:
Constant Field Values

QUERY_GET_IMPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP

public static final String QUERY_GET_IMPLICIT_RESOURCE_TYPE_COUNTS_BY_GROUP
See Also:
Constant Field Values

QUERY_FIND_BY_NAME_AND_PLUGIN

public static final String QUERY_FIND_BY_NAME_AND_PLUGIN
See Also:
Constant Field Values

QUERY_FIND_BY_PLUGIN

public static final String QUERY_FIND_BY_PLUGIN
See Also:
Constant Field Values

QUERY_FIND_BY_PARENT_AND_NAME

public static final String QUERY_FIND_BY_PARENT_AND_NAME
See Also:
Constant Field Values

QUERY_FIND_ALL

public static final String QUERY_FIND_ALL
See Also:
Constant Field Values

QUERY_FIND_BY_ID_WITH_ALL_OPERATIONS

public static final String QUERY_FIND_BY_ID_WITH_ALL_OPERATIONS
See Also:
Constant Field Values

QUERY_FIND_BY_CATEGORY

public static final String QUERY_FIND_BY_CATEGORY
See Also:
Constant Field Values

QUERY_FIND_CHILDREN

public static final String QUERY_FIND_CHILDREN
See Also:
Constant Field Values

QUERY_FIND_CHILDREN_admin

public static final String QUERY_FIND_CHILDREN_admin
See Also:
Constant Field Values

QUERY_FIND_CHILDREN_BY_CATEGORY

public static final String QUERY_FIND_CHILDREN_BY_CATEGORY
find child resource types for resource :parentResource and category :category

See Also:
Constant Field Values

QUERY_FIND_CHILDREN_BY_CATEGORY_admin

public static final String QUERY_FIND_CHILDREN_BY_CATEGORY_admin
See Also:
Constant Field Values

QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY

public static final String QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY
find utilized (i.e. represented in inventory) child resource types for resource :parentResource and category :category

See Also:
Constant Field Values

QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY_admin

public static final String QUERY_FIND_UTILIZED_CHILDREN_BY_CATEGORY_admin
See Also:
Constant Field Values

FIND_CHILDREN_BY_PARENT

public static final String FIND_CHILDREN_BY_PARENT
find child resource types for the resource type passed in :resourceType

See Also:
Constant Field Values

FIND_ALL_TEMPLATE_COUNT_COMPOSITES

public static final String FIND_ALL_TEMPLATE_COUNT_COMPOSITES
See Also:
Constant Field Values

QUERY_FIND_BY_SUBCATEGORY

public static final String QUERY_FIND_BY_SUBCATEGORY
See Also:
Constant Field Values

QUERY_FIND_UTILIZED_BY_CATEGORY

public static final String QUERY_FIND_UTILIZED_BY_CATEGORY
See Also:
Constant Field Values

QUERY_FIND_UTILIZED_BY_CATEGORY_admin

public static final String QUERY_FIND_UTILIZED_BY_CATEGORY_admin
See Also:
Constant Field Values

QUERY_FIND_BY_RESOURCE_GROUP

public static final String QUERY_FIND_BY_RESOURCE_GROUP
See Also:
Constant Field Values

QUERY_FIND_BY_RESOURCE_GROUP_admin

public static final String QUERY_FIND_BY_RESOURCE_GROUP_admin
See Also:
Constant Field Values

MAPPING_FIND_CHILDREN_BY_CATEGORY

public static final String MAPPING_FIND_CHILDREN_BY_CATEGORY
See Also:
Constant Field Values

QUERY_FIND_RESOURCE_FACETS

public static final String QUERY_FIND_RESOURCE_FACETS
See Also:
Constant Field Values

QUERY_FIND_DUPLICATE_TYPE_NAMES

public static final String QUERY_FIND_DUPLICATE_TYPE_NAMES
See Also:
Constant Field Values
Constructor Detail

ResourceType

public ResourceType()

ResourceType

public ResourceType(String name,
                    String plugin,
                    ResourceCategory category,
                    ResourceType parentResourceType)
Method Detail

getId

public int getId()

setId

public void setId(int id)

getName

public String getName()

setName

public void setName(String name)

getCategory

public ResourceCategory getCategory()

setCategory

public void setCategory(ResourceCategory category)

getCreationDataType

public ResourceCreationDataType getCreationDataType()

setCreationDataType

public void setCreationDataType(ResourceCreationDataType creationDataType)

getCreateDeletePolicy

public CreateDeletePolicy getCreateDeletePolicy()

setCreateDeletePolicy

public void setCreateDeletePolicy(CreateDeletePolicy createDeletePolicy)

isCreatable

public boolean isCreatable()

isDeletable

public boolean isDeletable()

getSubCategory

public ResourceSubCategory getSubCategory()
Returns the ResourceSubCategory, if any, which this ResourceType has been tagged with. If the ResourceType has not been tagged with a subcategory, null is returned.


setSubCategory

public void setSubCategory(ResourceSubCategory subcategory)
Tags this ResourceType as being part of the specified ResourceSubCategory


isSingleton

public boolean isSingleton()
If true, this resource may only ever have one discovered instance per parent resource.

Returns:
true if this is a singleton resource

setSingleton

public void setSingleton(boolean singleton)
Parameters:
singleton - true if there is only ever one discovered instance per parent resource

isSupportsManualAdd

public boolean isSupportsManualAdd()

setSupportsManualAdd

public void setSupportsManualAdd(boolean supportsManualAdd)

getDescription

public String getDescription()

setDescription

public void setDescription(String description)

getPlugin

public String getPlugin()

setPlugin

public void setPlugin(String plugin)

getCtime

public long getCtime()

getMtime

public long getMtime()

getResources

public List<Resource> getResources()

setResources

public void setResources(List<Resource> resources)

getParentResourceTypes

public Set<ResourceType> getParentResourceTypes()

setParentResourceTypes

public void setParentResourceTypes(Set<ResourceType> parentResourceTypes)

addParentResourceType

public void addParentResourceType(ResourceType parentResourceType)
Makes this resource type a child of the given parent resource type.

Parameters:
parentResourceType -

removeParentResourceType

public void removeParentResourceType(ResourceType oldParentResourceType)
Removes the given resource type as a parent of this resource type.

Parameters:
oldParentResourceType -

getChildResourceTypes

public Set<ResourceType> getChildResourceTypes()

addChildResourceType

public void addChildResourceType(ResourceType childResourceType)
Makes this resource type a parent of the given child resource type.

Parameters:
childResourceType -

removeChildResourceType

public void removeChildResourceType(ResourceType oldChildResourceType)
Removes the given resource type as a child of this resource type.

Parameters:
oldChildResourceType -

setChildResourceTypes

public void setChildResourceTypes(Set<ResourceType> childResourceTypes)

getPluginConfigurationDefinition

public ConfigurationDefinition getPluginConfigurationDefinition()

setPluginConfigurationDefinition

public void setPluginConfigurationDefinition(ConfigurationDefinition pluginConfigurationDefinition)

getResourceConfigurationDefinition

public ConfigurationDefinition getResourceConfigurationDefinition()

setResourceConfigurationDefinition

public void setResourceConfigurationDefinition(ConfigurationDefinition resourceConfigurationDefinition)

getMetricDefinitions

public Set<MeasurementDefinition> getMetricDefinitions()

setMetricDefinitions

public void setMetricDefinitions(Set<MeasurementDefinition> metricDefinitions)

addMetricDefinition

public boolean addMetricDefinition(MeasurementDefinition metricDef)

getEventDefinitions

public Set<EventDefinition> getEventDefinitions()

setEventDefinitions

public void setEventDefinitions(Set<EventDefinition> eventDefinitions)

addEventDefinition

public void addEventDefinition(EventDefinition eventDefinition)

getOperationDefinitions

public Set<OperationDefinition> getOperationDefinitions()

addOperationDefinition

public boolean addOperationDefinition(OperationDefinition operationDefinition)

getProcessScans

public Set<ProcessScan> getProcessScans()

setProcessScans

public void setProcessScans(Set<ProcessScan> processScans)

addProcessScan

public boolean addProcessScan(ProcessScan processMatch)

getPackageTypes

public Set<PackageType> getPackageTypes()

setPackageTypes

public void setPackageTypes(Set<PackageType> packageTypes)

addPackageType

public void addPackageType(PackageType packageType)

removePackageType

public void removePackageType(PackageType packageType)

getChildSubCategories

public List<ResourceSubCategory> getChildSubCategories()
Returns the List of child ResourceSubCategorys which have been defined on this ResourceType. These ResourceSubCategory's are available to tag any child ResourceTypes of this ResourceType.

Returns:
the list of ResourceSubCategory's which have been defined on this ResourceType

setChildSubCategories

public void setChildSubCategories(List<ResourceSubCategory> subCategories)
Sets the List of child ResourceSubCategorys for this ResourceType.

Parameters:
subCategories - the List of ResourceSubCategory's for this ResourceType

addChildSubCategory

public void addChildSubCategory(ResourceSubCategory subCategory)
Adds a child ResourceSubCategory to the List which has been defined on this ResourceType.


compareTo

public int compareTo(ResourceType that)
Specified by:
compareTo in interface Comparable<ResourceType>

getHelpText

public String getHelpText()

setHelpText

public void setHelpText(String helpText)

getClassLoaderType

public ClassLoaderType getClassLoaderType()

setClassLoaderType

public void setClassLoaderType(ClassLoaderType classLoaderType)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

toString

public String toString()
Overrides:
toString in class Object

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Specified by:
writeExternal in interface Externalizable
Throws:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Specified by:
readExternal in interface Externalizable
Throws:
IOException
ClassNotFoundException

writeExternalAgent

public void writeExternalAgent(ObjectOutput out)
                        throws IOException
Throws:
IOException

readExternalAgent

public void readExternalAgent(ObjectInput in)
                       throws IOException,
                              ClassNotFoundException
Throws:
IOException
ClassNotFoundException

writeExternalRemote

public void writeExternalRemote(ObjectOutput out)
                         throws IOException
Throws:
IOException

readExternalRemote

public void readExternalRemote(ObjectInput in)
                        throws IOException,
                               ClassNotFoundException
Throws:
IOException
ClassNotFoundException


Copyright © 2008-2009 RHQ Project Advisory Board (Red Hat, Inc.). All Rights Reserved.