exo-jcr SVN: r1777 - in jcr/trunk: exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc and 1 other directory.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-02-12 11:24:59 -0500 (Fri, 12 Feb 2010)
New Revision: 1777
Added:
jcr/trunk/maven-build-readme.txt
Removed:
jcr/trunk/README.txt
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DialectDetecter.java
Log:
EXOJCR-469 maven-build-readme.txt; import cleanup
Deleted: jcr/trunk/README.txt
===================================================================
--- jcr/trunk/README.txt 2010-02-12 16:14:51 UTC (rev 1776)
+++ jcr/trunk/README.txt 2010-02-12 16:24:59 UTC (rev 1777)
@@ -1,13 +0,0 @@
-JCR core
-========
-Goto JCR exo.jcr.component.core and call:
-mvn clean test - to run eXo JCR internal tests (all now)
-mvn clean test -Prun-all - to run eXo JCR internal tests + TCK (tck files are automatically downloaded. No manual task needed).
-mvn clean test -Prun-tck - to run TCK only (tck files are automatically downloaded. No manual task needed).
-mvn clean test -Prun-devtests - to run custom set of tests, useful for on-task development.
-
-JCR Ext
-=======
-Goto JCR exo.jcr.component.ext and call:
-mvn clean test - to run eXo JCR Ext tests... tests set managed by surefire-plugin configuration.
-
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DialectDetecter.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DialectDetecter.java 2010-02-12 16:14:51 UTC (rev 1776)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/storage/jdbc/DialectDetecter.java 2010-02-12 16:24:59 UTC (rev 1777)
@@ -18,13 +18,9 @@
*/
package org.exoplatform.services.jcr.impl.storage.jdbc;
-import java.sql.Connection;
import java.sql.DatabaseMetaData;
import java.sql.SQLException;
-import javax.jcr.RepositoryException;
-import javax.sql.DataSource;
-
/**
* JDBC dialect detecter based on database metadata and vendor product name.
*
Copied: jcr/trunk/maven-build-readme.txt (from rev 1773, jcr/trunk/README.txt)
===================================================================
--- jcr/trunk/maven-build-readme.txt (rev 0)
+++ jcr/trunk/maven-build-readme.txt 2010-02-12 16:24:59 UTC (rev 1777)
@@ -0,0 +1,13 @@
+JCR core
+========
+Goto JCR exo.jcr.component.core and call:
+mvn clean test - to run eXo JCR internal tests (all now)
+mvn clean test -Prun-all - to run eXo JCR internal tests + TCK (tck files are automatically downloaded. No manual task needed).
+mvn clean test -Prun-tck - to run TCK only (tck files are automatically downloaded. No manual task needed).
+mvn clean test -Prun-devtests - to run custom set of tests, useful for on-task development.
+
+JCR Ext
+=======
+Goto JCR exo.jcr.component.ext and call:
+mvn clean test - to run eXo JCR Ext tests... tests set managed by surefire-plugin configuration.
+
14 years, 4 months
exo-jcr SVN: r1776 - in jcr/trunk/applications/product-patches/as: jonas and 1 other directories.
by do-not-reply@jboss.org
Author: pnedonosko
Date: 2010-02-12 11:14:51 -0500 (Fri, 12 Feb 2010)
New Revision: 1776
Modified:
jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml
jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml
jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml
Log:
EXOJCR-503 REST Groovy auth configuration
EXOJCR-469 Groovy REST services loader enabled
Modified: jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml 2010-02-12 15:18:51 UTC (rev 1775)
+++ jcr/trunk/applications/product-patches/as/jboss/exo-configuration.xml 2010-02-12 16:14:51 UTC (rev 1776)
@@ -149,6 +149,37 @@
<type>org.exoplatform.services.jcr.ext.registry.RESTRegistryService</type>
</component>
+ <component>
+ <type>org.exoplatform.services.jcr.ext.script.groovy.GroovyScript2RestLoader</type>
+ <init-params>
+ <object-param>
+ <name>observation.config</name>
+ <object type="org.exoplatform.services.jcr.ext.script.groovy.ObservationListenerConfiguration">
+ <field name="repository">
+ <string>repository</string>
+ </field>
+ <field name="workspaces">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>production</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.rest.impl.method.MethodInvokerFilterComponentPlugin</type>
+ <init-params>
+ <value-param>
+ <name>method.access.filter</name>
+ <value>org.exoplatform.services.rest.ext.method.filter.MethodAccessFilter</value>
+ </value-param>
+ </init-params>
+ </component>
+
<!-- network services -->
<component>
<key>org.exoplatform.services.jcr.webdav.lnkproducer.LnkProducer</key>
Modified: jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml 2010-02-12 15:18:51 UTC (rev 1775)
+++ jcr/trunk/applications/product-patches/as/jonas/exo-configuration.xml 2010-02-12 16:14:51 UTC (rev 1776)
@@ -149,6 +149,37 @@
<type>org.exoplatform.services.jcr.ext.registry.RESTRegistryService</type>
</component>
+ <component>
+ <type>org.exoplatform.services.jcr.ext.script.groovy.GroovyScript2RestLoader</type>
+ <init-params>
+ <object-param>
+ <name>observation.config</name>
+ <object type="org.exoplatform.services.jcr.ext.script.groovy.ObservationListenerConfiguration">
+ <field name="repository">
+ <string>repository</string>
+ </field>
+ <field name="workspaces">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>production</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.rest.impl.method.MethodInvokerFilterComponentPlugin</type>
+ <init-params>
+ <value-param>
+ <name>method.access.filter</name>
+ <value>org.exoplatform.services.rest.ext.method.filter.MethodAccessFilter</value>
+ </value-param>
+ </init-params>
+ </component>
+
<!-- network services -->
<component>
<key>org.exoplatform.services.jcr.webdav.lnkproducer.LnkProducer</key>
Modified: jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml
===================================================================
--- jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml 2010-02-12 15:18:51 UTC (rev 1775)
+++ jcr/trunk/applications/product-patches/as/tomcat/exo-configuration.xml 2010-02-12 16:14:51 UTC (rev 1776)
@@ -149,6 +149,37 @@
<type>org.exoplatform.services.jcr.ext.registry.RESTRegistryService</type>
</component>
+ <component>
+ <type>org.exoplatform.services.jcr.ext.script.groovy.GroovyScript2RestLoader</type>
+ <init-params>
+ <object-param>
+ <name>observation.config</name>
+ <object type="org.exoplatform.services.jcr.ext.script.groovy.ObservationListenerConfiguration">
+ <field name="repository">
+ <string>repository</string>
+ </field>
+ <field name="workspaces">
+ <collection type="java.util.ArrayList">
+ <value>
+ <string>production</string>
+ </value>
+ </collection>
+ </field>
+ </object>
+ </object-param>
+ </init-params>
+ </component>
+
+ <component>
+ <type>org.exoplatform.services.rest.impl.method.MethodInvokerFilterComponentPlugin</type>
+ <init-params>
+ <value-param>
+ <name>method.access.filter</name>
+ <value>org.exoplatform.services.rest.ext.method.filter.MethodAccessFilter</value>
+ </value-param>
+ </init-params>
+ </component>
+
<!-- network services -->
<component>
<key>org.exoplatform.services.jcr.webdav.lnkproducer.LnkProducer</key>
14 years, 4 months
exo-jcr SVN: r1775 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 10:18:51 -0500 (Fri, 12 Feb 2010)
New Revision: 1775
Added:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/rest/
Removed:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/
Log:
EXOJCR-506 : wrong package name, needs to be "rest"
Copied: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/rest (from rev 1774, kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management)
14 years, 4 months
exo-jcr SVN: r1774 - in kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management: management and 1 other directories.
by do-not-reply@jboss.org
Author: julien_viet
Date: 2010-02-12 10:17:37 -0500 (Fri, 12 Feb 2010)
New Revision: 1774
Added:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/annotations/
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/annotations/RESTEndpoint.java
Log:
EXOJCR-506 : Define the RESTEndpoint annotation for exposing a managed service as a REST endpoint
Added: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/annotations/RESTEndpoint.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/annotations/RESTEndpoint.java (rev 0)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/management/management/annotations/RESTEndpoint.java 2010-02-12 15:17:37 UTC (rev 1774)
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) 2010 eXo Platform SAS.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.exoplatform.management.management.annotations;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+
+/**
+ * Annotates a managed service to define its exposure as a rest endpoint. The managed service must already be annotated
+ * with {@link org.exoplatform.management.annotations.Managed}.
+ *
+ * @author <a href="mailto:julien.viet@exoplatform.com">Julien Viet</a>
+ * @version $Revision$
+ */
+(a)Retention(RetentionPolicy.RUNTIME)
+(a)Target(ElementType.TYPE)
+public @interface RESTEndpoint
+{
+
+ /**
+ * Returns the rest path of the managed object.
+ *
+ * @return the path
+ */
+ String path();
+
+}
14 years, 4 months
exo-jcr SVN: r1773 - jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-12 09:02:02 -0500 (Fri, 12 Feb 2010)
New Revision: 1773
Modified:
jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/exo-jcr-config.xml
Log:
EXOJCR-488: main/resources/conf/portal/exo-jcr-config.xml .JDBCWorkspaceDataContainer changed to .optimisation.CQJDBCWorkspaceDataContainer
Modified: jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/exo-jcr-config.xml
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/exo-jcr-config.xml 2010-02-12 11:29:46 UTC (rev 1772)
+++ jcr/trunk/exo.jcr.component.core/src/main/resources/conf/portal/exo-jcr-config.xml 2010-02-12 14:02:02 UTC (rev 1773)
@@ -27,7 +27,7 @@
<workspaces>
<workspace name="production">
<!-- for system storage -->
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr" />
<property name="multi-db" value="false" />
@@ -73,7 +73,7 @@
</workspace>
<workspace name="backup">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr" />
<property name="multi-db" value="false" />
@@ -111,7 +111,7 @@
</workspace>
<workspace name="digital-assets">
- <container class="org.exoplatform.services.jcr.impl.storage.jdbc.JDBCWorkspaceDataContainer">
+ <container class="org.exoplatform.services.jcr.impl.storage.jdbc.optimisation.CQJDBCWorkspaceDataContainer">
<properties>
<property name="source-name" value="jdbcjcr" />
<property name="multi-db" value="false" />
14 years, 4 months
exo-jcr SVN: r1772 - jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config.
by do-not-reply@jboss.org
Author: tolusha
Date: 2010-02-12 06:29:46 -0500 (Fri, 12 Feb 2010)
New Revision: 1772
Modified:
jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
Log:
EXOJCR-489: change field type form VARBINARY to IMAGE for Sybase & translate to uppercase filed NAME in query
Modified: jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java
===================================================================
--- jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java 2010-02-12 10:25:59 UTC (rev 1771)
+++ jcr/trunk/exo.jcr.component.core/src/main/java/org/exoplatform/services/jcr/impl/config/JDBCConfigurationPersister.java 2010-02-12 11:29:46 UTC (rev 1772)
@@ -173,7 +173,7 @@
}
else if (DBConstants.DB_DIALECT_SYBASE.equalsIgnoreCase(dialect))
{
- binType = "VARBINARY(255)";
+ binType = "IMAGE";
}
else if (DBConstants.DB_DIALECT_INGRES.equalsIgnoreCase(dialect))
{
@@ -270,7 +270,7 @@
if (isDbInitialized(con))
{
- PreparedStatement ps = con.prepareStatement("SELECT * FROM " + configTableName + " WHERE name=?");
+ PreparedStatement ps = con.prepareStatement("SELECT * FROM " + configTableName + " WHERE NAME=?");
ps.setString(1, CONFIGNAME);
ResultSet res = ps.executeQuery();
14 years, 4 months
exo-jcr SVN: r1771 - kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/mc.
by do-not-reply@jboss.org
Author: mstruk
Date: 2010-02-12 05:25:59 -0500 (Fri, 12 Feb 2010)
New Revision: 1771
Modified:
kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java
Log:
EXOJCR-504 Reduced init err warn logging into debug
Modified: kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java
===================================================================
--- kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java 2010-02-12 09:56:01 UTC (rev 1770)
+++ kernel/trunk/exo.kernel.container/src/main/java/org/exoplatform/container/mc/MCIntegrationContainer.java 2010-02-12 10:25:59 UTC (rev 1771)
@@ -99,7 +99,7 @@
}
catch(Exception ignored)
{
- log.warn("MC integration failed - maybe not supported in this environment (component: "
+ log.debug("MC integration failed - maybe not supported in this environment (component: "
+ componentAdapter.getComponentKey() + ")", ignored);
}
}
14 years, 4 months
exo-jcr SVN: r1770 - core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-12 04:56:01 -0500 (Fri, 12 Feb 2010)
New Revision: 1770
Modified:
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
Log:
EXOJCR-485: auto detection fix
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-02-12 09:21:56 UTC (rev 1769)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-02-12 09:56:01 UTC (rev 1770)
@@ -116,7 +116,7 @@
String dialect = conf_.getProperty("hibernate.dialect");
- if (dialect != null && dialect.equalsIgnoreCase(AUTO_DIALECT))
+ if (dialect == null || dialect.equalsIgnoreCase(AUTO_DIALECT))
{
// detect dialect and replace parameter
Connection connection = null;
14 years, 4 months
exo-jcr SVN: r1769 - core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl.
by do-not-reply@jboss.org
Author: sergiykarpenko
Date: 2010-02-12 04:21:56 -0500 (Fri, 12 Feb 2010)
New Revision: 1769
Modified:
core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
Log:
EXOJCR-485: auto detection dialect implemented
Modified: core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java
===================================================================
--- core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-02-12 08:39:36 UTC (rev 1768)
+++ core/trunk/exo.core.component.database/src/main/java/org/exoplatform/services/database/impl/HibernateServiceImpl.java 2010-02-12 09:21:56 UTC (rev 1769)
@@ -34,15 +34,24 @@
import org.hibernate.SessionFactory;
import org.hibernate.cfg.Configuration;
import org.hibernate.dialect.Dialect;
+import org.hibernate.dialect.resolver.DialectFactory;
import org.hibernate.tool.hbm2ddl.SchemaUpdate;
import java.io.Serializable;
import java.net.URL;
+import java.sql.Connection;
+import java.sql.DriverManager;
+import java.sql.SQLException;
import java.util.Collection;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
+import java.util.Properties;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.sql.DataSource;
+
/**
* Created by The eXo Platform SAS .
*
@@ -52,6 +61,7 @@
*/
public class HibernateServiceImpl implements HibernateService, ComponentRequestLifecycle
{
+
public static final String AUTO_DIALECT = "AUTO";
private ThreadLocal<Session> threadLocal_;
@@ -69,7 +79,6 @@
{
threadLocal_ = new ThreadLocal<Session>();
PropertiesParam param = initParams.getPropertiesParam("hibernate.properties");
-
HibernateSettingsFactory settingsFactory = new HibernateSettingsFactory(new ExoCacheProvider(cacheService));
conf_ = new HibernateConfigurationImpl(settingsFactory);
Iterator properties = param.getPropertyIterator();
@@ -77,42 +86,135 @@
{
Property p = (Property)properties.next();
+ //
String name = p.getName();
String value = p.getValue();
// Julien: Don't remove that unless you know what you are doing
- if (name.equals("hibernate.dialect"))
+ if (name.equals("hibernate.dialect") && !value.equalsIgnoreCase(AUTO_DIALECT))
{
+ Package pkg = Dialect.class.getPackage();
+ String dialect = value.substring(22);
+ value = pkg.getName() + "." + dialect; // 22 is the length of
+ // "org.hibernate.dialect"
+ log_.info("Using dialect " + dialect);
+ }
- if (!value.equalsIgnoreCase(AUTO_DIALECT))
+ //
+ conf_.setProperty(name, value);
+ }
+
+ // Replace the potential "java.io.tmpdir" variable in the connection URL
+ String connectionURL = conf_.getProperty("hibernate.connection.url");
+ if (connectionURL != null)
+ {
+ connectionURL = connectionURL.replace("${java.io.tmpdir}", System.getProperty("java.io.tmpdir"));
+ conf_.setProperty("hibernate.connection.url", connectionURL);
+ }
+
+ // Auto-detect dialect if "hibernate.dialect" is set as AUTO or is not set.
+
+ String dialect = conf_.getProperty("hibernate.dialect");
+
+ if (dialect != null && dialect.equalsIgnoreCase(AUTO_DIALECT))
+ {
+ // detect dialect and replace parameter
+ Connection connection = null;
+
+ try
+ {
+ // check is there is datasource
+ String dataSourceName = conf_.getProperty("hibernate.connection.datasource");
+ if (dataSourceName != null)
{
+ //detect with datasource
+ DataSource dataSource;
+ try
+ {
+ dataSource = (DataSource)new InitialContext().lookup(dataSourceName);
+ if (dataSource == null)
+ {
+ log_.error("DataSource is configured but not finded.", new Exception());
+ }
- // TODO throw exception if dialect is incorrect
- Package pkg = Dialect.class.getPackage();
- String dialect = value.substring(22);
- value = pkg.getName() + "." + dialect; // 22 is the length of
- // "org.hibernate.dialect"
- log_.info("Using dialect " + dialect);
- conf_.setProperty(name, value);
+ connection = dataSource.getConnection();
+
+ Dialect d = DialectFactory.buildDialect(new Properties(), connection);
+ conf_.setProperty("hibernate.dialect", d.getClass().getName());
+
+ }
+ catch (NamingException e)
+ {
+ log_.error(e.getMessage(), e);
+ }
+
}
else
{
- log_.info("Dialect will be automaticaly detected by Hibernate.");
+
+ String url = conf_.getProperty("hibernate.connection.url");
+ if (url != null)
+ {
+ //detect with url
+ //get driver class
+
+ try
+ {
+ Class.forName(conf_.getProperty("hibernate.connection.driver_class")).newInstance();
+ }
+ catch (InstantiationException e)
+ {
+ log_.error(e.getMessage(), e);
+ }
+ catch (IllegalAccessException e)
+ {
+ log_.error(e.getMessage(), e);
+ }
+ catch (ClassNotFoundException e)
+ {
+ log_.error(e.getMessage(), e);
+ }
+
+ String dbUserName = conf_.getProperty("hibernate.connection.username");
+ String dbPassword = conf_.getProperty("hibernate.connection.password");
+
+ connection =
+ dbUserName != null ? DriverManager.getConnection(url, dbUserName, dbPassword) : DriverManager
+ .getConnection(url);
+
+ Dialect d = DialectFactory.buildDialect(new Properties(), connection);
+ conf_.setProperty("hibernate.dialect", d.getClass().getName());
+
+ }
+ else
+ {
+ Exception e = new Exception("Any data source is not configured!");
+ log_.error(e.getMessage(), e);
+ }
}
+
}
- else
+ catch (SQLException e)
{
- conf_.setProperty(name, value);
+ log_.error(e.getMessage(), e);
}
+ finally
+ {
+ if (connection != null)
+ {
+ try
+ {
+ connection.close();
+ }
+ catch (SQLException e)
+ {
+ log_.error(e.getMessage(), e);
+ }
+ }
+ }
+
}
- // Replace the potential "java.io.tmpdir" variable in the connection URL
- String connectionURL = conf_.getProperty("hibernate.connection.url");
- if (connectionURL != null)
- {
- connectionURL = connectionURL.replace("${java.io.tmpdir}", System.getProperty("java.io.tmpdir"));
- conf_.setProperty("hibernate.connection.url", connectionURL);
- }
}
public void addPlugin(ComponentPlugin plugin)
14 years, 4 months