001/*
002 * The contents of this file are subject to the terms of the Common Development and
003 * Distribution License (the License). You may not use this file except in compliance with the
004 * License.
005 *
006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
007 * specific language governing permission and limitations under the License.
008 *
009 * When distributing Covered Software, include this CDDL Header Notice in each file and include
010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
011 * Header, with the fields enclosed by brackets [] replaced by your own identifying
012 * information: "Portions Copyright [year] [name of copyright owner]".
013 *
014 * Copyright 2006-2008 Sun Microsystems, Inc.
015 * Portions Copyright 2015-2016 ForgeRock AS.
016 */
017package org.opends.server.types;
018
019
020
021/**
022 * This enumeration defines the set of possible behaviors that should
023 * be taken when attempting to write to a file that already exists.
024 */
025@org.opends.server.types.PublicAPI(
026     stability=org.opends.server.types.StabilityLevel.UNCOMMITTED,
027     mayInstantiate=false,
028     mayExtend=false,
029     mayInvoke=true)
030public enum ExistingFileBehavior
031{
032  /**
033   * The file behavior that indicates that the data written should be
034   * appended to any existing file.
035   */
036  APPEND("append"),
037
038
039
040  /** The file behavior that indicates that the data written should overwrite any existing file. */
041  OVERWRITE("overwrite"),
042
043
044
045  /**
046   * The file behavior that indicates that the write should fail if
047   * the specified file already exists.
048   */
049  FAIL("fail");
050
051
052
053  /** The name to use for this existing file behavior. */
054  private String name;
055
056
057
058  /**
059   * Creates a new existing file behavior with the specified name.
060   *
061   * @param  name  The name for this existing file behavior.
062   */
063  private ExistingFileBehavior(String name)
064  {
065    this.name = name;
066  }
067
068
069
070  /**
071   * Retrieves the name for this existing file behavior.
072   *
073   * @return  The name for this existing file behavior.
074   */
075  public String getName()
076  {
077    return name;
078  }
079
080
081
082  /**
083   * Retrieves a string representation of this existing file behavior.
084   *
085   * @return  A string representation of this existing file behavior.
086   */
087  @Override
088  public String toString()
089  {
090    return name;
091  }
092}
093