issrg.acm.extensions
Class LDAPSavingUtility

java.lang.Object
  extended by issrg.acm.SavingUtility
      extended by issrg.acm.DefaultSavingUtility
          extended by issrg.acm.extensions.LDAPSavingUtility
All Implemented Interfaces:
Utility, DITSelectionListener

public class LDAPSavingUtility
extends DefaultSavingUtility
implements DITSelectionListener

This is the LDAP saving utility.

This utility saves the given Attribute Certificate to an LDAP Directory, of which the URL a user can enter in a dialog. The DN to save to is obtained from the AC to save; the DN to load from the user should type in.

Simple authentication to the LDAP server is supported.

The utility was tested on LDAP v3 only.

Version:
1.0
Author:
A Otenko

Field Summary
static java.lang.String ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME
          The variable, containing the name of the attribute the LDAPSavingUtility will retrieve and store.
static java.lang.String LDAP_SAVING_UTILITY_AC_TYPE
          The variable, containing the name of the configuration variable, representing the default name of the attribute the LDAPSavingUtility will retrieve and store.
static java.lang.String LDAP_SAVING_UTILITY_LOGIN
          The variable, containing the name of the configuration variable, representing the default login for accessing LDAP server.
 
Fields inherited from class issrg.acm.DefaultSavingUtility
dialog, dialogMode, LOAD_MODE, modal_result, REVOKE_MODE, SAVE_MODE
 
Constructor Summary
LDAPSavingUtility()
           
 
Method Summary
 void approveSelection()
          This method should check, if the currently selected location is OK with the user (e.g.
 void communicationError(java.lang.Throwable th)
          A communication error occured while attempting to expand the tree.
 void delete()
          Deletes the selected Attribute Certificate from the entry.
 void doubleclick(LDAP_DIT sender)
          Something has been double-clicked in the tree.
 java.awt.Component getContentPane(java.util.Map env, 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.
 javax.naming.directory.Attribute loadACs(java.lang.String dn)
          Load all ACs (Attribute Certificate) from the specified entry.
 void resetLDAPTree()
          Resets the tree view of the LDAP.
 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.
 void select(LDAP_DIT sender)
          Something gets selected in the tree.
 void unselect(LDAP_DIT sender)
          User clicks outside the tree bounds.
 
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

LDAP_SAVING_UTILITY_LOGIN

public static final java.lang.String LDAP_SAVING_UTILITY_LOGIN
The variable, containing the name of the configuration variable, representing the default login for accessing LDAP server. (Usually such authentication is set for writing only.) The user may change this value at run time. At the moment it is "LDAPSavingUtility.Login". Note, that only simple authentication is suported at the moment.

See Also:
Constant Field Values

LDAP_SAVING_UTILITY_AC_TYPE

public static final java.lang.String LDAP_SAVING_UTILITY_AC_TYPE
The variable, containing the name of the configuration variable, representing the default name of the attribute the LDAPSavingUtility will retrieve and store. At the moment it is "LDAPSavingUtility.ACType".

See Also:
Constant Field Values

ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME

public static final java.lang.String ATTRIBUTE_CERTIFICATE_ATTRIBUTE_NAME
The variable, containing the name of the attribute the LDAPSavingUtility will retrieve and store. At the moment it is "2.5.4.58;binary". the OID of the attribute is 2.5.4.58.

See Also:
Constant Field Values
Constructor Detail

LDAPSavingUtility

public LDAPSavingUtility()
Method Detail

getContentPane

public java.awt.Component getContentPane(java.util.Map env,
                                         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:
env - - 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)

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

resetLDAPTree

public void resetLDAPTree()
                   throws ACCreationException
Resets the tree view of the LDAP. It uses URL text field to find the URL of the LDAP, Login and Password to authenticate and Anonymous tickbox to ignore the password, if it is provided.

Throws:
ACCreationException

loadACs

public javax.naming.directory.Attribute loadACs(java.lang.String dn)
                                         throws ACCreationException
Load all ACs (Attribute Certificate) from the specified entry.

Parameters:
dn - the specifed DN to retrive ACs.
Returns:
the attribute certificates (inside the Attribute)
Throws:
ACCreationException

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

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
Deletes the selected Attribute Certificate from the entry.

If the entry contains attributes other than well-formed X.509 ACs under 2.5.4.58 attributeCertificateAttribute, the behaviour is undefined (may spoil the contents of the entry).

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

select

public void select(LDAP_DIT sender)
Description copied from interface: DITSelectionListener
Something gets selected in the tree.

Specified by:
select in interface DITSelectionListener

doubleclick

public void doubleclick(LDAP_DIT sender)
Description copied from interface: DITSelectionListener
Something has been double-clicked in the tree.

Specified by:
doubleclick in interface DITSelectionListener

unselect

public void unselect(LDAP_DIT sender)
Description copied from interface: DITSelectionListener
User clicks outside the tree bounds.

Specified by:
unselect in interface DITSelectionListener

communicationError

public void communicationError(java.lang.Throwable th)
Description copied from interface: DITSelectionListener
A communication error occured while attempting to expand the tree. Note that if the error occurs at any other time, the corresponding methods will throw the exception.

Specified by:
communicationError in interface DITSelectionListener