KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > BackupRequest


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * BackupRequest.java
26  *
27  * Created on February 22, 2004, 1:40 AM
28  */

29
30 package com.sun.enterprise.config.backup;
31
32 import java.io.*;
33 import java.util.*;
34
35 import com.sun.enterprise.config.backup.util.ObjectAnalyzer;
36 import com.sun.enterprise.config.backup.util.FileUtils;
37
38 /**
39  * This class holds all of the values that the caller needs.
40  * An instance of this class can be used to create a request object.
41  * @author bnevins
42  */

43
44 public class BackupRequest
45 {
46     /**
47      * Create an instance
48      **/

49     public BackupRequest(String JavaDoc domainsDirName, String JavaDoc domain, String JavaDoc desc)
50     {
51         setDomainsDir(domainsDirName);
52         setDescription(desc);
53         domainName = domain;
54     }
55     
56     /**
57      * Create an instance
58      **/

59     public BackupRequest(String JavaDoc domainsDirName, String JavaDoc domain, String JavaDoc desc, String JavaDoc backupFileName)
60     {
61         this(domainsDirName, domain, desc);
62         setBackupFile(backupFileName);
63     }
64     
65     ///////////////////////////////////////////////////////////////////////////
66

67     public void setTerse(boolean b)
68     {
69         terse = b;
70     }
71     
72     ///////////////////////////////////////////////////////////////////////////
73

74     public void setVerbose(boolean b)
75     {
76         verbose = b;
77     }
78     
79     ///////////////////////////////////////////////////////////////////////////
80

81     public String JavaDoc toString()
82     {
83         return ObjectAnalyzer.toString(this);
84     }
85     
86     ///////////////////////////////////////////////////////////////////////////
87
//////////// Private Methods //////////////////////////////////////
88
///////////////////////////////////////////////////////////////////////////
89

90     private void setDomainsDir(String JavaDoc name)
91     {
92         domainsDir = FileUtils.safeGetCanonicalFile(new File(name));
93     }
94
95     ///////////////////////////////////////////////////////////////////////////
96

97     private void setBackupFile(String JavaDoc name)
98     {
99         backupFile = FileUtils.safeGetCanonicalFile(new File(name));
100     }
101
102     ///////////////////////////////////////////////////////////////////////////
103

104     private void setDescription(String JavaDoc desc)
105     {
106         description = desc;
107     }
108     
109     ///////////////////////////////////////////////////////////////////////////
110
//////////// Variables ////////////////////////////////////////////
111
///////////////////////////////////////////////////////////////////////////
112

113     final static String JavaDoc[] excludeDirs = {Constants.BACKUP_DIR + "/"};
114
115     File domainsDir;
116     String JavaDoc domainName;
117     String JavaDoc description;
118
119     // VARIABLES POSSIBLY SET AT RUNTIME
120
File backupFile;
121     
122     // VARIABLES SET AT RUNTIME
123
File domainDir;
124     long timestamp;
125     
126     // variables used ONLY by ListManager
127
// The reason it is here instead of in ListManager is so that
128
// we can get a nice concise centralized display of ALL the variables
129
// for all commands
130

131     File backupDir;
132     boolean terse = false;
133     boolean verbose = false;
134 }
135
136
Popular Tags