java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
net.adoptopenjdk.icedteaweb.client.policyeditor.PolicyEditor
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class PolicyEditor extends JPanel
This class provides a policy editing tool as a simpler alternate to the JDK PolicyTool.
See Also:
  • Field Details

  • Constructor Details

    • PolicyEditor

      public PolicyEditor(String filepath)
  • Method Details

    • setFile

      public void setFile(String filepath)
    • getPolicyEditorFrame

      public static PolicyEditor.PolicyEditorWindow getPolicyEditorFrame(String filepath)
    • getPolicyEditorDialog

      public static PolicyEditor.PolicyEditorWindow getPolicyEditorDialog(String filepath)
    • isClosed

      public boolean isClosed()
      Check if the PolicyEditor instance has been visually closed
      Returns:
      if the PolicyEditor instance has been closed
    • addNewEntry

      public void addNewEntry(PolicyIdentifier identifier)
      Add a new identifier to the editor's model.
      Parameters:
      identifier - to be added
    • getFile

      public File getFile()
    • addNewIdentifierInteractive

      public void addNewIdentifierInteractive()
      Display an input dialog, which will disappear when the user enters a valid entry or when the user presses cancel.
    • removeIdentifier

      public void removeIdentifier(PolicyIdentifier identifier)
      Remove an identifier from the editor's model
      Parameters:
      identifier - to be removed
    • modifyCodebase

      public void modifyCodebase(PolicyIdentifier identifier, String newCodebase)
    • modifyPrincipals

      public void modifyPrincipals(PolicyIdentifier identifier, List<PolicyParser.PrincipalEntry> principalEntries)
    • modifySignedBy

      public void modifySignedBy(PolicyIdentifier identifier, String newSignedBy)
    • copyEntry

      public void copyEntry(PolicyIdentifier identifier)
      Copy an entry to the system clipboard
      Parameters:
      identifier - the identifier to copy
    • pasteEntry

      Paste a grant entry from the system clipboard with a new identifier
      Throws:
      UnsupportedFlavorException
      PolicyParser.ParsingException
      IOException
    • setPermission

      public void setPermission(PolicyIdentifier identifier, PolicyEditorPermissions permission, boolean state)
    • getPermissions

      public Map<PolicyEditorPermissions,Boolean> getPermissions(PolicyIdentifier identifier)
    • addCustomPermission

      public void addCustomPermission(PolicyIdentifier identifier, PolicyParser.PermissionEntry permission)
    • getCustomPermissions

      public Collection<PolicyParser.PermissionEntry> getCustomPermissions(PolicyIdentifier identifier)
    • clearCustomPermissions

      public void clearCustomPermissions(PolicyIdentifier identifier)
    • isPerformingIO

      public boolean isPerformingIO()
      Returns:
      whether this PolicyEditor is currently opening or saving a policy file to disk
    • openPolicyFileSynchronously

      public void openPolicyFileSynchronously()
    • openAndParsePolicyFile

      public void openAndParsePolicyFile()
    • main

      public static void main(String[] args)
      Start a Policy Editor instance.
      Parameters:
      args - "-file $FILENAME" and/or "-codebase $CODEBASE" are accepted flag/value pairs. -file specifies a file path to be opened by the editor. If none is provided, the default policy file location for the user is opened. -help will print a help message and immediately return (no editor instance opens)
    • createInstance

      public static PolicyEditor createInstance(String filepath)
      Create a new PolicyEditor instance without passing argv. The returned instance is not yet set visible.
      Parameters:
      filepath - a policy file to open at start, or null if no file to load
      Returns:
      a reference to a new PolicyEditor instance