public class LocalBrokerUtilities
extends java.lang.Object
A collection of static utilities for querying and configuring local brokers and Message Broker runtime installations.
com.ibm.broker.config.proxy.LocalBrokerUtilities
|
|
Responsibilities | A collection of static utilities for querying and configuring local brokers and Message Broker runtime installations. |
Internal Collaborators | None |
Change Activity: -------- ----------- ------------- ------------------------------------ Reason: Date: Originator: Comments: -------- ----------- ------------- ------------------------------------ 55019 2009-06-22 HDMPL v7 Release 61433 2011-06-23 HDCAB v8 Release - added getAllLocalBrokerInstallations() - added getNumberOfLocalBrokerInstallations()
Constructor and Description |
---|
LocalBrokerUtilities() |
Modifier and Type | Method and Description |
---|---|
static void |
cacheBroker(java.lang.String brokerName)
Pre-loads configuration information for the broker with the supplied
name, for use by subsequent LocalBrokerUtilities method invocations.
|
static void |
clearCache()
Removes any information that the IBM Integration API (CMP)
application has cached relating to local brokers.
|
static java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> |
getAllLocalBrokerInstallLocations()
Returns a HashMap that describes the installation locations
of all the IBM Integration Bus and WebSphere Message Broker
installations on the local machine.
|
static java.lang.String |
getBrokerHAEnabledWorkPath(java.lang.String brokerName)
Returns the shared work-path for a multi-instance broker that
is enabled for high availability support.
|
static int |
getLocalBrokerFAD(java.lang.String brokerName)
Returns the value of the formats and data (FAD) level for the broker with the supplied name.
|
static java.util.HashMap<java.lang.String,java.lang.String> |
getLocalBrokerInstallLocations()
Returns a HashMap that describes the first installation
locations of all the IBM Integration Bus and WebSphere Message
Broker versions on the local machine.
|
static java.lang.String[] |
getLocalBrokerNames()
Returns a String array containing the names of all the brokers
that have been defined on the current machine.
|
static java.lang.String[] |
getLocalBrokerNames(int minFAD,
int maxFAD)
Returns a String array containing the names of all the brokers
within the supplied formats and data (FAD) range,
that have been defined on the local machine.
|
static int |
getLocalBrokerPID(java.lang.String brokerName)
Returns the process identifier (PID) of the local broker with the supplied name.
|
static java.lang.String |
getLocalBrokerQueueManagerName(java.lang.String brokerName)
Returns the queue manager associated with the locally defined broker of the supplied name.
|
static java.lang.String |
getLocalBrokerWindowsRegistryPath()
Returns the value of the Windows registry path root, which holds all
of the configuration information for all brokers on a Windows system.
|
static java.lang.String |
getLocalBrokerWorkpath(java.lang.String brokerName)
Returns the value of any non-default workpath for the broker with the supplied name.
|
static int |
getNumberOfLocalBrokerInstallLocations()
Returns the total number of IBM Integration Bus and WebSphere
Message Broker installations on the local machine.
|
static java.lang.String |
getVersionFromFAD(int fadLevel)
Returns a version identifier given a supplied FAD level.
|
static boolean |
isBrokerHAEnabled(java.lang.String brokerName)
Returns a boolean value that indicates whether the broker is
configured as multi-instance (for high availability support).
|
static boolean |
isHABrokerQMgrInActiveMode(java.lang.String brokerName)
Returns a boolean value that indicates whether a
multi-instance broker is running in Active mode
|
static boolean |
isHABrokerQMgrInStandByMode(java.lang.String brokerName)
Returns a boolean value that indicates whether a
multi-instance broker is running in Standby mode
|
static boolean |
isHABrokerStartedAsMQService(java.lang.String brokerName)
Returns true if a multi-instance broker will start as an MQ
Service .
|
static void |
saveLocalBrokerRegistry(java.lang.String brokerName,
java.util.zip.ZipOutputStream zos)
Writes to the supplied ZipOutputStream a copy of the
registry that describes the configuration of the broker with
the supplied name.
|
static void |
setBrokerHAEnabledWorkPath(java.lang.String brokerName,
java.lang.String newHAWorkPath)
Sets the value of the shared workpath for the multi-instance
broker with the supplied name.
|
static void |
setLocalBrokerWorkpath(java.lang.String brokerName,
java.lang.String newWorkPath)
Sets the value of the workpath for the broker with the supplied name.
|
public static java.lang.String[] getLocalBrokerNames() throws ConfigManagerProxyLoggedException
ConfigManagerProxyLoggedException
- if the list of brokers could not be readpublic static java.lang.String[] getLocalBrokerNames(int minFAD, int maxFAD) throws ConfigManagerProxyLoggedException
minFAD
- Minimum FAD level of brokers to return.
Use -1 to signify no minimum FAD limit.maxFAD
- Maximum FAD level of brokers to return.
Use -1 to signify no maximum FAD limit.ConfigManagerProxyLoggedException
- if the list of brokers could not be readpublic static java.lang.String getLocalBrokerWorkpath(java.lang.String brokerName) throws java.io.IOException
If the value of the workpath is the installation-wide default, null is returned. If a broker of the supplied name cannot be found, an IO exception will be thrown. The broker need not be running in order for this method to succeed.
brokerName
- name of a locally defined brokerjava.io.IOException
- if the broker's configuration could not be readpublic static void setLocalBrokerWorkpath(java.lang.String brokerName, java.lang.String newWorkPath) throws java.io.IOException
brokerName
- name of a locally defined brokernewWorkPath
- new workpathjava.io.IOException
- if the broker's configuration could not be writtenpublic static java.lang.String getLocalBrokerWindowsRegistryPath() throws java.io.IOException
If this method is called on non-Windows platforms or the windows registry cannot be located, null is returned.
java.io.IOException
- if the broker's configuration could not be readpublic static void clearCache()
public static void cacheBroker(java.lang.String brokerName)
If a broker of the supplied name cannot be found, this method does nothing.
brokerName
- Name of the broker whose
configuration is to be cached.public static int getLocalBrokerFAD(java.lang.String brokerName) throws java.io.IOException
If a broker of the supplied name cannot be found, an IOException will be thrown. The broker need not be running in order for this method to succeed.
brokerName
- name of a locally defined brokerjava.io.IOException
- if the broker's configuration could not be read or if the
broker does not exist.public static java.lang.String getVersionFromFAD(int fadLevel)
The format of the returned string is "V.R.M.F" which denotes the version identifier for brokers of the supplied FAD. Right-most characters will be omitted if the supplied FAD can correspond to more than one level. For example, if fadLevel is '4' the returned String is "6.1", as this FAD can be used to describe brokers at any 6.1.x.x version.
If the supplied FAD does not correspond to a level known by this level of IBM Integration API (CMP), this method returns the empty string.
For more detailed version information, connect to the broker and use BrokerProxy.getBrokerVersion() or BrokerProxy.getBrokerLongVersion().
fadLevel
- int describing a FAD levelpublic static java.lang.String getLocalBrokerQueueManagerName(java.lang.String brokerName) throws java.io.IOException
If a broker of the supplied name cannot be found, an IOException will be thrown. The broker need not be running in order for this method to succeed.
brokerName
- name of a locally defined brokerjava.io.IOException
- if the broker's configuration could not be read or if the
broker does not exist.public static boolean isHABrokerStartedAsMQService(java.lang.String brokerName) throws java.io.IOException
brokerName
- name of a locally defined brokerjava.io.IOException
- if the broker's configuration could not be read or if the
broker does not exist.public static int getLocalBrokerPID(java.lang.String brokerName) throws java.io.IOException
This method returns the PID of the broker's controlling process ("bipbroker"). If this process terminates uncleanly, this method might then return a non-zero value even though the broker is no longer running. For additional confirmation that the broker is running, you could correlate the returned PID with tasklist (on Windows) or ps (on UNIX) to ensure that a process with the returned PID is still running, and has a task name of "bipbroker".
The broker need not be running in order for this method to succeed. However, if a broker of the supplied name cannot be found, an IOException will be thrown.
brokerName
- name of a locally defined brokerjava.io.IOException
- if the broker's configuration could not be read or if the
broker does not exist.public static void saveLocalBrokerRegistry(java.lang.String brokerName, java.util.zip.ZipOutputStream zos) throws java.io.IOException
If the method is called from a Windows platform, the data is written as a single file in the Windows Registry Editor 5.0 .reg format. The name of the file is the value of brokerName with a ".reg" file extension. On all other platforms, the registry data is copied into the Zip file as a set of files, the structure matching the /var/mqsi/registry/BROKERNAME format that the broker uses.
The output stream is left open on exit from this method.
If a broker of the supplied name cannot be found, an IOException will be thrown. The broker need not be running in order for this method to succeed.
brokerName
- name of a locally defined brokerzos
- ZipOutputStream to which the registry will be written.java.io.IOException
- if the broker's configuration could not be read from the
registry or written to the ZipOutputStream.public static java.util.HashMap<java.lang.String,java.util.Vector<java.lang.String>> getAllLocalBrokerInstallLocations() throws java.io.IOException
This installation information is discovered on demand from the local filesystem and is not cached. Frequent calls to this method might impact performance.
java.io.IOException
- if the list of install locations could not be read.public static java.util.HashMap<java.lang.String,java.lang.String> getLocalBrokerInstallLocations() throws java.io.IOException
This installation information is discovered on demand from the local filesystem and is not cached. Frequent calls to this method might impact performance.
java.io.IOException
- if the list of install locations could not be read.public static int getNumberOfLocalBrokerInstallLocations() throws java.io.IOException
java.io.IOException
- if the list of install locations could not be read.public static boolean isBrokerHAEnabled(java.lang.String brokerName) throws java.io.IOException
brokerName
- name of a locally defined brokerjava.io.IOException
- if the list of install locations could not be read.public static boolean isHABrokerQMgrInActiveMode(java.lang.String brokerName) throws java.io.IOException
brokerName
- name of a locally defined brokerjava.io.IOException
- if the list of install locations could not be read.public static boolean isHABrokerQMgrInStandByMode(java.lang.String brokerName) throws java.io.IOException
brokerName
- name of a locally defined brokerjava.io.IOException
- if the list of install locations could not be read.public static java.lang.String getBrokerHAEnabledWorkPath(java.lang.String brokerName) throws java.io.IOException
brokerName
- name of a locally defined brokerjava.io.IOException
- if the list of install locations could not
be read.public static void setBrokerHAEnabledWorkPath(java.lang.String brokerName, java.lang.String newHAWorkPath) throws java.io.IOException
brokerName
- name of a locally defined broker instancenewHAWorkPath
- new shared workpath for the
multi-instance brokerjava.io.IOException
- if the broker's configuration could not be written