KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > directory > ldapstudio > apacheds > configuration > model > Partition


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.ldapstudio.apacheds.configuration.model;
21
22
23 import java.util.ArrayList JavaDoc;
24 import java.util.List JavaDoc;
25
26 import javax.naming.directory.Attributes JavaDoc;
27 import javax.naming.directory.BasicAttributes JavaDoc;
28
29
30 /**
31  * This class represents a Partition.
32  *
33  * @author <a HREF="mailto:dev@directory.apache.org">Apache Directory Project</a>
34  * @version $Rev$, $Date$
35  */

36 public class Partition
37 {
38     /** The name of the partition */
39     private String JavaDoc name;
40
41     /** The cache size of the partition */
42     private int cacheSize;
43
44     /** The suffix of the partition */
45     private String JavaDoc suffix;
46
47     /** The Enable Optimizer flag */
48     private boolean enableOptimizer;
49
50     /** The Synchronization On Write flag */
51     private boolean synchronizationOnWrite;
52
53     /** The Context Entry */
54     private Attributes JavaDoc contextEntry;
55
56     /** The indexed attributes */
57     private List JavaDoc<IndexedAttribute> indexedAttributes;
58
59     /** The System Partition flag */
60     private boolean systemPartition = false;
61
62
63     /**
64      * Creates a new instance of Partition.
65      */

66     public Partition()
67     {
68         indexedAttributes = new ArrayList JavaDoc<IndexedAttribute>();
69         contextEntry = new BasicAttributes JavaDoc( true );
70     }
71
72
73     /**
74      * Creates a new instance of Partition.
75      *
76      * @param name
77      * the name of the partition
78      */

79     public Partition( String JavaDoc name )
80     {
81         indexedAttributes = new ArrayList JavaDoc<IndexedAttribute>();
82         contextEntry = new BasicAttributes JavaDoc( true );
83         this.name = name;
84     }
85
86
87     /**
88      * Gets the name of the partition.
89      *
90      * @return
91      * the name of the partition
92      */

93     public String JavaDoc getName()
94     {
95         return this.name;
96     }
97
98
99     /**
100      * Sets the name of the partition.
101      *
102      * @param name
103      * the new name to set
104      */

105     public void setName( String JavaDoc name )
106     {
107         this.name = name;
108     }
109
110
111     /**
112      * Gets the cache size.
113      *
114      * @return
115      * the cache size
116      */

117     public int getCacheSize()
118     {
119         return cacheSize;
120     }
121
122
123     /**
124      * Sets the cache size.
125      *
126      * @param cacheSize
127      * the new cache size
128      */

129     public void setCacheSize( int cacheSize )
130     {
131         this.cacheSize = cacheSize;
132     }
133
134
135     /**
136      * Gets the Context Entry.
137      *
138      * @return
139      * the Content Entry
140      */

141     public Attributes JavaDoc getContextEntry()
142     {
143         return contextEntry;
144     }
145
146
147     /**
148      * Sets the Context Entry
149      *
150      * @param contextEntry
151      * the new Context Entry
152      */

153     public void setContextEntry( Attributes JavaDoc contextEntry )
154     {
155         this.contextEntry = contextEntry;
156     }
157
158
159     /**
160      * Gets the Enable Optimizer flag.
161      *
162      * @return
163      * the Enable Optimizer flag
164      */

165     public boolean isEnableOptimizer()
166     {
167         return enableOptimizer;
168     }
169
170
171     /**
172      * Sets the Enable Optimizer flag.
173      *
174      * @param enableOptimizer
175      * the new value for the Enable Optimizer flag
176      */

177     public void setEnableOptimizer( boolean enableOptimizer )
178     {
179         this.enableOptimizer = enableOptimizer;
180     }
181
182
183     /**
184      * Get the Indexed Attributes List.
185      *
186      * @return
187      * the Indexed Attributes List
188      */

189     public List JavaDoc<IndexedAttribute> getIndexedAttributes()
190     {
191         return indexedAttributes;
192     }
193
194
195     /**
196      * Set the Indexed Attributes List.
197      *
198      * @param indexedAttributes
199      * the new Indexed Attributes List
200      */

201     public void setIndexedAttributes( List JavaDoc<IndexedAttribute> indexedAttributes )
202     {
203         this.indexedAttributes = indexedAttributes;
204     }
205
206
207     /**
208      * Adds an Indexed Attribute.
209      *
210      * @param indexedAttribute
211      * the Indexed Attribute to add
212      * @return
213      * true (as per the general contract of the Collection.add method).
214      */

215     public boolean addIndexedAttribute( IndexedAttribute indexedAttribute )
216     {
217         return indexedAttributes.add( indexedAttribute );
218     }
219
220
221     /**
222      * Removes a Indexed Attribute.
223      *
224      * @param indexedAttribute
225      * the Indexed Attribute to remove
226      * @return
227      * true if this list contained the specified element.
228      */

229     public boolean removeIndexedAttribute( IndexedAttribute indexedAttribute )
230     {
231         return indexedAttributes.remove( indexedAttribute );
232     }
233
234
235     /**
236      * Gets the suffix.
237      *
238      * @return
239      * the suffix
240      */

241     public String JavaDoc getSuffix()
242     {
243         return suffix;
244     }
245
246
247     /**
248      * Sets the suffix.
249      *
250      * @param suffix
251      * the new suffix
252      */

253     public void setSuffix( String JavaDoc suffix )
254     {
255         this.suffix = suffix;
256     }
257
258
259     /**
260      * Gets the Synchronization On Write flag.
261      *
262      * @return
263      * the Synchronization On Write flag
264      */

265     public boolean isSynchronizationOnWrite()
266     {
267         return synchronizationOnWrite;
268     }
269
270
271     /**
272      * Sets the Synchronization On Write flag.
273      *
274      * @param synchronizationOnWrite
275      * the Synchronization On Write flag
276      */

277     public void setSynchronizationOnWrite( boolean synchronizationOnWrite )
278     {
279         this.synchronizationOnWrite = synchronizationOnWrite;
280     }
281
282
283     /**
284      * Returns the System Partition flag.
285      *
286      * @return
287      * true if the partition is the System Partition
288      */

289     public boolean isSystemPartition()
290     {
291         return systemPartition;
292     }
293
294
295     /**
296      * Sets the System Partition flag.
297      *
298      * @param systemPartition
299      * the System Partition flag
300      */

301     public void setSystemPartition( boolean systemPartition )
302     {
303         this.systemPartition = systemPartition;
304     }
305
306
307     /* (non-Javadoc)
308      * @see java.lang.Object#toString()
309      */

310     public String JavaDoc toString()
311     {
312         return name;
313     }
314 }
315
Popular Tags