|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectthinkmap.datasource.util.AbstractDataSource
thinkmap.datasource.flatfile2.FlatFileDataSource
public class FlatFileDataSource
FlatFileDataSource provides data from flat files representing database tables.
| Field Summary | |
|---|---|
protected org.apache.lucene.analysis.Analyzer |
analyzer
|
protected QueryBuilder |
builder
|
protected ThinkmapConfig |
config
|
protected IThinkmapContext |
context
|
protected int |
debugLevel
|
protected int |
defaultMaxSearchResults
|
protected org.apache.lucene.store.Directory |
directory
|
protected static org.apache.lucene.index.Term |
entityType
|
protected int |
errorThreshold
|
protected Map<String,Set<FieldDef<?>>> |
fieldMaps
|
protected int |
indexingNotificationInterval
|
protected File |
indexPath
|
protected boolean |
inMemory
|
protected static org.apache.lucene.index.Term |
ismodelrecord
|
protected Map<String,EntityModel> |
modelMaps
|
protected List<EntityModel> |
models
|
protected boolean |
newIndexOnStart
|
protected ReadWriteLock |
rwlock
|
protected org.apache.lucene.search.IndexSearcher |
searcher
|
protected boolean |
shutdown
|
protected int |
warningThreshold
|
protected HashMap<String,EntityWriter> |
writers
|
protected AtomicBoolean |
writing
|
| Constructor Summary | |
|---|---|
FlatFileDataSource()
Creates a new FlatFileDataSource object. |
|
| Method Summary | |
|---|---|
void |
addEntityModel(EntityModel model)
Adds the given entity model to this datasource |
EdgeEntityModel |
createEdge()
|
protected Indexer |
createIndexer()
|
NodeEntityModel |
createNode()
|
protected IFlatFileReader |
createReader(thinkmap.datasource.flatfile2.IFFEntityModel model,
URL url)
Creates a Flat File Reader from the given IFFEntityModel and url |
protected org.apache.lucene.document.Document |
getDocumentForEntity(EntityId id)
Returns an Document representing the given EntityId. |
EntityModel |
getEntityModel(String name)
Get an entity model by name; |
Set<FieldDef<?>> |
getFields(String name)
|
protected org.apache.lucene.store.Directory |
getIndexDir()
Returns the Lucene Directory. |
protected void |
getRelated(EntityId id,
IEntityHandler callback)
|
String[] |
getTypeChain(String type)
|
protected URL |
getURL(EntityModel em)
|
protected EntityWriter |
getWriter(org.apache.lucene.document.Document d)
|
protected EntityWriter |
getWriter(String name)
|
protected void |
index(boolean create)
This method is not meant to be called directly. |
void |
init()
|
protected void |
initializeEdgeModel(FFEdgeEntityModel model)
Initialize Edge Model |
protected boolean |
isCurrent(EntityModel model,
long lastModified)
Returns true if the given entity model is completely current with the index. |
boolean |
isIndexing()
Returns true if the datasource is currently indexing |
boolean |
isWriting()
Returns true if a writing operation is currently underway. |
protected void |
processEntityRequest(Message message,
IEntityHandler callback)
Handle an Entity request. |
protected void |
processIdRequest(Message message,
IEntityHandler callback)
Handle an ID request. |
protected void |
processMetadataRequest(Message message,
IEntityHandler callback)
Handle a metadata request. |
protected void |
processRelatedRequest(Message message,
IEntityHandler callback)
Handle a related request. |
void |
reindex(boolean create)
Reindexes the Flat file datasource. |
void |
reindexAsync(boolean create)
Performs a reindex asynchronously. |
protected void |
reportClientMessage(IEntityHandler callback,
Exception e)
Reports an error message to the client. |
protected void |
reportServerMessage(int level,
String message,
Exception e)
Reportes a server message to the context. |
void |
setContext(IThinkmapContext context)
Sets the context for this datasource. |
void |
setCreateNewIndexOnStart(boolean create)
If set to true, the server will create a new index each time on startup. |
void |
setDebugLevel(int level)
Sets the debug level for this datasource. |
void |
setDefaultMaxSearchResults(int defaultMaxSearchResults)
Set's the default number of max search results that is returned by a search request. |
void |
setErrorThreshold(int threshold)
Set's the error threshold for processing a file which is the number of errors that must take place before the file is abandoned entirely. |
void |
setIndexingNotificationInterval(int indexingNotificationInterval)
Set's the indexing notification interval which determines how many lines must be processed before notifying the server of indexing progress. |
void |
setIndexPath(File path)
Set's the directory where this index will be stored. |
void |
setMemoryOnly(boolean memory)
Set's where this datasource should be stored entirely in memory. |
void |
setThinkmapConfig(ThinkmapConfig config)
Sets the Thinkmap Config for this object |
void |
setWarningThreshold(int threshold)
Set's the warning threshold for processing a file. |
void |
shutDown()
|
void |
stopIndexing()
Stops the current indexing process and rolls back the changes. |
protected thinkmap.datasource.flatfile2.IFFEntityModel |
unpackModel(org.apache.lucene.document.Document doc)
Returns |
| Methods inherited from class thinkmap.datasource.util.AbstractDataSource |
|---|
createRequest, processCustomRequest, processRequest |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface thinkmap.datasource.IDataSource |
|---|
createRequest |
| Field Detail |
|---|
protected HashMap<String,EntityWriter> writers
protected QueryBuilder builder
protected Map<String,EntityModel> modelMaps
protected List<EntityModel> models
protected org.apache.lucene.search.IndexSearcher searcher
protected org.apache.lucene.store.Directory directory
protected boolean inMemory
protected boolean newIndexOnStart
protected IThinkmapContext context
protected File indexPath
protected ThinkmapConfig config
protected int defaultMaxSearchResults
protected int debugLevel
protected int indexingNotificationInterval
protected AtomicBoolean writing
protected volatile boolean shutdown
protected ReadWriteLock rwlock
protected final org.apache.lucene.analysis.Analyzer analyzer
protected Map<String,Set<FieldDef<?>>> fieldMaps
protected static final org.apache.lucene.index.Term entityType
protected static final org.apache.lucene.index.Term ismodelrecord
protected int errorThreshold
protected int warningThreshold
| Constructor Detail |
|---|
public FlatFileDataSource()
| Method Detail |
|---|
public EntityModel getEntityModel(String name)
IRelationalDataSource
getEntityModel in interface IRelationalDataSourcename - the name of the EntityModel to retrieve
public NodeEntityModel createNode()
createNode in interface IRelationalDataSourcepublic EdgeEntityModel createEdge()
createEdge in interface IRelationalDataSourcepublic String[] getTypeChain(String type)
protected URL getURL(EntityModel em)
throws IOException
em -
Exception
IOExceptionpublic void addEntityModel(EntityModel model)
model - public void setThinkmapConfig(ThinkmapConfig config)
config - public void setContext(IThinkmapContext context)
context - public void setMemoryOnly(boolean memory)
memory - public void setDefaultMaxSearchResults(int defaultMaxSearchResults)
defaultMaxSearchResults - public void setDebugLevel(int level)
level - public void setIndexPath(File path)
path - public void setCreateNewIndexOnStart(boolean create)
create - public void setErrorThreshold(int threshold)
threshold - public void setWarningThreshold(int threshold)
threshold - public void setIndexingNotificationInterval(int indexingNotificationInterval)
indexingNotificationInterval - public boolean isWriting()
public boolean isIndexing()
public void reindexAsync(boolean create)
public void reindex(boolean create)
create - public void stopIndexing()
protected void index(boolean create)
throws IOException
create -
IOException
Exceptionprotected Indexer createIndexer()
public Set<FieldDef<?>> getFields(String name)
getFields in interface Searchable
public void init()
throws Exception
Exception
public void shutDown()
throws Exception
Exception
protected org.apache.lucene.store.Directory getIndexDir()
throws IOException
IOException
protected boolean isCurrent(EntityModel model,
long lastModified)
model -
protected void initializeEdgeModel(FFEdgeEntityModel model)
throws Exception
model -
Exception
protected thinkmap.datasource.flatfile2.IFFEntityModel unpackModel(org.apache.lucene.document.Document doc)
throws IOException,
ClassNotFoundException
doc -
IOException
ClassNotFoundException
protected void getRelated(EntityId id,
IEntityHandler callback)
throws Exception
entityId - callback -
Exceptionprotected EntityWriter getWriter(org.apache.lucene.document.Document d)
protected org.apache.lucene.document.Document getDocumentForEntity(EntityId id)
throws IOException
id -
Exception
IOException
protected void processMetadataRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processMetadataRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processIdRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processIdRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processEntityRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processEntityRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void processRelatedRequest(Message message,
IEntityHandler callback)
AbstractDataSource
processRelatedRequest in class AbstractDataSourcemessage - The incoming request, packaged into a handy object.callback - The IEntityHandler which will receive the response.
protected void reportClientMessage(IEntityHandler callback,
Exception e)
callback - level - message - e -
protected void reportServerMessage(int level,
String message,
Exception e)
level - message - e -
protected IFlatFileReader createReader(thinkmap.datasource.flatfile2.IFFEntityModel model,
URL url)
throws IOException
model - url -
IOException
MalformedURLException
UnsupportedEncodingExceptionprotected EntityWriter getWriter(String name)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||