issrg.acm
Class SavingUtility

java.lang.Object
  extended by issrg.acm.SavingUtility
All Implemented Interfaces:
Utility
Direct Known Subclasses:
DefaultSavingUtility

public abstract class SavingUtility
extends java.lang.Object
implements Utility

This is a base class for loading/saving ACs to a file. Many implementation may want to load/save them to a disk, or to an LDAP directory, or use a combination of these features.

Version:
1.0
Author:
A Otenko

Constructor Summary
SavingUtility()
           
 
Method Summary
abstract  void delete()
          This method is invoked only after revoke().
abstract  AttributeCertificate load(java.awt.Frame frame, java.util.Map Environment)
          This method is called to load an attribute certificate from somewhere, as the implementation defines.
 void registerMe(Registry where)
          You do not need to override this method.
abstract  AttributeCertificate revoke(java.awt.Frame frame, java.util.Map Environment)
          This method is called to revoke an attribute certificate.
abstract  void save(java.awt.Frame frame, byte[] ac, java.util.Map Environment)
          This method is called to save an attribute certificate somewhere.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SavingUtility

public SavingUtility()
Method Detail

registerMe

public final void registerMe(Registry where)
You do not need to override this method. It does all what is needed.

Specified by:
registerMe in interface Utility

save

public abstract void save(java.awt.Frame frame,
                          byte[] ac,
                          java.util.Map Environment)
                   throws ACCreationException
This method is called to save an attribute certificate somewhere. The implementation of this class must know better where to. It must take all measures to save the certificate. Throw ACCreationException only in cases of utmost emergency; do not expect the process of saving to be redone in this case.

Parameters:
frame - the java.awt.Frame, to which this utility can display a modal window
ac - a correctly encoded Attribute Certificate to save; the utility may want to check whether it is an AC (or get particular values from it, like Holder DN) by calling a BER decoder. For security reasons you should not assume you could save anything.
Environment - a java.util.Map with environmental variables there; the implementation is expected to get useful configuration information from there.
Throws:
ACCreationException

load

public abstract AttributeCertificate load(java.awt.Frame frame,
                                          java.util.Map Environment)
                                   throws ACCreationException
This method is called to load an attribute certificate from somewhere, as the implementation defines.

Do not expect the application will ask to load the same AC again after an exception has been thrown.

Parameters:
frame - the java.awt.Frame, to which this utility can display a modal window
Environment - a java.util.Map with environmental variables there; the intention is to let the method know any configuration parameters it may want to know
Returns:
a parsed issrg.ac.AttributeCertificate; or null, if no certificate has been loaded; this should mean creation of a new AC.
Throws:
ACCreationException

revoke

public abstract AttributeCertificate revoke(java.awt.Frame frame,
                                            java.util.Map Environment)
                                     throws ACCreationException
This method is called to revoke an attribute certificate. The utility has to remember which AC has been selected, as the subsequent delete() call will not display any dialog.

Parameters:
frame - the java.awt.Frame, to which this utility can display a modal window
Environment - a java.util.Map with environmental variables there; the intention is to let the method know any configuration parameters it may want to know
Returns:
a parsed issrg.ac.AttributeCertificate; or null, if no certificate has been selected.
Throws:
ACCreationException

delete

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

Throws:
ACCreationException - if anything went wrong and the AC could not be removed.