/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* ident "%Z%%M% %I% %E% SMI"
*
* Copyright 2004 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* Printer class
* Printer object containing attributes and methods for
* updating printers.
*/
public class Printer
{
//
// Printer object attributes
//
private boolean use_ppd_file = true;
private boolean default_printer = false;
private boolean enable = true;
private boolean accept = true;
//
// Logs
//
//
// Constructors
//
public Printer()
{
nscontext = new NameService();
}
{
}
//
// Is a printer local to this machine
//
throws Exception
{
}
//
// Get details of a printer.
//
public synchronized void getPrinterDetails()
throws Exception
{
if (printername == null) {
throw new pmInternalErrorException(
"Printer.getPrinterDetails(): printername must be set");
}
}
//
// Add a local printer
//
public synchronized void addLocalPrinter()
throws Exception
{
if (printername == null) {
throw new pmInternalErrorException(
"Printer.addLocalPrinter(): printername must be set");
}
if (printserver == null) {
printserver = h.getLocalHostName();
h = null;
}
throw new pmInternalErrorException(
"Printer.addLocalPrinter(): device must be set");
}
throw new pmInternalErrorException(
"Printer.addLocalPrinter(): make must be set");
}
throw new pmInternalErrorException(
"Printer.addLocalPrinter(): model must be set");
}
throw new pmInternalErrorException(
"Printer.addLocalPrinter(): ppd file must be selected");
}
}
PrinterDebug.printObj(this);
clearLogs();
}
//
// Add access to a remote printer
//
public synchronized void addRemotePrinter()
throws Exception
{
if (printername == null) {
throw new pmInternalErrorException(
"Printer.addRemotePrinter(): printername must be set");
}
if (printserver == null) {
throw new pmInternalErrorException(
"Printer.addRemotePrinter(): printserver must be set");
}
PrinterDebug.printObj(this);
clearLogs();
}
//
// Delete a printer
//
public synchronized void deletePrinter()
throws Exception
{
if (printername == null) {
throw new pmInternalErrorException(
"Printer.deletePrinter(): printername must be set");
}
PrinterDebug.printObj(this);
clearLogs();
}
//
// Modify a printer
//
public synchronized void modifyPrinter()
throws Exception
{
if (printername == null) {
throw new pmInternalErrorException(
"Printer.modifyPrinter(): printername must be set");
}
PrinterDebug.printObj(this);
clearLogs();
}
//
// Set list of commands executed
//
{
return;
}
}
return;
}
}
//
// Set an error message.
//
{
return;
}
}
return;
} else {
}
}
//
// Set an warning message.
//
{
return;
}
}
return;
} else {
}
}
//
// Get commands executed.
//
{
return (null);
}
}
//
// Get error messages
//
{
return (null);
}
}
//
// Get warning messages
//
{
return (null);
}
}
//
// Set printer attributes
//
{
printername = arg;
}
{
printertype = arg;
}
{
printserver = arg;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
use_ppd_file = arg;
}
{
}
{
}
{
destination = arg;
}
{
extensions = arg;
}
{
file_contents = arg;
}
{
}
{
}
{
}
{
}
{
}
{
}
{
}
//
// Get printer attributes.
//
{
return (printername);
}
{
return (printertype);
}
{
return (printserver);
}
{
return (comment);
}
{
return (device);
}
public boolean getUsePPD()
{
return (use_ppd_file);
}
{
return (make);
}
{
return (model);
}
{
return (ppd);
}
{
return (ppdfile);
}
{
return (notify);
}
{
return (protocol);
}
{
return (destination);
}
{
return (extensions);
}
{
return (file_contents);
}
{
return (user_allow_list);
}
{
return (user_deny_list);
}
public boolean getIsDefaultPrinter()
{
return (default_printer);
}
{
return (banner);
}
public boolean getEnable()
{
return (enable);
}
public boolean getAccept()
{
return (accept);
}
{
return (locale);
}
protected void clearLogs()
{
}
// Hints for optimizing printer modifications
}