com.easysw.cups
Class Cups

java.lang.Object
  |
  +--com.easysw.cups.Cups

public class Cups
extends java.lang.Object


Constructor Summary
Cups()
          Void constructor.
Cups(java.net.URL p_url)
          Constructor using a URL.
 
Method Summary
 int cupsCancelJob(java.lang.String printer_name, int p_job_id, java.lang.String p_user_name)
          Cancel a job - send a job cancel request to the server.
 java.lang.String cupsGetDefault()
          Get default destination.
 CupsJob[] cupsGetJobs(boolean showMyJobs, boolean showCompleted)
          Get a list of jobs.
 java.util.List cupsGetPrinterAttributes(java.lang.String printer_name)
          Get printer attributes
 java.lang.String[] cupsGetPrinters()
          Get a list of printers.
 java.util.List cupsGetPrinterStatus(java.lang.String printer_name)
           
 CupsJob cupsPrintFile(java.lang.String p_filename, IPPAttribute[] p_attrs)
          Print a file.
 boolean doRequest()
          Do a CUPS request to the server.
 boolean doRequest(java.io.File file)
          Send a FILE to the CUPS server.
 boolean doRequest(java.lang.String from)
           
 boolean getEncrypt()
          Get the value of the encrypt member.
 void setDest(java.lang.String p_dest)
          Set the value of the dest member.
 void setEncrypt(boolean p_encrypt)
          Set the value of the encrypt member.
 void setInstance(java.lang.String p_instance)
          Set the value of the instance member.
 void setPasswd(java.lang.String p_passwd)
          Set the value of the passwd member.
 void setPath(java.lang.String p_path)
          Set the value of the path member.
 void setPort(int p_port)
          Set the value of the port member.
 void setProtocol(java.lang.String p_protocol)
          Set the value of the protocol member.
 void setServer(java.lang.String p_server)
          Set the value of the server member.
 void setUser(java.lang.String p_user)
          Set the value of the user member.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Cups

public Cups()
Void constructor.

Cups

public Cups(java.net.URL p_url)
Constructor using a URL.
Parameters:
p_url - A URL object.
Method Detail

setProtocol

public void setProtocol(java.lang.String p_protocol)
Set the value of the protocol member. Valid values are ipp or http.
Parameters:
p_protocol - String with protocol.

setServer

public void setServer(java.lang.String p_server)
Set the value of the server member. This is an IP address or a hostname.
Parameters:
p_server - IP address or hostname.

setPort

public void setPort(int p_port)
Set the value of the port member.
Parameters:
p_port - Port number.

setUser

public void setUser(java.lang.String p_user)
Set the value of the user member.
Parameters:
p_user - User name.

setPasswd

public void setPasswd(java.lang.String p_passwd)
Set the value of the passwd member.
Parameters:
p_passwd - Password.

setDest

public void setDest(java.lang.String p_dest)
Set the value of the dest member.
Parameters:
p_dest - Destination.

setInstance

public void setInstance(java.lang.String p_instance)
Set the value of the instance member.
Parameters:
p_instance - Instance.

setEncrypt

public void setEncrypt(boolean p_encrypt)
Set the value of the encrypt member.
Parameters:
p_enrypt - Yes or no.

getEncrypt

public boolean getEncrypt()
Get the value of the encrypt member.
Returns:
boolean Encryption on or off.

setPath

public void setPath(java.lang.String p_path)
Set the value of the path member. This is the path that will be used in the POST method.
Parameters:
p_path - Path on server.

doRequest

public boolean doRequest(java.lang.String from)
                  throws java.io.IOException

doRequest

public boolean doRequest()
                  throws java.io.IOException
Do a CUPS request to the server.
Parameters:
p_dest - Destination name.
Returns:
boolean True on success, false otherwise

doRequest

public boolean doRequest(java.io.File file)
                  throws java.io.IOException
Send a FILE to the CUPS server.
Parameters:
file - File to send.
Returns:
boolean True on success, false otherwise

cupsGetJobs

public CupsJob[] cupsGetJobs(boolean showMyJobs,
                             boolean showCompleted)
                      throws java.io.IOException
Get a list of jobs.
Parameters:
showMyJobs - Show only jobs for user.
showCompleted - Show completed OR active jobs.
Returns:
CupsJob[] Array of job objects, or null.

cupsGetPrinters

public java.lang.String[] cupsGetPrinters()
                                   throws java.io.IOException
Get a list of printers.
Returns:
String[] Array of printers, or null.

cupsGetDefault

public java.lang.String cupsGetDefault()
                                throws java.io.IOException
Get default destination.
Returns:
String Name of default printer, or null.

cupsGetPrinterAttributes

public java.util.List cupsGetPrinterAttributes(java.lang.String printer_name)
                                        throws java.io.IOException
Get printer attributes
Parameters:
printer_name - Name of printer to get info for.
Returns:
List List of attributes.
See Also:
CupsPrinter

cupsPrintFile

public CupsJob cupsPrintFile(java.lang.String p_filename,
                             IPPAttribute[] p_attrs)
                      throws java.io.IOException
Print a file.
Parameters:
p_filename - Path of file to print.
p_attrs[] - Array of print job attributes.
Returns:
CupsJob Object with job info.
See Also:
CupsJob

cupsCancelJob

public int cupsCancelJob(java.lang.String printer_name,
                         int p_job_id,
                         java.lang.String p_user_name)
                  throws java.io.IOException
Cancel a job - send a job cancel request to the server.
Parameters:
printer_name - Destination.
p_job_id - ID of job.
p_user_name - Requesting user name.

cupsGetPrinterStatus

public java.util.List cupsGetPrinterStatus(java.lang.String printer_name)
                                    throws java.io.IOException