public class DeploymentDescriptor
extends java.lang.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 51619.8 2008-12-16 HDMPL v7 Release (no changes) 80006 2012-04-26 HDCAB v8 release: Added DeploymentDescriptor(String fileName) constructor Added getSourceFilename()
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
FLOW_NODE_DELIMITER
The String that separates the flow name from the node name inside property identifiers.
|
static java.lang.String |
NODE_PROPERTY_DELIMITER
The String that separates the node name from the property name inside property identifiers.
|
Constructor and Description |
---|
DeploymentDescriptor()
Instantiates a blank DeploymentDescriptor object with no overridden
properties.
|
DeploymentDescriptor(java.io.InputStream inputStream)
Instantiates a new DeploymentDescriptor object that describes the
deployment descriptor file with the supplied contents.
|
DeploymentDescriptor(java.lang.String fileName)
Instantiates a new DeploymentDescriptor object that describes the
deployment descriptor file from the named fileName.
|
Modifier and Type | Method and Description |
---|---|
java.io.InputStream |
getContents()
Returns the deployment descriptor physical format as an InputStream
|
org.w3c.dom.Document |
getDeploymentDescriptorXML()
Returns the raw XML document that describes the contents of
the deployment descriptor.
|
java.lang.String |
getFilename()
Returns the static name of the deployment descriptor file, as it appears
in the Bar file.
|
java.util.Enumeration<java.lang.String> |
getOverriddenPropertyIdentifiers()
Returns an Enumeration of all the fully-qualified
property identifiers that have been overridden in this
deployment descriptor.
|
java.lang.String |
getOverride(java.lang.String propertyIdentifier)
Returns the current value of an override given a fully-qualified
property identifier.
|
java.util.Enumeration<java.lang.String> |
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.
|
java.lang.String |
getSourceFilename()
Returns the name of the source deployment descriptor file
that was used to construct this DeploymentDescriptor.
|
int |
replacePropertyValue(java.lang.String oldPropertyValue,
java.lang.String newPropertyValue)
Sets or removes an override property in the deployment descriptor.
|
void |
setOverride(java.lang.String propertyIdentifier,
java.lang.String newPropertyValue)
Sets or removes an override property in the deployment descriptor.
|
public static final java.lang.String FLOW_NODE_DELIMITER
public static final java.lang.String NODE_PROPERTY_DELIMITER
public DeploymentDescriptor(java.io.InputStream inputStream) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
inputStream
- Intended contents of the deployment descriptororg.xml.sax.SAXException
- if the deployment descriptor XML document
is invalidjavax.xml.parsers.ParserConfigurationException
- if there is a
problem with the XML parserjava.io.IOException
- if the deployment descriptor could not be readpublic DeploymentDescriptor()
public DeploymentDescriptor(java.lang.String fileName) throws org.xml.sax.SAXException, javax.xml.parsers.ParserConfigurationException, java.io.IOException
fileName
- the name of the file that contains a
deployment descriptororg.xml.sax.SAXException
- if the deployment descriptor XML document
is invalidjavax.xml.parsers.ParserConfigurationException
- if there is a
problem with the XML parserjava.io.IOException
- if the deployment descriptor could not be readpublic java.lang.String getFilename()
public java.lang.String getSourceFilename()
public java.io.InputStream getContents()
public void setOverride(java.lang.String propertyIdentifier, java.lang.String newPropertyValue) throws java.lang.IllegalArgumentException
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.
propertyIdentifier
- The fully-qualified identifier of the property
to overridenewPropertyValue
- New value to assign to the override.java.lang.IllegalArgumentException
- if the value of propertyIdentifier was not in
the correct format.public int replacePropertyValue(java.lang.String oldPropertyValue, java.lang.String newPropertyValue)
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.
oldPropertyValue
- The old property value to overridenewPropertyValue
- New value to assign to the overridepublic java.lang.String getOverride(java.lang.String propertyIdentifier)
propertyIdentifier
- Name of the property whose override value
is requiredpublic java.util.Enumeration<java.lang.String> getOverriddenPropertyIdentifiers()
public java.util.Enumeration<java.lang.String> getPropertyIdentifiers()
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 Broker 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.
public org.w3c.dom.Document getDeploymentDescriptorXML()