issrg.acm
Class DiskSavingUtility

java.lang.Object
  extended by issrg.acm.SavingUtility
      extended by issrg.acm.DefaultSavingUtility
          extended by issrg.acm.DiskSavingUtility
All Implemented Interfaces:
Utility, java.awt.event.ActionListener, java.util.EventListener

public class DiskSavingUtility
extends DefaultSavingUtility
implements java.awt.event.ActionListener

This is the default saving utility. You do not have to prescribe it in the configuration file. It will be loaded automatically, if no other utilities has been registered for Attribute Certificate saving purposes.

This utility saves the given Attribute Certificate to a file, which a user can pick from a dialog.

Version:
1.0
Author:
A.Otenko

Field Summary
static java.lang.String AC_EXTENSION
          This is the default AC file extension
static javax.swing.filechooser.FileFilter ace_filter
           
static java.io.File dir
           
 
Fields inherited from class issrg.acm.DefaultSavingUtility
dialog, dialogMode, LOAD_MODE, modal_result, REVOKE_MODE, SAVE_MODE
 
Constructor Summary
DiskSavingUtility()
           
DiskSavingUtility(Registry where)
           
 
Method Summary
 void actionPerformed(java.awt.event.ActionEvent e)
           
 void approveSelection()
          This method should check, if the currently selected location is OK with the user (e.g.
 void delete()
          This method is invoked only after revoke().
 java.awt.Component getContentPane(java.util.Map Environment, int dialogMode)
          This method returns the Component that displays all the controls for the load/saving dialog.
 AttributeCertificate load()
          This method returns an Attribute Certificate loaded by the utility, as specified by its controls.
 AttributeCertificate revoke()
          This method returns an Attribute Certificate loaded for revocation by the utility, as specified by its controls.
 void save(byte[] ac)
          This method saves the Attribute Certificate to the location, specified by the utility's controls.
 
Methods inherited from class issrg.acm.DefaultSavingUtility
attachControlButtons, cancelDialog, load, revoke, save
 
Methods inherited from class issrg.acm.SavingUtility
registerMe
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AC_EXTENSION

public static java.lang.String AC_EXTENSION
This is the default AC file extension


ace_filter

public static final javax.swing.filechooser.FileFilter ace_filter

dir

public static java.io.File dir
Constructor Detail

DiskSavingUtility

public DiskSavingUtility()

DiskSavingUtility

public DiskSavingUtility(Registry where)
Method Detail

getContentPane

public java.awt.Component getContentPane(java.util.Map Environment,
                                         int dialogMode)
Description copied from class: DefaultSavingUtility
This method returns the Component that displays all the controls for the load/saving dialog. The boolean flag actually tells whether the operation is load or save.

Specified by:
getContentPane in class DefaultSavingUtility
Parameters:
Environment - - the environment that allows the component to initialise its fields and controls
dialogMode - - set to one of LOAD_MODE, SAVE_MODE or REVOKE_MODE, depending on the required content pane for the dialog
Returns:
java.awt.Component that contains all the necessary controls (without Load/Save/Cancel buttons)

actionPerformed

public void actionPerformed(java.awt.event.ActionEvent e)
Specified by:
actionPerformed in interface java.awt.event.ActionListener

save

public void save(byte[] ac)
          throws ACCreationException
Description copied from class: DefaultSavingUtility
This method saves the Attribute Certificate to the location, specified by the utility's controls.

Specified by:
save in class DefaultSavingUtility
Throws:
ACCreationException

load

public AttributeCertificate load()
                          throws ACCreationException
Description copied from class: DefaultSavingUtility
This method returns an Attribute Certificate loaded by the utility, as specified by its controls.

Specified by:
load in class DefaultSavingUtility
Returns:
issrg.ac.AttributeCertificate, loaded from the specified location; never null
Throws:
ACCreationException

revoke

public AttributeCertificate revoke()
                            throws ACCreationException
Description copied from class: DefaultSavingUtility
This method returns an Attribute Certificate loaded for revocation by the utility, as specified by its controls.

Specified by:
revoke in class DefaultSavingUtility
Returns:
issrg.ac.AttributeCertificate, loaded from the specified location; never null
Throws:
ACCreationException

delete

public void delete()
            throws ACCreationException
Description copied from class: SavingUtility
This method is invoked only after revoke(). It effectively tells the SavingUtility to delete the AC that has been selected during revoke() call.

Specified by:
delete in class SavingUtility
Throws:
ACCreationException - if anything went wrong and the AC could not be removed.

approveSelection

public void approveSelection()
Description copied from class: DefaultSavingUtility
This method should check, if the currently selected location is OK with the user (e.g. he doesn't mind overwriting a file, etc)

Override to ask questions or display error messages.

Overrides:
approveSelection in class DefaultSavingUtility