java.lang.Object com.ibm.broker.config.proxy.DeploymentDescriptor
public class DeploymentDescriptor
extends Object
Represents a deployment descriptor. While a deployment descriptor is not deployable in itself, it is used to override properties of message flows inside a broker archive file.
To manipulate deployment descriptors programatically, you must first either create one from scratch or load the existing file from the broker archive:
BarFile b = BarFile.loadBarFile("C:\\MyBars\\test.bar"); DeploymentDescriptor d = new DeploymentDescriptor(); // [modify d here] b.setDeploymentDescriptor(d); b.save();or
BarFile b = BarFile.loadBarFile("C:\\MyBars\\test.bar"); DeploymentDescriptor d = b.getDeploymentDescriptor(); // [modify d here] b.save();
A number of methods in this class require a property identifier to be supplied. Property identifiers are a way of addressing a specific property that exists within a specific flow inside the Bar file. The format of the property identifier is FLOWNAME#NODENAME.PROPERTYNAME (FLOWNAME#PROPERTYNAME for message flow properties), where the '#' is the value of FLOW_NODE_DELIMITER, and the '.' is the value of NODE_PROPERTY_DELIMITER. However, unless you are creating a deployment descriptor from scratch it is normally possible to discover the available property identifiers using the getPropertyNames() and getOverriddenPropertyNames() methods.
The active deployment descriptor for a BarFile is always found in the Bar file's META-INF directory as the file 'broker.xml'. Manipulating the deployment descriptor implies manipulating this file. Changes are only persisted to the local filesystem if the BarFile.save() or BarFile.saveAs() is called.
com.ibm.broker.config.proxy.DeploymentDescriptor
|
|
Responsibilities | A representation of a deployment descriptor. Provides the ability to change values in the deployment descriptor |
Internal Collaborators | None |
Change Activity: -------- ----------- ------------- ------------------------------------ Reason: Date: Originator: Comments: -------- ----------- ------------- ------------------------------------ 45166 2007-06-05 HDMPL v6.1 Release
Field | Description |
---|---|
copyright | IBM Copyright |
FLOW_NODE_DELIMITER | The String that separates the flow name from the node name inside property identifiers. |
NODE_PROPERTY_DELIMITER | The String that separates the node name from the property name inside property identifiers. |
sccsid | Version information |
Constructor | Description |
---|---|
DeploymentDescriptor() | Instantiates a blank DeploymentDescriptor object with no overridden properties. |
DeploymentDescriptor(InputStream) | Instantiates a new DeploymentDescriptor object that describes the deployment descriptor file with the supplied contents. |
Method | Description |
---|---|
InputStream getContents() | Returns the deployment descriptor physical format as an InputStream |
Document getDeploymentDescriptorXML() | Returns the raw XML document that describes the contents of the deployment descriptor. |
String getFilename() | Returns the static name of the deployment descriptor file, as it appears in the BAR file. |
Enumeration getOverriddenPropertyIdentifiers() | Returns an Enumeration of all the fully-qualified property identifiers that have been overridden in this deployment descriptor. |
String getOverride(String) | Returns the current value of an override given a fully-qualified property identifier. |
Enumeration getPropertyIdentifiers() | Returns an Enumeration of all the fully-qualified property identifiers that are described in this deployment descriptor, regardless of whether they have been overridden. |
int replacePropertyValue(String, String) | Sets or removes an override property in the deployment descriptor. |
void setOverride(String, String) | Sets or removes an override property in the deployment descriptor. |
protected static final java.lang.String copyrightIBM Copyright
public static final java.lang.String FLOW_NODE_DELIMITERThe String that separates the flow name from the node name inside property identifiers.
public static final java.lang.String NODE_PROPERTY_DELIMITERThe String that separates the node name from the property name inside property identifiers.
protected static final java.lang.String sccsidVersion information
public DeploymentDescriptor()Instantiates a blank DeploymentDescriptor object with no overridden properties.
public DeploymentDescriptor(InputStream inputStream) throws SAXException, ParserConfigurationException, IOExceptionInstantiates a new DeploymentDescriptor object that describes the deployment descriptor file with the supplied contents.
- Parameters
- inputStream - Intended contents of the deployment descriptor
- Throws
SAXException
if the deployment descriptor XML document is invalid- Throws
ParserConfigurationException
if there is a problem with the XML parser- Throws
IOException
if the deployment descriptor could not be read
public InputStream getContents()Returns the deployment descriptor physical format as an InputStream
- Returns
- InputStream contents of the deployment descriptor
public Document getDeploymentDescriptorXML()Returns the raw XML document that describes the contents of the deployment descriptor. It is not usually necessary to call this method; use the other public methods in this class to manipulate the deployment descriptor more easily.
- Returns
- Document
public String getFilename()Returns the static name of the deployment descriptor file, as it appears in the BAR file.
- Returns
- String
public Enumeration getOverriddenPropertyIdentifiers()Returns an Enumeration of all the fully-qualified property identifiers that have been overridden in this deployment descriptor.
- Returns
- Enumeration Fully qualified property identifiers
public String getOverride(String propertyIdentifier)Returns the current value of an override given a fully-qualified property identifier. If the property whose name has been supplied has not been overridden in the deployment descriptor, null is returned. (This just means that the property has not been overridden; the property may still have been defined in the message flow.)
- Parameters
- propertyIdentifier - Name of the property whose override value is required
- Returns
- String value of the overridden property
public Enumeration getPropertyIdentifiers()Returns an Enumeration of all the fully-qualified property identifiers that are described in this deployment descriptor, regardless of whether they have been overridden.
The number of property identifiers returned by this method depends on the way the the deployment descriptor was generated. Deployment descriptors generated by the Message Brokers Toolkit will contain a complete set of overridable properties for each flow in the Bar file. Deployment descriptors created programatically using the empty constructor will not list any overridable properties unless they have been set manually.
- Returns
- Enumeration of fully qualified property identifer Strings.
public int replacePropertyValue(String oldPropertyValue, String newPropertyValue)Sets or removes an override property in the deployment descriptor.
This method will attempt to find any values of the supplied oldPropertyValue parameter as a property value in the deployment descriptor (e.g. "OLD_QUEUE_NAME").
All occurrences of the old property value will be replaced with the newPropertyValue unless newPropertyValue is null, in which case this method removes any overrides that are found.
Changes to the deployment descriptor are not saved to the local filesystem unless BarFile.save() or BarFile.saveAs() is called.
- Parameters
- oldPropertyValue - The old property value to override
- newPropertyValue - New value to assign to the override
- Returns
- int The number of occurrences that were replaced or removed.
public void setOverride(String propertyIdentifier, String newPropertyValue) throws IllegalArgumentExceptionSets or removes an override property in the deployment descriptor.
This method will attempt to override a property whose fully-qualified name is the value of propertyIdentifier (e.g. "sampleFlow#MQOutput.queueManagerName"). If the property had not previously been overridden, then a new override is added to the deployment descriptor.
If the value of newPropertyValue is null, this method removes the first override that is found after following the above algorithm. This means that the property value specified in the message flow definition will be used.
Changes to the deployment descriptor are not saved to the local filesystem unless BarFile.save() or BarFile.saveAs() is called.
- Parameters
- propertyIdentifier - The fully-qualified identifier of the property to override
- newPropertyValue - New value to assign to the override.
- Throws
IllegalArgumentException
if the value of propertyIdentifier was not in the correct format.