xref: /titanic_41/usr/src/cmd/print/printmgr/com/sun/admin/pm/server/PrinterDebug.java (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * ident	"%Z%%M%	%I%	%E% SMI"
24  *
25  * Copyright 2004 Sun Microsystems, Inc.  All rights reserved.
26  * Use is subject to license terms.
27  *
28  * PrinterDebug class
29  * Helper class to print attributes in objects.
30  */
31 
32 package com.sun.admin.pm.server;
33 
34 import java.io.*;
35 import java.util.*;
36 
37 public class  PrinterDebug {
38 
printObj(Printer p)39     public static void printObj(Printer p)
40     {
41 	String arr[];
42 	int i;
43 
44 	Debug.message("SVR: PrinterDebug.print_obj(Printer)");
45 
46 	Debug.message("SVR: \tName:\t\t" + p.getPrinterName());
47 	Debug.message("SVR: \tType:\t\t" + p.getPrinterType());
48 	Debug.message("SVR: \tServer:\t\t" + p.getPrintServer());
49 	Debug.message("SVR: \tComment:\t" + p.getComment());
50 	Debug.message("SVR: \tDevice:\t\t" + p.getDevice());
51 	Debug.message("SVR: \tMake:\t\t" + p.getMake());
52 	Debug.message("SVR: \tModel:\t\t" + p.getModel());
53 	Debug.message("SVR: \tPPD:\t\t" + p.getPPD());
54 	Debug.message("SVR: \tNotify:\t\t" + p.getNotify());
55 	Debug.message("SVR: \tProtocol:\t" + p.getProtocol());
56 	Debug.message("SVR: \tDest:\t\t" + p.getDestination());
57 	Debug.message("SVR: \tExtensions:\t" + p.getExtensions());
58 	Debug.message("SVR: \tDefault:\t" + p.getIsDefaultPrinter());
59 	Debug.message("SVR: \tBanner:\t\t" + p.getBanner());
60 	Debug.message("SVR: \tEnable:\t\t" + p.getEnable());
61 	Debug.message("SVR: \tAccept:\t\t" + p.getAccept());
62 
63 	arr = p.getFileContents();
64 	if (arr == null) {
65 		Debug.message("SVR: \tContents:\tNULL");
66 	} else {
67 		Debug.message("SVR: \tContents:");
68 		for (i = 0; i < arr.length; i++) {
69 			Debug.message("SVR: \t\t\t" + arr[i]);
70 		}
71 	}
72 	arr = p.getUserAllowList();
73 	if (arr == null) {
74 		Debug.message("SVR: \tUser allow:\tNULL");
75 	} else {
76 		Debug.message("SVR: \tUser allow:");
77 		for (i = 0; i < arr.length; i++) {
78 			Debug.message("SVR: \t\t\t" + arr[i]);
79 		}
80 	}
81 	arr = p.getUserDenyList();
82 	if (arr == null) {
83 		Debug.message("SVR: \tUser deny:\tNULL");
84 	} else {
85 		Debug.message("SVR: \tUser deny:");
86 		for (i = 0; i < arr.length; i++) {
87 			Debug.message("SVR: \t\t\t" + arr[i]);
88 		}
89 	}
90     }
91 
printObj(NameService ns)92     public static void printObj(NameService ns)
93     {
94 	Debug.message("SVR: PrinterDebug.printObj(NameService)");
95 
96 	// Keep passwd secret.
97 	String passwd = ns.getPasswd();
98 	if (passwd != null) {
99 		passwd = "*****";
100 	}
101 	Debug.message("SVR: \tnameservice:\t" + ns.getNameService());
102 	Debug.message("SVR: \tnshost:\t\t" + ns.getNameServiceHost());
103 	Debug.message("SVR: \tuser:\t\t" + ns.getUser());
104 	Debug.message("SVR: \tpasswd:\t\t" + passwd);
105 	Debug.message("SVR: \tboundtonisslave:" + ns.getBoundToNisSlave());
106 	Debug.message("SVR: \tisAuth:\t\t" + ns.isAuth());
107     }
108 
arr_to_str(String[] arr)109     public static String arr_to_str(String[] arr)
110     {
111 	if (arr == null) {
112 		return (new String("NULL"));
113 	}
114 	if (arr.length == 0) {
115 		return (new String("0 length array"));
116 	}
117 	String str = "";
118 	for (int i = 0; i < arr.length; i++) {
119 		if (arr[i] == null) {
120 			break;
121 		}
122 		str = str.concat(arr[i] + " ");
123 	}
124 	return (str);
125     }
126 }
127