mirror of https://github.com/OpenIdentityPlatform/OpenDJ.git

lutoff
11.13.2007 b0e6be77d61a4c2cf27dfa8e84ab6a069fd709d6
dsservice cli will be part on the opends.jar file (instead of the
quicksetup one)
6 files renamed
3 files modified
202 ■■■■ changed files
opends/build.xml 12 ●●●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/ADSContextException.java 52 ●●●●● patch | view | raw | blame | history
opends/src/ads/org/opends/admin/ads/util/TrustedSocketFactory.java 9 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliAds.java 7 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliMain.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliParser.java 6 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliReturnCode.java 77 ●●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliServerGroup.java 15 ●●●● patch | view | raw | blame | history
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliSubCommandGroup.java 9 ●●●●● patch | view | raw | blame | history
opends/build.xml
@@ -78,6 +78,7 @@
  <property name="quicksetup.classes.dir"
            location="${build.dir}/quicksetup/classes"                />
  <property name="ads.src.dir" location="src/ads"       />
  <property name="ads.class.dir" location="${classes.dir}/org/opends/admin/ads"/>
  <!-- Properties for use with the Status Panel.                      -->
  <property name="statuspanel.src.dir" location="src/statuspanel"       />
@@ -428,7 +429,7 @@
       description="Compile the Directory Server source files.">
    <mkdir dir="${classes.dir}" />
    <javac srcdir="${src.dir}:${admin.src.dir}" destdir="${classes.dir}"
    <javac srcdir="${src.dir}:${admin.src.dir}:${ads.src.dir}" destdir="${classes.dir}"
         excludes="**/package-info.java"
         debug="on" debuglevel="${build.debuglevel}" source="1.5" target="1.5"
         deprecation="true" fork="true" memoryInitialSize="${MEM}"
@@ -709,6 +710,7 @@
    <mkdir dir="${pdir}/locks"           />
    <mkdir dir="${pdir}/logs"            />
    <delete dir="${ads.class.dir}"       />
    <jar jarfile="${pdir}/lib/OpenDS.jar"
         basedir="${classes.dir}" compress="true" index="true" />
@@ -908,10 +910,12 @@
        <dirset dir="${classes.dir}" />
        <dirset dir="${dsml.classes.dir}" />
        <dirset dir="${quicksetup.classes.dir}" />
      </classpath>
      <packageset dir="${src.dir}" />
      <packageset dir="${admin.src.dir}" />
      <packageset dir="${ads.src.dir}" />
      <packageset dir="${dsml.src.dir}" />
    </javadoc>
  </target>
@@ -930,6 +934,10 @@
    <path id="run.classpath">
      <pathelement location="${classes.dir}" />
    </path>
    <path id="quickSetup.classpath">
       <pathelement location="${quicksetup.classes.dir}" />
    </path>
  </target>
@@ -968,6 +976,7 @@
        </fileset>
        <path refid="run.classpath" />
        <path refid="quickSetup.classpath" />
      </classpath>
    </javac>
@@ -1276,6 +1285,7 @@
      <classpath>
        <pathelement location="${coverage.instr.dir}" />
        <pathelement location="${classes.dir}" />
        <pathelement location="${quicksetup.classes.dir}" />
        <pathelement location="${unittest.classes.dir}" />
        <path refid="run.classpath" />
opends/src/ads/org/opends/admin/ads/ADSContextException.java
@@ -27,12 +27,11 @@
package org.opends.admin.ads;
import org.opends.admin.ads.DsServiceCliReturnCode.ReturnCode;
/**
 * This is the exception that is thrown in ADSContext.
 * @see ADSContext.
 * @see org.opends.admin.ads.ADSContext
 *
 */
public class ADSContextException extends Exception {
@@ -50,83 +49,64 @@
    /**
     * The host name is missing.
     */
    MISSING_HOSTNAME(ReturnCode.MISSING_HOSTNAME),
    MISSING_HOSTNAME(),
    /**
     * The host name is not valid.
     */
    NOVALID_HOSTNAME(ReturnCode.NOVALID_HOSTNAME),
    NOVALID_HOSTNAME(),
    /**
     * The installation path is missing.
     */
    MISSING_IPATH(ReturnCode.MISSING_IPATH),
    MISSING_IPATH(),
    /**
     * The installation path is not valid.
     */
    NOVALID_IPATH(ReturnCode.NOVALID_IPATH),
    NOVALID_IPATH(),
    /**
     * An access permission error.
     */
    ACCESS_PERMISSION(ReturnCode.ACCESS_PERMISSION),
    ACCESS_PERMISSION(),
    /**
     * The entity is already registered.
     */
    ALREADY_REGISTERED(ReturnCode.ALREADY_REGISTERED),
    ALREADY_REGISTERED(),
    /**
     * The installation is broken.
     */
    BROKEN_INSTALL(ReturnCode.BROKEN_INSTALL),
    BROKEN_INSTALL(),
    /**
     * The entity is not yet registered.
     */
    NOT_YET_REGISTERED(ReturnCode.NOT_YET_REGISTERED),
    NOT_YET_REGISTERED(),
    /**
     * The port is missing.
     */
    MISSING_PORT(ReturnCode.MISSING_PORT),
    MISSING_PORT(),
    /**
     * The port is not valid.
     */
    NOVALID_PORT(ReturnCode.NOVALID_PORT),
    NOVALID_PORT(),
    /**
     * The name is missing.
     */
    MISSING_NAME(ReturnCode.MISSING_NAME),
    MISSING_NAME(),
    /**
     * The administration UID is missing.
     */
    MISSING_ADMIN_UID(ReturnCode.MISSING_ADMIN_UID),
    MISSING_ADMIN_UID(),
    /**
     * The administrator password is missing.
     */
    MISSING_ADMIN_PASSWORD(ReturnCode.MISSING_ADMIN_PASSWORD),
    MISSING_ADMIN_PASSWORD(),
    /**
     * There is already a backend with the name of the ADS backend but not
     * of the expected type.
     */
    UNEXPECTED_ADS_BACKEND_TYPE(ReturnCode.BROKEN_INSTALL),
    UNEXPECTED_ADS_BACKEND_TYPE(),
    /**
     * Unexpected error (potential bug).
     */
    ERROR_UNEXPECTED(ReturnCode.ERROR_UNEXPECTED);
    // The corresponding return code.
    private final ReturnCode returnCode;
    // Private constructor.
    private ErrorType(ReturnCode returnCode)
    {
      this.returnCode = returnCode;
    }
    /**
     * Get the corresponding return code.
     *
     * @return The corresponding return code.
     */
    public ReturnCode getReturnCode()
    {
      return returnCode;
    }
    ERROR_UNEXPECTED();
  };
  ErrorType error;
opends/src/ads/org/opends/admin/ads/util/TrustedSocketFactory.java
@@ -99,7 +99,14 @@
  // SocketFactory implementation
  //
  /**
   * {@inheritDoc}
   * Returns the default SSL socket factory. The default
   * implementation can be changed by setting the value of the
   * "ssl.SocketFactory.provider" security property (in the Java
   * security properties file) to the desired class. If SSL has not
   * been configured properly for this virtual machine, the factory
   * will be inoperative (reporting instantiation exceptions).
   *
   * @return the default SocketFactory
   */
  public static synchronized SocketFactory getDefault()
  {
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliAds.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliAds.java
@@ -24,7 +24,7 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.admin.ads;
package org.opends.server.admin.client.cli;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.tools.ToolConstants.*;
@@ -33,7 +33,10 @@
import java.util.ArrayList;
import java.util.List;
import org.opends.admin.ads.DsServiceCliReturnCode.ReturnCode;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.ADSContextHelper;
import org.opends.server.admin.client.cli.DsServiceCliReturnCode.ReturnCode;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.SubCommand;
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliMain.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliMain.java
@@ -24,7 +24,7 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.admin.ads;
package org.opends.server.admin.client.cli;
import java.io.OutputStream;
import java.io.PrintStream;
@@ -32,17 +32,19 @@
import javax.naming.NamingException;
import javax.naming.ldap.InitialLdapContext;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.util.ConnectionUtils;
import org.opends.server.core.DirectoryServer;
import org.opends.server.types.NullOutputStream;
import org.opends.server.util.args.ArgumentException;
import static org.opends.server.admin.client.cli.DsServiceCliReturnCode.*;
import static org.opends.server.messages.MessageHandler.*;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.messages.ToolMessages.*;
import static org.opends.server.util.ServerConstants.*;
import static org.opends.server.util.StaticUtils.*;
import static org.opends.admin.ads.DsServiceCliReturnCode.*;
/**
@@ -54,7 +56,7 @@
   * The fully-qualified name of this class.
   */
  private static final String CLASS_NAME =
      "org.opends.admin.ads.DsServiceCliMain";
      "org.opends.server.admin.client.cli.DsServiceCliMain";
  // The print stream to use for standard error.
  private PrintStream err;
@@ -236,7 +238,12 @@
    catch (ADSContextException e)
    {
      adsException = e;
      returnCode = e.error.getReturnCode();
      returnCode = DsServiceCliReturnCode.getReturncodeFromAdsError(e
          .getError());
      if (returnCode == null)
      {
        returnCode = ReturnCode.ERROR_UNEXPECTED;
      }
    }
    // deconnection
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliParser.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliParser.java
@@ -24,7 +24,7 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.admin.ads;
package org.opends.server.admin.client.cli;
import static org.opends.server.loggers.debug.DebugLogger.*;
import static org.opends.server.messages.MessageHandler.getMessage;
@@ -37,7 +37,9 @@
import java.io.PrintStream;
import java.util.HashSet;
import org.opends.admin.ads.DsServiceCliReturnCode.ReturnCode;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.server.admin.client.cli.DsServiceCliReturnCode.ReturnCode;
import org.opends.server.loggers.debug.DebugTracer;
import org.opends.server.types.DebugLogLevel;
import org.opends.server.util.PasswordReader;
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliReturnCode.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliReturnCode.java
@@ -24,14 +24,18 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.admin.ads;
package org.opends.server.admin.client.cli;
import static org.opends.server.messages.AdminMessages.*;
import java.util.HashMap;
import org.opends.admin.ads.ADSContextException.ErrorType;
/**
 * This class is handling server group CLI.
 */
public class DsServiceCliReturnCode
public final class DsServiceCliReturnCode
{
  /**
   *
@@ -168,4 +172,73 @@
    }
  };
  /**
   * Indicate whenever the association between ADS errors and return
   * has been done.
   */
  private static boolean initialized = false ;
  // Prevent instantiation.
  private void DsServiceCliReturnCode()
  {
    // Do nothing.
  }
  /**
   * The association map between ADS Error and Return code.
   */
  private static HashMap<ErrorType, ReturnCode> adsErrorToReturnCode =
    new HashMap<ErrorType, ReturnCode>();
  /**
   * Associates a set of ADS errors to return code.
   */
  private  static void registerAdsError()
  {
    adsErrorToReturnCode.put(ErrorType.MISSING_HOSTNAME,
        ReturnCode.MISSING_HOSTNAME);
    adsErrorToReturnCode.put(ErrorType.NOVALID_HOSTNAME,
        ReturnCode.NOVALID_HOSTNAME);
    adsErrorToReturnCode.put(ErrorType.MISSING_IPATH,
        ReturnCode.MISSING_IPATH);
    adsErrorToReturnCode.put(ErrorType.NOVALID_IPATH,
        ReturnCode.NOVALID_IPATH);
    adsErrorToReturnCode.put(ErrorType.ACCESS_PERMISSION,
        ReturnCode.ACCESS_PERMISSION);
    adsErrorToReturnCode.put(ErrorType.ALREADY_REGISTERED,
        ReturnCode.ALREADY_REGISTERED);
    adsErrorToReturnCode.put(ErrorType.BROKEN_INSTALL,
        ReturnCode.BROKEN_INSTALL);
    adsErrorToReturnCode.put(ErrorType.UNEXPECTED_ADS_BACKEND_TYPE,
        ReturnCode.BROKEN_INSTALL);
    adsErrorToReturnCode.put(ErrorType.NOT_YET_REGISTERED,
        ReturnCode.NOT_YET_REGISTERED);
    adsErrorToReturnCode.put(ErrorType.MISSING_PORT,
        ReturnCode.MISSING_PORT);
    adsErrorToReturnCode.put(ErrorType.NOVALID_PORT,
        ReturnCode.NOVALID_PORT);
    adsErrorToReturnCode.put(ErrorType.MISSING_NAME,
        ReturnCode.MISSING_NAME);
    adsErrorToReturnCode.put(ErrorType.MISSING_ADMIN_UID,
        ReturnCode.MISSING_ADMIN_UID);
    adsErrorToReturnCode.put(ErrorType.MISSING_ADMIN_PASSWORD,
        ReturnCode.MISSING_ADMIN_PASSWORD);
    adsErrorToReturnCode.put(ErrorType.ERROR_UNEXPECTED,
        ReturnCode.ERROR_UNEXPECTED);
  }
  /**
   * Get ReturnCode from an ADS error.
   * @param error The ADS error
   * @return the ReturnCode associated to the ADS error.
   */
  public static ReturnCode getReturncodeFromAdsError(ErrorType error)
  {
    if (! initialized)
    {
      registerAdsError();
      initialized = true ;
    }
    return adsErrorToReturnCode.get(error);
  }
}
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliServerGroup.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliServerGroup.java
@@ -24,7 +24,7 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
package org.opends.admin.ads;
package org.opends.server.admin.client.cli;
import static org.opends.server.messages.AdminMessages.*;
import static org.opends.server.tools.ToolConstants.*;
@@ -41,8 +41,10 @@
import javax.naming.ldap.Rdn;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.admin.ads.ADSContext.ServerGroupProperty;
import org.opends.admin.ads.DsServiceCliReturnCode.ReturnCode;
import org.opends.server.admin.client.cli.DsServiceCliReturnCode.ReturnCode;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.StringArgument;
@@ -220,6 +222,15 @@
  private HashMap<ServerGroupProperty, String> attributeDisplayName;
  /**
   * Get the display attribute name for a given attribute.
   * @param prop The server prperty
   * @return the display attribute name for a given attribute
   */
  public String getAttributeDisplayName(ServerGroupProperty prop)
  {
    return attributeDisplayName.get(prop);
  }
  /**
   * {@inheritDoc}
   */
  public void initializeCliGroup(SubCommandArgumentParser argParser,
opends/src/server/org/opends/server/admin/client/cli/DsServiceCliSubCommandGroup.java
File was renamed from opends/src/ads/org/opends/admin/ads/DsServiceCliSubCommandGroup.java
@@ -24,11 +24,13 @@
 *
 *      Portions Copyright 2006-2007 Sun Microsystems, Inc.
 */
 package org.opends.admin.ads;
 package org.opends.server.admin.client.cli;
import java.io.OutputStream;
import org.opends.admin.ads.DsServiceCliReturnCode.ReturnCode;
import org.opends.admin.ads.ADSContext;
import org.opends.admin.ads.ADSContextException;
import org.opends.server.admin.client.cli.DsServiceCliReturnCode.ReturnCode;
import org.opends.server.util.args.ArgumentException;
import org.opends.server.util.args.BooleanArgument;
import org.opends.server.util.args.SubCommand;
@@ -82,5 +84,4 @@
  public ReturnCode performSubCommand(ADSContext adsContext,
      SubCommand subCmd, OutputStream outStream, OutputStream errStream)
      throws ADSContextException;
}
}