KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sleepycat > persist > evolve > EvolveConfig


1 /*-
2  * See the file LICENSE for redistribution information.
3  *
4  * Copyright (c) 2002,2006 Oracle. All rights reserved.
5  *
6  * $Id: EvolveConfig.java,v 1.6 2006/10/30 21:14:31 bostic Exp $
7  */

8
9 package com.sleepycat.persist.evolve;
10
11 import java.util.Collections JavaDoc;
12 import java.util.HashSet JavaDoc;
13 import java.util.Set JavaDoc;
14
15 import com.sleepycat.persist.EntityStore;
16
17 /**
18  * Configuration properties for eager conversion of unevolved objects. This
19  * configuration is used with {@link EntityStore#evolve EntityStore.evolve}.
20  *
21  * @see com.sleepycat.persist.evolve Class Evolution
22  * @author Mark Hayes
23  */

24 public class EvolveConfig implements Cloneable JavaDoc {
25
26     private Set JavaDoc<String JavaDoc> classesToEvolve;
27     private EvolveListener listener;
28
29     /**
30      * Creates an evolve configuration with default properties.
31      */

32     public EvolveConfig() {
33         classesToEvolve = new HashSet JavaDoc<String JavaDoc>();
34     }
35
36     /**
37      * Returns a shallow copy of the configuration.
38      */

39     public EvolveConfig cloneConfig() {
40         try {
41             return (EvolveConfig) clone();
42         } catch (CloneNotSupportedException JavaDoc cannotHappen) {
43             return null;
44         }
45     }
46
47     /**
48      * Adds an entity class for a primary index to be converted. If no classes
49      * are added, all indexes that require evolution will be converted.
50      */

51     public void addClassToEvolve(String JavaDoc entityClass) {
52         classesToEvolve.add(entityClass);
53     }
54
55     /**
56      * Returns an unmodifiable set of the entity classes to be evolved.
57      */

58     public Set JavaDoc<String JavaDoc> getClassesToEvolve() {
59         return Collections.unmodifiableSet(classesToEvolve);
60     }
61
62     /**
63      * Sets a progress listener that is notified each time an entity is read.
64      */

65     public void setEvolveListener(EvolveListener listener) {
66         this.listener = listener;
67     }
68
69     /**
70      * Returns the progress listener that is notified each time an entity is
71      * read.
72      */

73     public EvolveListener getEvolveListener() {
74         return listener;
75     }
76 }
77
Popular Tags