0N/A/*
0N/A * CDDL HEADER START
0N/A *
0N/A * The contents of this file are subject to the terms of the
0N/A * Common Development and Distribution License, Version 1.0 only
0N/A * (the "License"). You may not use this file except in compliance
0N/A * with the License.
0N/A *
6983N/A * You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
6983N/A * or http://forgerock.org/license/CDDLv1.0.html.
0N/A * See the License for the specific language governing permissions
0N/A * and limitations under the License.
0N/A *
0N/A * When distributing Covered Code, include this CDDL HEADER in each
6983N/A * file and include the License file at legal-notices/CDDLv1_0.txt.
6983N/A * If applicable, add the following below this CDDL HEADER, with the
6983N/A * fields enclosed by brackets "[]" replaced with your own identifying
6983N/A * information:
0N/A * Portions Copyright [yyyy] [name of copyright owner]
0N/A *
0N/A * CDDL HEADER END
0N/A *
0N/A *
3215N/A * Copyright 2006-2008 Sun Microsystems, Inc.
0N/A */
0N/Apackage org.opends.server.tools;
0N/A
0N/Aimport java.util.ArrayList;
4134N/Aimport org.opends.server.types.Control;
0N/A
0N/A
0N/A/**
0N/A * This class defines common options for all the operations used
0N/A * by the tools.
0N/A */
0N/Apublic class LDAPToolOptions
0N/A{
0N/A
0N/A private boolean showOperations = false;
0N/A private boolean verbose = false;
0N/A private boolean continueOnError = false;
0N/A private String encoding = System.getProperty("file.encoding");
4134N/A private ArrayList<Control> controls = new ArrayList<Control>();
0N/A
0N/A /**
0N/A * Creates a the tool options instance.
0N/A *
0N/A */
0N/A public LDAPToolOptions()
0N/A {
0N/A }
0N/A
0N/A /**
0N/A * Set whether to show what would be run but not actually do it.
0N/A *
0N/A * @param showOperations True if we need to show what needs to be done.
0N/A *
0N/A */
0N/A
0N/A public void setShowOperations(boolean showOperations)
0N/A {
0N/A this.showOperations = showOperations;
0N/A }
0N/A
0N/A /**
0N/A * Return the showOperations flag value.
0N/A *
0N/A * @return <CODE>true</CODE> if the operations should only be displayed, or
0N/A * <CODE>false</CODE> if they should actually be performed.
0N/A */
0N/A public boolean showOperations()
0N/A {
0N/A return showOperations;
0N/A }
0N/A
0N/A /**
0N/A * Set verbose flag.
0N/A *
0N/A * @param verbose Indicates whether the tool should operate in verbose mode.
0N/A */
0N/A
0N/A public void setVerbose(boolean verbose)
0N/A {
0N/A this.verbose = verbose;
0N/A }
0N/A
0N/A /**
0N/A * Return the verbose flag value.
0N/A *
0N/A * @return <CODE>true</CODE> if the tool should operate in verbose mode, or
0N/A * <CODE>false</CODE> if not.
0N/A */
0N/A public boolean getVerbose()
0N/A {
0N/A return verbose;
0N/A }
0N/A
0N/A /**
0N/A * Set whether to use continue on error or not.
0N/A *
0N/A * @param continueOnError True if processing should continue on
0N/A * error, false otherwise.
0N/A *
0N/A */
0N/A
0N/A public void setContinueOnError(boolean continueOnError)
0N/A {
0N/A this.continueOnError = continueOnError;
0N/A }
0N/A
0N/A /**
0N/A * Return the continueOnError flag value.
0N/A *
0N/A * @return <CODE>true</CODE> if the tool should continue processing
0N/A * operations if an error occurs with a previous operation, or
0N/A * <CODE>false</CODE> if not.
0N/A */
0N/A public boolean continueOnError()
0N/A {
0N/A return continueOnError;
0N/A }
0N/A
0N/A /**
0N/A * Return the controls to apply to the operation.
0N/A *
0N/A * @return The controls to apply to the operation.
0N/A */
4134N/A public ArrayList<Control> getControls()
0N/A {
0N/A return controls;
0N/A }
0N/A
0N/A /**
763N/A * Specifies the set of controls to apply to the operation.
763N/A *
763N/A * @param controls The set of controls to apply to the operation.
763N/A */
4134N/A public void setControls(ArrayList<Control> controls)
763N/A {
763N/A this.controls = controls;
763N/A }
763N/A
763N/A /**
0N/A * Set the encoding.
0N/A *
0N/A * @param encodingStr The encoding to use for string values.
0N/A */
0N/A public void setEncoding(String encodingStr)
0N/A {
0N/A this.encoding = encodingStr;
0N/A }
0N/A
0N/A /**
0N/A * Return the encoding value.
0N/A *
0N/A * @return The encoding to use for string values.
0N/A */
0N/A public String getEncoding()
0N/A {
0N/A return encoding;
0N/A }
0N/A
0N/A}
0N/A