--- /dev/null
+/*\r
+\r
+ Derby - Class org.apache.derby.impl.io.DirStorageFactory4\r
+\r
+ Licensed to the Apache Software Foundation (ASF) under one or more\r
+ contributor license agreements. See the NOTICE file distributed with\r
+ this work for additional information regarding copyright ownership.\r
+ The ASF licenses this file to you under the Apache License, Version 2.0\r
+ (the "License"); you may not use this file except in compliance with\r
+ the License. You may obtain a copy of the License at\r
+\r
+ http://www.apache.org/licenses/LICENSE-2.0\r
+\r
+ Unless required by applicable law or agreed to in writing, software\r
+ distributed under the License is distributed on an "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ See the License for the specific language governing permissions and\r
+ limitations under the License.\r
+\r
+ */\r
+\r
+package org.apache.derby.impl.io;\r
+\r
+import org.apache.derby.io.StorageFile;\r
+import org.apache.derby.iapi.services.info.JVMInfo;\r
+\r
+import java.io.IOException;\r
+\r
+/**\r
+ * This class implements the WritableStorageFactory interface using features found in Java 1.4 but\r
+ * not in earlier versions of Java.\r
+ */\r
+public class DirStorageFactory4 extends DirStorageFactory\r
+{\r
+\r
+ private static final boolean rwsOK = JVMInfo.JDK_ID >= JVMInfo.J2SE_142;\r
+ \r
+ /**\r
+ * Most of the initialization is done in the init method.\r
+ */\r
+ public DirStorageFactory4()\r
+ {\r
+ super();\r
+ }\r
+\r
+ /**\r
+ * Construct a persistent StorageFile from a path name.\r
+ *\r
+ * @param path The path name of the file. Guaranteed not to be in the temporary file directory. If null\r
+ * then the database directory should be returned.\r
+ *\r
+ * @return A corresponding StorageFile object\r
+ */\r
+ StorageFile newPersistentFile( String path)\r
+ {\r
+ if( path == null)\r
+ return new DirFile4(dataDirectory, rwsOK);\r
+ return new DirFile4(dataDirectory, path, rwsOK);\r
+ }\r
+\r
+ /**\r
+ * Construct a persistent StorageFile from a directory and path name.\r
+ *\r
+ * @param directoryName The path name of the directory. Guaranteed not to be in the temporary file directory.\r
+ * Guaranteed not to be null\r
+ * @param fileName The name of the file within the directory. Guaranteed not to be null.\r
+ *\r
+ * @return A corresponding StorageFile object\r
+ */\r
+ StorageFile newPersistentFile( String directoryName, String fileName)\r
+ {\r
+ return new DirFile4( separatedDataDirectory + directoryName, fileName, rwsOK);\r
+ }\r
+\r
+ /**\r
+ * Construct a persistent StorageFile from a directory and path name.\r
+ *\r
+ * @param directoryName The path name of the directory. Guaranteed not to be to be null. Guaranteed to be\r
+ * created by a call to one of the newPersistentFile methods.\r
+ * @param fileName The name of the file within the directory. Guaranteed not to be null.\r
+ *\r
+ * @return A corresponding StorageFile object\r
+ */\r
+ StorageFile newPersistentFile( StorageFile directoryName, String fileName)\r
+ {\r
+ return new DirFile4( (DirFile) directoryName, fileName, rwsOK);\r
+ }\r
+\r
+ \r
+ /**\r
+ * This method tests whether the "rws" and "rwd" modes are implemented. If\r
+ * the "rws" and "rwd" modes are supported then the database engine will\r
+ * conclude that the write methods of "rws"/"rwd" mode\r
+ * StorageRandomAccessFiles are slow but the sync method is fast and\r
+ * optimize accordingly.\r
+ *\r
+ * @return <b>true</b> if an StIRandomAccess file opened with "rws" or "rwd" modes immediately writes data to the\r
+ * underlying storage, <b>false</b> if not.\r
+ */\r
+ public boolean supportsWriteSync()\r
+ {\r
+ return rwsOK;\r
+ }\r
+ \r
+\r
+}\r