View Javadoc
1   /*
2    *   Licensed to the Apache Software Foundation (ASF) under one
3    *   or more contributor license agreements.  See the NOTICE file
4    *   distributed with this work for additional information
5    *   regarding copyright ownership.  The ASF licenses this file
6    *   to you under the Apache License, Version 2.0 (the
7    *   "License"); you may not use this file except in compliance
8    *   with the License.  You may obtain a copy of the License at
9    *
10   *     http://www.apache.org/licenses/LICENSE-2.0
11   *
12   *   Unless required by applicable law or agreed to in writing,
13   *   software distributed under the License is distributed on an
14   *   "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   *   KIND, either express or implied.  See the License for the
16   *   specific language governing permissions and limitations
17   *   under the License.
18   *
19   */
20  package org.apache.directory.server.config.beans;
21  
22  
23  import org.apache.directory.server.config.ConfigurationElement;
24  
25  
26  /**
27   * A class used to store the Journal configuration.
28   *
29   * @author <a href="mailto:dev@directory.apache.org">Apache Directory Project</a>
30   */
31  public class JournalBean extends AdsBaseBean
32  {
33      /** The journal unique Id */
34      @ConfigurationElement(attributeType = "ads-journalId", isRdn = true)
35      private String journalId;
36  
37      /** The journal file name */
38      @ConfigurationElement(attributeType = "ads-journalFileName")
39      private String journalFileName;
40  
41      /** The journal working directory */
42      @ConfigurationElement(attributeType = "ads-journalWorkingDir")
43      private String journalWorkingDir;
44  
45      /** The journal rotation */
46      @ConfigurationElement(attributeType = "ads-journalRotation")
47      private int journalRotation;
48  
49  
50      /**
51       * Create a new JournalBean instance
52       */
53      public JournalBean()
54      {
55          // Default to infinite
56          journalRotation = 0;
57  
58          // Not enabled by default
59          setEnabled( false );
60      }
61  
62  
63      /**
64       * @return the journalId
65       */
66      public String getJournalId()
67      {
68          return journalId;
69      }
70  
71  
72      /**
73       * @param journalId the journalId to set
74       */
75      public void setJournalId( String journalId )
76      {
77          this.journalId = journalId;
78      }
79  
80  
81      /**
82       * @return the fileName
83       */
84      public String getJournalFileName()
85      {
86          return journalFileName;
87      }
88  
89  
90      /**
91       * @param journalFileName the journalFileName to set
92       */
93      public void setJournalFileName( String journalFileName )
94      {
95          this.journalFileName = journalFileName;
96      }
97  
98  
99      /**
100      * @return the journal WorkingDir
101      */
102     public String getJournalWorkingDir()
103     {
104         return journalWorkingDir;
105     }
106 
107 
108     /**
109      * @param journalWorkingDir the journal WorkingDir to set
110      */
111     public void setJournalWorkingDir( String journalWorkingDir )
112     {
113         this.journalWorkingDir = journalWorkingDir;
114     }
115 
116 
117     /**
118      * @return the journal Rotation
119      */
120     public int getJournalRotation()
121     {
122         return journalRotation;
123     }
124 
125 
126     /**
127      * @param journalRotation the journal Rotation to set
128      */
129     public void setJournalRotation( int journalRotation )
130     {
131         this.journalRotation = journalRotation;
132     }
133 
134 
135     /**
136      * {@inheritDoc}
137      */
138     @Override
139     public String toString( String tabs )
140     {
141         StringBuilder sb = new StringBuilder();
142 
143         sb.append( tabs ).append( "Journal :\n" );
144         sb.append( tabs ).append( "  journal id : " ).append( journalId ).append( '\n' );
145         sb.append( tabs ).append( "  journal file name : " ).append( journalFileName ).append( '\n' );
146         sb.append( toString( tabs, "  journal working dir", journalWorkingDir ) );
147         sb.append( toString( tabs, "  journal rotation", journalRotation ) );
148 
149         return sb.toString();
150     }
151 
152 
153     /**
154      * {@inheritDoc}
155      */
156     @Override
157     public String toString()
158     {
159         return toString( "" );
160     }
161 }