Ejemplo n.º 1
0
 /**
  * This sets the error state when the user has attempted a fiendishly complex and stoopid request
  * that requires a mixture of 'deleteOldRDN=false' and 'deleteOldRDN=true'. Since JX does not
  * handle indeterminate quantum states, we throw an error instead.
  *
  * @param oldDN
  * @param newDN
  * @return
  */
 private boolean setWierdoRDNError(DN oldDN, DN newDN) {
   String msg =
       CBIntText.get(
               "The rename operation is too complex to proceed.  Try to break it up into smaller stages.")
           + "\n    "
           + oldDN.toString()
           + "\n => "
           + newDN.toString();
   return error(msg, new NamingException(msg));
 }
Ejemplo n.º 2
0
  /**
   * This postparses a namingEnumeration of NameClassPairs, after it has been returned from the jndi
   * operation. Usefull to over-ride if the names in the enumeration need to be unescaped or
   * reformatted.
   *
   * @param e the post jndi operation namingEnumeration.
   * @param base the 'base' dn from which the names in the enumeration (may) be relative. If the
   *     Names in the enumeration are suffixed by the searchBase, they are unaltered, otherwise the
   *     searchBase is added to the names to give the full DN in the namespace.
   * @return the re-formatted version used by the application.
   */
  public NamingEnumeration postParseNameClassPairs(NamingEnumeration e, Name base)
      throws NamingException {
    log.log(Level.FINER, "parsing with base :" + base.toString());
    DXNamingEnumeration dxe = new DXNamingEnumeration();

    String baseString = null;

    if (base != null && base.isEmpty() == false) baseString = base.toString();

    try {
      while (e.hasMore()) {
        NameClassPair ncp = (NameClassPair) e.next();

        String rawName = postParseString(ncp.getName()).toString();

        // IMPORTANT!
        // This appends the 'base' DN to the enumerated DNs in order to get absolute DNs...

        if (ncp.isRelative() && baseString != null) {
          if (rawName.length() != 0) rawName = rawName + "," + baseString;
          else rawName = baseString;
        }

        log.log(Level.FINER, "ended up with: '" + rawName + "'");
        ncp.setName(rawName);
        dxe.add(ncp);
      }
    } catch (NamingException ex) {
      CBUtility.error(
          CBIntText.get("Search partially failed! - only ")
              + dxe.size()
              + CBIntText.get(" entries returned."),
          ex);
    }

    return dxe;
  }