--- /dev/null
+/*
+ * Sonar, open source software quality management tool.
+ * Copyright (C) 2008-2012 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * Sonar 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 3 of the License, or (at your option) any later version.
+ *
+ * Sonar 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 Sonar; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02
+ */
+package org.sonar.core.persistence.dialect;
+
+/**
+ * @since 3.2
+ */
+abstract class AbstractDialect implements Dialect {
+ private final String id;
+ private final String activeRecordDialectCode;
+ private final String activeRecordJdbcAdapter;
+
+ protected AbstractDialect(String id, String activeRecordDialectCode, String activeRecordJdbcAdapter) {
+ this.id = id;
+ this.activeRecordDialectCode = activeRecordDialectCode;
+ this.activeRecordJdbcAdapter = activeRecordJdbcAdapter;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getActiveRecordDialectCode() {
+ return activeRecordDialectCode;
+ }
+
+ public String getActiveRecordJdbcAdapter() {
+ return activeRecordJdbcAdapter;
+ }
+}
/**
* @since 1.12
*/
-public class H2 implements Dialect {
+public class H2 extends AbstractDialect {
public static final String ID = "h2";
- public String getId() {
- return ID;
- }
-
- public String getActiveRecordDialectCode() {
- return "h2";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "jdbc";
+ public H2() {
+ super(ID, "h2", "jdbc");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
import java.sql.Types;
-public class MsSql implements Dialect {
+public class MsSql extends AbstractDialect {
public static final String ID = "mssql";
- public String getId() {
- return ID;
- }
-
- public String getActiveRecordDialectCode() {
- return "sqlserver";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "jdbc";
+ public MsSql() {
+ super(ID, "sqlserver", "jdbc");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
/**
* @since 1.12
*/
-public class MySql implements Dialect {
+public class MySql extends AbstractDialect {
public static final String ID = "mysql";
- public String getId() {
- return ID;
- }
-
- public String getActiveRecordDialectCode() {
- return "mysql";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "jdbc";
+ public MySql() {
+ super(ID, "mysql", "jdbc");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
/**
* @since 1.12
*/
-public class Oracle implements Dialect {
+public class Oracle extends AbstractDialect {
public static final String ID = "oracle";
- public String getId() {
- return ID;
- }
-
- public String getActiveRecordDialectCode() {
- return "oracle";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "oracle_enhanced";
+ public Oracle() {
+ super(ID, "oracle", "oracle");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {
/**
* @since 1.12
*/
-public class PostgreSql implements Dialect {
+public class PostgreSql extends AbstractDialect {
public static final String ID = "postgresql";
- public String getId() {
- return ID;
- }
-
- public String getActiveRecordDialectCode() {
- return "postgre";
- }
-
- public String getActiveRecordJdbcAdapter() {
- return "jdbc";
+ public PostgreSql() {
+ super(ID, "postgre", "jdbc");
}
public Class<? extends org.hibernate.dialect.Dialect> getHibernateDialectClass() {