1 23 24 29 30 package com.sun.enterprise.tools.upgrade.miscconfig; 31 32 import java.io.*; 33 import java.util.Enumeration ; 34 35 39 40 public class PolicyParser extends sun.security.provider.PolicyParser { 41 42 43 public PolicyParser() { 44 } 45 46 49 public static void main(String [] args) { 50 } 51 52 public void write(java.io.Writer policy) { 53 PrintWriter out = new PrintWriter(new BufferedWriter(policy)); 54 55 Enumeration ee = grantElements(); 56 57 out.println("/* Generated by asupgrade on "+ 58 (new java.util.Date ()) + " */"); 59 out.println("/* Copyright 2004 Sun Microsystems, Inc. All rights reserved. */"); 60 out.println("/* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */"); 61 out.println(); 62 63 if (getKeyStoreUrl() != null) { 66 writeKeyStoreEntry(out); 67 } 68 69 while (ee.hasMoreElements()) { 71 GrantEntry ge = (GrantEntry) ee.nextElement(); 72 ge.write(out); 73 out.println(); 74 } 75 out.flush(); 76 out.close(); 77 } 78 79 82 private void writeKeyStoreEntry(PrintWriter out) { 83 out.print("keystore \""); 84 out.print(getKeyStoreUrl()); 85 out.print('"'); 86 String keyStoreType = getKeyStoreType(); 87 if (keyStoreType != null && keyStoreType.length() > 0) 88 out.print(", \"" + keyStoreType + "\""); 89 out.println(";"); 90 out.println(); 91 } 92 } 93 | Popular Tags |