KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > components > modules > database > AbstractAutoIncrementModule


1 /*
2  * Copyright 1999-2004 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16
17 package org.apache.cocoon.components.modules.database;
18
19 import org.apache.avalon.framework.activity.Disposable;
20 import org.apache.avalon.framework.configuration.Configurable;
21 import org.apache.avalon.framework.configuration.Configuration;
22 import org.apache.avalon.framework.configuration.ConfigurationException;
23 import org.apache.avalon.framework.logger.AbstractLogEnabled;
24
25 import org.apache.cocoon.util.HashMap;
26
27 /**
28  * AbstractDatabaseModule gives you the infrastructure for easily
29  * deploying more AutoIncrementModules. In order to get at the Logger, use
30  * getLogger().
31  *
32  * @author <a HREF="mailto:haul@apache.org">Christian Haul</a>
33  * @version CVS $Id: AbstractAutoIncrementModule.java 30932 2004-07-29 17:35:38Z vgritsenko $
34  */

35 public abstract class AbstractAutoIncrementModule extends AbstractLogEnabled
36     implements AutoIncrementModule, Configurable, Disposable {
37
38     /**
39      * Stores (global) configuration parameters as <code>key</code> /
40      * <code>value</code> pairs.
41      */

42     protected HashMap settings = null;
43
44     /**
45      * Configures the database access module.
46      *
47      * Takes all elements nested in component declaration and stores
48      * them as key-value pairs in <code>settings</code>. Nested
49      * configuration option are not catered for. This way global
50      * configuration options can be used.
51      *
52      * For nested configurations override this function.
53      * */

54     public void configure(Configuration conf) throws ConfigurationException {
55         Configuration[] parameters = conf.getChildren();
56         this.settings = new HashMap(parameters.length);
57         for (int i = 0; i < parameters.length; i++) {
58             String JavaDoc key = parameters[i].getName();
59             String JavaDoc val = parameters[i].getValue();
60             this.settings.put(key, val);
61         }
62     }
63
64     /**
65      * dispose
66      */

67     public void dispose() {
68         // Purposely empty so that we don't need to implement it in every
69
// class.
70
}
71 }
72
Popular Tags