You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-commits@db.apache.org by dj...@apache.org on 2006/12/08 21:02:25 UTC
svn commit: r484722 - in /db/derby/code/trunk/java/engine/org/apache/derby:
iapi/store/access/FileResource.java impl/db/BasicDatabase.java
impl/store/raw/data/RFResource.java
Author: djd
Date: Fri Dec 8 12:02:24 2006
New Revision: 484722
URL: http://svn.apache.org/viewvc?view=rev&rev=484722
Log:
DERBY-538 DERBY-2040 Remove the FileResource.getAsStream method as the getAsFile()
method now returns a StorageFile and that class has a getInputStream method.
Incremental step in pushing the JarClassLoader to work off URLs for the jar files
and thus allow use of the standard java.net.URLClassLoader.
Modified:
db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java
Modified: db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java?view=diff&rev=484722&r1=484721&r2=484722
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/iapi/store/access/FileResource.java Fri Dec 8 12:02:24 2006
@@ -105,28 +105,14 @@
throws StandardException;
/**
- Get the File handle to a file resource. In some situations
- higher level code can make optimisations if it can access
- a file as a File, rather than an output stream. If this call
- returns null then the resouce is not accessable as a file
- (e.g. the database is in a zip file).
+ Get the StorageFile for a file resource.
@param name The name of the fileResource
@param generationId the generationId of the fileResource
- @return A File object representing the file, or null if
- the resource is not accessable as a file.
+ @return A StorageFile object representing the file.
*/
public StorageFile getAsFile(String name, long generationId);
-
- /**
- Get the file resource as a stream.
-
- @exception IOException some io error occured
- @exception FileNotFoundException file does not exist.
- */
- public InputStream getAsStream(String name, long generationId)
- throws IOException;
/**
* @return the separator character to be used in file names.
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java?view=diff&rev=484722&r1=484721&r2=484722
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/db/BasicDatabase.java Fri Dec 8 12:02:24 2006
@@ -70,6 +70,7 @@
import org.apache.derby.iapi.store.access.TransactionController;
import org.apache.derby.iapi.jdbc.AuthenticationService;
import org.apache.derby.iapi.services.uuid.UUIDFactory;
+import org.apache.derby.io.StorageFile;
import org.apache.derby.catalog.UUID;
import java.io.InputStream;
@@ -801,12 +802,12 @@
String externalName = org.apache.derby.impl.sql.execute.JarDDL.mkExternalName(schemaName, sqlName, fr.getSeparatorChar());
- Object f = fr.getAsFile(externalName, generationId);
+ StorageFile f = fr.getAsFile(externalName, generationId);
if (f instanceof java.io.File)
return f;
try {
- return fr.getAsStream(externalName, generationId);
+ return f.getInputStream();
} catch (java.io.IOException ioe) {
throw StandardException.newException(SQLState.LANG_FILE_ERROR, ioe, ioe.toString());
}
Modified: db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java
URL: http://svn.apache.org/viewvc/db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java?view=diff&rev=484722&r1=484721&r2=484722
==============================================================================
--- db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java (original)
+++ db/derby/code/trunk/java/engine/org/apache/derby/impl/store/raw/data/RFResource.java Fri Dec 8 12:02:24 2006
@@ -21,32 +21,22 @@
package org.apache.derby.impl.store.raw.data;
-import org.apache.derby.iapi.reference.SQLState;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.security.AccessController;
+import java.security.PrivilegedActionException;
+import java.security.PrivilegedExceptionAction;
-import org.apache.derby.iapi.services.context.ContextService;
+import org.apache.derby.iapi.error.StandardException;
+import org.apache.derby.iapi.reference.SQLState;
import org.apache.derby.iapi.services.context.ContextManager;
+import org.apache.derby.iapi.services.context.ContextService;
import org.apache.derby.iapi.services.daemon.Serviceable;
-import org.apache.derby.iapi.services.sanity.SanityManager;
-import org.apache.derby.iapi.error.StandardException;
-import org.apache.derby.iapi.store.access.FileResource;
-import org.apache.derby.iapi.store.raw.Transaction;
import org.apache.derby.iapi.store.access.AccessFactoryGlobals;
-import org.apache.derby.iapi.store.access.DatabaseInstant;
+import org.apache.derby.iapi.store.access.FileResource;
import org.apache.derby.iapi.store.raw.xact.RawTransaction;
-
-import org.apache.derby.io.StorageFactory;
-import org.apache.derby.io.WritableStorageFactory;
import org.apache.derby.io.StorageFile;
-import org.apache.derby.io.StorageRandomAccessFile;
-
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.security.AccessController;
-import java.security.PrivilegedAction;
-import java.security.PrivilegedActionException;
-import java.security.PrivilegedExceptionAction;
class RFResource implements FileResource {
@@ -208,16 +198,6 @@
String versionedFileName = factory.getVersionedName(name, generationId);
return factory.storageFactory.newStorageFile( versionedFileName);
- }
-
- /**
- @see FileResource#getAsStream
- @exception IOException trouble accessing file.
- */
- public InputStream getAsStream(String name, long generationId)
- throws IOException
- {
- return getAsFile(name, generationId).getInputStream();
}
public char getSeparatorChar()