Package org.nasutekds.server.config

Examples of org.nasutekds.server.config.ConfigException


          buffer.append(".  ");
          buffer.append(iterator.next());
        }
      }
      Message message = ERR_FSCACHE_CANNOT_INITIALIZE.get(buffer.toString());
      throw new ConfigException(message);
    }

    // Set the cache type.
    if (cacheType.equalsIgnoreCase("LRU")) {
      accessOrder = true;
View Full Code Here


    // Make sure that this plugin is only registered as a startup plugin.
    if (pluginTypes.isEmpty())
    {
      Message message = ERR_PLUGIN_PROFILER_NO_PLUGIN_TYPES.get(
          String.valueOf(configEntryDN));
      throw new ConfigException(message);
    }
    else
    {
      for (PluginType t : pluginTypes)
      {
        if (t != PluginType.STARTUP)
        {
          Message message = ERR_PLUGIN_PROFILER_INVALID_PLUGIN_TYPE.get(
              String.valueOf(configEntryDN), String.valueOf(t));
          throw new ConfigException(message);
        }
      }
    }


    // Make sure that the profile directory exists.
    File profileDirectory = getFileForPath(configuration.getProfileDirectory());
    if (! (profileDirectory.exists() && profileDirectory.isDirectory()))
    {
      Message message = WARN_PLUGIN_PROFILER_INVALID_PROFILE_DIR.get(
          profileDirectory.getAbsolutePath(), String.valueOf(configEntryDN));
      throw new ConfigException(message);
    }
  }
View Full Code Here

    // Make sure that the Directory Server is configured with information about
    // one or more mail servers.
    List<Properties> propList = DirectoryServer.getMailServerPropertySets();
    if ((propList == null) || propList.isEmpty())
    {
      throw new ConfigException(ERR_SMTP_ASNH_NO_MAIL_SERVERS_CONFIGURED.get(
                                     configuration.dn().toString()));
    }

    // Make sure that either an explicit recipient list or a set of email
    // address attributes were provided.
    Set<AttributeType> mailAttrs = configuration.getEmailAddressAttributeType();
    Set<String> recipients = configuration.getRecipientAddress();
    if (((mailAttrs == null) || mailAttrs.isEmpty()) &&
        ((recipients == null) || recipients.isEmpty()))
    {
      throw new ConfigException(ERR_SMTP_ASNH_NO_RECIPIENTS.get(
                                     configuration.dn().toString()));
    }
  }
View Full Code Here

    for (String s : configuration.getMessageSubject())
    {
      int colonPos = s.indexOf(':');
      if (colonPos < 0)
      {
        throw new ConfigException(ERR_SMTP_ASNH_SUBJECT_NO_COLON.get(s,
                                       configuration.dn().toString()));
      }

      String notificationTypeName = s.substring(0, colonPos).trim();
      AccountStatusNotificationType t =
           AccountStatusNotificationType.typeForName(notificationTypeName);
      if (t == null)
      {
        throw new ConfigException(
                       ERR_SMTP_ASNH_SUBJECT_INVALID_NOTIFICATION_TYPE.get(
                            s, configuration.dn().toString(),
                            notificationTypeName));
      }
      else if (map.containsKey(t))
      {
        throw new ConfigException(ERR_SMTP_ASNH_SUBJECT_DUPLICATE_TYPE.get(
                                       configuration.dn().toString(),
                                       notificationTypeName));
      }

      map.put(t, s.substring(colonPos+1).trim());
View Full Code Here

    for (String s : configuration.getMessageTemplateFile())
    {
      int colonPos = s.indexOf(':');
      if (colonPos < 0)
      {
        throw new ConfigException(ERR_SMTP_ASNH_TEMPLATE_NO_COLON.get(s,
                                       configuration.dn().toString()));
      }

      String notificationTypeName = s.substring(0, colonPos).trim();
      AccountStatusNotificationType t =
           AccountStatusNotificationType.typeForName(notificationTypeName);
      if (t == null)
      {
        throw new ConfigException(
                       ERR_SMTP_ASNH_TEMPLATE_INVALID_NOTIFICATION_TYPE.get(
                            s, configuration.dn().toString(),
                            notificationTypeName));
      }
      else if (map.containsKey(t))
      {
        throw new ConfigException(ERR_SMTP_ASNH_TEMPLATE_DUPLICATE_TYPE.get(
                                       configuration.dn().toString(),
                                       notificationTypeName));
      }

      String path = s.substring(colonPos+1).trim();
      File f = new File(path);
      if (! f.isAbsolute() )
      {
        f = new File(DirectoryServer.getInstanceRoot() + File.separator +
            path);
      }
      if (! f.exists())
      {
        throw new ConfigException(ERR_SMTP_ASNH_TEMPLATE_NO_SUCH_FILE.get(
                                       path, configuration.dn().toString()));
      }

      map.put(t, parseTemplateFile(f));
      if (debugEnabled())
View Full Code Here

            int closeDelimPos = line.indexOf("%%", delimPos+1);
            if (closeDelimPos < 0)
            {
              // There was an opening %% but not a closing one.
              throw new ConfigException(
                             ERR_SMTP_ASNH_TEMPLATE_UNCLOSED_TOKEN.get(
                                  delimPos, lineNumber));
            }
            else
            {
              String tokenStr = line.substring(delimPos+2, closeDelimPos);
              String lowerTokenStr = toLowerCase(tokenStr);
              if (lowerTokenStr.equals("notification-type"))
              {
                if (debugEnabled())
                {
                  TRACER.debugInfo("Found a notification type token " +
                                   tokenStr);
                }

                elementList.add(
                     new NotificationTypeNotificationMessageTemplateElement());
              }
              else if (lowerTokenStr.equals("notification-message"))
              {
                if (debugEnabled())
                {
                  TRACER.debugInfo("Found a notification message token " +
                                   tokenStr);
                }

                elementList.add(
                  new NotificationMessageNotificationMessageTemplateElement());
              }
              else if (lowerTokenStr.equals("notification-user-dn"))
              {
                if (debugEnabled())
                {
                  TRACER.debugInfo("Found a notification user DN token " +
                                   tokenStr);
                }

                elementList.add(
                     new UserDNNotificationMessageTemplateElement());
              }
              else if (lowerTokenStr.startsWith("notification-user-attr:"))
              {
                String attrName = lowerTokenStr.substring(23);
                AttributeType attrType =
                     DirectoryServer.getAttributeType(attrName, false);
                if (attrType == null)
                {
                  throw new ConfigException(
                                 ERR_SMTP_ASNH_TEMPLATE_UNDEFINED_ATTR_TYPE.get(
                                      delimPos, lineNumber, attrName));
                }
                else
                {
                  if (debugEnabled())
                  {
                    TRACER.debugInfo("Found a user attribute token for  " +
                                     attrType.getNameOrOID() + " -- " +
                                     tokenStr);
                  }

                  elementList.add(
                       new UserAttributeNotificationMessageTemplateElement(
                                attrType));
                }
              }
              else if (lowerTokenStr.startsWith("notification-property:"))
              {
                String propertyName = lowerTokenStr.substring(22);
                AccountStatusNotificationProperty property =
                     AccountStatusNotificationProperty.forName(propertyName);
                if (property == null)
                {
                  throw new ConfigException(
                                 ERR_SMTP_ASNH_TEMPLATE_UNDEFINED_PROPERTY.get(
                                      delimPos, lineNumber, propertyName));
                }
                else
                {
                  if (debugEnabled())
                  {
                    TRACER.debugInfo("Found a notification property token " +
                                     "for " + propertyName + " -- " + tokenStr);
                  }

                  elementList.add(
                    new NotificationPropertyNotificationMessageTemplateElement(
                          property));
                }
              }
              else
              {
                throw new ConfigException(
                               ERR_SMTP_ASNH_TEMPLATE_UNRECOGNIZED_TOKEN.get(
                                    tokenStr, delimPos, lineNumber));
              }

              startPos = closeDelimPos + 2;
            }
          }
        }


        // We need to put a CRLF at the end of the line, as per the SMTP spec.
        elementList.add(new TextNotificationMessageTemplateElement("\r\n"));
      }

      return elementList;
    }
    catch (Exception e)
    {
      if (debugEnabled())
      {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }

      throw new ConfigException(ERR_SMTP_ASNH_TEMPLATE_CANNOT_PARSE.get(
                                     f.getAbsolutePath(),
                                     currentConfig.dn().toString(),
                                     getExceptionMessage(e)));
    }
    finally
View Full Code Here

    // map.
    if ((baseDNs == null) || (baseDNs.length != 1))
    {
      Message message = ERR_LDIF_BACKEND_MULTIPLE_BASE_DNS.get(
                             currentConfig.dn().toString());
      throw new ConfigException(message);
    }

    for (DN dn : baseDNs)
    {
      try
View Full Code Here

      baseDNs = new DN[currentConfig.getBaseDN().size()];
      currentConfig.getBaseDN().toArray(baseDNs);
      if (baseDNs.length != 1)
      {
        throw new ConfigException(ERR_LDIF_BACKEND_MULTIPLE_BASE_DNS.get(
                                       currentConfig.dn().toString()));
      }

      baseDNSet = new HashSet<DN>();
      for (DN dn : baseDNs)
View Full Code Here

        int equalPos = overrideSeverity.indexOf('=');
        if (equalPos < 0)
        {
          Message msg =
              WARN_ERROR_LOGGER_INVALID_OVERRIDE_SEVERITY.get(overrideSeverity);
          throw new ConfigException(msg);

        } else
        {
          String categoryName = overrideSeverity.substring(0, equalPos);
          categoryName = categoryName.replace("-", "_").toUpperCase();
          try
          {
            Category category = Category.valueOf(categoryName);

            HashSet<Severity> severities =
                new HashSet<Severity>();
            StringTokenizer sevTokenizer =
              new StringTokenizer(overrideSeverity.substring(equalPos+1), ",");
            while (sevTokenizer.hasMoreElements())
            {
              String severityName = sevTokenizer.nextToken();
              severityName = severityName.replace("-", "_").toUpperCase();
              if(severityName.equalsIgnoreCase(LOG_SEVERITY_ALL))
              {
                severities.add(Severity.FATAL_ERROR);
                severities.add(Severity.INFORMATION);
                severities.add(Severity.MILD_ERROR);
                severities.add(Severity.MILD_WARNING);
                severities.add(Severity.NOTICE);
                severities.add(Severity.SEVERE_ERROR);
                severities.add(Severity.SEVERE_WARNING);
              }
              else
              {
                try
                {
                  Severity severity =
                      Severity.parseString(severityName);

                  severities.add(severity);
                }
                catch(Exception e)
                {
                  Message msg =
                      WARN_ERROR_LOGGER_INVALID_SEVERITY.get(severityName);
                  throw new ConfigException(msg);
                }
              }
            }
            definedSeverities.put(category, severities);
          }
          catch(Exception e)
          {
            Message msg = WARN_ERROR_LOGGER_INVALID_CATEGORY.get(categoryName);
            throw new ConfigException(msg);
          }
        }
      }
    }
View Full Code Here

                }
                catch(Exception e)
                {
                  Message msg =
                      WARN_ERROR_LOGGER_INVALID_SEVERITY.get(severityName);
                  throw new ConfigException(msg);
                }
              }
            }
            definedSeverities.put(category, severities);
          }
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.