org.apache.derby.impl.store.raw.data
Class RFResource

java.lang.Object
  extended byorg.apache.derby.impl.store.raw.data.RFResource
All Implemented Interfaces:
FileResource

public class RFResource
extends java.lang.Object
implements FileResource


Field Summary
protected  BaseDataFileFactory factory
           
 
Constructor Summary
RFResource(BaseDataFileFactory dataFactory)
           
 
Method Summary
 long add(java.lang.String name, java.io.InputStream source)
          Add a file resource, copying from the input stream.
 StorageFile getAsFile(java.lang.String name)
          Get the File handle to a file resource.
 StorageFile getAsFile(java.lang.String name, long generationId)
          Get the File handle to a file resource.
 java.io.InputStream getAsStream(java.lang.String name)
          Get the file resource as a stream.
 java.io.InputStream getAsStream(java.lang.String name, long generationId)
          Get the file resource as a stream.
 char getSeparatorChar()
           
protected  Serviceable privRemoveFile(StorageFile file)
           
protected  RemoveFileOperation privRemoveFileOperation(java.lang.String name, long generationId, boolean removeAtOnce)
           
 void purgeOldGenerations(DatabaseInstant purgeTo)
          Purge old generations that were removed or replaced before the database instant provided.
 void remove(java.lang.String name, long currentGenerationId, boolean purgeOnCommit)
          Remove the current generation of a file resource from the database.
 long replace(java.lang.String name, long currentGenerationId, java.io.InputStream source, boolean purgeOnCommit)
          Replace a file resource with a new version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

factory

protected final BaseDataFileFactory factory
Constructor Detail

RFResource

public RFResource(BaseDataFileFactory dataFactory)
Method Detail

add

public long add(java.lang.String name,
                java.io.InputStream source)
         throws StandardException
Description copied from interface: FileResource
Add a file resource, copying from the input stream. The InputStream will be closed by this method.

Specified by:
add in interface FileResource
Parameters:
name - the name of the file resource.
source - an input stream for reading the content of the file resource.
Returns:
the generationId for the file resource. This quantity increases when you replace the file resource.
Throws:
StandardException - Oops
See Also:
FileResource.add(java.lang.String, java.io.InputStream)

remove

public void remove(java.lang.String name,
                   long currentGenerationId,
                   boolean purgeOnCommit)
            throws StandardException
Description copied from interface: FileResource
Remove the current generation of a file resource from the database.

Specified by:
remove in interface FileResource
Parameters:
name - the name of the fileResource to remove.
purgeOnCommit - true means purge the fileResource when the current transaction commits. false means retain the file resource for use by replication.
Throws:
StandardException - Oops
See Also:
FileResource.remove(java.lang.String, long, boolean)

replace

public long replace(java.lang.String name,
                    long currentGenerationId,
                    java.io.InputStream source,
                    boolean purgeOnCommit)
             throws StandardException
Description copied from interface: FileResource
Replace a file resource with a new version.

The InputStream will be closed by this method.

Specified by:
replace in interface FileResource
Parameters:
name - the name of the file resource.
source - an input stream for reading the content of the file resource.
purgeOnCommit - true means purge the existing version of fileResource when the current transaction commits. false means retain the existing version for use by replication.
Returns:
the generationId for the new 'current' version of the file resource.
Throws:
StandardException - Oops
See Also:
FileResource.replace(java.lang.String, long, java.io.InputStream, boolean)

getAsFile

public StorageFile getAsFile(java.lang.String name,
                             long generationId)
Description copied from interface: FileResource
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).

Specified by:
getAsFile in interface FileResource
Parameters:
name - The name of the fileResource
generationId - the generationId of the fileResource
Returns:
A File object representing the file, or null if the resource is not accessable as a file.
See Also:
FileResource.getAsFile(java.lang.String, long)

getAsFile

public StorageFile getAsFile(java.lang.String name)
Description copied from interface: FileResource
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).

Specified by:
getAsFile in interface FileResource
Parameters:
name - The name of the fileResource
Returns:
A File object representing the file, or null if the resource is not accessable as a file.
See Also:
FileResource.getAsFile(java.lang.String, long)

getAsStream

public java.io.InputStream getAsStream(java.lang.String name,
                                       long generationId)
                                throws java.io.IOException
Description copied from interface: FileResource
Get the file resource as a stream.

Specified by:
getAsStream in interface FileResource
Throws:
java.io.IOException - trouble accessing file.
See Also:
FileResource.getAsStream(java.lang.String, long)

getAsStream

public java.io.InputStream getAsStream(java.lang.String name)
                                throws java.io.IOException
Description copied from interface: FileResource
Get the file resource as a stream.

Specified by:
getAsStream in interface FileResource
Throws:
java.io.IOException - trouble accessing file.
See Also:
FileResource.getAsStream(java.lang.String, long)

purgeOldGenerations

public void purgeOldGenerations(DatabaseInstant purgeTo)
Description copied from interface: FileResource
Purge old generations that were removed or replaced before the database instant provided.

Specified by:
purgeOldGenerations in interface FileResource
See Also:
FileResource.purgeOldGenerations(org.apache.derby.iapi.store.access.DatabaseInstant)

getSeparatorChar

public char getSeparatorChar()
Specified by:
getSeparatorChar in interface FileResource
Returns:
the separator character to be used in file names.

privRemoveFile

protected Serviceable privRemoveFile(StorageFile file)

privRemoveFileOperation

protected RemoveFileOperation privRemoveFileOperation(java.lang.String name,
                                                      long generationId,
                                                      boolean removeAtOnce)

Built on Tue 2006-10-10 19:23:47+0200, from revision exported

Apache Derby V10.1 Engine Documentation - Copyright © 1997,2005 The Apache Software Foundation or its licensors, as applicable.