001 /*
002 * CDDL HEADER START
003 *
004 * The contents of this file are subject to the terms of the
005 * Common Development and Distribution License, Version 1.0 only
006 * (the "License"). You may not use this file except in compliance
007 * with the License.
008 *
009 * You can obtain a copy of the license at
010 * trunk/opends/resource/legal-notices/OpenDS.LICENSE
011 * or https://OpenDS.dev.java.net/OpenDS.LICENSE.
012 * See the License for the specific language governing permissions
013 * and limitations under the License.
014 *
015 * When distributing Covered Code, include this CDDL HEADER in each
016 * file and include the License file at
017 * trunk/opends/resource/legal-notices/OpenDS.LICENSE. If applicable,
018 * add the following below this CDDL HEADER, with the fields enclosed
019 * by brackets "[]" replaced with your own identifying information:
020 * Portions Copyright [yyyy] [name of copyright owner]
021 *
022 * CDDL HEADER END
023 *
024 *
025 * Copyright 2006-2008 Sun Microsystems, Inc.
026 */
027 package org.opends.server.loggers;
028
029 import java.io.File;
030
031 /**
032 * This class implements a post rotation action that encrypts
033 * the log file.
034 */
035 public class EncryptAction implements PostRotationAction
036 {
037
038 private File originalFile;
039 private String newFile;
040 private boolean deleteOriginal = false;
041 private String encryptAlgorithm = "RSA";
042 private String alias = null;
043
044 /**
045 * Create the action based on the original file, the new file after
046 * encrypting and whether the original file should be deleted.
047 *
048 * @param origFile The source file to be encrypted.
049 * @param newFile The new file to which the encrypted data should be
050 * written.
051 * @param deleteOriginal Indicates whether the original file should be
052 * deleted.
053 * @param alias The nickname of the certificate to use for the
054 * encryption.
055 * @param encryptAlg The encryption algorithm that should be used.
056 */
057 public EncryptAction(String origFile, String newFile,
058 boolean deleteOriginal, String alias, String encryptAlg)
059 {
060 this.originalFile = new File(origFile);
061 this.newFile = newFile;
062 this.deleteOriginal = deleteOriginal;
063 this.alias = alias;
064 this.encryptAlgorithm = encryptAlg;
065 }
066
067
068 /**
069 * The signature action that is executed. Returns true if the
070 * encryption succeeded and false otherwise.
071 *
072 * @return <CODE>true</CODE> if the encryption succeeded, or
073 * <CODE>false</CODE> if it did not.
074 */
075 public boolean execute()
076 {
077 // NYI.
078 return true;
079 }
080
081
082 }
083