org.rhq.core.pluginapi.inventory
Interface CreateChildResourceFacet


public interface CreateChildResourceFacet

Components that implement this facet have defined at least one of its child resources is creatable. Calls to create any of the child resource types will be fielded by implementations of this interface.


Method Summary
 CreateResourceReport createResource(CreateResourceReport report)
          Creates a new resource.
 

Method Detail

createResource

CreateResourceReport createResource(CreateResourceReport report)

Creates a new resource. The report will contain all of the information necessary to configure the resource and have it begin to function. If this call indicates success, the resource should be picked up by the next discovery performed against the plugin.

There are two different approaches to creating a resource, requiring either a set of configuration values for the new resource or an artifact. The following description of how to interpret the status codes applies in both cases. Implementers of this method should set the status code on the report appropriately and return the instance at the end of the call.

If the plugin was unable to create the resource for some reason, the report object will be returned with its status set to CreateResourceStatus.FAILURE. More detail on the failure should be specified in the report's error message. Additionally, if a configuration was specified as part of the resource creation, it is possible one or more of the values failed plugin-side validation. In this case, the Configuration inside the report should reflect the failed validations.

If everything was successful (that is, the resource was created and was fully configured with the given set of configuration values), then the returned report will indicate a CreateResourceStatus.SUCCESS. Note that the returned report will not have the new resource in it - that will be picked up in the next auto-discovery run (which should be kicked off automatically by this method).

Note that this method should not throw any exceptions. Any error conditions encountered should be indicated in the report object through the status code and error message (as well as the configuration instance if applicable).

Prior to returning the report, the following should be set:

Parameters:
report - contains all of the necessary information to create the specified resource and should be populated with the
Returns:
report specified in the call, with its status code updated to reflect the result of the create, along with any error messages if applicable


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