Package org.nasutekds.server.config

Examples of org.nasutekds.server.config.ConfigException


      case PRE_OPERATION_MODIFY_DN:
      case PRE_OPERATION_SEARCH:
        // This is fine.
        break;
      default:
        throw new ConfigException(Message.raw("Invalid plugin type "
            + t + " for the IGF plugin."));
      }
    }

  }
View Full Code Here


  {
    // See if the db cache size setting is valid.
    if(cfg.getDBCacheSize() != 0)
    {
      if (MemoryBudget.getRuntimeMaxMemory() < cfg.getDBCacheSize()) {
        throw new ConfigException(
            ERR_CONFIG_JEB_CACHE_SIZE_GREATER_THAN_JVM_HEAP.get(
                cfg.getDBCacheSize(), MemoryBudget.getRuntimeMaxMemory()));
      }
      if (cfg.getDBCacheSize() < MemoryBudget.MIN_MAX_MEMORY_SIZE) {
        throw new ConfigException(
            ERR_CONFIG_JEB_CACHE_SIZE_TOO_SMALL.get(
                cfg.getDBCacheSize(), MemoryBudget.MIN_MAX_MEMORY_SIZE));
      }
    }

    EnvironmentConfig envConfig = defaultConfig();

    // Durability settings.
    if (cfg.isDBTxnNoSync() && cfg.isDBTxnWriteNoSync())
    {
      throw new ConfigException(
              ERR_CONFIG_JEB_DURABILITY_CONFLICT.get());
    }
    if (cfg.isDBTxnNoSync())
    {
      envConfig.setDurability(Durability.COMMIT_NO_SYNC);
    }
    if (cfg.isDBTxnWriteNoSync())
    {
      envConfig.setDurability(Durability.COMMIT_WRITE_NO_SYNC);
    }

    // Iterate through the config attributes associated with a JE property.
    for (Map.Entry<String, String> mapEntry : attrMap.entrySet())
    {
      String jeProperty = mapEntry.getKey();
      String attrName = mapEntry.getValue();

      String value = getPropertyValue(cfg, attrName);
      envConfig.setConfigParam(jeProperty, value);
    }

    // Set logging and file handler levels.
    Logger parent = Logger.getLogger("com.sleepycat.je");
    try
    {
      parent.setLevel(Level.parse(cfg.getDBLoggingLevel()));
    }
    catch (Exception e)
    {
      throw new ConfigException(
              ERR_JEB_INVALID_LOGGING_LEVEL.get(
              String.valueOf(cfg.getDBLoggingLevel()),
              String.valueOf(cfg.dn())));
    }
    if (cfg.isDBLoggingFileHandlerOn())
View Full Code Here

        String jePropertyValue = st.nextToken();
        // Check if it is a duplicate.
        if (uniqueJEProperties.contains(jePropertyName)) {
          Message message = ERR_CONFIG_JE_DUPLICATE_PROPERTY.get(
              jePropertyName);
            throw new ConfigException(message);
        }
        // Set JE property.
        try {
          envConfig.setConfigParam(jePropertyName, jePropertyValue);
          // If this property shadows an existing config attribute.
          if (configAttrMap.containsKey(jePropertyName)) {
            Message message = ERR_CONFIG_JE_PROPERTY_SHADOWS_CONFIG.get(
              jePropertyName, attrMap.get(jePropertyName));
            throw new ConfigException(message);
          }
          // Add this property to unique set.
          uniqueJEProperties.add(jePropertyName);
        } catch(IllegalArgumentException e) {
          if (debugEnabled()) {
            TRACER.debugCaught(DebugLogLevel.ERROR, e);
          }
          Message message =
            ERR_CONFIG_JE_PROPERTY_INVALID.get(
            jeEntry, e.getMessage());
          throw new ConfigException(message, e.getCause());
        }
      } else {
        Message message =
          ERR_CONFIG_JE_PROPERTY_INVALID_FORM.get(jeEntry);
        throw new ConfigException(message);
      }
    }

    return envConfig;
  }
View Full Code Here

      keyStorePIN = configuration.getKeyStorePin().toCharArray();
    } else {
      // Pin wasn't defined anywhere.
      Message message =
          ERR_PKCS11_KEYMANAGER_NO_PIN.get(String.valueOf(configEntryDN));
      throw new ConfigException(message);
    }
  }
View Full Code Here

    random     = new Random();

    if ((name == null) || (name.length() == 0))
    {
      Message message = ERR_CHARSET_CONSTRUCTOR_NO_NAME.get();
      throw new ConfigException(message);
    }

    for (int i=0; i < name.length(); i++)
    {
      if (! isAlpha(name.charAt(i)))
      {
        Message message = ERR_CHARSET_CONSTRUCTOR_INVALID_NAME_CHAR.
            get(String.valueOf(name.charAt(i)), i);
        throw new ConfigException(message);
      }
    }
  }
View Full Code Here

    this.random     = random;

    if ((name == null) || (name.length() == 0))
    {
      Message message = ERR_CHARSET_CONSTRUCTOR_NO_NAME.get();
      throw new ConfigException(message);
    }

    for (int i=0; i < name.length(); i++)
    {
      if (! isAlpha(name.charAt(i)))
      {
        Message message = ERR_CHARSET_CONSTRUCTOR_INVALID_NAME_CHAR.
            get(String.valueOf(name.charAt(i)), i);
        throw new ConfigException(message);
      }
    }
  }
View Full Code Here

      int colonPos = value.indexOf(':');
      if (colonPos < 0)
      {
        Message message =
            ERR_CHARSET_NO_COLON.get(String.valueOf(value));
        throw new ConfigException(message);
      }
      else if (colonPos == 0)
      {
        Message message =
            ERR_CHARSET_NO_NAME.get(String.valueOf(value));
        throw new ConfigException(message);
      }
      else if (colonPos == (value.length() - 1))
      {
        Message message =
            ERR_CHARSET_NO_CHARS.get(String.valueOf(value));
        throw new ConfigException(message);
      }
      else
      {
        String name       = value.substring(0, colonPos);
        char[] characters = value.substring(colonPos+1).toCharArray();
View Full Code Here

    }
    catch (PatternSyntaxException pse) {
      Message message = ERR_REGEXMAP_INVALID_MATCH_PATTERN.get(
              currentConfig.getMatchPattern(),
              pse.getMessage());
      throw new ConfigException(message, pse);
    }

    replacePattern = currentConfig.getReplacePattern();
    if (replacePattern == null)
    {
      replacePattern = "";
    }


    // Get the attribute types to use for the searches.  Ensure that they are
    // all indexed for equality.
    attributeTypes =
         currentConfig.getMatchAttribute().toArray(new AttributeType[0]);

    Set<DN> cfgBaseDNs = configuration.getMatchBaseDN();
    if ((cfgBaseDNs == null) || cfgBaseDNs.isEmpty())
    {
      cfgBaseDNs = DirectoryServer.getPublicNamingContexts().keySet();
    }

    for (AttributeType t : attributeTypes)
    {
      for (DN baseDN : cfgBaseDNs)
      {
        Backend b = DirectoryServer.getBackend(baseDN);
        if ((b != null) && (! b.isIndexed(t, IndexType.EQUALITY)))
        {
          throw new ConfigException(ERR_REGEXMAP_ATTR_UNINDEXED.get(
                                         configuration.dn().toString(),
                                         t.getNameOrOID(),
                                         b.getBackendID()));
        }
      }
View Full Code Here

      }

      Message message = ERR_CONFIG_EXTOP_INVALID_CLASS.
          get(String.valueOf(className), String.valueOf(config.dn()),
              String.valueOf(e));
      throw new ConfigException(message, e);
    }

    // The handler has been successfully initialized.
    return extendedOperationHandler;
  }
View Full Code Here

      }

      Message message = ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.
          get(String.valueOf(className), String.valueOf(config.dn()),
              stackTraceToSingleLineString(e));
      throw new ConfigException(message, e);
    }

    // Perform the necessary initialization for the connection
    // handler.
    try {
      // Determine the initialization method to use: it must take a
      // single parameter which is the exact type of the configuration
      // object.
      Method method = theClass.getMethod("initializeConnectionHandler", config
          .configurationClass());

      method.invoke(connectionHandler, config);
    } catch (Exception e) {
      if (debugEnabled())
      {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }

      Message message = ERR_CONFIG_CONNHANDLER_CANNOT_INITIALIZE.
          get(String.valueOf(className), String.valueOf(config.dn()),
              stackTraceToSingleLineString(e));
      throw new ConfigException(message, e);
    }

    // The connection handler has been successfully initialized.
    return connectionHandler;
  }
View Full Code Here

TOP

Related Classes of org.nasutekds.server.config.ConfigException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.