/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
private boolean fidelity;
private boolean printing = false;
private boolean printReturned = false;
/* these variables used globally to store reference to the print
* data retrieved as a stream. On completion these are always closed
* if non-null.
*/
/* default values overridden by those extracted from the attributes */
}
return service;
}
synchronized (this) {
if (jobAttrSet == null) {
/* just return an empty set until the job is submitted */
} else {
return jobAttrSet;
}
}
}
synchronized (this) {
return;
}
if (jobListeners == null) {
jobListeners = new Vector();
}
}
}
synchronized (this) {
return;
}
if (jobListeners.isEmpty()) {
jobListeners = null;
}
}
}
/* Closes any stream already retrieved for the data.
* We want to avoid unnecessarily asking the Doc to create a stream only
* to get a reference in order to close it because the job failed.
* If the representation class is itself a "stream", this
* closes that stream too.
*/
private void closeDataStreams() {
return;
}
try {
} catch (IOException e) {
return;
}
try {
} catch (IOException e) {
} finally {
}
}
try {
} catch (IOException e) {
} finally {
}
}
else if (data instanceof InputStream) {
try {
} catch (IOException e) {
}
}
try {
} catch (IOException e) {
}
}
}
/* since this method should always get called, here's where
* we will perform the clean up of any data stream supplied.
*/
switch (reason) {
case PrintJobEvent.JOB_CANCELED :
case PrintJobEvent.JOB_FAILED :
case PrintJobEvent.NO_MORE_EVENTS :
case PrintJobEvent.JOB_COMPLETE :
}
synchronized (this) {
if (jobListeners != null) {
switch (reason) {
case PrintJobEvent.JOB_CANCELED :
break;
case PrintJobEvent.JOB_FAILED :
break;
break;
case PrintJobEvent.NO_MORE_EVENTS :
break;
default:
break;
}
}
}
}
}
public void addPrintJobAttributeListener(
synchronized (this) {
return;
}
if (attrListeners == null) {
attrListeners = new Vector();
listenedAttributeSets = new Vector();
}
if (attributes == null) {
attributes = new HashPrintJobAttributeSet();
}
}
}
public void removePrintJobAttributeListener(
synchronized (this) {
return;
}
if (index == -1) {
return;
} else {
if (attrListeners.isEmpty()) {
}
}
}
}
throws PrintException {
synchronized (this) {
if (printing) {
throw new PrintException("already printing");
} else {
printing = true;
}
}
PrinterIsAcceptingJobs.class)) ==
throw new PrintException("Printer is not accepting job.");
}
/* check if the parameters are valid before doing much processing */
try {
} catch (IOException e) {
}
}
// set up mOptions
if ((service instanceof IPPPrintService) &&
CUPSPrinter.isCupsRunning()) {
"instanceof IPPPrintService");
if (customMedia != null) {
}
}
if (customTray != null &&
customTray instanceof CustomMediaTray) {
}
}
}
}
}
}
}
try {
throw new PrintException("No stream for data");
}
if (!(service instanceof IPPPrintService &&
flavor.getMimeType()))) {
return;
}
} catch (ClassCastException cce) {
throw new PrintException(cce);
} catch (IOException ioe) {
throw new PrintException(ioe);
}
try {
if ((service instanceof IPPPrintService) &&
flavor.getMimeType())) {
} else {
return;
}
} catch (ClassCastException cce) {
throw new PrintException(cce);
} catch (IOException e) {
throw new PrintException(e.toString());
}
try {
throw new PrintException("No reader for data");
}
} catch (IOException ioe) {
}
try {
throw new PrintException("No stream for data");
}
} catch (IOException ioe) {
}
/*
* This extracts the data from the URL and passes it the content
* directly to the print service as a file.
* This is appropriate for the current implementation where lp or
* lpr is always used to spool the data. We expect to revise the
* implementation to provide more complete IPP support (ie not just
* CUPS) and at that time the job will be spooled via IPP
* and the URL
* itself should be sent to the IPP print service not the content.
*/
try {
} catch (IOException e) {
throw new PrintException(e.toString());
}
try {
if (service instanceof IPPPrintService) {
} else {
}
return;
} catch (ClassCastException cce) {
throw new PrintException(cce);
} catch (IOException ioe) {
throw new PrintException(ioe);
}
try {
if (service instanceof IPPPrintService) {
} else {
}
return;
} catch (ClassCastException cce) {
throw new PrintException(cce);
} catch (IOException ioe) {
throw new PrintException(ioe);
}
} else {
}
// now spool the print data.
}
/* There are three cases:
* 1) Text data from a Reader, just pass through.
* 2) Text data from an input stream which we must read using the
* correct encoding
* 3) Raw byte data from an InputStream we don't interpret as text,
* just pass through: eg postscript.
*/
char []buffer = new char[1024];
int cread;
try {
}
} catch (IOException e) {
throw new PrintException (e);
}
try {
encoding);
char []buffer = new char[1024];
int cread;
}
} catch (IOException e) {
throw new PrintException (e);
} finally {
try {
}
} catch (IOException e) {
}
}
byte[] buffer = new byte[1024];
int bread = 0;
try {
}
} catch (IOException e) {
throw new PrintException (e);
}
}
}
}
if (service instanceof IPPPrintService) {
} else {
}
}
try {
synchronized(this) {
throw new PrintException("already printing");
} else {
job = new PSPrinterJob();
}
}
p.getHeight()-144.0);
}
}
return;
} catch (PrinterException pe) {
throw new PrintException(pe);
} finally {
printReturned = true;
}
}
try {
synchronized(this) {
throw new PrintException("already printing");
} else {
job = new PSPrinterJob();
}
}
return;
} catch (PrinterException pe) {
throw new PrintException(pe);
} finally {
printReturned = true;
}
}
/* There's some inefficiency here as the job set is created even though
* it may never be requested.
*/
private synchronized void
reqAttrSet = new HashPrintRequestAttributeSet();
jobAttrSet = new HashPrintJobAttributeSet();
if (attrs[i] instanceof PrintJobAttribute) {
}
}
}
if (attrs[i] instanceof PrintRequestAttribute) {
}
if (attrs[i] instanceof PrintJobAttribute) {
}
}
}
/* add the user name to the job */
try {
} catch (SecurityException se) {
}
} else {
}
} else {
}
/* if no job name supplied use doc name (if supplied), if none and
* its a URL use that, else finally anything .. */
} else {
try {
}
} catch (IOException e) {
}
}
}
}
fidelity = true;
} else {
fidelity = false;
}
if (fidelity == true) {
throw new PrintJobAttributeException(
} else if
throw new PrintJobAttributeException(
}
}
if (category == Destination.class) {
throw new PrintException("Not a file: URI");
} else {
try {
} catch (Exception e) {
throw new PrintException(e);
}
// check write access
try {
} catch (SecurityException se) {
throw new PrintException(se);
}
}
}
mNoJobSheet = true;
}
if (attr instanceof MediaSizeName) {
"mediaName "+mediaName);
}
} else if (attr instanceof CustomMediaTray) {
}
} else if (category == OrientationRequested.class) {
}
}
}
boolean noJobSheet,
int PRINTER = 0x1;
int OPTIONS = 0x2;
int BANNER = 0x4;
int COPIES = 0x8;
int NOSHEET = 0x10;
int pFlags = 0;
int n = 0;
// conveniently "lp" is the default destination for both lp and lpr.
ncomps+=1;
}
ncomps+=1;
}
ncomps+=1;
}
if (copies > 1) {
ncomps+=1;
}
if (noJobSheet) {
ncomps+=1;
}
}
}
}
execCmd[n++] = "-o nobanner";
}
}
} else {
}
}
}
execCmd[n++] = "-h";
}
}
}
if (IPPPrintService.debugPrint) {
}
}
return execCmd;
}
private boolean mNoJobSheet = false;
// Inner class to run "privileged" to open the printer output stream.
try {
} else {
/* Write to a temporary file which will be spooled to
* the printer then deleted. In the case that the file
* is not removed for some reason, request that it is
* removed when the VM exits.
*/
}
return result;
} catch (IOException ex) {
// If there is an IOError we subvert it to a PrinterException.
}
return null;
}
}
// Inner class to run "privileged" to invoke the system print command
}
}
} finally {
}
}
}
return null;
}
try {
/**
* Spool to the printer.
*/
if (0 != result) {
}
} catch (IOException ex) {
// REMIND : 2d printing throws PrinterException
} catch (InterruptedException ie) {
} finally {
}
return null;
}
}
synchronized (this) {
if (!printing) {
throw new PrintException("Job is not yet submitted.");
return;
} else {
throw new PrintException("Job could not be cancelled.");
}
}
}
}