]> SALOME platform Git repositories - tools/siman.git/blob - Workspace/Siman-Common/src/org/splat/dal/dao/kernel/Database.java
Salome HOME
Refactoring continues: UserService is created instead of UserDirectory. Database...
[tools/siman.git] / Workspace / Siman-Common / src / org / splat / dal / dao / kernel / Database.java
1 package org.splat.dal.dao.kernel;
2
3 /**
4  * 
5  * @author    Daniel Brunier-Coulin
6  * @copyright OPEN CASCADE 2012
7  */
8
9 import org.hibernate.Session;
10 import org.splat.service.technical.IndexService;
11 import org.splat.service.technical.RepositoryService;
12 import org.springframework.beans.BeansException;
13 import org.springframework.context.ApplicationContext;
14 import org.springframework.context.ApplicationContextAware;
15 import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
16 import org.apache.log4j.Logger;
17
18 public abstract class Database extends HibernateDaoSupport implements
19                 ApplicationContextAware {
20
21         /**
22          * The ApplicationContext.
23          */
24         private static ApplicationContext _context = null;
25
26         /**
27          * Spring will call this method for initialize the applicationContext.
28          * 
29          * @param ctx
30          *            the application context
31          * @throws BeansException
32          *             the BeanException
33          */
34         public void setApplicationContext(final ApplicationContext ctx)
35                         throws BeansException {
36                 _context = ctx;
37         }
38
39         /**
40          * Static for getting the context.
41          * 
42          * @return ApplicationContext the application context
43          */
44         public static ApplicationContext getContext() {
45                 return _context;
46         }
47
48         // private static String CONFIG_FILE = "/hibernate.cfg.xml";
49         protected final static Logger logger = Logger.getLogger(Database.class);
50
51         // ==============================================================================================================================
52         // Protected services
53         // ==============================================================================================================================
54
55         protected String getSchemaVersion() {
56                 // ------------------------------------
57                 return null;// TODO: Get schema version into specific object/table: getIDPool().getSchemaVersion();
58         }
59
60         protected void setSchemaVersion(String version) {
61                 // ------------------------------------------------
62                 // TODO: Set schema version into specific object/table: myIDpool = new IDPool(version);
63                 // getSession().save(myIDpool);
64         }
65
66         // ==============================================================================================================================
67         // Private services
68         // ==============================================================================================================================
69 //{
70 //              if (myDB == null) {
71 //                      myDB = new Database();
72 //              }
73 //              return myDB;
74 //      }
75 }