• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /netgear-WNDR4500v2-V1.0.0.60_1.0.38/ap/gpl/timemachine/db-4.7.25.NC/java/src/com/sleepycat/persist/evolve/
1/*-
2 * See the file LICENSE for redistribution information.
3 *
4 * Copyright (c) 2002,2008 Oracle.  All rights reserved.
5 *
6 * $Id: EvolveConfig.java,v 1.1 2008/02/07 17:12:27 mark Exp $
7 */
8
9package com.sleepycat.persist.evolve;
10
11import java.util.Collections;
12import java.util.HashSet;
13import java.util.Set;
14
15import 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 */
24public class EvolveConfig implements Cloneable {
25
26    private Set<String> classesToEvolve;
27    private EvolveListener listener;
28
29    /**
30     * Creates an evolve configuration with default properties.
31     */
32    public EvolveConfig() {
33        classesToEvolve = new HashSet<String>();
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 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 entityClass) {
52        classesToEvolve.add(entityClass);
53    }
54
55    /**
56     * Returns an unmodifiable set of the entity classes to be evolved.
57     */
58    public Set<String> 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