ProfileService DeploymentTemplates

A DeploymentTemplate is a server-side template for creating a DeploymentContext given a set of ManagedProperty representing the template properties to set in the resulting deployment.


A DeploymentTemplateInfo contains a set of ManagedProperties used to create the template. The DeploymentTemplate itself creates the deployment based on the properties.



The deploymentTemplate contains:

  • name: the name of the corresponding deployment template
  • description: a description about the deployment template
  • properties: the avaiable managed properties for this template
public interface DeploymentTemplateInfo
   String getName();

   String getDescription();

   Map<String, ManagedProperty> getProperties();


The server-side template will create a deployment based on the properties from the template info. The templates will be regisered in the ManagementView and can be used over the deployment template related operations exposed by the ManagementView:


public interface ManagementView

   // ...

    * Get the registered DeploymentTemplate names.
    * @return the template names
   Set<String> getTemplateNames();

    * Get a deployment template.
    * @param name - the deployment name to identify the template to retrieve
    * @return the named DeploymentTemplate
    * @throws NoSuchDeploymentException - if there is no such template
   DeploymentTemplateInfo getTemplate(String name)
      throws NoSuchDeploymentException;

    * Create a deployment based on the given DeploymentTemplateInfo.
    * @param deploymentBaseName the base name
    * @param info the deployment template info
    * @throws Exception
   void applyTemplate(String deploymentBaseName, DeploymentTemplateInfo info)
       throws Exception;

   // ...



Example usage
// The queue names
String name = "testQueueTemplate";
String jndiName = name + "JndiName";
// Get the queue deployment template
ManagementView mgtView = getManagementView();
DeploymentTemplateInfo info = mgtView.getTemplate("QueueTemplate");
// Update the template values

// Create the deployment
mgtView.applyTemplate(jndiName, info);
// Get the created managed component
ComponentType type = KnownComponentTypes.JMSDestination.Queue.getType();
ManagedComponent queue = mgtView.getComponent(jndiName, type);

This example will create a testQueueTemplate-service.xml deployment in the deploy/ folder containing a simple JMSQueue with the name "testQueueTemplate" and the JndiName "testQueueTemplateJndiName".