/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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
*/
/*
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
* DoPrinterView class
* Worker class for gathering printer information.
*/
// import com.sun.admin.pm.client.pmGuiException;
public class DoPrinterView {
p.setPrinterName("petite");
try {
}
catch (Exception e)
{
}
PrinterDebug.printObj(p);
}
//
// Interface to Printer object.
//
public static void view(
Printer p,
{
boolean islocal =
if (islocal) {
} else {
viewRemote(p, ns);
}
return;
}
//
// Do the work getting Remote printer attributes.
//
private static void viewRemote(
Printer p,
{
int exitvalue = 0;
int i, j;
boolean default_printer = false;
printername, "LC_ALL=C");
p.setErrorLog(err);
// Add stdout since thats where lpget sends errors.
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
if (o == null) {
throw new pmCmdFailedException(err);
}
// For easier parsing.
o = o.concat("\n");
i = o.indexOf("bsdaddr=");
if (i == -1) {
throw new pmException();
}
i = i + 8;
j = o.indexOf(",", i);
if (j == -1) {
throw new pmException();
}
printserver = o.substring(i, j);
i = o.indexOf(",Solaris");
if (i != -1) {
extensions = "Solaris";
}
i = o.indexOf("description=");
if (i != -1) {
i = i + 12;
j = o.indexOf("\n", i);
if (j != -1) {
}
}
default_printer = true;
}
p.setComment(comment);
return;
}
//
// Do the work getting printer attributes.
//
private static void viewLocal(
{
int i = -1;
int exitvalue = 0;
boolean default_printer = false;
boolean enable = false;
boolean accept = false;
default_printer = true;
}
//
// Parse lpstat output
//
p.setErrorLog(err);
throw new pmCmdFailedException(err);
}
// Append a newline to make parsing easier.
o = o.concat("\n");
}
} else {
if (!pmMisc.isppdCachefile()) {
throw new pmNeedPPDCacheException("ppdcache missing");
}
} else {
throw new pmCacheMissingPPDException(
"PPD file not in cache");
}
}
int j = -1;
printserver = p.getPrintServer();
i = o.indexOf("enabled since");
if (i != -1) {
enable = true;
}
i = o.indexOf("not accepting requests");
if (i == -1) {
accept = true;
}
i = o.indexOf("Banner not required");
if (i != -1) {
banner = "optional";
}
i = o.indexOf("Banner required");
if (i != -1) {
banner = "always";
}
i = o.indexOf("Banner page never printed");
if (i != -1) {
banner = "never";
}
// If we have Options then look for destination and protocol.
protocol = "bsd";
str = "Options:";
if (i != -1) {
// Set str to the substring containing only the options line.
j = o.indexOf("\n", i);
// Append a comma to make parsing easier.
if (i != -1) {
i += 5;
}
if (i != -1) {
i += 9;
}
}
// Build array of content types.
}
}
}
//
// User allow list.
//
str = "Users allowed:\n";
if (i != -1) {
// Grab the substring containing only users.
j = o.indexOf("\tForms");
if (j != -1) {
}
}
}
}
if (user_allow_list == null) {
}
//
// User deny list
//
syscmd = new SysCommand();
}
}
}
}
//
// Get fault action
//
notify = "write";
notify = "mail";
notify = "none";
if (i != -1) {
if (j > i) {
}
}
notify = "quiet";
} else {
notify = "unknown";
}
}
}
//
// Get the printers device
//
syscmd = new SysCommand();
"LC_ALL=C");
if (o != null) {
o = o.concat("\n");
}
//
// If the device is in URI form (scheme:// ...), set the protocol
// for the "network attached" modify screen.
//
protocol = "uri";
}
p.setComment(comment);
p.setPPDFile(ppdfile);
p.setProtocol(protocol);
return;
"SVR: Overlaying name service attributes on local printer");
try {
viewRemote(p, ns);
}
catch (Exception e)
{
"SVR: Overlay of name service attributes failed.");
}
return;
}
//
// Return substring starting at sub + 1 and ending with
// a newline.
//
{
int i = -1;
int j = -1;
if (i != -1) {
return (null);
}
if (j != -1) {
}
}
return (result);
}
}