org.neodatis.odb.core.layers.layer3.engine
Class FileSystemInterface

java.lang.Object
  extended by org.neodatis.odb.core.layers.layer3.engine.FileSystemInterface
All Implemented Interfaces:
IFileSystemInterface
Direct Known Subclasses:
LocalFileSystemInterface, ServerFileSystemInterface

public abstract class FileSystemInterface
extends java.lang.Object
implements IFileSystemInterface

Class that knows how to read/write all language native types : byte, char, String, int, long,....

Author:
osmadja

Field Summary
protected  IByteArrayConverter byteArrayConverter
           
static java.lang.String LOG_ID
           
static int nbCall1
           
static int nbCall2
           
protected  IBaseIdentification parameters
           
 
Constructor Summary
FileSystemInterface(java.lang.String name, IBaseIdentification parameters, boolean canLog, int bufferSize)
           
FileSystemInterface(java.lang.String name, java.lang.String fileName, boolean canWrite, boolean canLog, int bufferSize)
           
 
Method Summary
 void clear()
           
 void close()
           
 boolean delete()
           
 void ensureSpaceFor(ODBType type)
           
 void flush()
           
 long getAvailablePosition()
           
 IBufferedIO getIo()
           
 long getLength()
           
 IBaseIdentification getParameters()
           
 long getPosition()
           
abstract  ISession getSession()
           
(package private)  boolean isWritingInWrongPlace(long position)
          Writing at position < DATABASE_HEADER_PROTECTED_ZONE_SIZE is writing in ODB Header place.
 java.math.BigDecimal readBigDecimal()
           
 java.math.BigDecimal readBigDecimal(java.lang.String label)
           
 byte[] readBigDecimalBytes()
           
 java.math.BigInteger readBigInteger()
           
 java.math.BigInteger readBigInteger(java.lang.String label)
           
 byte[] readBigIntegerBytes(boolean hasSize)
           
 boolean readBoolean()
           
 boolean readBoolean(java.lang.String label)
           
 byte[] readBooleanBytes()
           
 byte readByte()
           
 byte readByte(java.lang.String label)
           
 byte[] readBytes(int length)
           
 char readChar()
           
 char readChar(java.lang.String label)
           
 byte[] readCharBytes()
           
 java.util.Date readDate()
           
 java.util.Date readDate(java.lang.String label)
           
 byte[] readDateBytes()
           
 double readDouble()
           
 double readDouble(java.lang.String label)
           
 byte[] readDoubleBytes()
           
 float readFloat()
           
 float readFloat(java.lang.String label)
           
 byte[] readFloatBytes()
           
 int readInt()
           
 int readInt(java.lang.String label)
           
 byte[] readIntBytes()
           
 long readLong()
           
 long readLong(java.lang.String label)
           
 byte[] readLongBytes()
           
 byte[] readNativeAttributeBytes(int attributeType)
           
 short readShort()
           
 short readShort(java.lang.String label)
           
 byte[] readShortBytes()
           
 java.lang.String readString(boolean useEncoding)
           
 java.lang.String readString(boolean useEncoding, java.lang.String label)
           
 byte[] readStringBytes(boolean withSize)
           
 void setDatabaseCharacterEncoding(java.lang.String databaseCharacterEncoding)
           
 void setReadPosition(long position)
           
 void setWritePosition(long position, boolean writeInTransacation)
           
 void setWritePositionNoVerification(long position, boolean writeInTransacation)
          Does the same thing than setWritePosition, but do not control write position
 void useBuffer(boolean useBuffer)
           
 void writeBigDecimal(java.math.BigDecimal d, boolean writeInTransaction)
           
 void writeBigInteger(java.math.BigInteger d, boolean writeInTransaction)
           
 void writeBoolean(boolean b, boolean writeInTransaction)
           
 void writeBoolean(boolean b, boolean writeInTransaction, java.lang.String label)
           
 void writeByte(byte i, boolean writeInTransaction)
           
 void writeByte(byte i, boolean writeInTransaction, java.lang.String label)
           
 void writeBytes(byte[] bytes, boolean writeInTransaction, java.lang.String label)
           
 void writeChar(char c, boolean writeInTransaction)
           
 void writeDate(java.util.Date d, boolean writeInTransaction)
           
 void writeDouble(double d, boolean writeInTransaction)
           
 void writeFloat(float f, boolean writeInTransaction)
           
 void writeInt(int i, boolean writeInTransaction, java.lang.String label)
           
 void writeLong(long i, boolean writeInTransaction, java.lang.String label, int writeActionType)
           
 void writeShort(short s, boolean writeInTransaction)
           
 void writeString(java.lang.String s, boolean writeInTransaction, boolean useEncoding)
           
 void writeString(java.lang.String s, boolean writeInTransaction, boolean useEncoding, int totalSpace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

nbCall1

public static int nbCall1

nbCall2

public static int nbCall2

LOG_ID

public static final java.lang.String LOG_ID
See Also:
Constant Field Values

parameters

protected IBaseIdentification parameters

byteArrayConverter

protected IByteArrayConverter byteArrayConverter
Constructor Detail

FileSystemInterface

public FileSystemInterface(java.lang.String name,
                           java.lang.String fileName,
                           boolean canWrite,
                           boolean canLog,
                           int bufferSize)

FileSystemInterface

public FileSystemInterface(java.lang.String name,
                           IBaseIdentification parameters,
                           boolean canLog,
                           int bufferSize)
Method Detail

setDatabaseCharacterEncoding

public void setDatabaseCharacterEncoding(java.lang.String databaseCharacterEncoding)
Specified by:
setDatabaseCharacterEncoding in interface IFileSystemInterface

getSession

public abstract ISession getSession()

useBuffer

public void useBuffer(boolean useBuffer)
Specified by:
useBuffer in interface IFileSystemInterface

flush

public void flush()
Specified by:
flush in interface IFileSystemInterface

getPosition

public long getPosition()
Specified by:
getPosition in interface IFileSystemInterface

getLength

public long getLength()
Specified by:
getLength in interface IFileSystemInterface

isWritingInWrongPlace

boolean isWritingInWrongPlace(long position)
Writing at position < DATABASE_HEADER_PROTECTED_ZONE_SIZE is writing in ODB Header place. Here we check the positions where the writing is done. Search for 'page format' in ODB wiki to understand the positions

Parameters:
position -
Returns:

setWritePositionNoVerification

public void setWritePositionNoVerification(long position,
                                           boolean writeInTransacation)
Description copied from interface: IFileSystemInterface
Does the same thing than setWritePosition, but do not control write position

Specified by:
setWritePositionNoVerification in interface IFileSystemInterface

setWritePosition

public void setWritePosition(long position,
                             boolean writeInTransacation)
Specified by:
setWritePosition in interface IFileSystemInterface

setReadPosition

public void setReadPosition(long position)
Specified by:
setReadPosition in interface IFileSystemInterface

getAvailablePosition

public long getAvailablePosition()
Specified by:
getAvailablePosition in interface IFileSystemInterface

ensureSpaceFor

public void ensureSpaceFor(ODBType type)
Specified by:
ensureSpaceFor in interface IFileSystemInterface

writeByte

public void writeByte(byte i,
                      boolean writeInTransaction)
Specified by:
writeByte in interface IFileSystemInterface

writeByte

public void writeByte(byte i,
                      boolean writeInTransaction,
                      java.lang.String label)
Specified by:
writeByte in interface IFileSystemInterface

readByte

public byte readByte()
Specified by:
readByte in interface IFileSystemInterface

readByte

public byte readByte(java.lang.String label)
Specified by:
readByte in interface IFileSystemInterface

writeBytes

public void writeBytes(byte[] bytes,
                       boolean writeInTransaction,
                       java.lang.String label)
Specified by:
writeBytes in interface IFileSystemInterface

readBytes

public byte[] readBytes(int length)
Specified by:
readBytes in interface IFileSystemInterface

writeChar

public void writeChar(char c,
                      boolean writeInTransaction)
Specified by:
writeChar in interface IFileSystemInterface

readCharBytes

public byte[] readCharBytes()
Specified by:
readCharBytes in interface IFileSystemInterface

readChar

public char readChar()
Specified by:
readChar in interface IFileSystemInterface

readChar

public char readChar(java.lang.String label)
Specified by:
readChar in interface IFileSystemInterface

writeShort

public void writeShort(short s,
                       boolean writeInTransaction)
Specified by:
writeShort in interface IFileSystemInterface

readShortBytes

public byte[] readShortBytes()
Specified by:
readShortBytes in interface IFileSystemInterface

readShort

public short readShort()
Specified by:
readShort in interface IFileSystemInterface

readShort

public short readShort(java.lang.String label)
Specified by:
readShort in interface IFileSystemInterface

writeInt

public void writeInt(int i,
                     boolean writeInTransaction,
                     java.lang.String label)
Specified by:
writeInt in interface IFileSystemInterface

readIntBytes

public byte[] readIntBytes()
Specified by:
readIntBytes in interface IFileSystemInterface

readInt

public int readInt()
Specified by:
readInt in interface IFileSystemInterface

readInt

public int readInt(java.lang.String label)
Specified by:
readInt in interface IFileSystemInterface

writeLong

public void writeLong(long i,
                      boolean writeInTransaction,
                      java.lang.String label,
                      int writeActionType)
Specified by:
writeLong in interface IFileSystemInterface

readLongBytes

public byte[] readLongBytes()
Specified by:
readLongBytes in interface IFileSystemInterface

readLong

public long readLong()
Specified by:
readLong in interface IFileSystemInterface

readLong

public long readLong(java.lang.String label)
Specified by:
readLong in interface IFileSystemInterface

writeFloat

public void writeFloat(float f,
                       boolean writeInTransaction)
Specified by:
writeFloat in interface IFileSystemInterface

readFloatBytes

public byte[] readFloatBytes()
Specified by:
readFloatBytes in interface IFileSystemInterface

readFloat

public float readFloat()
Specified by:
readFloat in interface IFileSystemInterface

readFloat

public float readFloat(java.lang.String label)
Specified by:
readFloat in interface IFileSystemInterface

writeDouble

public void writeDouble(double d,
                        boolean writeInTransaction)
Specified by:
writeDouble in interface IFileSystemInterface

readDoubleBytes

public byte[] readDoubleBytes()
Specified by:
readDoubleBytes in interface IFileSystemInterface

readDouble

public double readDouble()
Specified by:
readDouble in interface IFileSystemInterface

readDouble

public double readDouble(java.lang.String label)
Specified by:
readDouble in interface IFileSystemInterface

writeBigDecimal

public void writeBigDecimal(java.math.BigDecimal d,
                            boolean writeInTransaction)
Specified by:
writeBigDecimal in interface IFileSystemInterface

readBigDecimalBytes

public byte[] readBigDecimalBytes()
Specified by:
readBigDecimalBytes in interface IFileSystemInterface

readBigDecimal

public java.math.BigDecimal readBigDecimal()
Specified by:
readBigDecimal in interface IFileSystemInterface

readBigDecimal

public java.math.BigDecimal readBigDecimal(java.lang.String label)
Specified by:
readBigDecimal in interface IFileSystemInterface

writeBigInteger

public void writeBigInteger(java.math.BigInteger d,
                            boolean writeInTransaction)
Specified by:
writeBigInteger in interface IFileSystemInterface

readBigIntegerBytes

public byte[] readBigIntegerBytes(boolean hasSize)
Specified by:
readBigIntegerBytes in interface IFileSystemInterface

readBigInteger

public java.math.BigInteger readBigInteger()
Specified by:
readBigInteger in interface IFileSystemInterface

readBigInteger

public java.math.BigInteger readBigInteger(java.lang.String label)
Specified by:
readBigInteger in interface IFileSystemInterface

writeDate

public void writeDate(java.util.Date d,
                      boolean writeInTransaction)
Specified by:
writeDate in interface IFileSystemInterface

readDateBytes

public byte[] readDateBytes()
Specified by:
readDateBytes in interface IFileSystemInterface

readDate

public java.util.Date readDate()
Specified by:
readDate in interface IFileSystemInterface

readDate

public java.util.Date readDate(java.lang.String label)
Specified by:
readDate in interface IFileSystemInterface

writeString

public void writeString(java.lang.String s,
                        boolean writeInTransaction,
                        boolean useEncoding)
Specified by:
writeString in interface IFileSystemInterface

writeString

public void writeString(java.lang.String s,
                        boolean writeInTransaction,
                        boolean useEncoding,
                        int totalSpace)
Specified by:
writeString in interface IFileSystemInterface

readStringBytes

public byte[] readStringBytes(boolean withSize)
Specified by:
readStringBytes in interface IFileSystemInterface

readString

public java.lang.String readString(boolean useEncoding)
Specified by:
readString in interface IFileSystemInterface

readString

public java.lang.String readString(boolean useEncoding,
                                   java.lang.String label)
Specified by:
readString in interface IFileSystemInterface

writeBoolean

public void writeBoolean(boolean b,
                         boolean writeInTransaction)
Specified by:
writeBoolean in interface IFileSystemInterface

writeBoolean

public void writeBoolean(boolean b,
                         boolean writeInTransaction,
                         java.lang.String label)
Specified by:
writeBoolean in interface IFileSystemInterface

readBooleanBytes

public byte[] readBooleanBytes()
Specified by:
readBooleanBytes in interface IFileSystemInterface

readBoolean

public boolean readBoolean()
Specified by:
readBoolean in interface IFileSystemInterface

readBoolean

public boolean readBoolean(java.lang.String label)
Specified by:
readBoolean in interface IFileSystemInterface

readNativeAttributeBytes

public byte[] readNativeAttributeBytes(int attributeType)
Specified by:
readNativeAttributeBytes in interface IFileSystemInterface

close

public void close()
Specified by:
close in interface IFileSystemInterface

clear

public void clear()
Specified by:
clear in interface IFileSystemInterface

getParameters

public IBaseIdentification getParameters()
Specified by:
getParameters in interface IFileSystemInterface
Returns:
Returns the parameters.

delete

public boolean delete()
Specified by:
delete in interface IFileSystemInterface

getIo

public IBufferedIO getIo()
Specified by:
getIo in interface IFileSystemInterface