|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--com.xerox.bantam.util.AbstractStorage
This is a base class for working up a storage. It has some basic functionality, but also implements Storage forcing all of its subclasses to implement that.
| Fields inherited from interface com.xerox.bantam.Storage |
FilesystemRepo, InternalRepo, WebRepo |
| Constructor Summary | |
AbstractStorage()
|
|
| Method Summary | |
void |
addQueryListener(Query q,
com.xerox.bantam.ext.QueryListener ql)
Add a query listener to a given storage, listening for a change in the results of query q. |
protected static void |
addToMap(Map map,
Object key,
Document doc)
Used by the map creation routines. |
int |
countDocuments(Query query)
Count how many documents match a given query. |
Document |
createDocument(DocumentType docType)
This factory method is for creating documents from scratch. |
abstract Document |
createDocument(DocumentType docType,
Schema schema,
Map props)
This factory method is for creating documents from scratch. |
boolean |
documentExists(String id)
Determine whether the document named by 'id' exists. |
abstract DocumentList |
find(Query query)
Find all documents that match a given query. |
abstract Document |
getDocument(String id)
Get a document, given an ID. |
Object |
getExtension(Class ifclass)
Get an object implementing an extension interface on this storage. |
abstract String |
getInfo()
Get a description of this storage instance. |
abstract String |
getName()
Get the name of this storage implementation. |
Map |
getValueDistribution(String propertyName)
Returns a set of all of the values for the specified property. |
Map |
getValueDistribution(String propertyName,
Query query)
Returns a set of all the values for the specified property, but only over the documents matching the specified query. |
Map |
getValueMap(String propertyName)
Get a value map that maps values to the documents with those values. |
Map |
getValueMap(String propertyName,
Query query)
Get a value map that maps values to the documents with those values. |
abstract String |
getVersion()
Get the version of this storage implementation. |
Document |
importDocument(DocumentType docType,
String repo,
Object repoParams)
Import a document from a given repository. |
abstract Document |
importDocument(DocumentType docType,
String repoType,
Object repoParams,
Schema schema,
Map props)
Import a document from a given repository. |
protected static void |
incrementCount(HashMap map,
Object key)
Increment a counter in a given map. |
void |
register()
|
void |
removeQueryListener(Query q,
com.xerox.bantam.ext.QueryListener ql)
Remove a query listener from a given storage. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface com.xerox.bantam.Storage |
getQueryFactory, shutdown, validateSchema |
| Constructor Detail |
public AbstractStorage()
| Method Detail |
public abstract Document getDocument(String id)
throws StorageException
XXX This really is bogus that it allows you to return null
isn't this likely to be a programming error? Couldn't
documentExists be made into abstract method that could handle
this issue? XXX
getDocument in interface Storage
String - id the document ID to be converted into a documentStorageException - something went wrong during the
lookup
public boolean documentExists(String id)
throws StorageException
documentExists in interface StorageString - id the document id of interest
public Document createDocument(DocumentType docType)
throws StorageException
createDocument in interface StorageDocumentType - type what kind of doc you
wantSchemaException - something went wrong during the creation
phaseDocumentType,
Document
public abstract Document createDocument(DocumentType docType,
Schema schema,
Map props)
throws StorageException
createDocument in interface StorageDocumentType - type what kind of doc you
wantSchema - a schema to immediately apply to the documentprops - the properties to set so document conforms to schemaSchemaException - something went wrong during the creation
phaseDocumentType,
Document
public Document importDocument(DocumentType docType,
String repo,
Object repoParams)
throws StorageException
importDocument in interface StoragedocType - what kind of doc you wantStorageException - this is thrown if something goes wrong
during the import.DocumentType,
Document
public abstract Document importDocument(DocumentType docType,
String repoType,
Object repoParams,
Schema schema,
Map props)
throws StorageException
importDocument in interface StoragedocType - what kind of doc you wantrepoType - what repository you wantrepoParams - XXXSchema - schema the schema you want applied to the documentprops - properties to set so schema can be immediately enforcedStorageException - this is thrown if something goes wrong
during the import.DocumentType,
Document
public int countDocuments(Query query)
throws StorageException
countDocuments in interface StorageQuery - query to considerStorageException - something went wrong in the
query evaluation
public abstract DocumentList find(Query query)
throws StorageException
find in interface StorageQuery - query query to run against the
full document set. This cannot be null.StorageException - something went wrong during the
processing
public Map getValueDistribution(String propertyName)
throws StorageException
getValueDistribution in interface StorageString - propertyName the name of the property in questionStorageException - something went wrong computing
the value map
public Map getValueDistribution(String propertyName,
Query query)
throws StorageException
Currently this is implemented completely in the client and is slower than hell. Much of this computation could be profitably moved into the kernel...
getValueDistribution in interface StorageString - propertyName the name of the property in questionQuery - query the query to run to get the document setStorageException - something went wrong computing
the value map
protected static void incrementCount(HashMap map,
Object key)
HashMap - map the map to look in for the key valueObject - key the key to search for, whose value will
be inceremented
public Map getValueMap(String propertyName)
throws StorageException
getValueMap in interface StorageString - propertyName the name of the property to partition
onStorageException - something went wrong computing the map
public Map getValueMap(String propertyName,
Query query)
throws StorageException
getValueMap in interface StorageString - propertyName the name of the property to partition
onQuery - query the query to restrict this map toStorageException - something went wrong computing the map
protected static void addToMap(Map map,
Object key,
Document doc)
Map - map the map to updateObject - key the key value to updateDocument - doc the document to add to the array list of
documents
public void addQueryListener(Query q,
com.xerox.bantam.ext.QueryListener ql)
throws StorageException
addQueryListener in interface com.xerox.bantam.ext.NotificationQuery - q the query to be evaluatedQueryListener - ql the object to get notified when the
results of a query changeStorageException - something went wrong trying to
add the listener
public void removeQueryListener(Query q,
com.xerox.bantam.ext.QueryListener ql)
throws StorageException
removeQueryListener in interface com.xerox.bantam.ext.NotificationQuery - q the query to be evaluatedQueryListener - ql the object to be removedStorageException - something went wrong trying to
add the listenerpublic abstract String getName()
StoragegetName in interface Storagecom.xerox.bantam.Storagepublic abstract String getVersion()
StoragegetVersion in interface Storagecom.xerox.bantam.Storagepublic abstract String getInfo()
StoragegetInfo in interface Storagecom.xerox.bantam.Storagepublic void register()
public Object getExtension(Class ifclass)
StoragegetExtension in interface Storagecom.xerox.bantam.Storageifclass - Java interface
|
Project Harland | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||