org.openpermis.editor.policy.view
Class RoleAssignmentWizard

java.lang.Object
  extended by org.openpermis.editor.policy.view.RoleAssignmentWizard

public class RoleAssignmentWizard
extends Object

Wizard to create an attribute certificates assigning roles to a subject.

Since:
0.3.0

Field Summary
private  JTextArea aceContentArea
          Text area showing the ace content.
private  JTextField aceFile
          Text field for the selection of the output file created.
private  JTextField acPath
          Text field for the selection of the attribute certificate to browse file.
private  ActionMap actionMap
          The action map attached to this view instance.
private static Border BORDER
          The content border for the wizard.
private static Dimension BROWSER_PREFERRED_SIZE
          The preferred size of the certificate browser.
private static String CHOOSER_TEXT
          The text on the directory chooser buttons.
private  JPanel content
          The wizard content pane.
private static Dimension CONTENT_PANEL_DIMENSION
          The size of the content panel.
private  JButton defaultButton
          The default button of the wizard.
private  JDialog dialog
          The wizard dialog component.
private static org.slf4j.Logger LOGGER
          The logger of this class.
private static String NEXT_FOCUS
          Client property for chooser buttons that contains the next focus field.
private  JPasswordField password
          Password field for the PKCS12 password.
private  JTextField pkcs12File
          Text field for the selection of the PKCS12 file.
private  org.jdesktop.application.ResourceMap resourceMap
          The resource map attached to this view instance.
private  CheckList<org.openpermis.policy.Role> roleList
          The list of roles to choose from.
private  org.jdesktop.observablecollections.ObservableList<org.openpermis.policy.Role> selectedRoles
          The list of the actually selected roles.
private  JTextField subject
          Subject field.
private static int TEXT_FIELD_COLUMNS
          The number of columns in a text field.
 
Constructor Summary
RoleAssignmentWizard(org.jdesktop.application.ApplicationContext context, org.openpermis.policy.bean.PolicyBean policy)
          Creates a wizard to create an attribute certificates assigning roles to a subject.
 
Method Summary
 void cancel()
          Action to close the wizard without executing it.
private
<T extends JTextComponent>
T
configure(T component, JLabel label)
          Configures the specified text component.
protected  boolean createAttributeCertificate(File input, char[] pw, File output)
          Creates a an attribute certificate with the specified input pkcs12 file, password and output file.
private  JButton createChooser(JTextField target, int type, PolicyFileFilter filter)
          Creates a file chooser button for the specified target field.
protected  org.openpermis.cert.KeyStoreReader createKeyStoreReader(File input, char[] pw)
          Creates a key store reader for the specified input file and password.
private  JLabel createLabel(String name)
          Creates a named label for automated translation.
private  JPasswordField createPasswordField(JLabel label)
          Creates and configures a password field.
private  JComponent createSeparator(String name)
          Creates a named separator for automated translation.
private  JTextField createTextField(JLabel label)
          Creates and configures a text field.
 void execute()
          Action to execute the signing process.
protected  org.openpermis.cert.AttributeCertificate generateAttributeCertificate(org.openpermis.cert.KeyStoreReader rd, org.openpermis.cert.Attribute rolesAttribute)
          Generates an attribute certificate for the specified key store reader and policy.
 void show(Component parent)
          Starts the wizard.
protected  void showErrorDialog(Component parent, String key, Object... args)
          Shows an error dialog with the specified title, message and paramters.
protected  void showErrorDialog(String key, Object... args)
          Shows an error dialog with the specified title, message and paramters.
private  void updateActions()
          Updates the actions according to the values in the wizard fields.
protected  boolean writeAttributeCertificate(File output, org.openpermis.cert.AttributeCertificate ac)
          Encodes and writes an attribute certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

LOGGER

private static final org.slf4j.Logger LOGGER
The logger of this class.

Since:
0.3.0

TEXT_FIELD_COLUMNS

private static final int TEXT_FIELD_COLUMNS
The number of columns in a text field.

Constant Field Value:
25
Since:
0.3.0

NEXT_FOCUS

private static final String NEXT_FOCUS
Client property for chooser buttons that contains the next focus field.

Constant Field Value:
"chooserNextFocus"
Since:
0.3.0

CHOOSER_TEXT

private static final String CHOOSER_TEXT
The text on the directory chooser buttons.

Constant Field Value:
"..."
Since:
0.3.0

BORDER

private static final Border BORDER
The content border for the wizard.

Since:
0.3.0

CONTENT_PANEL_DIMENSION

private static final Dimension CONTENT_PANEL_DIMENSION
The size of the content panel.

Since:
0.3.0

BROWSER_PREFERRED_SIZE

private static final Dimension BROWSER_PREFERRED_SIZE
The preferred size of the certificate browser.

Since:
0.3.0

actionMap

private final ActionMap actionMap
The action map attached to this view instance.

Since:
0.3.0

resourceMap

private final org.jdesktop.application.ResourceMap resourceMap
The resource map attached to this view instance.

Since:
0.3.0

acPath

private final JTextField acPath
Text field for the selection of the attribute certificate to browse file.

Since:
0.3.0

aceContentArea

private final JTextArea aceContentArea
Text area showing the ace content.

Since:
0.3.0

pkcs12File

private final JTextField pkcs12File
Text field for the selection of the PKCS12 file.

Since:
0.3.0

content

private final JPanel content
The wizard content pane.

Since:
0.3.0

password

private final JPasswordField password
Password field for the PKCS12 password.

Since:
0.3.0

subject

private final JTextField subject
Subject field.

Since:
0.3.0

roleList

private final CheckList<org.openpermis.policy.Role> roleList
The list of roles to choose from.

Since:
0.3.0

selectedRoles

private final org.jdesktop.observablecollections.ObservableList<org.openpermis.policy.Role> selectedRoles
The list of the actually selected roles.

Since:
0.3.0

aceFile

private final JTextField aceFile
Text field for the selection of the output file created.

Since:
0.3.0

defaultButton

private final JButton defaultButton
The default button of the wizard.

Since:
0.3.0

dialog

private JDialog dialog
The wizard dialog component.

Since:
0.3.0
Constructor Detail

RoleAssignmentWizard

public RoleAssignmentWizard(org.jdesktop.application.ApplicationContext context,
                            org.openpermis.policy.bean.PolicyBean policy)
Creates a wizard to create an attribute certificates assigning roles to a subject.

Parameters:
context - the application context used to lookup the action and resource map.
policy - the policy to export to the ace file.
Since:
0.3.0
Method Detail

updateActions

private final void updateActions()
Updates the actions according to the values in the wizard fields.

Since:
0.3.0

configure

private final <T extends JTextComponent> T configure(T component,
                                                     JLabel label)
Configures the specified text component.

Changes to the document of the text component will cause the actions of the wizard to be updated (see updateActions(). In addition a label for the text field is configured.

Type Parameters:
T - the type of text component to configure.
Parameters:
component - the text component to configure.
label - the label of the text component, must not be null.
Returns:
the text component passed in for fluent use.
Since:
0.3.0

createSeparator

private final JComponent createSeparator(String name)
Creates a named separator for automated translation.

Parameters:
name - the name of the separator.
Returns:
the separator created.
Since:
0.3.0

createLabel

private final JLabel createLabel(String name)
Creates a named label for automated translation.

Parameters:
name - the name of the label.
Returns:
the label created.
Since:
0.3.0

createTextField

private final JTextField createTextField(JLabel label)
Creates and configures a text field.

Parameters:
label - the label of the text field.
Returns:
the text field created.
Since:
0.3.0

createPasswordField

private final JPasswordField createPasswordField(JLabel label)
Creates and configures a password field.

Parameters:
label - the label of the password field.
Returns:
the password field created.
Since:
0.3.0

createChooser

private final JButton createChooser(JTextField target,
                                    int type,
                                    PolicyFileFilter filter)
Creates a file chooser button for the specified target field.

Parameters:
target - the field to store the chosen file to.
type - the file chooser type, either JFileChooser.OPEN_DIALOG or JFileChooser.SAVE_DIALOG.
filter - the file filter to use.
Returns:
the button created.
Since:
0.3.0

showErrorDialog

protected void showErrorDialog(String key,
                               Object... args)
Shows an error dialog with the specified title, message and paramters.

Parameters:
key - translation key for the title.
args - optional parameters for the title and message.
Since:
0.3.0

showErrorDialog

protected void showErrorDialog(Component parent,
                               String key,
                               Object... args)
Shows an error dialog with the specified title, message and paramters.

Parameters:
parent - the parent component to show the error dialog for.
key - translation key for the title.
args - optional parameters for the title and message.
Since:
0.3.0

show

public void show(Component parent)
Starts the wizard.

Parameters:
parent - the parent component of the dialog.
Since:
0.3.0

createKeyStoreReader

protected org.openpermis.cert.KeyStoreReader createKeyStoreReader(File input,
                                                                  char[] pw)
Creates a key store reader for the specified input file and password.

Parameters:
input - the input file to read the pkcs12 data from.
pw - the password for the pkcs12 file.
Returns:
the key store reader requested, null if the key store cannot be read.
Since:
0.3.0

generateAttributeCertificate

protected org.openpermis.cert.AttributeCertificate generateAttributeCertificate(org.openpermis.cert.KeyStoreReader rd,
                                                                                org.openpermis.cert.Attribute rolesAttribute)
Generates an attribute certificate for the specified key store reader and policy.

Parameters:
rd - the key store reader to use for creation of the attribute certificate.
rolesAttribute - the roles attribute.
Returns:
the attribute certificate generated, null in case of an error.
Since:
0.3.0

writeAttributeCertificate

protected boolean writeAttributeCertificate(File output,
                                            org.openpermis.cert.AttributeCertificate ac)
Encodes and writes an attribute certificate.

Parameters:
output - the output file to write to.
ac - the certificate to write.
Returns:
true if the output file was written, false in case of an error.
Since:
0.3.0

createAttributeCertificate

protected boolean createAttributeCertificate(File input,
                                             char[] pw,
                                             File output)
Creates a an attribute certificate with the specified input pkcs12 file, password and output file.

Parameters:
input - the pkcs12 input file.
pw - the password for the pkcs12 input file.
output - the output file.
Returns:
true if the attribute certificate was created, false otherwise.
Since:
0.3.0

cancel

@Action
public void cancel()
Action to close the wizard without executing it.

Notes:
Do not call directly, this action is triggered by the wizard.
Since:
0.3.0

execute

@Action
public void execute()
Action to execute the signing process.

Notes:
Do not call directly, this action is triggered by the wizard.
Since:
0.3.0


PERMIS Role Based Access Control 0.3.0 (Build 14)
2009/05/08 09:06:48
Copyright (c) 2002-2007 Ergon Informatik AG