Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.Entry


    {
      return;
    }

    // FIXME -- Do we need any special authorization here?
    Entry taskEntry = getTaskEntry();

    // Retrieves the eventual generation-ID
    AttributeType typeNewValue;
    typeNewValue =
      getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE, true);
    attrList = taskEntry.getAttribute(typeNewValue);
    if ((attrList != null) && !attrList.isEmpty())
    {
      try
      {
        generationId = new Long(TaskUtils.getSingleValueString(attrList));
      }
      catch(Exception e)
      {
        MessageBuilder mb = new MessageBuilder();
        mb.append(TaskMessages.ERR_TASK_INITIALIZE_INVALID_GENERATION_ID.get());
        mb.append(e.getMessage());
        throw new DirectoryException(ResultCode.CLIENT_SIDE_PARAM_ERROR,
            mb.toMessage());
      }
    }

    // Retrieves the replication domain
    AttributeType typeDomainBase;
    typeDomainBase =
      getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN, true);

    attrList = taskEntry.getAttribute(typeDomainBase);
    domainString = TaskUtils.getSingleValueString(attrList);

    try
    {
      DN dn = DN.decode(domainString);
View Full Code Here


                                     message);
      }
    }


    Entry taskEntry = getTaskEntry();

    AttributeType typeBaseDN;
    AttributeType typeIndex;
    AttributeType typeTmpDirectory;

    typeBaseDN =
         getAttributeType(ATTR_REBUILD_BASE_DN, true);
    typeIndex =
         getAttributeType(ATTR_REBUILD_INDEX, true);
    typeTmpDirectory =
         getAttributeType(ATTR_REBUILD_TMP_DIRECTORY, true);

    List<Attribute> attrList;

    attrList = taskEntry.getAttribute(typeBaseDN);
    baseDN = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeIndex);
    indexes = TaskUtils.getMultiValueString(attrList);

    if(isRebuildAll(indexes))
    {
      if(indexes.size() != 1)
      {
        Message msg = ERR_TASK_INDEXREBUILD_ALL_ERROR.get();
        throw new DirectoryException(ResultCode.UNWILLING_TO_PERFORM, msg);
      }
      rebuildAll = true;
      indexes.clear();
    }

    attrList = taskEntry.getAttribute(typeTmpDirectory);
    tmpDirectory = TaskUtils.getSingleValueString(attrList);

  }
View Full Code Here

                                     message);
      }
    }


    Entry taskEntry = getTaskEntry();

    AttributeType typeBackupDirectory;
    AttributeType typebackupID;
    AttributeType typeVerifyOnly;


    typeBackupDirectory = getAttributeType(ATTR_BACKUP_DIRECTORY_PATH, true);
    typebackupID        = getAttributeType(ATTR_BACKUP_ID, true);
    typeVerifyOnly      = getAttributeType(ATTR_TASK_RESTORE_VERIFY_ONLY, true);

    List<Attribute> attrList;

    attrList = taskEntry.getAttribute(typeBackupDirectory);
    String backupDirectoryPath = TaskUtils.getSingleValueString(attrList);
    backupDirectory = new File(backupDirectoryPath);
    if (! backupDirectory.isAbsolute())
    {
      backupDirectory =
           new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath);
    }

    attrList = taskEntry.getAttribute(typebackupID);
    backupID = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeVerifyOnly);
    verifyOnly = TaskUtils.getBoolean(attrList, false);

  }
View Full Code Here

      }
    }


    // Get the connection ID for the client connection.
    Entry taskEntry = getTaskEntry();
    connectionID = -1L;
    AttributeType attrType =
         DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID, true);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
connIDLoop:
      for (Attribute a : attrList)
      {
        for (AttributeValue v : a)
        {
          try
          {
            connectionID = Long.parseLong(v.getValue().toString());
            break connIDLoop;
          }
          catch (Exception e)
          {
            Message message =
               ERR_TASK_DISCONNECT_INVALID_CONN_ID.get(v.getValue().toString());
            throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
                                         message, e);
          }
        }
      }
    }

    if (connectionID < 0)
    {
      Message message =
          ERR_TASK_DISCONNECT_NO_CONN_ID.get(ATTR_TASK_DISCONNECT_CONN_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION,
                                   message);
    }


    // Determine whether to notify the client.
    notifyClient = false;
    attrType =
         DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT,
                                          true);
    attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
notifyClientLoop:
      for (Attribute a : attrList)
      {
        for (AttributeValue v : a)
        {
          String stringValue = toLowerCase(v.getValue().toString());
          if (stringValue.equals("true"))
          {
            notifyClient = true;
            break notifyClientLoop;
          }
          else if (stringValue.equals("false"))
          {
            break notifyClientLoop;
          }
          else
          {
            Message message =
                ERR_TASK_DISCONNECT_INVALID_NOTIFY_CLIENT.get(stringValue);
            throw new DirectoryException(ResultCode.INVALID_ATTRIBUTE_SYNTAX,
                                         message);
          }
        }
      }
    }


    // Get the disconnect message.
    disconnectMessage = INFO_TASK_DISCONNECT_GENERIC_MESSAGE.get();
    attrType = DirectoryServer.getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE,
                                                true);
    attrList = taskEntry.getAttribute(attrType);
    if (attrList != null)
    {
disconnectMessageLoop:
      for (Attribute a : attrList)
      {
View Full Code Here

    {
      return;
    }

    // FIXME -- Do we need any special authorization here?
    Entry taskEntry = getTaskEntry();

    AttributeType typeDomainBase;
    AttributeType typeScope;

    typeDomainBase =
      getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN, true);
    typeScope =
      getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE, true);

    List<Attribute> attrList;
    attrList = taskEntry.getAttribute(typeDomainBase);
    domainString = TaskUtils.getSingleValueString(attrList);

    try
    {
      DN dn = DN.decode(domainString);
      // We can assume that this is an LDAP replication domain
      domain = LDAPReplicationDomain.retrievesReplicationDomain(dn);
    }
    catch(DirectoryException e)
    {
      MessageBuilder mb = new MessageBuilder();
      mb.append(TaskMessages.ERR_TASK_INITIALIZE_INVALID_DN.get());
      mb.append(e.getMessage());
      throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, e);
    }

    attrList = taskEntry.getAttribute(typeScope);
    String targetString = TaskUtils.getSingleValueString(attrList);
    target = domain.decodeTarget(targetString);

    setTotal(0);
  }
View Full Code Here

   * {@inheritDoc}
   */
  @Override()
  public Entry getEntry(DN entryDN)
  {
    return new Entry(null, objectClasses, null, null);
  }
View Full Code Here

  public void initializeTask()
         throws DirectoryException
  {
    // See if the entry contains a shutdown message.  If so, then use it.
    // Otherwise, use a default message.
    Entry taskEntry = getTaskEntry();

    restart         = false;
    shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(
        String.valueOf(taskEntry.getDN()));

    AttributeType attrType =
         DirectoryServer.getAttributeType(ATTR_SHUTDOWN_MESSAGE, true);
    List<Attribute> attrList = taskEntry.getAttribute(attrType);
    if ((attrList != null) && (attrList.size() > 0))
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
      {
        String valueString = attr.iterator().next()
            .getValue().toString();

        shutdownMessage = INFO_TASK_SHUTDOWN_CUSTOM_MESSAGE.get(String
            .valueOf(taskEntry.getDN()), String.valueOf(valueString));
      }
    }


    attrType = DirectoryServer.getAttributeType(ATTR_RESTART_SERVER, true);
    attrList = taskEntry.getAttribute(attrType);
    if ((attrList != null) && (attrList.size() > 0))
    {
      Attribute attr = attrList.get(0);
      if (!attr.isEmpty())
      {
View Full Code Here

    try
    {
      while (true)
      {
        Entry e = null;
        try
        {
          e = reader.readEntry();
          if (e == null)
          {
            break;
          }
        }
        catch (LDIFException le)
        {
          if (! le.canContinueReading())
          {
            Message message = Message.raw(
              Category.BACKEND, Severity.SEVERE_ERROR, le.getMessage());
            throw new DirectoryException(
              DirectoryServer.getServerErrorResultCode(),message);
          }
          else
          {
            continue;
          }
        }

        try
        {
          addEntry(e, null);
        }
        catch (DirectoryException de)
        {
          reader.rejectLastEntry(de.getMessageObject());
        }
      }

      return new LDIFImportResult(reader.getEntriesRead(),
                                  reader.getEntriesRejected(),
                                  reader.getEntriesIgnored());
    }
    catch (DirectoryException de)
    {
      throw de;
    }
    catch (Exception e)
    {
      Message message = Message.raw(
        Category.BACKEND, Severity.SEVERE_ERROR, e.getMessage());
      throw new DirectoryException(DirectoryServer.getServerErrorResultCode(),
                                   message);
    }
    finally
    {
View Full Code Here

                                     message);
      }
    }


    Entry taskEntry = getTaskEntry();

    AttributeType typeLdifFile;
    AttributeType typeBackendID;
    AttributeType typeAppendToLDIF;
    AttributeType typeCompressLDIF;
    AttributeType typeEncryptLDIF;
    AttributeType typeSignHash;
    AttributeType typeIncludeAttribute;
    AttributeType typeExcludeAttribute;
    AttributeType typeIncludeFilter;
    AttributeType typeExcludeFilter;
    AttributeType typeIncludeBranch;
    AttributeType typeExcludeBranch;
    AttributeType typeWrapColumn;
    AttributeType typeIncludeOperationalAttributes;


    typeLdifFile =
         getAttributeType(ATTR_TASK_EXPORT_LDIF_FILE, true);
    typeBackendID =
         getAttributeType(ATTR_TASK_EXPORT_BACKEND_ID, true);
    typeAppendToLDIF =
         getAttributeType(ATTR_TASK_EXPORT_APPEND_TO_LDIF, true);
    typeCompressLDIF =
         getAttributeType(ATTR_TASK_EXPORT_COMPRESS_LDIF, true);
    typeEncryptLDIF =
         getAttributeType(ATTR_TASK_EXPORT_ENCRYPT_LDIF, true);
    typeSignHash =
         getAttributeType(ATTR_TASK_EXPORT_SIGN_HASH, true);
    typeIncludeAttribute =
         getAttributeType(ATTR_TASK_EXPORT_INCLUDE_ATTRIBUTE, true);
    typeExcludeAttribute =
         getAttributeType(ATTR_TASK_EXPORT_EXCLUDE_ATTRIBUTE, true);
    typeIncludeFilter =
         getAttributeType(ATTR_TASK_EXPORT_INCLUDE_FILTER, true);
    typeExcludeFilter =
         getAttributeType(ATTR_TASK_EXPORT_EXCLUDE_FILTER, true);
    typeIncludeBranch =
         getAttributeType(ATTR_TASK_EXPORT_INCLUDE_BRANCH, true);
    typeExcludeBranch =
         getAttributeType(ATTR_TASK_EXPORT_EXCLUDE_BRANCH, true);
    typeWrapColumn =
         getAttributeType(ATTR_TASK_EXPORT_WRAP_COLUMN, true);
    typeIncludeOperationalAttributes =
      getAttributeType(ATTR_TASK_EXPORT_INCLUDE_OPERATIONAL_ATTRIBUTES, true);


    List<Attribute> attrList;

    attrList = taskEntry.getAttribute(typeLdifFile);
    ldifFile = TaskUtils.getSingleValueString(attrList);
    File f = new File (ldifFile);
    if (! f.isAbsolute())
    {
      f = new File(DirectoryServer.getInstanceRoot(), ldifFile);
      try
      {
        ldifFile = f.getCanonicalPath();
      }
      catch (Exception ex)
      {
        ldifFile = f.getAbsolutePath();
      }
    }

    attrList = taskEntry.getAttribute(typeBackendID);
    backendID = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeAppendToLDIF);
    appendToLDIF = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeCompressLDIF);
    compressLDIF = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeEncryptLDIF);
    encryptLDIF = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeSignHash);
    signHash = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeIncludeAttribute);
    includeAttributeStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeAttribute);
    excludeAttributeStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeIncludeFilter);
    includeFilterStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeFilter);
    excludeFilterStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeIncludeBranch);
    includeBranchStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeBranch);
    excludeBranchStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeWrapColumn);
    wrapColumn = TaskUtils.getSingleValueInteger(attrList, 0);

    attrList = taskEntry.getAttribute(typeIncludeOperationalAttributes);
    includeOperationalAttributes = TaskUtils.getBoolean(attrList, true);

  }
View Full Code Here

                                     message);
      }
    }


    Entry taskEntry = getTaskEntry();

    AttributeType typeLdifFile;
    AttributeType typeTemplateFile;
    AttributeType typeAppend;
    AttributeType typeReplaceExisting;
    AttributeType typeBackendID;
    AttributeType typeIncludeBranch;
    AttributeType typeExcludeBranch;
    AttributeType typeIncludeAttribute;
    AttributeType typeExcludeAttribute;
    AttributeType typeIncludeFilter;
    AttributeType typeExcludeFilter;
    AttributeType typeRejectFile;
    AttributeType typeSkipFile;
    AttributeType typeOverwrite;
    AttributeType typeSkipSchemaValidation;
    AttributeType typeIsCompressed;
    AttributeType typeIsEncrypted;
    AttributeType typeClearBackend;
    AttributeType typeRandomSeed;
    AttributeType typeThreadCount;
    AttributeType typeTmpDirectory;
    AttributeType typeDNCheckPhase2;

    typeLdifFile =
         getAttributeType(ATTR_IMPORT_LDIF_FILE, true);
    typeTemplateFile =
         getAttributeType(ATTR_IMPORT_TEMPLATE_FILE, true);
    typeAppend =
         getAttributeType(ATTR_IMPORT_APPEND, true);
    typeReplaceExisting =
         getAttributeType(ATTR_IMPORT_REPLACE_EXISTING, true);
    typeBackendID =
         getAttributeType(ATTR_IMPORT_BACKEND_ID, true);
    typeIncludeBranch =
         getAttributeType(ATTR_IMPORT_INCLUDE_BRANCH, true);
    typeExcludeBranch =
         getAttributeType(ATTR_IMPORT_EXCLUDE_BRANCH, true);
    typeIncludeAttribute =
         getAttributeType(ATTR_IMPORT_INCLUDE_ATTRIBUTE, true);
    typeExcludeAttribute =
         getAttributeType(ATTR_IMPORT_EXCLUDE_ATTRIBUTE, true);
    typeIncludeFilter =
         getAttributeType(ATTR_IMPORT_INCLUDE_FILTER, true);
    typeExcludeFilter =
         getAttributeType(ATTR_IMPORT_EXCLUDE_FILTER, true);
    typeRejectFile =
         getAttributeType(ATTR_IMPORT_REJECT_FILE, true);
    typeSkipFile =
      getAttributeType(ATTR_IMPORT_SKIP_FILE, true);
    typeOverwrite =
         getAttributeType(ATTR_IMPORT_OVERWRITE, true);
    typeSkipSchemaValidation =
         getAttributeType(ATTR_IMPORT_SKIP_SCHEMA_VALIDATION, true);
    typeIsCompressed =
         getAttributeType(ATTR_IMPORT_IS_COMPRESSED, true);
    typeIsEncrypted =
         getAttributeType(ATTR_IMPORT_IS_ENCRYPTED, true);
    typeClearBackend =
         getAttributeType(ATTR_IMPORT_CLEAR_BACKEND, true);
    typeRandomSeed =
         getAttributeType(ATTR_IMPORT_RANDOM_SEED, true);
    typeThreadCount =
         getAttributeType(ATTR_IMPORT_THREAD_COUNT, true);
    typeTmpDirectory =
         getAttributeType(ATTR_IMPORT_TMP_DIRECTORY, true);
    typeDNCheckPhase2 =
         getAttributeType(ATTR_IMPORT_SKIP_DN_VALIDATION, true);

    List<Attribute> attrList;

    attrList = taskEntry.getAttribute(typeLdifFile);
    ArrayList<String> ldifFilestmp = TaskUtils.getMultiValueString(attrList);
    ldifFiles = new ArrayList<String>(ldifFilestmp.size());
    for (String s : ldifFilestmp)
    {
      File f = new File (s);
      if (!f.isAbsolute())
      {
        f = new File(DirectoryServer.getInstanceRoot(), s);
        try
        {
          s = f.getCanonicalPath();
        }
        catch (Exception ex)
        {
          s = f.getAbsolutePath();
        }
        ldifFiles.add(s);
      }
      else
      {
        ldifFiles.add(s);
      }
    }

    attrList = taskEntry.getAttribute(typeTemplateFile);
    templateFile = TaskUtils.getSingleValueString(attrList);
    if (templateFile != null)
    {
      File f = new File(templateFile);
      if (!f.isAbsolute())
      {
        templateFile = new File(DirectoryServer.getInstanceRoot(), templateFile)
            .getAbsolutePath();
      }
    }

    attrList = taskEntry.getAttribute(typeAppend);
    append = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeDNCheckPhase2);
    skipDNValidation = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeTmpDirectory);
    tmpDirectory = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeReplaceExisting);
    replaceExisting = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeBackendID);
    backendID = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeIncludeBranch);
    includeBranchStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeBranch);
    excludeBranchStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeIncludeAttribute);
    includeAttributeStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeAttribute);
    excludeAttributeStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeIncludeFilter);
    includeFilterStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeExcludeFilter);
    excludeFilterStrings = TaskUtils.getMultiValueString(attrList);

    attrList = taskEntry.getAttribute(typeRejectFile);
    rejectFile = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeSkipFile);
    skipFile = TaskUtils.getSingleValueString(attrList);

    attrList = taskEntry.getAttribute(typeOverwrite);
    overwrite = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeSkipSchemaValidation);
    skipSchemaValidation = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeIsCompressed);
    isCompressed = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeIsEncrypted);
    isEncrypted = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeClearBackend);
    clearBackend = TaskUtils.getBoolean(attrList, false);

    attrList = taskEntry.getAttribute(typeRandomSeed);
    randomSeed = TaskUtils.getSingleValueInteger(attrList, 0);

    attrList = taskEntry.getAttribute(typeThreadCount);
    threadCount = TaskUtils.getSingleValueInteger(attrList, 0);

    // Make sure that either the "includeBranchStrings" argument or the
    // "backendID" argument was provided.
    if(includeBranchStrings.isEmpty() && backendID == null)
View Full Code Here

TOP

Related Classes of org.nasutekds.server.types.Entry

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.