com.ibm.mq
Class MQManagedObject
- java.lang.Object
-
- com.ibm.mq.jmqi.JmqiObject
-
- com.ibm.mq.MQManagedObject
-
- Direct Known Subclasses:
- MQDestination, MQDistributionList, MQProcess, MQQueueManager, MQSubscription
public class MQManagedObject extends com.ibm.mq.jmqi.JmqiObject
MQManagedObject is a superclass for MQDistributionList, MQProcess, MQQueue, MQQueueManager. It provides the ability to inquire and set attributes of these objects.- See Also:
MQQueueManager
,MQQueue
,MQProcess
,MQDistributionList
-
-
Field Summary
Fields Modifier and Type Field and Description java.lang.String
alternateUserId
Deprecated.Accessing this field directly is not recommended. ThegetAlternateUserId()
call should be used instead.int
closeOptions
Deprecated.Accessing this field directly is not recommended. ThesetCloseOptions(int)
andgetCloseOptions()
calls should be used instead.MQQueueManager
connectionReference
Deprecated.Accessing this field directly is not recommended. ThegetConnectionReference()
call should be used instead.boolean
isOpen
Deprecated.Accessing this field directly is not recommended. TheisOpen()
call should be used instead.java.lang.String
name
Deprecated.Accessing this field directly is not recommended. ThegetName()
call should be used instead.int
openOptions
Deprecated.Accessing this field directly is not recommended. ThegetOpenOptions()
call should be used instead.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description void
close()
Closes the object.java.lang.String
getAlternateUserId()
Gets the alternative user ID specified (if any) when this resource was opened.java.lang.String
getAttributeString(int aSelector, int length)
Gets an attribute string.int
getCloseOptions()
Gets the options controlling the way the resource is closed.MQQueueManager
getConnectionReference()
Gets the connection queue manager associated with this resource.java.lang.String
getDescription()
Gets the description of this resource as held by the queue manager.java.lang.String
getName()
Gets the name of this resource.int
getOpenOptions()
Gets the set of open options used when opening the resource.java.lang.String
getResolvedObjectString()
java.lang.String
getResolvedQName()
int
getResolvedType()
void
inquire(int[] selectors, int[] intAttrs, byte[] charAttrs)
Queries requested attributes of the object.void
inquire(int[] selectors, int[] intAttrs, char[] charAttrs)
Queries requested attributes of the object.boolean
isOpen()
Indicates whether the resource is currently open.void
set(int[] selectors, int[] intAttrs, byte[] charAttrs)
Sets requested attributes of the object.void
setAttributeString(int aSelector, java.lang.String aValue, int length)
Sets an attribute string.void
setCloseOptions(int closeOptions)
Set this attribute to control the way the resource is closed.
-
-
-
Field Detail
-
alternateUserId
public java.lang.String alternateUserId
Deprecated. Accessing this field directly is not recommended. ThegetAlternateUserId()
call should be used instead.The alternative user ID specified (if any) when this resource was opened. Setting this attribute has no effect.
-
name
public java.lang.String name
Deprecated. Accessing this field directly is not recommended. ThegetName()
call should be used instead.The name of this resource. Setting this attribute has no effect.
-
openOptions
public int openOptions
Deprecated. Accessing this field directly is not recommended. ThegetOpenOptions()
call should be used instead.The set of open options used when opening this resource. Setting this attribute has no effect.
-
isOpen
public boolean isOpen
Deprecated. Accessing this field directly is not recommended. TheisOpen()
call should be used instead.Indicates whether this resource is currently open. Do not set this attribute.
-
connectionReference
public MQQueueManager connectionReference
Deprecated. Accessing this field directly is not recommended. ThegetConnectionReference()
call should be used instead.The queue manager to which this resource belongs. Setting this attribute has no effect.
-
closeOptions
public int closeOptions
Deprecated. Accessing this field directly is not recommended. ThesetCloseOptions(int)
andgetCloseOptions()
calls should be used instead.Controls the way the resource is closed.
-
-
Method Detail
-
inquire
public void inquire(int[] selectors, int[] intAttrs, char[] charAttrs) throws MQException
Queries requested attributes of the object. This method return character attributes converted if necessary, in a char array.Many of the common attribute values can be queried using the getXXX() methods defined in MQManagedObject, MQQueue, MQQueueManager and MQProcess.
- Parameters:
selectors
- indicates which attributes are being queried. Suitable selectors for character attributes are shown inMQCA_*
Suitable selectors for integer attributes are shown inMQIA_*
.intAttrs
- the requested attribute values in the same order as inselectors
.charAttrs
- the requested character attributes, concatenated together and in the same order as inselectors
.- Throws:
MQException
- if the inquire fails.
-
inquire
public void inquire(int[] selectors, int[] intAttrs, byte[] charAttrs) throws MQException
Queries requested attributes of the object.Many of the common attribute values can be queried using the getXXX() methods defined in MQManagedObject, MQQueue, MQQueueManager and MQProcess.
- Parameters:
selectors
- indicates which attributes are being queried. Suitable selectors for character attributes are shown inMQCA_*
Suitable selectors for integer attributes are shown inMQIA_*
.intAttrs
- the requested attribute values in the same order as inselectors
.charAttrs
- the requested character attributes, concatenated together and in the same order as inselectors
.- Throws:
MQException
- if the inquire fails.
-
set
public void set(int[] selectors, int[] intAttrs, byte[] charAttrs) throws MQException
Sets requested attributes of the object.Note that many of the more common attribute values can be set using the setXXX() methods defined in MQQueue.
- Parameters:
selectors
- indicates which attributes are being set. Suitable selectors for character attributes are shown inMQCA_*
Suitable selectors for integer attributes are shown inMQIA_*
.intAttrs
- the requested attribute values in the same order as inselectors
.charAttrs
- the requested character attributes, concatenated together and in the same order as inselectors
.- Throws:
MQException
- if the set call fails.
-
close
public void close() throws MQException
Closes the object. No further operations on this object are permitted after it is closed. The behaviour of the close method can be altered by settingcloseOptions
.- Throws:
MQException
- if the IBM MQ call fails.
-
getAttributeString
public java.lang.String getAttributeString(int aSelector, int length) throws MQException
Gets an attribute string.- Parameters:
aSelector
- indicates which attribute is being queried. Suitable selectors for character attributes are shown inMQCA_*
length
- the length of string required.- Returns:
- String attribute string
- Throws:
MQException
- if the call fails.
-
setAttributeString
public void setAttributeString(int aSelector, java.lang.String aValue, int length) throws MQException
Sets an attribute string.- Parameters:
aSelector
- an integer that indicates which attribute is being set. Suitable selectors for character attributes are shown inMQCA_*
together with the string lengths. Please refer to MQI Applications Reference section of the IBM MQ Documentation for further details.aValue
- the value of the attribute.length
- the number of characters of aValue to set.- Throws:
MQException
- if the call fails.
-
getDescription
public java.lang.String getDescription() throws MQException
Gets the description of this resource as held by the queue manager. The description of the resource is queried using the underlyingMQINQ
function.- Returns:
- The description.
- Throws:
MQException
- If this method is called after the resource has been closed, to indicate that the resource is no longer available.
-
getAlternateUserId
public java.lang.String getAlternateUserId() throws MQException
Gets the alternative user ID specified (if any) when this resource was opened.- Returns:
- the alternative user ID
- Throws:
MQException
- If the call fails.
-
getName
public java.lang.String getName() throws MQException
Gets the name of this resource. This is either the name supplied by the access method, or the name allocated by the queue manager for a dynamic queue, or Upon opening an MQTopic resource this property will map to the full, resolved topic name.- Returns:
- the name
- Throws:
MQException
- If the call fails.
-
getOpenOptions
public int getOpenOptions() throws MQException
Gets the set of open options used when opening the resource. Currently, these options will map directly to theMQOO
options. Upon opening anMQTopic
resource these options will map directly to theMQSO
options. The property is not valid for theMQSubscription
sub class.- Returns:
- the open options
- Throws:
MQException
- If the call fails.
-
getConnectionReference
public MQQueueManager getConnectionReference() throws MQException
Gets the connection queue manager associated with this resource.- Returns:
- the queue manager
- Throws:
MQException
- If the call fails.
-
isOpen
public boolean isOpen()
Indicates whether the resource is currently open. The property is valid for all sub classes. Since theMQSubscription
sub class is created and implicitly opened during anMQSUB
function call, this property will always returntrue
unless explicitly closed by the user.- Returns:
true
if the object is open.
-
getCloseOptions
public int getCloseOptions() throws MQException
Gets the options controlling the way the resource is closed.- Returns:
- the close options
- Throws:
MQException
- If the call fails.- See Also:
setCloseOptions(int)
-
setCloseOptions
public void setCloseOptions(int closeOptions) throws MQException
Set this attribute to control the way the resource is closed. The default value isCMQC.MQCO_NONE
. The standard set of options can be used when closing anMQTopic
orMQQueue
object. TheCMQC.MQCO_QUIESCE
close option can only be honored when explicitly closing anMQTopic
orMQQueue
object using theclose()
method. Upon object destruction, this option is ignored and disabled. Upon closing anMQTopic
orMQSubscription
object, the following additional values are permissible:CMQC.MQCO_DELETE
- (NotMQSubscription
) Delete the queue if there are no messages remaining.CMQC.MQCO_DELETE_PURGE
- (NotMQSubscription
) Delete the queue, purging any messages remaining.CMQC.MQCO_KEEP_SUB
- (OnlyMQSubscription
) The subscription made is kept. This option is only valid if the original subscription was durable. This is the default value if the resource is a durableMQTopic
object.CMQC.MQCO_REMOVE_SUB
- (OnlyMQSubscription
) The subscription is removed. This is the default value if the resource is a non-durable, unmanagedMQTopic
object.
- Parameters:
closeOptions
- the close options- Throws:
MQException
- If the call fails.
-
getResolvedType
public int getResolvedType()
- Returns:
- resolved type from MQOPEN
-
getResolvedQName
public java.lang.String getResolvedQName()
- Returns:
- resolved Queue Name from MQOPEN
-
getResolvedObjectString
public java.lang.String getResolvedObjectString()
- Returns:
- resolved Object String from MQOPEN
-
-