org.exist.source
Interface Source

All Known Implementing Classes:
AbstractSource, ClassLoaderSource, CocoonSource, DBSource, FileSource, StringSource, URLSource

public interface Source

A general interface for access to external or internal sources. This is mainly used as an abstraction for loading XQuery scripts and modules, but can also be applied to other use cases.

Author:
wolf

Field Summary
static int INVALID
           
static int UNKNOWN
           
static int VALID
           
 
Method Summary
 long getCacheTimestamp()
           
 String getContent()
           
 Object getKey()
          Returns a unique key to identify the source, usually an URI.
 Reader getReader()
          Returns a Reader to read the contents of the source.
 int isValid(DBBroker broker)
          Is this source object still valid? Returns UNKNOWN if the validity of the source cannot be determined.
 int isValid(Source other)
          Checks if the source object is still valid by comparing it to another version of the same source.
 void setCacheTimestamp(long timestamp)
          Set a timestamp for this source.
 

Field Detail

VALID

static final int VALID
See Also:
Constant Field Values

INVALID

static final int INVALID
See Also:
Constant Field Values

UNKNOWN

static final int UNKNOWN
See Also:
Constant Field Values
Method Detail

getKey

Object getKey()
Returns a unique key to identify the source, usually an URI.


isValid

int isValid(DBBroker broker)
Is this source object still valid? Returns UNKNOWN if the validity of the source cannot be determined. The DBBroker parameter is required by some implementations as they have to read resources from the database.

Parameters:
broker -

isValid

int isValid(Source other)
Checks if the source object is still valid by comparing it to another version of the same source. It depends on the concrete implementation how the sources are compared. Use this method if isValid(DBBroker) return UNKNOWN.

Parameters:
other -

getReader

Reader getReader()
                 throws IOException
Returns a Reader to read the contents of the source.

Throws:
IOException

getContent

String getContent()
                  throws IOException
Throws:
IOException

setCacheTimestamp

void setCacheTimestamp(long timestamp)
Set a timestamp for this source. This is used by XQueryPool to check if a source has timed out.

Parameters:
timestamp -

getCacheTimestamp

long getCacheTimestamp()


Copyright (C) Wolfgang Meier. All rights reserved.