The model classes are primarily used in the core component (the pineapple-core project) to load configuration data from schema based XML files.
The plugin framework interfaces are implemented by plugins and used by the core component at runtime to handle the execution of plugins.
The schema supports transport of a sequence of execution results which represents the order of which event took place at an agent.
The model mapper class com.alpha.pineapple.model.ExecutionResultMapperImpl which implements the interface ExecutionResultMapper supports mapping of execution results to/from XML conforming to the schema.
Plugin framework reference
This guide describes the plugin framework and how to implement plugins.
Execution framework reference
This guide describes the execution framework and how to use it in plugins, commands and clients.
The project contains these classes for internationalization:
Interface for message providers which supports resolution of resource bundle messages.
The message provider supports resolution of compound messages. Parameters are defined in a compound text message in resource bundles by a brace which encloses an integer, starting from zero, e.g. {0}. When a message is resolved the parameters are supplied by an object array where the first value is substituted with {0} in the message and so forth. For more information abound compound messages consult the Java I18N documentation.
Messages are looked up with the getMessage(..) methods, either no no parameters:
String message = someProvider.getMessage( "myclass.success" );
or with an object array which includes the parameters which is substituted in the message:
Object[] args = { "XXX", "YYY", "ZZZ" String message = someProvider.getMessage( "myclass.another_success", args );
Implementation of the MessageProvider interface which loads messages from a property file using the JDK PropertyResourceBundle implementation.
An instance is created with the no-arg constructor and the initialized with the setBasename(String basename) method which accepts the base name of the resource bundle:
MessageProvider provider = new PropertyFileMessageProviderImpl(); ((PropertyFileMessageProviderImpl) provider).setBasename("advisor");
..at which point the provider will try to load the property file named advisor.properties from the class path.
Another example which illustrates the recommended naming scheme for resource bundle in Pineapple:
MessageProvider provider = new PropertyFileMessageProviderImpl(); ((PropertyFileMessageProviderImpl) provider).setBasename("com.alpha.pineapple.plugin.wbem-messages");
..at which point the provider will try to load the property file named com.alpha.pineapple.plugin.wbem-messages.properties from the class path.
The project contains the helper classes:
The class is used to provide map oriented access to the properties defined by the Resource class.
To use the class, start by creating an instance which wraps a Resource instance:
ResourcePropertyGetter getter = new ResourcePropertyGetter(); getter.setResource(resource);
To query whether a property exists invoke containsProperty(..):
boolean exists = getter.containsProperty( "my-property" );
To get the value of a property invoke getProperty(..):
String value = getter.getProperty( "my-property" );
If the property has multiple values defined, then the values are returned as a comma separated list. If a property isn't defined in the Resource then invocation of getProperty(..) will throw a ResourceException.