mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

boli
01.27.2007 455897cc245b67d929f409a93cfa7106e835cc1f
opends/src/server/org/opends/server/extensions/PKCS11KeyManagerProvider.java
@@ -54,7 +54,9 @@
import org.opends.server.types.ResultCode;
import static org.opends.server.config.ConfigConstants.*;
import static org.opends.server.loggers.Debug.*;
import static org.opends.server.loggers.debug.DebugLogger.debugCought;
import static org.opends.server.loggers.debug.DebugLogger.debugEnabled;
import org.opends.server.types.DebugLogLevel;
import static org.opends.server.messages.ExtensionsMessages.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.util.StaticUtils.*;
@@ -70,11 +72,6 @@
       extends KeyManagerProvider
       implements ConfigurableComponent
{
  /**
   * The fully-qualified name of this class for debugging purposes.
   */
  private static final String CLASS_NAME =
       "org.opends.server.extensions.PKCS11KeyManagerProvider";
@@ -109,7 +106,6 @@
   */
  public PKCS11KeyManagerProvider()
  {
    assert debugConstructor(CLASS_NAME);
    // No implementation is required.
  }
@@ -134,8 +130,6 @@
  public void initializeKeyManagerProvider(ConfigEntry configEntry)
         throws ConfigException, InitializationException
  {
    assert debugEnter(CLASS_NAME, "initializeKeyManagerProvider",
                      String.valueOf(configEntry));
    // Store the DN of the configuration entry.
@@ -186,13 +180,19 @@
      }
      catch (InitializationException ie)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", ie);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, ie);
        }
        throw ie;
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_PROPERTY;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -230,13 +230,19 @@
      }
      catch (InitializationException ie)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", ie);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, ie);
        }
        throw ie;
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_ENVAR;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -302,13 +308,19 @@
      }
      catch (InitializationException ie)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", ie);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, ie);
        }
        throw ie;
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FILE;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -333,7 +345,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "initializeKeyManagerProvider", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FROM_ATTR;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -361,7 +376,6 @@
   */
  public void finalizeKeyManagerProvider()
  {
    assert debugEnter(CLASS_NAME, "finalizeKeyManagerProvider");
    DirectoryServer.deregisterConfigurableComponent(this);
  }
@@ -381,7 +395,6 @@
  public KeyManager[] getKeyManagers()
         throws DirectoryException
  {
    assert debugEnter(CLASS_NAME, "getKeyManagers");
    KeyStore keyStore;
    try
@@ -391,7 +404,10 @@
    }
    catch (Exception e)
    {
      assert debugException(CLASS_NAME, "getKeyManagers", e);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_LOAD;
      String message = getMessage(msgID, stackTraceToSingleLineString(e));
@@ -410,7 +426,10 @@
    }
    catch (Exception e)
    {
      assert debugException(CLASS_NAME, "getKeyManagers", e);
      if (debugEnabled())
      {
        debugCought(DebugLogLevel.ERROR, e);
      }
      int msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_CREATE_FACTORY;
      String message = getMessage(msgID, stackTraceToSingleLineString(e));
@@ -430,7 +449,6 @@
   */
  public DN getConfigurableComponentEntryDN()
  {
    assert debugEnter(CLASS_NAME, "getConfigurableComponentEntryDN");
    return configEntryDN;
  }
@@ -446,7 +464,6 @@
   */
  public List<ConfigAttribute> getConfigurationAttributes()
  {
    assert debugEnter(CLASS_NAME, "getConfigurationAttributes");
    LinkedList<ConfigAttribute> attrList = new LinkedList<ConfigAttribute>();
@@ -514,8 +531,6 @@
  public boolean hasAcceptableConfiguration(ConfigEntry configEntry,
                                            List<String> unacceptableReasons)
  {
    assert debugEnter(CLASS_NAME, "hasAcceptableConfiguration",
                      String.valueOf(configEntry), "java.util.List<String>");
    DN configEntryDN = configEntry.getDN();
@@ -556,7 +571,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_PROPERTY;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -595,7 +613,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_ENVAR;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -664,7 +685,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FILE;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -690,7 +714,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "hasAcceptableConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FROM_ATTR;
        String message = getMessage(msgID, String.valueOf(configEntryDN),
@@ -734,9 +761,6 @@
  public ConfigChangeResult applyNewConfiguration(ConfigEntry configEntry,
                                                  boolean detailedResults)
  {
    assert debugEnter(CLASS_NAME, "applyNewConfiguration",
                      String.valueOf(configEntry),
                      String.valueOf(detailedResults));
    ResultCode        resultCode          = ResultCode.SUCCESS;
    boolean           adminActionRequired = false;
@@ -788,7 +812,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "applyNewConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_PROPERTY;
        messages.add(getMessage(msgID, String.valueOf(configEntryDN),
@@ -838,7 +865,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "applyNewConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_ENVAR;
        messages.add(getMessage(msgID, String.valueOf(configEntryDN),
@@ -928,7 +958,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "applyNewConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FILE;
        messages.add(getMessage(msgID, String.valueOf(configEntryDN),
@@ -959,7 +992,10 @@
      }
      catch (Exception e)
      {
        assert debugException(CLASS_NAME, "applyNewConfiguration", e);
        if (debugEnabled())
        {
          debugCought(DebugLogLevel.ERROR, e);
        }
        msgID = MSGID_PKCS11_KEYMANAGER_CANNOT_DETERMINE_PIN_FROM_ATTR;
        messages.add(getMessage(msgID, String.valueOf(configEntryDN),