You can retrieve print object attributes by using the attribute ID and one of these methods from the base PrintObject class:
The attributeID parameter is an integer that identifies which attribute to retrieve. All of the IDs are defined as public constants in the base PrintObject class. The PrintAttributes file contains an entry of each attribute ID. The entry includes a description of the attribute and its type (integer, floating point, or string). For a list of which attributes may be retrieved using these methods, select the following links:
To achieve acceptable performance, these attributes are copied to the client. These attributes are copied either when the objects are listed, or the first time they are needed if the object was created implicitly. This keeps the object from going to the host every time the application needs to retrieve an attribute. This also makes it possible for the Java™ print object instance to contain out-of-date information about the object on the server. The user of the object can refresh all of the attributes by calling the update() method on the object. In addition, if the application calls any methods on the object that would cause the object's attributes to change, the attributes are automatically updated. For example, if an output queue has a status attribute of RELEASED (getStringAttribute(ATTR_OUTQSTS); returns a string of "RELEASED"), and the hold() method is called on the output queue, getting the status attribute after that returns HELD.
You can use the setAttributes method to change the attributes of spooled files and printer file objects. Select the following links for a list or which attributes may be set:
The setAttributes method takes a PrintParameterList parameter, which is a class that is used to hold a collection of attributes IDs and their values. The list starts out empty, and the caller can add attributes to the list by using the various setParameter() methods on it.
You can use the PrintParameterList class to pass a group of attributes to a method that takes any of a number of attributes as parameters. For example, you can send a spooled file using TCP (LPR) by using the SpooledFile method, sendTCP(). The PrintParameterList object contains the required parameters for the send command, such as the remote system and queue, plus any optional parameters desired, such as whether to delete the spooled file after it is sent. In these cases, the method documentation gives a list of required and optional attributes. The PrintParameterList setParameter() method does not check which attributes you are setting and the values that you set them to. The PrintParameterList setParameter() method simply contains the values to pass along to the method. In general, extra attributes in the PrintParameterList are ignored, and illegal values on the attributes that are used are diagnosed on the server.