karaf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jbono...@apache.org
Subject svn commit: r1538218 - in /karaf/trunk/main/src: main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
Date Sat, 02 Nov 2013 16:38:26 GMT
Author: jbonofre
Date: Sat Nov  2 16:38:25 2013
New Revision: 1538218

URL: http://svn.apache.org/r1538218
Log:
[KARAF-2523] Add SQLServer JDBC lock support

Added:
    karaf/trunk/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
Modified:
    karaf/trunk/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java

Added: karaf/trunk/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java?rev=1538218&view=auto
==============================================================================
--- karaf/trunk/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java (added)
+++ karaf/trunk/main/src/main/java/org/apache/karaf/main/lock/SQLServerJDBCLock.java Sat Nov
 2 16:38:25 2013
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.karaf.main.lock;
+
+import java.util.Properties;
+
+/**
+ * Represents an exclusive lock on a database,
+ * used to avoid multiple Karaf instances attempting
+ * to become master.
+ */
+public class SQLServerJDBCLock extends DefaultJDBCLock {
+
+    public SQLServerJDBCLock(Properties properties) {
+        super(properties);
+    }
+
+    @Override
+    Statements createStatements() {
+        Statements statements = new MsSQLServerStatements();
+        return statements;
+    }
+
+    private class MsSQLServerStatements extends Statements {
+
+        @Override
+        public String getLockCreateStatement() {
+            return "SELECT * FROM " + getFullLockTableName();
+        }
+
+    }
+
+}

Modified: karaf/trunk/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
URL: http://svn.apache.org/viewvc/karaf/trunk/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java?rev=1538218&r1=1538217&r2=1538218&view=diff
==============================================================================
--- karaf/trunk/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
(original)
+++ karaf/trunk/main/src/test/java/org/apache/karaf/main/lock/OracleJDBCLockIntegrationTest.java
Sat Nov  2 16:38:25 2013
@@ -38,7 +38,7 @@ public class OracleJDBCLockIntegrationTe
         password = "root";
         driver = "oracle.jdbc.driver.OracleDriver";
         url = "jdbc:oracle:thin:@172.16.16.133:1521:XE";
-        momentDatatype = "NuMBER(20)";
+        momentDatatype = "NUMBER(20)";
         
         super.setUp();
     }



Mime
View raw message