FileDocCategorySizeDatePackage
PolicyParser.javaAPI DocGlassfish v2 API3806Fri May 04 22:35:08 BST 2007com.sun.enterprise.tools.upgrade.miscconfig

PolicyParser

public class PolicyParser extends PolicyParser
author
Hans Hrasna

Fields Summary
Constructors Summary
public PolicyParser()
Creates a new instance of PolicyParser

    
Methods Summary
public static voidmain(java.lang.String[] args)

param
args the command line arguments

    
public voidwrite(java.io.Writer policy)

        PrintWriter out = new PrintWriter(new BufferedWriter(policy));
        
        Enumeration ee = grantElements();
        
        out.println("/* Generated by asupgrade on "+
        (new java.util.Date()) + "         */");
        out.println("/* Copyright 2004 Sun Microsystems, Inc. All rights reserved.     */");
        out.println("/* SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. */");
        out.println();
        
        // write the (unexpanded) keystore entry as the first entry of the
        // policy file
        if (getKeyStoreUrl() != null) {
            writeKeyStoreEntry(out);
        }
        
        // write "grant" entries
        while (ee.hasMoreElements()) {
            GrantEntry ge = (GrantEntry) ee.nextElement();
            ge.write(out);
            out.println();
        }
        out.flush();
        out.close();
    
private voidwriteKeyStoreEntry(java.io.PrintWriter out)
writes the (unexpanded) keystore entry

        out.print("keystore \"");
        out.print(getKeyStoreUrl());
        out.print('"");
        String keyStoreType = getKeyStoreType();
        if (keyStoreType != null && keyStoreType.length() > 0)
            out.print(", \"" + keyStoreType + "\"");
        out.println(";");
        out.println();