Update of /cvsroot/jrobin/src/org/jrobin/core
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8320/org/jrobin/core
Modified Files:
RrdBackendFactory.java RrdDbPool.java RrdFileBackend.java
Util.java
Log Message:
Default backend selection changed. Defaults to NIO for JDK >= 1.4.2, to FILE otherwise.
Index: RrdDbPool.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdDbPool.java,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** RrdDbPool.java 12 Nov 2004 10:09:38 -0000 1.19
--- RrdDbPool.java 22 Nov 2004 13:34:51 -0000 1.20
***************
*** 466,470 ****
private static String getCanonicalPath(String path) throws IOException {
! return RrdFileBackend.getCanonicalPath(path);
}
--- 466,470 ----
private static String getCanonicalPath(String path) throws IOException {
! return Util.getCanonicalPath(path);
}
Index: Util.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/Util.java,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** Util.java 18 Nov 2004 13:27:58 -0000 1.27
--- Util.java 22 Nov 2004 13:34:51 -0000 1.28
***************
*** 570,572 ****
--- 570,582 ----
}
+ /**
+ * Returns canonical file path for the given file path
+ * @param path Absolute or relative file path
+ * @return Canonical file path
+ * @throws IOException Thrown if canonical file path could not be resolved
+ */
+ public static String getCanonicalPath(String path) throws IOException {
+ return new File(path).getCanonicalPath();
+ }
+
}
\ No newline at end of file
Index: RrdBackendFactory.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdBackendFactory.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** RrdBackendFactory.java 9 Nov 2004 11:36:53 -0000 1.8
--- RrdBackendFactory.java 22 Nov 2004 13:34:51 -0000 1.9
***************
*** 82,89 ****
RrdSafeFileBackendFactory safeFactory = new RrdSafeFileBackendFactory();
registerFactory(safeFactory);
!
! // Here is the default backend factory
! defaultFactory = nioFactory;
!
} catch (RrdException e) {
throw new RuntimeException("FATAL: Cannot register RRD backend factories: " + e);
--- 82,86 ----
RrdSafeFileBackendFactory safeFactory = new RrdSafeFileBackendFactory();
registerFactory(safeFactory);
! selectDefaultFactory();
} catch (RrdException e) {
throw new RuntimeException("FATAL: Cannot register RRD backend factories: " + e);
***************
*** 91,94 ****
--- 88,102 ----
}
+ private static void selectDefaultFactory() throws RrdException {
+ String version = System.getProperty("java.version");
+ if(version == null || version.startsWith("1.3.") ||
+ version.startsWith("1.4.0") || version.startsWith("1.4.1")) {
+ setDefaultFactory("FILE");
+ }
+ else {
+ setDefaultFactory("NIO");
+ }
+ }
+
/**
* Returns backend factory for the given backend factory name.
Index: RrdFileBackend.java
===================================================================
RCS file: /cvsroot/jrobin/src/org/jrobin/core/RrdFileBackend.java,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** RrdFileBackend.java 19 Oct 2004 10:14:03 -0000 1.11
--- RrdFileBackend.java 22 Nov 2004 13:34:51 -0000 1.12
***************
*** 28,32 ****
import java.io.IOException;
import java.io.RandomAccessFile;
- import java.io.File;
import java.nio.channels.FileChannel;
import java.nio.channels.FileLock;
--- 28,31 ----
***************
*** 157,161 ****
*/
public static String getCanonicalPath(String path) throws IOException {
! return new File(path).getCanonicalPath();
}
--- 156,160 ----
*/
public static String getCanonicalPath(String path) throws IOException {
! return Util.getCanonicalPath(path);
}
|