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 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 /** 041 * The file behavior that indicates that the data written should 042 * overwrite any existing file. 043 */ 044 OVERWRITE("overwrite"), 045 046 047 048 /** 049 * The file behavior that indicates that the write should fail if 050 * the specified file already exists. 051 */ 052 FAIL("fail"); 053 054 055 056 /** The name to use for this existing file behavior. */ 057 private String name; 058 059 060 061 /** 062 * Creates a new existing file behavior with the specified name. 063 * 064 * @param name The name for this existing file behavior. 065 */ 066 private ExistingFileBehavior(String name) 067 { 068 this.name = name; 069 } 070 071 072 073 /** 074 * Retrieves the name for this existing file behavior. 075 * 076 * @return The name for this existing file behavior. 077 */ 078 public String getName() 079 { 080 return name; 081 } 082 083 084 085 /** 086 * Retrieves a string representation of this existing file behavior. 087 * 088 * @return A string representation of this existing file behavior. 089 */ 090 public String toString() 091 { 092 return name; 093 } 094} 095