List of usage examples for org.hibernate.cfg Configuration getProperty
public String getProperty(String propertyName)
From source file:org.ow2.bonita.env.descriptor.HibernateSessionFactoryDescriptor.java
License:Open Source License
private static void addInterceptor(Configuration configuration) { String interceptorClassName = configuration.getProperty("bonita.hibernate.interceptor"); if (interceptorClassName != null) { if (LOG.isLoggable(Level.INFO)) { LOG.info("Adding interceptor: " + interceptorClassName); }/*from w w w . ja v a 2s .c o m*/ Class<?> interceptorClass = ReflectUtil.loadClass(Thread.currentThread().getContextClassLoader(), interceptorClassName); EmptyInterceptor interceptor = (EmptyInterceptor) ReflectUtil.newInstance(interceptorClass); configuration.setInterceptor(interceptor); } }
From source file:org.ow2.bonita.search.SearchUtil.java
License:Open Source License
private static boolean disableSearchConfiguration(final Configuration configuration) { boolean disable = false; String sysValue = System.getProperty("bonita.search.use"); if ("false".equals(sysValue)) { disable = true;// w w w .j a v a2 s . c o m } else { String useSearch = configuration.getProperty("bonita.search.use"); if (!"true".equals(useSearch)) { disable = true; } } return disable; }
From source file:org.ow2.bonita.search.SearchUtil.java
License:Open Source License
public static String getIndexesDirectoryPath(final Configuration configuration) { if (disableSearchConfiguration(configuration)) { return null; } else {/* w w w. j a v a 2 s . c om*/ return configuration.getProperty("hibernate.search.default.indexBase"); } }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static String getDbDialect(final Configuration config) { return config.getProperty("hibernate.dialect"); }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static String getDbUrl(final Configuration config) { return config.getProperty("hibernate.connection.url"); }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static String getDbUseQueryCache(final Configuration config) { return config.getProperty("hibernate.cache.use_query_cache"); }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static String getDbUseSecondLeveleCache(final Configuration config) { return config.getProperty("hibernate.cache.use_second_level_cache"); }
From source file:org.ow2.bonita.util.DbTool.java
License:Open Source License
public static String getDbDriverClass(final Configuration config) { return config.getProperty("hibernate.connection.driver_class"); }
From source file:org.ow2.bonita.util.IndexTool.java
License:Open Source License
public static void populateIndexes(String domain, String configurationName) throws Exception { System.setProperty(REINDEX_DOMAIN_PROPERTY, domain); SessionFactoryImplementor sessionFactory = null; try {//from w ww . j a v a2 s . c o m BonitaConstants.getBonitaHomeFolder(); Configuration cfg = DbTool.getConfiguration(domain, configurationName); if ("true".equals(cfg.getProperty("bonita.search.use"))) { sessionFactory = DbTool.getSessionFactory(domain, configurationName.replaceAll("-configuration", "-session-factory")); if (sessionFactory != null) { populateIndexes(sessionFactory); } } else { LOG.info(configurationName + "does not support indexing"); } } finally { System.clearProperty(REINDEX_DOMAIN_PROPERTY); closeSession(sessionFactory); } }
From source file:org.pentaho.pac.server.common.HibernateSessionFactory.java
License:Open Source License
public static void addConfiguration(String name, String configFile) { Configuration configuration = new AnnotationConfiguration(); try {//from ww w . java 2 s.co m File file = new File(configFile); if (file != null && file.exists()) { configuration.configure(file); } else { configuration.configure(configFile); } // If Hibernate is running in a managed environment SessionFactory sessionFactory = null; if (!DEFAULT_CONFIG_NAME.equals(name) || !AppConfigProperties.getInstance().isHibernateManaged()) { sessionFactory = configuration.buildSessionFactory(); } else { String factoryJndiName = configuration.getProperty(Environment.SESSION_FACTORY_NAME); if (factoryJndiName != null && factoryJndiName.length() > 0) { sessionFactory = configuration.buildSessionFactory(); // Let hibernate Bind it to JNDI... } else { throw new HibernateException(Messages.getErrorString( "HibernateSessionFactory.ERROR_0002_MISSING_MANAGED_CONFIGURATION", //$NON-NLS-1$ Environment.SESSION_FACTORY_NAME.toString())); } } configs.put(name, new HibConfig(sessionFactory, configuration, configFile)); } catch (Exception e) { throw new HibernateException( Messages.getErrorString("HibernateSessionFactory.ERROR_0003_UNABLE_TO_CREATE_SESSION_FACTORY", //$NON-NLS-1$ e.getLocalizedMessage()), e); } }