All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.unboundid.ldap.sdk.unboundidds.Launcher Maven / Gradle / Ivy

Go to download

The UnboundID LDAP SDK for Java is a fast, comprehensive, and easy-to-use Java API for communicating with LDAP directory servers and performing related tasks like reading and writing LDIF, encoding and decoding data using base64 and ASN.1 BER, and performing secure communication. This package contains the Standard Edition of the LDAP SDK, which is a complete, general-purpose library for communicating with LDAPv3 directory servers.

There is a newer version: 7.0.1
Show newest version
/*
 * Copyright 2010-2018 Ping Identity Corporation
 * All Rights Reserved.
 */
/*
 * Copyright (C) 2015-2018 Ping Identity Corporation
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License (GPLv2 only)
 * or the terms of the GNU Lesser General Public License (LGPLv2.1 only)
 * as published by the Free Software Foundation.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, see .
 */
package com.unboundid.ldap.sdk.unboundidds;



import java.io.OutputStream;
import java.io.PrintStream;

import com.unboundid.ldap.listener.InMemoryDirectoryServerTool;
import com.unboundid.ldap.sdk.ResultCode;
import com.unboundid.ldap.sdk.Version;
import com.unboundid.ldap.sdk.examples.AuthRate;
import com.unboundid.ldap.sdk.examples.Base64Tool;
import com.unboundid.ldap.sdk.examples.IdentifyReferencesToMissingEntries;
import com.unboundid.ldap.sdk.examples.IdentifyUniqueAttributeConflicts;
import com.unboundid.ldap.sdk.examples.LDAPCompare;
import com.unboundid.ldap.sdk.examples.LDAPDebugger;
import com.unboundid.ldap.sdk.examples.ModRate;
import com.unboundid.ldap.sdk.examples.SearchRate;
import com.unboundid.ldap.sdk.examples.SearchAndModRate;
import com.unboundid.ldap.sdk.examples.ValidateLDIF;
import com.unboundid.ldap.sdk.persist.GenerateSchemaFromSource;
import com.unboundid.ldap.sdk.persist.GenerateSourceFromSchema;
import com.unboundid.ldap.sdk.transformations.TransformLDIF;
import com.unboundid.ldap.sdk.unboundidds.examples.DumpDNs;
import com.unboundid.ldap.sdk.unboundidds.examples.SubtreeAccessibility;
import com.unboundid.ldap.sdk.unboundidds.examples.SummarizeAccessLog;
import com.unboundid.ldap.sdk.unboundidds.tools.GenerateTOTPSharedSecret;
import com.unboundid.ldap.sdk.unboundidds.tools.LDAPModify;
import com.unboundid.ldap.sdk.unboundidds.tools.LDAPSearch;
import com.unboundid.ldap.sdk.unboundidds.tools.ManageAccount;
import com.unboundid.ldap.sdk.unboundidds.tools.SplitLDIF;
import com.unboundid.util.StaticUtils;
import com.unboundid.util.ThreadSafety;
import com.unboundid.util.ThreadSafetyLevel;
import com.unboundid.util.ssl.cert.ManageCertificates;



/**
 * This class provides an entry point that may be used to launch other tools
 * provided as part of the LDAP SDK.  This is primarily a convenience for
 * someone who just has the jar file and none of the scripts, since you can run
 * "java -jar unboundid-ldapsdk.jar {tool-name} {tool-args}"
 * in order to invoke any of the example tools.  Running just
 * "java -jar unboundid-ldapsdk.jar" will display version
 * information about the LDAP SDK.
 * 
*
* NOTE: This class, and other classes within the * {@code com.unboundid.ldap.sdk.unboundidds} package structure, are only * supported for use against Ping Identity, UnboundID, and * Nokia/Alcatel-Lucent 8661 server products. These classes provide support * for proprietary functionality or for external specifications that are not * considered stable or mature enough to be guaranteed to work in an * interoperable way with other types of LDAP servers. *
*
* The tool names are case-insensitive. Supported tool names include: *
    *
  • authrate -- Launch the {@link AuthRate} tool.
  • *
  • base64 -- Launch the {@link Base64Tool} tool.
  • *
  • deliver-one-time-password -- Launch the * {@link DeliverOneTimePassword} tool.
  • *
  • deliver-password-reset-token -- Launch the * {@link DeliverPasswordResetToken} tool.
  • *
  • dump-dns -- Launch the {@link DumpDNs} tool.
  • *
  • generate-schema-from-source -- Launch the * {@link GenerateSchemaFromSource} tool.
  • *
  • generate-source-from-schema -- Launch the * {@link GenerateSourceFromSchema} tool.
  • *
  • generate-totp-shared-secret -- Launch the * {@link GenerateTOTPSharedSecret} tool.
  • *
  • identify-references-to-missing-entries -- Launch the * {@link IdentifyReferencesToMissingEntries} tool.
  • *
  • identify-unique-attribute-conflicts -- Launch the * {@link IdentifyUniqueAttributeConflicts} tool.
  • *
  • in-memory-directory-server -- Launch the * {@link InMemoryDirectoryServerTool} tool.
  • *
  • ldapcompare -- Launch the {@link LDAPCompare} tool.
  • *
  • ldapmodify -- Launch the {@link LDAPModify} tool.
  • *
  • ldapsearch -- Launch the {@link LDAPSearch} tool.
  • *
  • ldap-debugger -- Launch the {@link LDAPDebugger} tool.
  • *
  • manage-account -- Launch the {@link ManageAccount} tool.
  • *
  • manage-certificates -- Launch the {@link ManageCertificates} tool.
  • *
  • modrate -- Launch the {@link ModRate} tool.
  • *
  • move-subtree -- Launch the {@link MoveSubtree} tool.
  • *
  • register-yubikey-otp-device -- Launch the * {@link RegisterYubiKeyOTPDevice} tool.
  • *
  • searchrate -- Launch the {@link SearchRate} tool.
  • *
  • search-and-mod-rate -- Launch the {@link SearchAndModRate} tool.
  • *
  • split-ldif -- Launch the {@link SplitLDIF} tool.
  • *
  • subtree-accessibility -- Launch the {@link SubtreeAccessibility} * tool.
  • *
  • summarize-access-log -- Launch the {@link SummarizeAccessLog} * tool.
  • *
  • transform-ldif -- Launch the {@link TransformLDIF} tool.
  • *
  • validate-ldif -- Launch the {@link ValidateLDIF} tool.
  • *
  • version -- Display version information for the LDAP SDK.
  • *
*/ @ThreadSafety(level=ThreadSafetyLevel.COMPLETELY_THREADSAFE) public final class Launcher { /** * Prevent this utility class from being instantiated. */ private Launcher() { // No implementation required. } /** * Parses the command-line arguments and performs any appropriate processing * for this program. * * @param args The command-line arguments provided to this program. */ public static void main(final String... args) { main(System.out, System.err, args); } /** * Parses the command-line arguments and performs any appropriate processing * for this program. * * @param outStream The output stream to which standard out should be * written. It may be {@code null} if output should be * suppressed. * @param errStream The output stream to which standard error should be * written. It may be {@code null} if error messages * should be suppressed. * @param args The command-line arguments provided to this program. * * @return A result code with information about the status of processing. */ public static ResultCode main(final OutputStream outStream, final OutputStream errStream, final String... args) { if ((args == null) || (args.length == 0) || args[0].equalsIgnoreCase("version")) { if (outStream != null) { final PrintStream out = new PrintStream(outStream); for (final String line : Version.getVersionLines()) { out.println(line); } } return ResultCode.SUCCESS; } final String firstArg = StaticUtils.toLowerCase(args[0]); final String[] remainingArgs = new String[args.length - 1]; System.arraycopy(args, 1, remainingArgs, 0, remainingArgs.length); if (firstArg.equals("authrate")) { return AuthRate.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("base64")) { return Base64Tool.main(System.in, outStream, errStream, remainingArgs); } else if (firstArg.equals("deliver-one-time-password")) { return DeliverOneTimePassword.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("deliver-password-reset-token")) { return DeliverPasswordResetToken.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("dump-dns")) { return DumpDNs.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("identify-references-to-missing-entries")) { return IdentifyReferencesToMissingEntries.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("identify-unique-attribute-conflicts")) { return IdentifyUniqueAttributeConflicts.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("in-memory-directory-server")) { return InMemoryDirectoryServerTool.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("generate-schema-from-source")) { return GenerateSchemaFromSource.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("generate-source-from-schema")) { return GenerateSourceFromSchema.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("generate-totp-shared-secret")) { return GenerateTOTPSharedSecret.main(outStream, errStream, remainingArgs); } else if (firstArg.equals("ldapcompare")) { return LDAPCompare.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("ldapmodify")) { return LDAPModify.main(System.in, outStream, errStream, remainingArgs); } else if (firstArg.equals("ldapsearch")) { return LDAPSearch.main(outStream, errStream, remainingArgs); } else if (firstArg.equals("ldap-debugger")) { return LDAPDebugger.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("manage-account")) { return ManageAccount.main(outStream, errStream, remainingArgs); } else if (firstArg.equals("manage-certificates")) { return ManageCertificates.main(System.in, outStream, errStream, remainingArgs); } else if (firstArg.equals("modrate")) { return ModRate.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("move-subtree")) { return MoveSubtree.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("register-yubikey-otp-device")) { return RegisterYubiKeyOTPDevice.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("searchrate")) { return SearchRate.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("search-and-mod-rate")) { return SearchAndModRate.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("split-ldif")) { return SplitLDIF.main(outStream, errStream, remainingArgs); } else if (firstArg.equals("subtree-accessibility")) { return SubtreeAccessibility.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("summarize-access-log")) { return SummarizeAccessLog.main(remainingArgs, outStream, errStream); } else if (firstArg.equals("transform-ldif")) { return TransformLDIF.main(outStream, errStream, remainingArgs); } else if (firstArg.equals("validate-ldif")) { return ValidateLDIF.main(remainingArgs, outStream, errStream); } else { if (errStream != null) { final PrintStream err = new PrintStream(errStream); err.println("Unrecognized tool name '" + args[0] + '\''); err.println("Supported tool names include:"); err.println(" authrate"); err.println(" base64"); err.println(" deliver-one-time-password"); err.println(" deliver-password-reset-token"); err.println(" dump-dns"); err.println(" generate-schema-from-source"); err.println(" generate-source-from-schema"); err.println(" generate-totp-shared-secret"); err.println(" identify-references-to-missing-entries"); err.println(" identify-unique-attribute-conflicts"); err.println(" in-memory-directory-server"); err.println(" ldapcompare"); err.println(" ldapmodify"); err.println(" ldapsearch"); err.println(" ldap-debugger"); err.println(" manage-account"); err.println(" manage-certificates"); err.println(" modrate"); err.println(" move-subtree"); err.println(" register-yubikey-otp-device"); err.println(" searchrate"); err.println(" search-and-mod-rate"); err.println(" split-ldif"); err.println(" subtree-accessibility"); err.println(" summarize-access-log"); err.println(" transform-ldif"); err.println(" validate-ldif"); err.println(" version"); } return ResultCode.PARAM_ERROR; } } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy