org.owasp.webscarab.plugin.fragments
Class FileSystemStore

java.lang.Object
  extended by org.owasp.webscarab.plugin.fragments.FileSystemStore
All Implemented Interfaces:
FragmentsStore

public class FileSystemStore
extends java.lang.Object
implements FragmentsStore

Author:
knoppix

Constructor Summary
FileSystemStore(java.io.File dir, java.lang.String session)
          Creates a new instance of FileSystemStore
 
Method Summary
 void flush()
           
 java.lang.String getFragment(java.lang.String key)
          retrieves a saved text fragment
 int getFragmentCount(java.lang.String type)
           
 java.lang.String getFragmentKeyAt(java.lang.String type, int position)
           
 java.lang.String getFragmentType(int index)
           
 int getFragmentTypeCount()
           
 int indexOfFragment(java.lang.String type, java.lang.String key)
           
 int putFragment(java.lang.String type, java.lang.String key, java.lang.String fragment)
          Stores a text fragment for future retrieval
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileSystemStore

public FileSystemStore(java.io.File dir,
                       java.lang.String session)
                throws StoreException
Creates a new instance of FileSystemStore

Throws:
StoreException
Method Detail

getFragment

public java.lang.String getFragment(java.lang.String key)
retrieves a saved text fragment

Specified by:
getFragment in interface FragmentsStore
Parameters:
key - The key used previously to save the fragment
Returns:
A String containing the fragment
Throws:
StoreException - if there are any problems reading from the Store

putFragment

public int putFragment(java.lang.String type,
                       java.lang.String key,
                       java.lang.String fragment)
Stores a text fragment for future retrieval

Specified by:
putFragment in interface FragmentsStore
Parameters:
type - The type of the fragment
key - the key that identifies the fragment.
fragment - The fragment string that should be stored.
Returns:
the position of the new key in the list, or -1 if it was already there
Throws:
StoreException - if there are any problems writing to the Store

flush

public void flush()
           throws StoreException
Specified by:
flush in interface FragmentsStore
Throws:
StoreException

getFragmentCount

public int getFragmentCount(java.lang.String type)
Specified by:
getFragmentCount in interface FragmentsStore

getFragmentKeyAt

public java.lang.String getFragmentKeyAt(java.lang.String type,
                                         int position)
Specified by:
getFragmentKeyAt in interface FragmentsStore

getFragmentType

public java.lang.String getFragmentType(int index)
Specified by:
getFragmentType in interface FragmentsStore

getFragmentTypeCount

public int getFragmentTypeCount()
Specified by:
getFragmentTypeCount in interface FragmentsStore

indexOfFragment

public int indexOfFragment(java.lang.String type,
                           java.lang.String key)
Specified by:
indexOfFragment in interface FragmentsStore