Package org.nasutekds.messages

Examples of org.nasutekds.messages.Message


      // Check whether the renamed entry already exists.
      if (dn2id.getID(txn, newApexEntry.getDN(),
        NdbOperation.LockMode.LM_Exclusive) != 0)
      {
        Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(
            newApexEntry.getDN().toString());
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                     message);
      }

      Entry oldApexEntry = dn2id.get(txn, oldApexDN,
        NdbOperation.LockMode.LM_Exclusive);
      if (oldApexEntry == null)
      {
        // Check for referral entries above the target entry.
        targetEntryReferrals(txn, oldApexDN, null);

        Message message =
                ERR_NDB_MODIFYDN_NO_SUCH_OBJECT.get(oldApexDN.toString());
        DN matchedDN = getMatchedDN(txn, baseDN);
        throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
            message, matchedDN, null);
      }

      if (!isManageDsaITOperation(modifyDNOperation))
      {
        checkTargetForReferral(oldApexEntry, null);
      }

      long oldApexID = (Long) oldApexEntry.getAttachment();
      long newApexID = oldApexID;

      if (newSuperiorDN != null)
      {
        long newSuperiorID = dn2id.getID(txn, newSuperiorDN,
          NdbOperation.LockMode.LM_Exclusive);
        if (newSuperiorID == 0)
        {
          Message msg =
                  ERR_NDB_NEW_SUPERIOR_NO_SUCH_OBJECT.get(
                          newSuperiorDN.toString());
          DN matchedDN = getMatchedDN(txn, baseDN);
          throw new DirectoryException(ResultCode.NO_SUCH_OBJECT,
              msg, matchedDN, null);
View Full Code Here


      dn2id.remove(txn, oldEntry);

      // Insert the new DN in dn2id.
      if (!dn2id.insert(txn, newDN, newID, newEntry))
      {
        Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(newDN.toString());
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                     message);
      }
    }
View Full Code Here

      dn2id.remove(txn, oldEntry);

      // Insert the new DN in dn2id.
      if (!dn2id.insert(txn, newDN, newID, newEntry))
      {
        Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(newDN.toString());
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                     message);
      }
    }
View Full Code Here

      newEntry.setDN(newDN);

      // Put the new DN in dn2id.
      if (!dn2id.insert(txn, newDN, newID, newEntry))
      {
        Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(newDN.toString());
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                     message);
      }
    }
View Full Code Here

      newEntry.setDN(newDN);

      // Insert the new DN in dn2id.
      if (!dn2id.insert(txn, newDN, entryID, newEntry))
      {
        Message message = ERR_NDB_MODIFYDN_ALREADY_EXISTS.get(newDN.toString());
        throw new DirectoryException(ResultCode.ENTRY_ALREADY_EXISTS,
                                     message);
      }
    }
View Full Code Here

                application.notifyListeners(
                        application.getFormattedDoneWithLineBreak());
              }

            } catch (Exception e) {
              Message errMsg = INFO_ERROR_COPYING_FILE.get(
                      objectFile.getAbsolutePath(),
                      destination.getAbsolutePath());
              throw new ApplicationException(
                      ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                      errMsg, null);
            } finally {
              if (fis != null) {
                try {
                  fis.close();
                } catch (IOException e) {
                  // ignore;
                }
              }
              if (fos != null) {
                try {
                  fos.close();
                } catch (IOException e) {
                  // ignore;
                }
              }
            }
          } else {
            Message errMsg = INFO_ERROR_COPYING_FILE.get(
                    objectFile.getAbsolutePath(),
                    destination.getAbsolutePath());
            throw new ApplicationException(
                    ReturnCode.FILE_SYSTEM_ACCESS_ERROR,
                    errMsg, null);
View Full Code Here

  public void setValue(long intValue, String unit)
         throws ConfigException
  {
    if ((unit == null) || (! units.containsKey(unit)))
    {
      Message message = ERR_CONFIG_ATTR_INVALID_UNIT.get(unit, getName());
      throw new ConfigException(message);
    }


    long calculatedValue = (long) (intValue * units.get(unit));
    if (hasLowerBound && (calculatedValue < lowerBound))
    {
      Message message = ERR_CONFIG_ATTR_INT_BELOW_LOWER_BOUND.get(
          getName(), calculatedValue, lowerBound);
      throw new ConfigException(message);
    }

    if (hasUpperBound && (calculatedValue > upperBound))
    {
      Message message = ERR_CONFIG_ATTR_INT_ABOVE_UPPER_BOUND.get(
          getName(), calculatedValue, upperBound);
      throw new ConfigException(message);
    }


View Full Code Here

         throws ConfigException
  {
    int spacePos = value.indexOf(' ');
    if (spacePos <= 0)
    {
      Message message = ERR_CONFIG_ATTR_NO_UNIT_DELIMITER.get(
          String.valueOf(value), getName());
      throw new ConfigException(message);
    }


    long longValue;
    try
    {
      longValue = Long.parseLong(value.substring(0, spacePos));
    }
    catch (Exception e)
    {
      if (debugEnabled())
      {
        TRACER.debugCaught(DebugLogLevel.ERROR, e);
      }

      Message message = ERR_CONFIG_ATTR_COULD_NOT_PARSE_INT_COMPONENT.get(
          String.valueOf(value), getName(), String.valueOf(e));
      throw new ConfigException(message, e);
    }

    setValue(longValue, value.substring(spacePos+1));
View Full Code Here

          }
        }
      }

      if (!delete) {
        Message errMsg;
        if (isFile) {
          errMsg = INFO_ERROR_DELETING_FILE.get(file.getAbsolutePath());
        } else {
          errMsg = INFO_ERROR_DELETING_DIRECTORY.get(file.getAbsolutePath());
        }
View Full Code Here

  {
    if ((valueStrings == null) || valueStrings.isEmpty())
    {
      if (isRequired())
      {
        Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(getName());
        throw new ConfigException(message);
      }
      else
      {
        return new LinkedHashSet<AttributeValue>();
      }
    }


    int numValues = valueStrings.size();
    if ((! isMultiValued()) && (numValues > 1))
    {
      Message message =
          ERR_CONFIG_ATTR_SET_VALUES_IS_SINGLE_VALUED.get(getName());
      throw new ConfigException(message);
    }


    LinkedHashSet<AttributeValue> valueSet =
         new LinkedHashSet<AttributeValue>(numValues);
    for (String valueString : valueStrings)
    {
      if ((valueString == null) || (valueString.length() == 0))
      {
        Message message = ERR_CONFIG_ATTR_EMPTY_STRING_VALUE.get(getName());
        if (allowFailures)
        {
          ErrorLogger.logError(message);
          continue;
        }
        else
        {
          throw new ConfigException(message);
        }
      }


      StringBuilder rejectReason = new StringBuilder();
      if (! valueIsAcceptable(valueString.toLowerCase(), rejectReason))
      {
        Message message = ERR_CONFIG_ATTR_INVALID_VALUE_WITH_UNIT.get(
                valueString, getName(),
                rejectReason.toString());

        if (allowFailures)
        {
          ErrorLogger.logError(message);
          continue;
        }
        else
        {
          throw new ConfigException(message);
        }
      }


      valueSet.add(AttributeValues.create(ByteString.valueOf(valueString),
          ByteString.valueOf(valueString)));
    }


    // If this method was configured to continue on error, then it is possible
    // that we ended up with an empty list.  Check to see if this is a required
    // attribute and if so deal with it accordingly.
    if ((isRequired()) && valueSet.isEmpty())
    {
      Message message = ERR_CONFIG_ATTR_IS_REQUIRED.get(getName());
      throw new ConfigException(message);
    }


    return valueSet;
View Full Code Here

TOP

Related Classes of org.nasutekds.messages.Message

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.