org.rhq.enterprise.server.xmlschema
Class ServerPluginDescriptorMetadataParser

java.lang.Object
  extended by org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorMetadataParser

public class ServerPluginDescriptorMetadataParser
extends Object

Provides methods to parse the server plugin descriptors.

Author:
John Mazzitelli

Constructor Summary
ServerPluginDescriptorMetadataParser()
           
 
Method Summary
static List<ControlDefinition> getControlDefinitions(ServerPluginDescriptorType descriptor)
          Returns the list of all defined control operations.
static String getFullyQualifiedClassName(ServerPluginDescriptorType descriptor, String className)
          Given a plugn descriptor that may or may not have defined a package name, this converts the given class name to a fully qualified class name.
static String getPluginComponentClassName(ServerPluginDescriptorType descriptor)
          Returns the fully qualified class name of the plugin component.
static org.rhq.core.domain.configuration.definition.ConfigurationDefinition getPluginConfigurationDefinition(ServerPluginDescriptorType descriptor)
          Returns the global configuration definition for the plugin.
static List<ScheduledJobDefinition> getScheduledJobs(org.rhq.core.domain.configuration.Configuration scheduledJobsConfig)
          Given a configuration, this will return any scheduled jobs that are defined in it.
static List<ScheduledJobDefinition> getScheduledJobs(ServerPluginDescriptorType descriptor)
          Given a descriptor, this will parse it and return any scheduled jobs that it finds.
static org.rhq.core.domain.configuration.definition.ConfigurationDefinition getScheduledJobsDefinition(ServerPluginDescriptorType descriptor)
          Returns the scheduled jobs configuration definition for the plugin.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ServerPluginDescriptorMetadataParser

public ServerPluginDescriptorMetadataParser()
Method Detail

getPluginComponentClassName

public static String getPluginComponentClassName(ServerPluginDescriptorType descriptor)
Returns the fully qualified class name of the plugin component. If the descriptor did not define a plugin component, this will return null.

Parameters:
descriptor -
Returns:
the name of the plugin component class, or null if not specified

getFullyQualifiedClassName

public static String getFullyQualifiedClassName(ServerPluginDescriptorType descriptor,
                                                String className)
Given a plugn descriptor that may or may not have defined a package name, this converts the given class name to a fully qualified class name. If the descriptor does not define a package name, this method does nothing and returns className unchanged. If className contains at least one "." character, it is assumed to be already fully qualified and so it will be returned unchanged. If className has no "." characters, and the descriptor defines a package name, that package name will prefix the given class name and will form the fully qualified class name that is returned.

Parameters:
descriptor - a plugin descriptor that may or may not define a package name
className - a classname that may or may not be fully qualified
Returns:
the fully qualified class name or null if className is null

getControlDefinitions

public static List<ControlDefinition> getControlDefinitions(ServerPluginDescriptorType descriptor)
                                                     throws Exception
Returns the list of all defined control operations. If there are no controls, an empty list is returned.

Parameters:
descriptor -
Returns:
list of control operations defined in the descriptor
Throws:
Exception - if the plugin descriptor was invalid

getPluginConfigurationDefinition

public static org.rhq.core.domain.configuration.definition.ConfigurationDefinition getPluginConfigurationDefinition(ServerPluginDescriptorType descriptor)
                                                                                                             throws Exception
Returns the global configuration definition for the plugin. This does not include any scheduled job information - see getScheduledJobs(ServerPluginDescriptorType) for that.

Parameters:
descriptor -
Returns:
the plugin configuration definition, or null if the descriptor did not define plugin config.
Throws:
Exception - if the plugin descriptor was invalid

getScheduledJobsDefinition

public static org.rhq.core.domain.configuration.definition.ConfigurationDefinition getScheduledJobsDefinition(ServerPluginDescriptorType descriptor)
                                                                                                       throws Exception
Returns the scheduled jobs configuration definition for the plugin. Use getScheduledJobs(ServerPluginDescriptorType) to return a list of a more strongly typed jobs object, as opposed to a generic configuration definition.

Parameters:
descriptor -
Returns:
the scheduled jobs configuration definition, or null if the descriptor did not define plugin config.
Throws:
Exception - if the plugin descriptor was invalid

getScheduledJobs

public static List<ScheduledJobDefinition> getScheduledJobs(ServerPluginDescriptorType descriptor)
                                                     throws Exception
Given a descriptor, this will parse it and return any scheduled jobs that it finds. This essentially gives you a list of the pre-defined jobs, prior to a user customizing them with their own settings.

Parameters:
descriptor -
Returns:
list of jobs that are defined, will be empty if no jobs are defined.
Throws:
Exception - if the plugin descriptor was invalid

getScheduledJobs

public static List<ScheduledJobDefinition> getScheduledJobs(org.rhq.core.domain.configuration.Configuration scheduledJobsConfig)
                                                     throws Exception
Given a configuration, this will return any scheduled jobs that are defined in it. This essentially gives you a list of the jobs that may be different from the descriptor's pre-defined jobs due to a user customizing them with their own settings.

Parameters:
jobsConfig - the configuration with the scheduled job information
Returns:
list of jobs that are defined, will be empty if no jobs are defined.
Throws:
Exception - if the configuration was invalid


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.