Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.Attribute


    {
      Message message = ERR_TASKSCHED_MULTIPLE_CLASS_TYPES.get(ATTR_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }

    Attribute attr = attrList.get(0);
    if (attr.isEmpty())
    {
      Message message = ERR_TASKSCHED_NO_CLASS_VALUES.get(ATTR_TASK_ID);
      throw new DirectoryException(ResultCode.CONSTRAINT_VIOLATION, message);
    }

    Iterator<AttributeValue> iterator = attr.iterator();
    AttributeValue value = iterator.next();
    if (iterator.hasNext())
    {
      Message message = ERR_TASKSCHED_MULTIPLE_CLASS_VALUES.get(ATTR_TASK_ID);
      throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message);
View Full Code Here


      return PluginResult.PostOperation.continueOperationProcessing();
    }

    for (Modification m : modifyOperation.getModifications())
    {
      Attribute a = m.getAttribute();
      AttributeType t = a.getAttributeType();
      if (! config.getType().contains(t))
      {
        // This modification isn't for a unique attribute.
        continue;
      }

      switch (m.getModificationType())
      {
        case ADD:
        case REPLACE:
          for (AttributeValue v : a)
          {
            uniqueAttrValue2Dn.remove(v);
          }
          break;

        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                           a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
                continue;
              }

              for (AttributeValue v : updatedAttr)
View Full Code Here

    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())
      {
        String valueString = toLowerCase(attr.iterator().next()
            .getValue().toString());

        restart = (valueString.equals("true") || valueString.equals("yes")
            || valueString.equals("on") || valueString.equals("1"));
      }
View Full Code Here

    HashMap<AttributeType,List<Attribute>> monitorOperationalAttrs =
         new LinkedHashMap<AttributeType,List<Attribute>>();


    // Add the "cn" attribute.
    Attribute cnAttr = createAttribute(ATTR_COMMON_NAME, ATTR_COMMON_NAME,
                                       "monitor");
    ArrayList<Attribute> cnList = new ArrayList<Attribute>(1);
    cnList.add(cnAttr);
    monitorUserAttrs.put(cnAttr.getAttributeType(), cnList);


    // Add the server product name.
    Attribute productNameAttr = createAttribute(ATTR_PRODUCT_NAME,
                                                ATTR_PRODUCT_NAME_LC,
                                                DynamicConstants.PRODUCT_NAME);
    ArrayList<Attribute> productNameList = new ArrayList<Attribute>(1);
    productNameList.add(productNameAttr);
    monitorUserAttrs.put(productNameAttr.getAttributeType(), productNameList);


    // Add the vendor name.
    Attribute vendorNameAttr = createAttribute(ATTR_VENDOR_NAME,
                                               ATTR_VENDOR_NAME_LC,
                                               SERVER_VENDOR_NAME);
    ArrayList<Attribute> vendorNameList = new ArrayList<Attribute>(1);
    vendorNameList.add(vendorNameAttr);
    monitorUserAttrs.put(vendorNameAttr.getAttributeType(), vendorNameList);


    // Add the vendor version.
    Attribute versionAttr = createAttribute(ATTR_VENDOR_VERSION,
                                            ATTR_VENDOR_VERSION_LC,
                                            DirectoryServer.getVersionString());
    ArrayList<Attribute> versionList = new ArrayList<Attribute>(1);
    versionList.add(versionAttr);
    monitorUserAttrs.put(versionAttr.getAttributeType(), versionList);


    // Add the server startup time.
    Attribute startTimeAttr =
         createAttribute(ATTR_START_TIME, ATTR_START_TIME_LC,
                         DirectoryServer.getStartTimeUTC());
    ArrayList<Attribute> startTimeList = new ArrayList<Attribute>(1);
    startTimeList.add(startTimeAttr);
    monitorUserAttrs.put(startTimeAttr.getAttributeType(), startTimeList);


    // Add the current time.
    Attribute currentTimeAttr =
         createAttribute(ATTR_CURRENT_TIME, ATTR_CURRENT_TIME_LC,
                         TimeThread.getGMTTime());
    ArrayList<Attribute> currentTimeList = new ArrayList<Attribute>(1);
    currentTimeList.add(currentTimeAttr);
    monitorUserAttrs.put(currentTimeAttr.getAttributeType(), currentTimeList);


    // Add the uptime as a human-readable string.
    long upSeconds =
         ((System.currentTimeMillis() - DirectoryServer.getStartTime()) / 1000);
    long upDays = (upSeconds / 86400);
    upSeconds %= 86400;
    long upHours = (upSeconds / 3600);
    upSeconds %= 3600;
    long upMinutes = (upSeconds / 60);
    upSeconds %= 60;
    Message upTimeStr =
        INFO_MONITOR_UPTIME.get(upDays, upHours, upMinutes, upSeconds);
    Attribute upTimeAttr = createAttribute(ATTR_UP_TIME, ATTR_UP_TIME_LC,
                                           upTimeStr.toString());
    ArrayList<Attribute> upTimeList = new ArrayList<Attribute>(1);
    upTimeList.add(upTimeAttr);
    monitorUserAttrs.put(upTimeAttr.getAttributeType(), upTimeList);


    // Add the number of connections currently established.
    long currentConns = DirectoryServer.getCurrentConnections();
    Attribute currentConnsAttr = createAttribute(ATTR_CURRENT_CONNS,
                                                 ATTR_CURRENT_CONNS_LC,
                                                 String.valueOf(currentConns));
    ArrayList<Attribute> currentConnsList = new ArrayList<Attribute>(1);
    currentConnsList.add(currentConnsAttr);
    monitorUserAttrs.put(currentConnsAttr.getAttributeType(), currentConnsList);


    // Add the maximum number of connections established at one time.
    long maxConns = DirectoryServer.getMaxConnections();
    Attribute maxConnsAttr = createAttribute(ATTR_MAX_CONNS,
                                             ATTR_MAX_CONNS_LC,
                                             String.valueOf(maxConns));
    ArrayList<Attribute> maxConnsList = new ArrayList<Attribute>(1);
    maxConnsList.add(maxConnsAttr);
    monitorUserAttrs.put(maxConnsAttr.getAttributeType(), maxConnsList);


    // Add the total number of connections the server has accepted.
    long totalConns = DirectoryServer.getTotalConnections();
    Attribute totalConnsAttr = createAttribute(ATTR_TOTAL_CONNS,
                                               ATTR_TOTAL_CONNS_LC,
                                               String.valueOf(totalConns));
    ArrayList<Attribute> totalConnsList = new ArrayList<Attribute>(1);
    totalConnsList.add(totalConnsAttr);
    monitorUserAttrs.put(totalConnsAttr.getAttributeType(), totalConnsList);


    // Add all the user-defined attributes.
    for (Attribute a : userDefinedAttributes)
    {
View Full Code Here

      // Add the RDN values
      for (int i=0; i<rdn.getNumValues(); i++)
      {
        AttributeType attributeType = rdn.getAttributeType(i);
        AttributeValue value = rdn.getAttributeValue(attributeType);
        Attribute attr = Attributes.create(attributeType, value);
        List<Attribute> attrList = new ArrayList<Attribute>(1);
        attrList.add(attr);
        monitorUserAttrs.put(attributeType, attrList);
      }
    }
View Full Code Here

    // Make sure to include the RDN attribute.
    RDN            entryRDN = entryDN.getRDN();
    AttributeType  rdnType  = entryRDN.getAttributeType(0);
    AttributeValue rdnValue = entryRDN.getAttributeValue(0);

    Attribute rdnAttr = Attributes.create(rdnType, rdnValue);
    ArrayList<Attribute> rdnList = new ArrayList<Attribute>(1);
    rdnList.add(rdnAttr);
    attrMap.put(rdnType, rdnList);

View Full Code Here

      return PluginResult.PreOperation.continueOperationProcessing();
    }

    for (Modification m : modifyOperation.getModifications())
    {
      Attribute a = m.getAttribute();
      AttributeType t = a.getAttributeType();
      if (! config.getType().contains(t))
      {
        // This modification isn't for a unique attribute.
        continue;
      }

      switch (m.getModificationType())
      {
        case ADD:
        case REPLACE:
          for (AttributeValue v : a)
          {
            try
            {
              DN conflictDN = null;
              //Raise an exception if a conflicting concurrent operation is in
              //progress. Otherwise, store this attribute value with its
              //corresponding DN and proceed.
              if((conflictDN=
                      uniqueAttrValue2Dn.putIfAbsent(v, entryDN))==null)
              {
               conflictDN = getConflictingEntryDN(baseDNs, entryDN, config,
                                                   v);
              }
              if (conflictDN != null)
              {
                Message msg = ERR_PLUGIN_UNIQUEATTR_ATTR_NOT_UNIQUE.get(
                    t.getNameOrOID(), v.getValue().toString(),
                    conflictDN.toString());
                return PluginResult.PreOperation.stopProcessing(
                    ResultCode.CONSTRAINT_VIOLATION, msg);
              }
            }
            catch (DirectoryException de)
            {
              if (debugEnabled())
              {
                TRACER.debugCaught(DebugLogLevel.ERROR, de);
              }

              Message message = ERR_PLUGIN_UNIQUEATTR_INTERNAL_ERROR.get(
                                     de.getResultCode().toString(),
                                     de.getMessageObject());

              return PluginResult.PreOperation.stopProcessing(
                    DirectoryServer.getServerErrorResultCode(), message);
            }
          }
          break;

        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                               a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
                continue;
              }

              for (AttributeValue v : updatedAttr)
View Full Code Here

      return;
    }

    for (Modification m : modifyOperation.getModifications())
    {
      Attribute a = m.getAttribute();
      AttributeType t = a.getAttributeType();
      if (! config.getType().contains(t))
      {
        // This modification isn't for a unique attribute.
        continue;
      }

      switch (m.getModificationType())
      {
        case ADD:
        case REPLACE:
          for (AttributeValue v : a)
          {
            try
            {
              DN conflictDN = null;
              if((conflictDN=uniqueAttrValue2Dn.get(v)) == null)
              {
               conflictDN = getConflictingEntryDN(baseDNs, entryDN, config,
                                                    v);
              }
              if (conflictDN != null)
              {
                Message message = ERR_PLUGIN_UNIQUEATTR_SYNC_NOT_UNIQUE.get(
                                       t.getNameOrOID(),
                                       modifyOperation.getConnectionID(),
                                       modifyOperation.getOperationID(),
                                       v.getValue().toString(),
                                       entryDN.toString(),
                                       conflictDN.toString());
                DirectoryServer.sendAlertNotification(this,
                                     ALERT_TYPE_UNIQUE_ATTR_SYNC_CONFLICT,
                                     message);
              }
            }
            catch (DirectoryException de)
            {
              if (debugEnabled())
              {
                TRACER.debugCaught(DebugLogLevel.ERROR, de);
              }

              Message message = ERR_PLUGIN_UNIQUEATTR_INTERNAL_ERROR_SYNC.get(
                                    modifyOperation.getConnectionID(),
                                    modifyOperation.getOperationID(),
                                    entryDN.toString(),
                                    de.getResultCode().toString(),
                                    de.getMessageObject());
              DirectoryServer.sendAlertNotification(this,
                                   ALERT_TYPE_UNIQUE_ATTR_SYNC_ERROR, message);
            }
          }
          break;

        case INCREMENT:
          // We could calculate the new value, but we'll just take it from the
          // updated entry.
          List<Attribute> attrList =
               modifyOperation.getModifiedEntry().getAttribute(t,
                                                               a.getOptions());
          if (attrList != null)
          {
            for (Attribute updatedAttr : attrList)
            {
              if (! updatedAttr.optionsEqual(a.getOptions()))
              {
                continue;
              }

              for (AttributeValue v : updatedAttr)
View Full Code Here

      DirectoryServer.getAttributeType(REPLICATION_STATE);
    List<Attribute> attrs =
      resultEntry.getAttribute(synchronizationStateType);
    if (attrs != null)
    {
      Attribute attr = attrs.get(0);
      for (AttributeValue value : attr)
      {
        ChangeNumber changeNumber = new ChangeNumber(value.toString());
        update(changeNumber);
      }
View Full Code Here

  public ArrayList<Attribute> getMonitorData()
  {
    ArrayList<Attribute> attributes = new ArrayList<Attribute>();

    /* get the base dn */
    Attribute attr = Attributes.create("domain-name", domain.getServiceID());
    attributes.add(attr);

    /* get the base dn */
    attr = Attributes.create("connected-to", domain
        .getReplicationServer());
View Full Code Here

TOP

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

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.