Package org.nasutekds.server.types

Examples of org.nasutekds.server.types.DN


                                     m, e);
      }


      // Walk through all the entries and write them to LDIF.
      DN entryDN = null;
      try
      {
        for (Entry entry : entryMap.values())
        {
          entryDN = entry.getDN();
View Full Code Here


            }
          }

          // Make sure that we don't already have an entry with the same DN.  If
          // a duplicate is encountered, then log a message and continue.
          DN entryDN = e.getDN();
          if (entryMap.containsKey(entryDN))
          {
            Message m = ERR_LDIF_BACKEND_DUPLICATE_ENTRY.get(ldifFilePath,
                             currentConfig.dn().toString(), entryDN.toString());
            logError(m);
            reader.rejectLastEntry(m);
            continue;
          }


          // If the entry DN is a base DN, then add it with no more processing.
          if (baseDNSet.contains(entryDN))
          {
            entryMap.put(entryDN, e);
            continue;
          }


          // Make sure that the parent exists.  If not, then reject the entry.
          boolean isBelowBaseDN = false;
          for (DN baseDN : baseDNs)
          {
            if (baseDN.isAncestorOf(entryDN))
            {
              isBelowBaseDN = true;
              break;
            }
          }

          if (! isBelowBaseDN)
          {
            Message m = ERR_LDIF_BACKEND_ENTRY_OUT_OF_SCOPE.get(ldifFilePath,
                             currentConfig.dn().toString(), entryDN.toString());
            logError(m);
            reader.rejectLastEntry(m);
            continue;
          }

          DN parentDN = entryDN.getParentDNInSuffix();
          if ((parentDN == null) || (! entryMap.containsKey(parentDN)))
          {
            Message m = ERR_LDIF_BACKEND_MISSING_PARENT.get(ldifFilePath,
                             currentConfig.dn().toString(), entryDN.toString());
            logError(m);
View Full Code Here

          {
            m = INFO_LDIF_CONNHANDLER_ERROR_MESSAGE.get(errorMessage);
            writer.writeComment(m, 78);
          }

          DN matchedDN = operation.getMatchedDN();
          if (matchedDN != null)
          {
            m = INFO_LDIF_CONNHANDLER_MATCHED_DN.get(matchedDN.toString());
            writer.writeComment(m, 78);
          }

          List<String> referralURLs = operation.getReferralURLs();
          if ((referralURLs != null) && (! referralURLs.isEmpty()))
View Full Code Here

   * the entry.
   */
  public boolean remove(AbstractTransaction txn, Entry entry)
       throws NdbApiException
  {
    DN dn = entry.getDN();

    NdbResultSet rs = null;

    NdbTransaction ndbTxn = txn.getNdbTransaction();

    NdbOperation op = ndbTxn.getSelectOperation(name,
      NdbOperation.LockMode.LM_CommittedRead);

    boolean extensibleObject = false;

    int componentIndex = dn.getNumComponents() - 1;
    for (int i=0; i < BackendImpl.DN2ID_DN_NC; i++) {
      while (componentIndex >= 0) {
        op.equalString(BackendImpl.DN2ID_DN + Integer.toString(i),
          dn.getRDN(componentIndex).toNormalizedString());
        componentIndex--;
        i++;
      }
      op.equalString(BackendImpl.DN2ID_DN +
        Integer.toString(i), "");
    }
    op.getValue(BackendImpl.EID);
    op.getValue(BackendImpl.DN2ID_OC);
    op.getValue(BackendImpl.DN2ID_XOC);

    rs = op.resultData();
    ndbTxn.execute(ExecType.NoCommit, AbortOption.AO_IgnoreError, true);

    long eid = 0;
    NdbTransaction ndbDATxn = null;
    String[] ocsStringArray = null;
    String[] xocsStringArray = null;
    List<NdbResultSet> ocRsList = new ArrayList<NdbResultSet>();
    NdbIndexScanOperation indexScanOp = null;

    if (rs.next()) {
      eid = rs.getLong(BackendImpl.EID);
      String ocsString = rs.getString(BackendImpl.DN2ID_OC);
      ocsStringArray = ocsString.split(" ");

      String xocsString = rs.getString(BackendImpl.DN2ID_XOC);
      xocsStringArray = xocsString.split(" ");
      if (xocsString.length() > 0) {
        extensibleObject = true;
      }

      for (String ocName : ocsStringArray) {
        ObjectClass oc =
          DirectoryServer.getObjectClass(ocName, true);
        if (oc.getObjectClassType() == ObjectClassType.ABSTRACT) {
          continue;
        }
        if (ndbDATxn == null) {
          ndbDATxn = txn.getNdbDATransaction(ocName, eid);
        }
        indexScanOp =
          ndbDATxn.getSelectIndexScanOperation(PRIMARY_INDEX_NAME, ocName);
        indexScanOp.setBoundLong(BackendImpl.EID,
            NdbIndexScanOperation.BoundType.BoundEQ, eid);
        indexScanOp.getValue(BackendImpl.MID);
        ocRsList.add(indexScanOp.resultData());
      }

      // Extensible object.
      if (extensibleObject) {
        for (String xocName : xocsStringArray) {
          ObjectClass xoc =
            DirectoryServer.getObjectClass(xocName, true);
          if (xoc.getObjectClassType() == ObjectClassType.ABSTRACT) {
            continue;
          }
          if (ndbDATxn == null) {
            ndbDATxn = txn.getNdbDATransaction(xocName, eid);
          }
          indexScanOp =
            ndbDATxn.getSelectIndexScanOperation(PRIMARY_INDEX_NAME, xocName);
          indexScanOp.setBoundLong(BackendImpl.EID,
            NdbIndexScanOperation.BoundType.BoundEQ, eid);
          indexScanOp.getValue(BackendImpl.MID);
          ocRsList.add(indexScanOp.resultData());
        }
      }
    }

    // Attribute options.
    if (ndbDATxn == null) {
      ndbDATxn = txn.getNdbDATransaction(BackendImpl.TAGS_TABLE, eid);
    }
    indexScanOp = ndbDATxn.getSelectIndexScanOperation(PRIMARY_INDEX_NAME,
      BackendImpl.TAGS_TABLE);
    indexScanOp.setBoundLong(BackendImpl.EID,
      NdbIndexScanOperation.BoundType.BoundEQ, eid);
    indexScanOp.getValue(BackendImpl.TAG_ATTR);
    indexScanOp.getValue(BackendImpl.MID);
    NdbResultSet tagRs = indexScanOp.resultData();

    ndbDATxn.execute(ExecType.NoCommit, AbortOption.AO_IgnoreError, true);

    Iterator<NdbResultSet> rsIterator = ocRsList.iterator();
    for (String ocName : ocsStringArray) {
      ObjectClass oc =
        DirectoryServer.getObjectClass(ocName, true);
      if (oc.getObjectClassType() == ObjectClassType.ABSTRACT) {
        continue;
      }
      NdbResultSet ocRs = rsIterator.next();
      while (ocRs.next()) {
        int mid = ocRs.getInt(BackendImpl.MID);
        op = ndbDATxn.getDeleteOperation(ocName);
        op.equalLong(BackendImpl.EID, eid);
        op.equalInt(BackendImpl.MID, mid);
      }
    }

    // Extensible object.
    if (extensibleObject) {
      for (String xocName : xocsStringArray) {
        ObjectClass xoc =
          DirectoryServer.getObjectClass(xocName, true);
        if (xoc.getObjectClassType() == ObjectClassType.ABSTRACT) {
          continue;
        }
        NdbResultSet ocRs = rsIterator.next();
        while (ocRs.next()) {
          int mid = ocRs.getInt(BackendImpl.MID);
          op = ndbDATxn.getDeleteOperation(xocName);
          op.equalLong(BackendImpl.EID, eid);
          op.equalInt(BackendImpl.MID, mid);
        }
      }
    }

    // Operational attributes.
    op = ndbDATxn.getDeleteOperation(BackendImpl.OPATTRS_TABLE);
    op.equalLong(BackendImpl.EID, eid);

    // Attribute options.
    while (tagRs.next()) {
      String attrName = tagRs.getString(BackendImpl.TAG_ATTR);
      int mid = tagRs.getInt(BackendImpl.MID);
      op = ndbDATxn.getDeleteOperation(BackendImpl.TAGS_TABLE);
      op.equalLong(BackendImpl.EID, eid);
      op.equalString(BackendImpl.TAG_ATTR, attrName);
      op.equalInt(BackendImpl.MID, mid);
    }

    // Indexes.
    for (String attrName : BackendImpl.indexes) {
      AttributeType attributeType =
              DirectoryServer.getAttributeType(
              attrName.toLowerCase(), true);
      if (entry.hasAttribute(attributeType)) {
        List<Attribute> attrList =
          entry.getAttribute(attributeType);
        int mid = MIN_MID;
        for (Attribute attr : attrList) {
          for (AttributeValue attrVal : attr) {
            NdbOperation idxOp = ndbDATxn.getDeleteOperation(
              BackendImpl.IDX_TABLE_PREFIX + attrName);
            idxOp.equalLong(BackendImpl.EID, eid);
            idxOp.equalInt(BackendImpl.MID, mid);
            mid++;
          }
        }
      }
    }

    // dn2id.
    op = ndbTxn.getDeleteOperation(name);
    componentIndex = dn.getNumComponents() - 1;
    for (int i=0; i < BackendImpl.DN2ID_DN_NC; i++) {
      while (componentIndex >= 0) {
        op.equalString(BackendImpl.DN2ID_DN + Integer.toString(i),
          dn.getRDN(componentIndex).toNormalizedString());
        componentIndex--;
        i++;
      }
      op.equalString(BackendImpl.DN2ID_DN +
        Integer.toString(i), "");
View Full Code Here

    NdbOperation.LockMode lockMode)
       throws NdbApiException, DirectoryException
  {
    NdbIndexScanOperation indexScanOp = null;
    NdbResultSet rs = null;
    DN dn = null;

    NdbTransaction ndbTxn = txn.getNdbTransaction();

    indexScanOp = ndbTxn.getSelectIndexScanOperation(
      BackendImpl.EID, name, lockMode);
View Full Code Here

      {
        for (AttributeValue v : a)
        {
          try
          {
            DN memberDN = DN.decode(v.getValue());
            memberDNs.add(memberDN);
          }
          catch (DirectoryException de)
          {
            if (debugEnabled())
View Full Code Here

  {
    ensureNotNull(userEntry);

    synchronized (this)
    {
      DN userDN = userEntry.getDN();
      if (memberDNs.contains(userDN))
      {
        Message message = ERR_STATICGROUP_ADD_MEMBER_ALREADY_EXISTS.get(
            String.valueOf(userDN), String.valueOf(groupEntryDN));
        throw new DirectoryException(ResultCode.ATTRIBUTE_OR_VALUE_EXISTS,
                                     message);
      }

      Attribute attr = Attributes.create(memberAttributeType, userDN
          .toString());
      LinkedList<Modification> mods = new LinkedList<Modification>();
      mods.add(new Modification(ModificationType.ADD, attr));

      LinkedList<Control> requestControls = new LinkedList<Control>();
View Full Code Here

    }


    // Get the subject from the peer certificate and use it to create a search
    // filter.
    DN peerDN;
    X500Principal peerPrincipal = peerCertificate.getSubjectX500Principal();
    String peerName = peerPrincipal.getName(X500Principal.RFC2253);
    try
    {
      peerDN = DN.decode(peerName);
    }
    catch (DirectoryException de)
    {
      Message message = ERR_SATUACM_CANNOT_DECODE_SUBJECT_AS_DN.get(
          peerName, de.getMessageObject());
      throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, message,
                                   de);
    }

    LinkedList<SearchFilter> filterComps = new LinkedList<SearchFilter>();
    for (int i=0; i < peerDN.getNumComponents(); i++)
    {
      RDN rdn = peerDN.getRDN(i);
      for (int j=0; j < rdn.getNumValues(); j++)
      {
        String lowerName = toLowerCase(rdn.getAttributeName(j));
        AttributeType attrType = attributeMap.get(lowerName);
        if (attrType != null)
View Full Code Here

              SubjectAttributeToUserAttributeCertificateMapperCfg
                   configuration,
              List<Message> unacceptableReasons)
  {
    boolean configAcceptable = true;
    DN cfgEntryDN = configuration.dn();

    // Get and validate the subject attribute to user attribute mappings.
    LinkedHashMap<String,AttributeType> newAttributeMap =
         new LinkedHashMap<String,AttributeType>();
mapLoop:
View Full Code Here

    else if (entryDN.equals(recurringTaskParentDN))
    {
      return taskScheduler.getRecurringTaskCount();
    }

    DN parentDN = entryDN.getParentDNInSuffix();
    if (parentDN == null)
    {
      return -1;
    }

    if (parentDN.equals(scheduledTaskParentDN) &&
        taskScheduler.getScheduledTask(entryDN) != null)
    {
      return 0;
    }
    else if (parentDN.equals(recurringTaskParentDN) &&
        taskScheduler.getRecurringTask(entryDN) != null)
    {
      return 0;
    }
    else
View Full Code Here

TOP

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

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.