|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--webfunds.store.Store
|
+--webfunds.store.AppendFileStore
A hashtable object that provides access to files stored in a directory. Every piece of data is appended to a single file, hence 'AppendFile'. This is oriented to network storage, where there is a need to encrypt and hide the structure of the static data that is stored Network security concerns: There will remain a fairly clear signature in the append events, but that is mirrored by the actual activity anyway, so may not be so efficacious to protect. Probably, a wholistic protection approach would be preferable, as in an anonymiser ring.
| Field Summary | |
protected java.io.FileOutputStream |
append
|
protected java.lang.String |
badFiles
|
protected java.io.PrintWriter |
bug
implements Diagnostics |
static java.lang.String |
DELETE
|
protected java.io.File |
dir
|
static java.lang.String |
DUMMY
|
protected boolean |
error
|
protected java.io.File |
file
|
protected java.lang.String |
fix
|
protected long |
high_watermark
|
static long |
HIGH_WATERMARK
|
protected long |
post_watermark
|
static long |
POST_WATERMARK
|
protected java.util.Hashtable |
stores
|
static java.lang.String |
suffix
|
protected static java.lang.String |
test
|
static int |
VERSION
The version of the stored format for objects. |
| Fields inherited from class webfunds.store.Store |
APPEND,
changed,
error,
hash,
name,
NET,
SOMETHING |
| Constructor Summary | |
AppendFileStore()
An uninitialised object, for ClassLoader. |
|
AppendFileStore(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
Open an empty, new AppendFileStore. |
|
| Method Summary | |
boolean |
checkErrors()
|
protected void |
cleanup(int lastfile)
Clean up the old files we don't want, those a few numbers back. |
void |
clear()
Removes all files in this directory, and any empty directories (intentional?). |
protected void |
dumpAll(java.io.DataOutputStream dos)
Dump all objects to the output. |
protected void |
dumpObject(java.io.DataOutputStream dos,
byte[] b1,
byte[] b2,
byte[] b3)
Dump an object in Encodable format to the output. |
protected void |
dumpObject(java.io.DataOutputStream dos,
java.lang.String key,
java.lang.Object obj)
Dump an object in Encodable format to the output. |
boolean |
equals(java.lang.Object obj)
|
protected boolean |
equalsKeys(AppendFileStore one,
AppendFileStore two)
|
java.io.PrintWriter |
err()
Do stack trace prints to err(), should always return something. |
static AppendFileStore |
example(java.io.File fname)
|
static void |
exampleFill(AppendFileStore ex)
Provide a dirname that is empty / not present. |
protected static void |
exampleRemove(AppendFileStore a)
|
java.lang.String |
getBadFiles()
|
protected long |
getChecksum(byte[] b1,
byte[] b2,
byte[] b3)
|
java.io.PrintWriter |
getDebug()
Returns a debug writer, if any is set. |
static Store |
getInstance(java.io.File dir)
|
static AppendFileStore |
getInstance(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
Returns an existing AppendFileStore, with files in dir read in as objects in the hashtable. |
protected static int |
getNumber(java.lang.String name)
|
Store |
getStore(java.lang.String s,
int i)
|
Store[] |
getStores()
|
void |
init(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
Has to be a non-existant file. |
protected void |
initFiles()
|
protected void |
initialiseFromFile(java.io.File file)
Reads in the current hashtable from the file, which was saved by the previous incantation as an Append file. |
void |
logmsg(java.lang.String s)
|
static void |
main(java.lang.String[] args)
|
protected void |
newFile(java.lang.String s)
Has to be a non-existant file. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
(Re)sets a (file) object into the hashtable. |
java.lang.Object |
remove(java.lang.Object key)
Drop the object from both hashtable and disk. |
protected static void |
removeIt(java.io.File dir)
|
protected void |
removeObject(java.io.DataOutputStream dos,
java.lang.String key)
Remove an object from the stream by adding a remove signal. |
void |
rollover()
Cause a new file to be set up if old one is too big. |
protected void |
rollover(java.lang.String name)
|
protected void |
sync()
Store interface requires this, but it is a no-op. |
java.lang.String |
toString()
Convert this object to a human readable string |
protected static void |
tryit()
|
| Methods inherited from class webfunds.store.Store |
contains,
containsKey,
elements,
get,
getClassLoader,
getName,
getStore,
getType,
isChanged,
isEmpty,
keys,
setChanged,
setClassLoader,
size |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int VERSION
public static final long HIGH_WATERMARK
public static final long POST_WATERMARK
protected long high_watermark
protected long post_watermark
public static final java.lang.String suffix
public static final java.lang.String DUMMY
public static final java.lang.String DELETE
protected java.io.File dir
protected java.io.File file
protected java.io.FileOutputStream append
protected boolean error
protected java.lang.String badFiles
protected java.util.Hashtable stores
protected java.io.PrintWriter bug
protected java.lang.String fix
protected static final java.lang.String test
| Constructor Detail |
public AppendFileStore(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
throws StoreException
public AppendFileStore()
throws StoreException
| Method Detail |
public java.lang.String getBadFiles()
public void logmsg(java.lang.String s)
public java.io.PrintWriter getDebug()
public java.io.PrintWriter err()
public void init(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
throws StoreException
protected void newFile(java.lang.String s)
throws StoreException
public static Store getInstance(java.io.File dir)
throws StoreException
public static AppendFileStore getInstance(java.io.File dir,
java.io.PrintWriter pw,
java.lang.String logfix)
throws StoreException
protected static int getNumber(java.lang.String name)
protected void initFiles()
throws StoreException
protected long getChecksum(byte[] b1,
byte[] b2,
byte[] b3)
protected void initialiseFromFile(java.io.File file)
throws StoreException
protected void cleanup(int lastfile)
public void rollover()
throws StoreException
protected void rollover(java.lang.String name)
throws StoreException
protected void dumpAll(java.io.DataOutputStream dos)
throws StoreException
protected void dumpObject(java.io.DataOutputStream dos,
java.lang.String key,
java.lang.Object obj)
throws StoreException
protected void dumpObject(java.io.DataOutputStream dos,
byte[] b1,
byte[] b2,
byte[] b3)
throws StoreException
protected void removeObject(java.io.DataOutputStream dos,
java.lang.String key)
throws StoreException
public boolean checkErrors()
public void clear()
public java.lang.Object put(java.lang.Object key,
java.lang.Object value)
value - is an Encodable objectkey - is the String name of the objectpublic java.lang.Object remove(java.lang.Object key)
protected void sync()
public Store getStore(java.lang.String s,
int i)
public Store[] getStores()
public java.lang.String toString()
protected boolean equalsKeys(AppendFileStore one,
AppendFileStore two)
public boolean equals(java.lang.Object obj)
public static void exampleFill(AppendFileStore ex)
throws StoreException
public static AppendFileStore example(java.io.File fname)
throws StoreException
public static void main(java.lang.String[] args)
protected static void exampleRemove(AppendFileStore a)
throws java.lang.Exception
protected static void tryit()
throws java.lang.Exception
protected static void removeIt(java.io.File dir)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||