Commits

Shantanu Kumar committed 5abaa4d

prepare for 0.6 development
- use Clojure 1.3.0 and modular contrib instead of Clojure 1.2
- use OSS-JDBC 0.6 for test dependencies

  • Participants
  • Parent commits 184d185

Comments (0)

Files changed (4)

 - [TODO] Support XADataSource - maybe use JOTM: http://jotm.objectweb.org/
 
 
+## 0.6 / 2011-Dec-??
+
+- [TODO] properties support in DataSource JDBC URL
+- [TODO] layered .jdbc.properties file
+         - clj-dbcp.properties
+         - jdbc.properties
+- [TODO] protocols for memory-connect, file-connect, net-connect
+- [TODO] MonetDB support
+- [TODO] MckoiDDB support
+- Test with OSS-JDBC 0.6
+- Use Clojure 1.3.0 and modular contrib
+- [TODO] Rename README to README.md
+
 ## 0.5 / 2011-Apr-01
 
 - Support for loading datasource configuration from properties file
   <groupId>org.bituf</groupId>
   <artifactId>clj-dbcp</artifactId>
   <packaging>jar</packaging>
-  <version>0.5</version>
+  <version>0.6-SNAPSHOT</version>
   <name>Clj-DBCP</name>
   <description>
     Clj-DBCP is a simple Java-6/Clojure wrapper around the Apache DBCP library
     applications.
   </description>
   <url>http://code.google.com/p/bitumenframework/</url>
+  
+  <developers>
+    <developer>
+      <name>Shantanu Kumar</name>
+      <email>kumar.shantanu@gmail.com</email>
+      <timezone>+5:30</timezone>
+    </developer>
+  </developers>
+  
+  <licenses>
+    <license>
+      <name>Apache License, Version 2.0</name>
+      <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+      <distribution>repo</distribution>
+    </license>
+  </licenses>
+  
+  <mailingLists>
+    <mailingList>
+      <name>Bitumen Framework discussion group</name>
+      <archive>http://groups.google.com/group/bitumenframework</archive>
+    </mailingList>
+  </mailingLists>
+  
   <repositories>
     <repository>
       <id>build.clojure.org</id>
     </repository>
   </repositories>
   <dependencies>
+    <!--
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>clojure</artifactId>
       <version>1.2.0</version>
       <optional>true</optional>
     </dependency>
-    <!--
+    -->
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>clojure</artifactId>
-      <version>1.3.0-master-20101220.130227-7</version>
+      <version>1.3.0</version>
       <optional>true</optional>
     </dependency>
-    -->
+    <!--
     <dependency>
       <groupId>org.clojure</groupId>
       <artifactId>clojure-contrib</artifactId>
       <scope>test</scope>
       <optional>true</optional>
     </dependency>
-    <!--
+    -->
     <dependency>
-      <groupId>org.clojure.contrib</groupId>
-      <artifactId>sql</artifactId>
-      <version>1.3.0-SNAPSHOT</version>
+      <groupId>org.clojure</groupId>
+      <artifactId>java.jdbc</artifactId>
+      <version>0.1.1</version>
       <scope>test</scope>
-      <optional>true</optional>
     </dependency>
-    <dependency>
-      <groupId>org.clojure.contrib</groupId>
-      <artifactId>java-utils</artifactId>
-      <version>1.3.0-SNAPSHOT</version>
-      <scope>test</scope>
-      <optional>true</optional>
-    </dependency>
-    -->
     <!-- Apache DBCP -->
     <dependency>
       <groupId>commons-dbcp</groupId>
     <dependency><!-- All Open Source JDBC Drivers available via Maven -->
       <groupId>org.bituf</groupId>
       <artifactId>oss-jdbc</artifactId>
-      <version>0.4</version>
+      <version>0.6</version>
       <scope>test</scope>
     </dependency>
     <dependency><!-- Simple-JNDI: Emulate JNDI container -->
       <plugin>
         <groupId>com.theoryinpractise</groupId>
         <artifactId>clojure-maven-plugin</artifactId>
-        <version>1.3.6</version>
+        <version>1.3.8</version>
         <executions>
           <execution>
             <id>compile</id>

File src/test/clj/org/bituf/test_clj_dbcp.clj

 (ns org.bituf.test-clj-dbcp
   (:require
     [org.bituf.test-util :as tu]
-    [clojure.pprint :as pp])
+    [clojure.pprint :as pp]
+    [clojure.java.jdbc :as sql])
   (:use org.bituf.clj-dbcp)
   (:use org.bituf.dbserver-util)
-  (:use [clojure.contrib.sql :as sql :only ()])
-  (:use clojure.contrib.java-utils)
-  ;(:use clojure.contrib.pprint)
-  (:use clojure.string)
-  (:use clojure.pprint)
   (:use clojure.test)
   (:import (javax.naming.spi.DirectoryManager)))
 
 
 (def dbcred (let [props (tu/str-to-keys
                           (tu/property-map
-                            (read-properties "src/test/dbcred.properties")))]
+                            (tu/read-properties "src/test/dbcred.properties")))]
               (println "*** DB-Credentials properties map ***")
-              (pprint props)
+              (pp/pprint props)
               props))
 
 

File src/test/clj/org/bituf/test_util.clj

   makes sense to do so, so that Clj-DBCP doesn't need to depend on a certain
   version of Clj-MiscUtil."
   (:import
+    (java.io      File)
     (java.util    List Map Properties)
     (javax.naming Binding Context InitialContext
                   NameClassPair NamingEnumeration)))
 
 
+(defmulti relative-path-string 
+  "Interpret a String or java.io.File as a relative path string. 
+   Building block for clojure.contrib.java-utils/file."
+  class)
+
+(defmethod relative-path-string String [#^String s]
+  (relative-path-string (File. s)))
+
+(defmethod relative-path-string File [#^File f]
+  (if (.isAbsolute f)
+    (throw (IllegalArgumentException. (str f " is not a relative path")))
+    (.getPath f)))
+
+(defmulti #^File as-file 
+  "Interpret a String or a java.io.File as a File. Building block
+   for clojure.contrib.java-utils/file, which you should prefer
+   in most cases."
+  class)
+(defmethod as-file String [#^String s] (File. s))
+(defmethod as-file File [f] f)
+
+(defn #^File file
+  "Returns a java.io.File from string or file args."
+  ([arg]                      
+     (as-file arg))
+  ([parent child]             
+     (File. #^File (as-file parent) #^String (relative-path-string child)))
+  ([parent child & more]
+     (reduce file (file parent child) more)))
+
+
+(defn read-properties
+  "Read properties from file-able."
+  [file-able]
+  (with-open [f (java.io.FileInputStream. (file file-able))]
+    (doto (Properties.)
+      (.load f))))
+
+
 (defn property-map
   "Transform a given Properties instance to a map."
   [^Properties properties]