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 (c) 1999-2000 by Sun Microsystems, Inc.
26  * All rights reserved.
27  */
28 
29 //
30 // Class to hold a policy list
31 //
32 
33 import java.util.Vector;
34 
35 public class PolicyList {
36     Kadmin Kadmin = null;
37     boolean dummy;
38     /*
39      * Dummy data for testing
40      */
41     String [] dummyPL = { "first", "default", "admins", "engineers",
42    			    "managers", "markerters", "temps", "contractors",
43 			    "hourly", "remote1", "remote2", "chelmsford" };
44 
PolicyList()45     public PolicyList() {
46 	dummy = true;
47     }
48 
PolicyList(Kadmin session)49     public PolicyList(Kadmin session) {
50         dummy = false;
51         Kadmin = session;
52     }
53 
getPolicyList()54     public String[] getPolicyList() {
55 	    String[] in;
56 
57 	    if (dummy) {
58 		in = new String[dummyPL.length];
59 		System.arraycopy(dummyPL, 0, in, 0, dummyPL.length);
60 	    } else {
61 		in = Kadmin.getPolicyList();
62 	    }
63 	    return in;
64     }
65 
66 
main(String[] args)67     public static void main(String[] args) {
68         PolicyList p = new PolicyList();
69         String[] pl = p.getPolicyList();
70         System.out.println("Policy List:");
71         for (int i = 0; i < pl.length; i++)
72 	    System.out.println("  "+pl[i]);
73     }
74 }
75