Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.javax.print.ipp
Class IppRequest  view IppRequest download IppRequest.java

java.lang.Object
  extended bygnu.javax.print.ipp.IppRequest

public class IppRequest
extends java.lang.Object

IppRequest models a request to an IPP compatible server as described in RFC 2910 - IPP/1.1: Encoding and Transport.

The byte stream is structured as follows (for an official description please have a look at the RFC document mentioned above):


Nested Class Summary
(package private)  class IppRequest.RequestWriter
          Helper class used to write the attributes of a request into the supplied data output stream in the correct way.
 
Field Summary
private  boolean alreadySent
          Signals if the request is already on its way
private  java.net.HttpURLConnection connection
          The underlying connection - IPP is http based
private  java.lang.Object data
           
private  javax.print.attribute.AttributeSet jobAttributes
           
(package private) static java.util.logging.Logger logger
          Logger for tracing - enable by passing -Dgnu.classpath.debug.components=ipp to the vm.
private  short operation_id
          The operation type of this request.
private  javax.print.attribute.AttributeSet operationAttributes
           
private  javax.print.attribute.AttributeSet printerAttributes
           
private  int request_id
          The request id of this request.
private static int requestIdCounter
          The request id counter simply counts up to give unique request ids per JVM instance.
private  java.net.URI requestUri
           
private static short VERSION
          The IPP version defaults to 1.1
 
Constructor Summary
IppRequest(java.net.URI uri, java.lang.String user, java.lang.String password)
          Creates an IPPRequest instance.
 
Method Summary
 void addAndFilterJobOperationAttributes(javax.print.attribute.AttributeSet set)
          Filters from the given attribute set the job operation out and adds them to the operation attributes set.
 void addAndFilterJobTemplateAttributes(javax.print.attribute.AttributeSet set)
          Filters from the given attribute set the job template attributes out and adds them to the job attributes set.
 void addJobAttribute(javax.print.attribute.Attribute attribute)
          Add the job attribute of this request to the given attribute set.
 void addOperationAttribute(javax.print.attribute.Attribute attribute)
          Adds the given attribute to the operation attributes set.
 void addPrinterAttributes(javax.print.attribute.Attribute attribute)
          Sets the printer attribute of this request to the given attribute set.
 int getRequestID()
          Returns the id of this request.
private  int incrementRequestIdCounter()
          Synchronized method to be called by the constructor to assign a unique request id to this request.
 IppResponse send()
          Does some validation of the supplied parameters and then sends the request to the ipp server or service.
 void setData(byte[] bytes)
          Sets the data of the request.
 void setData(java.io.InputStream stream)
          Sets the data of the request.
 void setOperationAttributeDefaults()
          Adds the default values for the operation attributes "attributes-charset" and "attributes-natural-language"
 void setOperationID(short id)
          Sets the operation id for this request.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static final java.util.logging.Logger logger
Logger for tracing - enable by passing -Dgnu.classpath.debug.components=ipp to the vm.


requestIdCounter

private static int requestIdCounter
The request id counter simply counts up to give unique request ids per JVM instance.


VERSION

private static final short VERSION
The IPP version defaults to 1.1

See Also:
Constant Field Values

alreadySent

private boolean alreadySent
Signals if the request is already on its way


operation_id

private short operation_id
The operation type of this request.


request_id

private final int request_id
The request id of this request. This is assigned automatically by the constructor.


operationAttributes

private javax.print.attribute.AttributeSet operationAttributes

printerAttributes

private javax.print.attribute.AttributeSet printerAttributes

jobAttributes

private javax.print.attribute.AttributeSet jobAttributes

data

private java.lang.Object data

requestUri

private java.net.URI requestUri

connection

private java.net.HttpURLConnection connection
The underlying connection - IPP is http based

Constructor Detail

IppRequest

public IppRequest(java.net.URI uri,
                  java.lang.String user,
                  java.lang.String password)
Creates an IPPRequest instance.

Method Detail

incrementRequestIdCounter

private int incrementRequestIdCounter()
Synchronized method to be called by the constructor to assign a unique request id to this request.


getRequestID

public int getRequestID()
Returns the id of this request.


setData

public void setData(java.io.InputStream stream)
Sets the data of the request. The data used in this request will be the one of the supplied inputstream instead of the alternative byte array possibility.


setData

public void setData(byte[] bytes)
Sets the data of the request. The data used in this request will be the one of the supplied byte[] instead of the alternative input stream possibility.


setOperationID

public void setOperationID(short id)
Sets the operation id for this request.


setOperationAttributeDefaults

public void setOperationAttributeDefaults()
Adds the default values for the operation attributes "attributes-charset" and "attributes-natural-language"


addJobAttribute

public void addJobAttribute(javax.print.attribute.Attribute attribute)
Add the job attribute of this request to the given attribute set.


addPrinterAttributes

public void addPrinterAttributes(javax.print.attribute.Attribute attribute)
Sets the printer attribute of this request to the given attribute set.


addOperationAttribute

public void addOperationAttribute(javax.print.attribute.Attribute attribute)
Adds the given attribute to the operation attributes set.


addAndFilterJobOperationAttributes

public void addAndFilterJobOperationAttributes(javax.print.attribute.AttributeSet set)
Filters from the given attribute set the job operation out and adds them to the operation attributes set.


addAndFilterJobTemplateAttributes

public void addAndFilterJobTemplateAttributes(javax.print.attribute.AttributeSet set)
Filters from the given attribute set the job template attributes out and adds them to the job attributes set.


send

public IppResponse send()
                 throws IppException,
                        java.io.IOException
Does some validation of the supplied parameters and then sends the request to the ipp server or service.