KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > cocoon > ojb > jdo > components > JDOImpl


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 package org.apache.cocoon.ojb.jdo.components;
17
18 import org.apache.avalon.framework.activity.Initializable;
19 import org.apache.avalon.framework.logger.AbstractLogEnabled;
20 import org.apache.avalon.framework.thread.ThreadSafe;
21
22 import org.apache.ojb.jdori.sql.OjbStorePMF;
23
24 import javax.jdo.PersistenceManager;
25 import javax.jdo.PersistenceManagerFactory;
26
27 /**
28  * Implementation of the JDO component. Creates one PersistenceManagerFactory
29  * and stores it for the future use.
30  *
31  * @author <a HREF="mailto:antonio@apache.org">Antonio Gallardo</a>
32  * @version CVS $Id: JDOImpl.java 155366 2005-02-25 19:54:12Z vgritsenko $
33 */

34 public class JDOImpl extends AbstractLogEnabled
35                      implements JDO, ThreadSafe, Initializable {
36
37     protected PersistenceManagerFactory factory;
38
39     /* (non-Javadoc)
40      * @see org.apache.cocoon.ojb.jdori.components.JDO#getPersistenceManager()
41      */

42     public PersistenceManager getPersistenceManager() {
43         return this.factory.getPersistenceManager();
44     }
45
46     /* (non-Javadoc)
47      * @see org.apache.avalon.framework.activity.Initializable#initialize()
48      */

49     public void initialize() throws Exception JavaDoc {
50         this.factory = new OjbStorePMF();
51     }
52 }
53
Popular Tags