Hyperic HQ Plugin API v. 4.4.0.2

org.hyperic.hq.product
Class TypeBuilder

java.lang.Object
  extended by org.hyperic.hq.product.TypeBuilder

public class TypeBuilder
extends java.lang.Object

Simple helper class to help keep plugin entity names consistent. This class supports adding one server, and its child services. This class also supports adding multiple versions of the same server. Typically, the plugin developer uses the default PLATFORM_NAMES for the list of platforms supported by a given server. The plugin developer can specify her own list of supported platforms.

Since:
1.0
Version:
1.0

Field Summary
static java.lang.String[] ALL_PLATFORM_NAMES
           
static java.lang.String NO_VERSION
          Version will be excluded from composed server name.
static java.lang.String[] UNIX_PLATFORM_NAMES
           
static java.lang.String[] WIN32_PLATFORM_NAMES
           
 
Constructor Summary
TypeBuilder()
           
TypeBuilder(java.lang.String serverName, java.lang.String serverDesc)
          Create a server type for use on all supported platforms
TypeBuilder(java.lang.String serverName, java.lang.String serverDesc, java.lang.String[] platforms)
          use this constructor for specifying a list of supported platforms.
 
Method Summary
 boolean add(TypeInfo type)
           
 PlatformTypeInfo addPlatform(java.lang.String name)
           
 ServerTypeInfo addServer(ServerTypeInfo server, java.lang.String[] platforms)
          Add a ServerTypeInfo clone of the given server, changing valid platforms to the given platforms.
 ServerTypeInfo addServer(java.lang.String version)
          This method creates a ServerTypeInfo and adds this object to the entity list using a version string.
 ServerTypeInfo addServer(java.lang.String name, java.lang.String version)
          This method creates a ServerTypeInfo and adds this object to the entity list using a version string.
 ServerTypeInfo addServer(java.lang.String name, java.lang.String version, java.lang.String[] platforms)
           
 ServerTypeInfo addServerAndServices(ServerTypeInfo server, java.lang.String[] platforms)
          Add a ServerTypeInfo clone of the given server, changing valid platforms to the given platforms.
 ServiceTypeInfo addService(ServerTypeInfo server, java.lang.String name)
          This method creates a deployed (non-internal) ServiceTypeInfo object and adds it services to the entity list
 void addServices(ServerTypeInfo fromServer, ServerTypeInfo toServer)
          Clone all services from an existing server.
 void addServices(ServerTypeInfo server, java.lang.String[] services)
          This method adds a list of services to the this.entity list.
 void addServices(ServerTypeInfo server, java.lang.String[] deployedServices, java.lang.String[] internalServices)
          This method adds a list of internal and deployed services to the this.entity.
static java.lang.String composePlatformTypeName(java.lang.String name, java.lang.String platformName)
           
static java.lang.String composeServerTypeName(java.lang.String name, java.lang.String version)
           
static java.lang.String composeServiceTypeName(java.lang.String serverName, java.lang.String serviceName)
          Given a serverName and a serviceName, return the name of the service type.
 TypeInfo[] getTypes()
          This method returns a list of server/service added to this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_VERSION

public static final java.lang.String NO_VERSION
Version will be excluded from composed server name.

See Also:
Constant Field Values

ALL_PLATFORM_NAMES

public static final java.lang.String[] ALL_PLATFORM_NAMES

WIN32_PLATFORM_NAMES

public static final java.lang.String[] WIN32_PLATFORM_NAMES

UNIX_PLATFORM_NAMES

public static final java.lang.String[] UNIX_PLATFORM_NAMES
Constructor Detail

TypeBuilder

public TypeBuilder()

TypeBuilder

public TypeBuilder(java.lang.String serverName,
                   java.lang.String serverDesc)
Create a server type for use on all supported platforms

Parameters:
serverName - name of the server
serverDesc - server description

TypeBuilder

public TypeBuilder(java.lang.String serverName,
                   java.lang.String serverDesc,
                   java.lang.String[] platforms)
use this constructor for specifying a list of supported platforms.

Parameters:
serverName - name of the server
serverDesc - server description
Method Detail

addPlatform

public PlatformTypeInfo addPlatform(java.lang.String name)

addServer

public ServerTypeInfo addServer(java.lang.String version)
This method creates a ServerTypeInfo and adds this object to the entity list using a version string.

Parameters:
version - version of the server
Returns:
ServerTypeInfo

addServer

public ServerTypeInfo addServer(java.lang.String name,
                                java.lang.String version)
This method creates a ServerTypeInfo and adds this object to the entity list using a version string.

Parameters:
name - name of the server
version - version of the server
Returns:
ServerTypeInfo

addServer

public ServerTypeInfo addServer(java.lang.String name,
                                java.lang.String version,
                                java.lang.String[] platforms)

addServer

public ServerTypeInfo addServer(ServerTypeInfo server,
                                java.lang.String[] platforms)
Add a ServerTypeInfo clone of the given server, changing valid platforms to the given platforms.

Parameters:
server - Server type to clone.
platforms - Platforms supported by the server clone.
Returns:
The cloned server with valid platforms updated.

addServices

public void addServices(ServerTypeInfo server,
                        java.lang.String[] services)
This method adds a list of services to the this.entity list. All the services added through this method will be marked with the internal flag set to false

Parameters:
server - the server the services belong to
services - a list of services names to add

addServices

public void addServices(ServerTypeInfo server,
                        java.lang.String[] deployedServices,
                        java.lang.String[] internalServices)
This method adds a list of internal and deployed services to the this.entity.

Parameters:
server -
deployedServices -
internalServices -

addServices

public void addServices(ServerTypeInfo fromServer,
                        ServerTypeInfo toServer)
Clone all services from an existing server.

Parameters:
fromServer - Server from which to clone services.
toServer - Server to which the clones services are tied.

addService

public ServiceTypeInfo addService(ServerTypeInfo server,
                                  java.lang.String name)
This method creates a deployed (non-internal) ServiceTypeInfo object and adds it services to the entity list

Parameters:
server - server which the server belongs to
name - name of the service
Returns:
ServiceTypeInfo

composeServiceTypeName

public static java.lang.String composeServiceTypeName(java.lang.String serverName,
                                                      java.lang.String serviceName)
Given a serverName and a serviceName, return the name of the service type. This procedure is abstracted out into this method because it needs to be reused in runtime discovery.


composeServerTypeName

public static java.lang.String composeServerTypeName(java.lang.String name,
                                                     java.lang.String version)

composePlatformTypeName

public static java.lang.String composePlatformTypeName(java.lang.String name,
                                                       java.lang.String platformName)

addServerAndServices

public ServerTypeInfo addServerAndServices(ServerTypeInfo server,
                                           java.lang.String[] platforms)
Add a ServerTypeInfo clone of the given server, changing valid platforms to the given platforms. Clone all services from the given server.

Parameters:
server - Server to clone
platforms - Supported platforms of the server clone
See Also:
addServer(ServerTypeInfo server,String[] platforms), addServices(ServerTypeInfo fromServer,ServerTypeInfo toServer)

getTypes

public TypeInfo[] getTypes()
This method returns a list of server/service added to this object.

Returns:
a list of TypeInfo objects.

add

public boolean add(TypeInfo type)

Hyperic HQ Plugin API v. 4.4.0.2

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