org.owasp.webscarab.model
Interface SiteModelStore

All Known Implementing Classes:
FileSystemStore

public interface SiteModelStore

This interface defines the necessary functions for a persistent or non-persistent backing store.

Author:
rdawes

Method Summary
 int addConversation(ConversationID id, java.util.Date when, Request request, Response response)
          adds a new conversation
 boolean addConversationProperty(ConversationID id, java.lang.String property, java.lang.String value)
          adds a new value to the list of values for the specified property and conversation
 boolean addCookie(Cookie cookie)
          adds a new cookie to the store
 void addUrl(HttpUrl url)
          adds an entry for the specified URL, so that subsequent calls to isKnownUrl will return true.
 boolean addUrlProperty(HttpUrl url, java.lang.String property, java.lang.String value)
          adds a new value to the list of values for the specified property and url
 void flush()
          forces the store implementation to ensure that all external representations are in a consistent state
 HttpUrl getChildAt(HttpUrl url, int index)
          returns the specified child of the URL passed.
 int getChildCount(HttpUrl url)
          returns the number of URL's that are children of the URL passed.
 ConversationID getConversationAt(HttpUrl url, int index)
          returns the ID of the conversation at position index in the list of conversations related to the supplied url.
 int getConversationCount(HttpUrl url)
          returns the number of conversations related to the url supplied
 java.lang.String[] getConversationProperties(ConversationID id, java.lang.String property)
          returns an array of strings containing the values that have been set for the specified conversation property
 java.lang.String getCookieAt(int index)
          returns a key which represents a cookie in the jar, basically "domain/path name"
 Cookie getCookieAt(java.lang.String key, int index)
          returns the cookie containing the value indicated by the key and index parameters
 int getCookieCount()
          returns the number of unique cookie names in the jar
 int getCookieCount(java.lang.String key)
          returns the number of different cookie values that have been observed for the particular cookie key
 Cookie getCurrentCookie(java.lang.String key)
          returns the most recent cookie indicated by the key parameters
 int getIndexOf(HttpUrl url)
           
 int getIndexOfConversation(HttpUrl url, ConversationID id)
          Conversations are sorted according to the natural ordering of their conversationID.
 int getIndexOfCookie(Cookie cookie)
          returns the index of the provided cookie in the list of values
 int getIndexOfCookie(java.lang.String key, Cookie cookie)
          returns the index of the provided cookie in the list of values
 Request getRequest(ConversationID id)
          Reads the requested Request class from long-term storage.
 Response getResponse(ConversationID id)
          Reads the desired Response class from long-term storage.
 java.lang.String[] getUrlProperties(HttpUrl url, java.lang.String property)
          returns an array of strings containing the values that have been set for the specified url property
 boolean isKnownUrl(HttpUrl url)
          returns true if the url is already existing in the store, false otherwise
 boolean removeCookie(Cookie cookie)
          removes a cookie from the store
 void setConversationProperty(ConversationID id, java.lang.String property, java.lang.String value)
          sets a value for a property, for a specific conversation
 void setRequest(ConversationID id, Request request)
          writes a specific Request instance to long-term storage.
 void setResponse(ConversationID id, Response response)
          writes a specific Response instance to long-term storage.
 void setUrlProperty(HttpUrl url, java.lang.String property, java.lang.String value)
          sets a value for a property, for a specific URL
 

Method Detail

addConversation

int addConversation(ConversationID id,
                    java.util.Date when,
                    Request request,
                    Response response)
adds a new conversation

Parameters:
id - the id of the new conversation
when - the date the conversation was created
request - the request to add
response - the response to add

setConversationProperty

void setConversationProperty(ConversationID id,
                             java.lang.String property,
                             java.lang.String value)
sets a value for a property, for a specific conversation

Parameters:
id - the conversation ID
property - the name of the property
value - the value to set

addConversationProperty

boolean addConversationProperty(ConversationID id,
                                java.lang.String property,
                                java.lang.String value)
adds a new value to the list of values for the specified property and conversation

Parameters:
id - the conversation id
property - the name of the property
value - the value to add

getConversationProperties

java.lang.String[] getConversationProperties(ConversationID id,
                                             java.lang.String property)
returns an array of strings containing the values that have been set for the specified conversation property

Parameters:
id - the conversation id
property - the name of the property
Returns:
the property values

getIndexOfConversation

int getIndexOfConversation(HttpUrl url,
                           ConversationID id)
Conversations are sorted according to the natural ordering of their conversationID. This method returns the position of the specified conversation in the list of conversations relating to the specified URL. If the URL is null, returns the position of the conversation in the overall list of conversations.

Parameters:
url - acts as a filter on the overall list of conversations
id - the conversation
Returns:
the position in the list of conversations, or -insert-1 if the conversation does not apply to the url

getConversationCount

int getConversationCount(HttpUrl url)
returns the number of conversations related to the url supplied

Parameters:
url - the url in question, or null for all conversations
Returns:
the number of conversations related to the supplied URL

getConversationAt

ConversationID getConversationAt(HttpUrl url,
                                 int index)
returns the ID of the conversation at position index in the list of conversations related to the supplied url. If url is null, returns the position in the total list of conversations.

Parameters:
url - the url to use as a filter, or null for none
index - the position in the list
Returns:
the conversation id

addUrl

void addUrl(HttpUrl url)
adds an entry for the specified URL, so that subsequent calls to isKnownUrl will return true.

Parameters:
url - the url to add

isKnownUrl

boolean isKnownUrl(HttpUrl url)
returns true if the url is already existing in the store, false otherwise

Parameters:
url - the url to test
Returns:
true if the url is already known, false otherwise

setUrlProperty

void setUrlProperty(HttpUrl url,
                    java.lang.String property,
                    java.lang.String value)
sets a value for a property, for a specific URL

Parameters:
url - the url
property - the name of the property
value - the value to set

addUrlProperty

boolean addUrlProperty(HttpUrl url,
                       java.lang.String property,
                       java.lang.String value)
adds a new value to the list of values for the specified property and url

Parameters:
url - the url
property - the name of the property
value - the value to add

getUrlProperties

java.lang.String[] getUrlProperties(HttpUrl url,
                                    java.lang.String property)
returns an array of strings containing the values that have been set for the specified url property

Parameters:
url - the url
property - the name of the property
Returns:
the property values

getChildCount

int getChildCount(HttpUrl url)
returns the number of URL's that are children of the URL passed.

Parameters:
url - the url
Returns:
the number of children of the supplied url.

getChildAt

HttpUrl getChildAt(HttpUrl url,
                   int index)
returns the specified child of the URL passed.

Parameters:
url - the url
index - the index
Returns:
the child at position index.

getIndexOf

int getIndexOf(HttpUrl url)

setRequest

void setRequest(ConversationID id,
                Request request)
writes a specific Request instance to long-term storage.

Parameters:
id - the request id
request - the request

getRequest

Request getRequest(ConversationID id)
Reads the requested Request class from long-term storage.

Parameters:
id - The id of the specific Request
Returns:
the desired Request

setResponse

void setResponse(ConversationID id,
                 Response response)
writes a specific Response instance to long-term storage.

Parameters:
id - the response id
response - the response

getResponse

Response getResponse(ConversationID id)
Reads the desired Response class from long-term storage.

Parameters:
id - the id of the desired Response
Returns:
the desired Response

getCookieCount

int getCookieCount()
returns the number of unique cookie names in the jar

Returns:
the number of unique cookie names in the jar

getCookieCount

int getCookieCount(java.lang.String key)
returns the number of different cookie values that have been observed for the particular cookie key

Parameters:
key - the cookie key
Returns:
the number of cookies

getCookieAt

java.lang.String getCookieAt(int index)
returns a key which represents a cookie in the jar, basically "domain/path name"

Parameters:
index - the number of the cookie in the jar
Returns:
a key which represents a cookie in the jar, basically "domain/path name"

getCookieAt

Cookie getCookieAt(java.lang.String key,
                   int index)
returns the cookie containing the value indicated by the key and index parameters

Parameters:
key - the cookie key
index - the index. The higher the number, the more recent the cookie.
Returns:
the cookie

getCurrentCookie

Cookie getCurrentCookie(java.lang.String key)
returns the most recent cookie indicated by the key parameters

Parameters:
key - the cookie key
Returns:
the cookie

getIndexOfCookie

int getIndexOfCookie(Cookie cookie)
returns the index of the provided cookie in the list of values

Parameters:
cookie - the cookie
Returns:
the index of the cookie

getIndexOfCookie

int getIndexOfCookie(java.lang.String key,
                     Cookie cookie)
returns the index of the provided cookie in the list of values

Parameters:
key - the key
cookie - the cookie
Returns:
the index of the cookie

addCookie

boolean addCookie(Cookie cookie)
adds a new cookie to the store

Parameters:
cookie - the cookie to add
Returns:
true if the cookie did not previously exist in the store, false if it did.

removeCookie

boolean removeCookie(Cookie cookie)
removes a cookie from the store

Parameters:
cookie - the cookie to remove
Returns:
true if the cookie was deleted, or false if it was not already in the store

flush

void flush()
           throws StoreException
forces the store implementation to ensure that all external representations are in a consistent state

Throws:
StoreException - if there is any error writing the data