1 21 22 package org.apache.derby.impl.io; 23 24 import org.apache.derby.iapi.services.sanity.SanityManager; 25 26 import org.apache.derby.io.StorageFactory; 27 import org.apache.derby.io.StorageFile; 28 29 import java.io.FileNotFoundException ; 30 import java.io.InputStream ; 31 import java.io.OutputStream ; 32 import java.io.IOException ; 33 34 38 39 public class URLStorageFactory extends BaseStorageFactory 40 { 41 42 49 StorageFile newPersistentFile( String path) 50 { 51 return new URLFile( this, path); 52 } 53 54 62 StorageFile newPersistentFile( String directoryName, String fileName) 63 { 64 if( directoryName == null || directoryName.length() == 0) 65 return newPersistentFile( fileName); 66 return new URLFile( this, directoryName, fileName); 67 } 68 69 77 StorageFile newPersistentFile( StorageFile directoryName, String fileName) 78 { 79 if( directoryName == null) 80 return newPersistentFile( fileName); 81 return new URLFile( (URLFile) directoryName, fileName); 82 } 83 84 void doInit() throws IOException 85 { 86 if( dataDirectory != null) 87 { 88 if( dataDirectory.endsWith( "/")) 89 { 90 separatedDataDirectory = dataDirectory; 91 dataDirectory = dataDirectory.substring( 0, dataDirectory.length() - 1); 92 } 93 else 94 separatedDataDirectory = dataDirectory + '/'; canonicalName = dataDirectory; 96 createTempDir(); 97 } 98 } } 100 | Popular Tags |