|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.dfki.lt.hog.MoCoMan
public class MoCoMan
The Module Communication Manager for the DeepThought project. It
manages sessions opened with several applications along with
documents analysed during such a session. For communication with
remote modules XML-RPC is used and a config file
mocoman.cfg
specifies the port of its server.
MoCoMan
is implemented as a Singleton class which means
that not a constructor but the method getInstance
has to
be called in order to get an instance of MoCoMan
.
Constructor Summary | |
---|---|
protected |
MoCoMan()
Creates an instance of MoCoMan . |
Method Summary | |
---|---|
java.lang.String |
analyse(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String annId,
java.lang.Integer startSpan,
java.lang.Integer endSpan,
java.lang.Integer depth)
Analyses a document given as XML string via XML-RPC. |
java.lang.String |
analyse(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String annId,
int startSpan,
int endSpan,
int depth)
Analyses a document given as XML string. |
byte[] |
analyseBinary(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String annId,
java.lang.Integer startSpan,
java.lang.Integer endSpan,
java.lang.Integer depth)
Analyses a document given as XML string via XML-RPC. |
byte[] |
analyseBinary(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String annId,
java.lang.Integer startSpan,
java.lang.Integer endSpan,
java.lang.Integer depth,
java.lang.String encoding)
Analyses a document given as XML string via XML-RPC. |
byte[] |
analyseBinary(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String annId,
int startSpan,
int endSpan,
int depth)
Analyses a document given as XML string via XML-RPC. |
org.w3c.dom.Node |
analyseDOMTree(java.lang.String sid,
java.lang.String aid,
int startSpan,
int endSpan,
int depth)
Analyses a document given as DOM tree. |
void |
clearAnnotationCollection(java.lang.String sessionId,
java.lang.String annCollId)
|
boolean |
closeSession(java.lang.String sessionId)
Closes a session with MoCoMan. |
java.lang.String |
createAnnotation(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String ann,
java.lang.String language,
java.lang.String anId)
Creates a new annotation for a given session and annotation collection each of them specified by their ID. |
java.lang.String |
createAnnotationCollection(java.lang.String sessionId)
Creates an annotation collection for a session specified by a given session ID. |
java.lang.String |
createInitialAnnotation(java.lang.String sessionId,
java.lang.String annCollId,
byte[] rawtext,
java.lang.String language,
java.lang.String component)
Creates two initial annotations in a given session/collection: 1. |
java.lang.String |
createInitialAnnotation(java.lang.String sessionId,
java.lang.String annCollId,
byte[] rawtext,
java.lang.String language,
java.lang.String component,
java.lang.String encoding)
Creates two initial annotations in a given session/collection: 1. |
java.lang.String |
createInitialAnnotation(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String rawtext,
java.lang.String language,
java.lang.String component)
Creates two initial annotations in a given session/collection: 1. |
java.lang.String |
createInitialAnnotation(java.lang.String sessionId,
java.lang.String annCollId,
java.lang.String rawtext,
java.lang.String language,
java.lang.String component,
java.lang.String encoding)
Creates two initial annotations in a given session/collection: 1. |
java.lang.String |
createSession(java.lang.String configFileName)
Creates a Session configured through
a config file from which
Properties are derived. |
java.lang.String |
createSession(java.lang.String configFileName,
java.lang.String sessionId)
Creates a Session configured through a config file from
which Properties are derived. |
java.lang.String |
getAllLogMessages()
|
java.lang.String |
getAnnotation(java.lang.String sessId,
java.lang.String annCollId,
java.lang.String annId)
Retrieves an annotation belonging to a given session and annotation collection specified by an annotation ID. |
java.lang.String |
getAnnotation7bit(java.lang.String sessId,
java.lang.String annCollId,
java.lang.String annId)
Retrieves an annotation converting it to 7-bit encoded unicode before returning. |
byte[] |
getAnnotationBinary(java.lang.String sessId,
java.lang.String annCollId,
java.lang.String annId)
Retrieves an annotation belonging to a given session and annotation collection specified by an annotation ID. |
byte[] |
getAnnotationBinary(java.lang.String sessId,
java.lang.String annCollId,
java.lang.String annId,
java.lang.String encoding)
Retrieves an annotation belonging to a given session and annotation collection specified by an annotation ID. |
java.lang.String |
getAnnotationIds(java.lang.String sessionId,
java.lang.String collectionId)
Returns all annotation IDs in a given session.collection as a comma-sep. |
protected java.util.Properties |
getConfig()
Returns configuration for this MoCoMan
as Properties object. |
XMLDBAnnotationDatabase |
getDatabase()
Returns the XML:DB annotation database in which all documents and annotations are stored. |
java.lang.String |
getDatabaseLocation()
Returns an URL where the XML:DB annotation database is located. |
java.lang.String |
getFormatedUptime()
Returns the amount of time elapsed since the creation of this instance as a readable String. |
static MoCoMan |
getInstance()
Creates an instance of MoCoMan if none exists. |
java.lang.String |
getLast100LogMessages()
|
java.lang.String |
getLast20LogMessages()
|
java.lang.String |
getLast500LogMessages()
|
java.lang.String |
getLast5LogMessages()
|
java.lang.String |
getLastLogMessage()
|
java.lang.String |
getLastLogMessage(int n)
Returns the last n messages as read from the log4j html log file. |
java.lang.String |
getLogString()
compute configured log4j HTML appender and return its file content as String |
java.lang.String |
getNumLogMesgs()
Returns the number of messages currently in the html log file. |
int |
getSentenceCount()
Return the number of processed (and counted) sentences. |
MoCoManServer |
getServer()
Returns the instance of the XML-RPC server frontend using this instance as the backend. |
static java.util.Hashtable |
getSessions()
Returns all Session objects stored in a
Hashtable . |
java.lang.String |
getStatus()
Generates and returns a summary String of the current status of this instance. |
java.lang.String |
getStatusXml()
|
long |
getUniqueID()
|
long |
getUptime()
Returns the amount of time elapsed since the creation of this instance in millisecond. |
java.lang.String |
getXmlAnnotationIds(java.lang.String sessionId,
java.lang.String collectionId)
Returns those annotation IDs in a given session.collection where the annotation is present in XML format. |
java.lang.String |
hasSession(java.lang.String sessionId)
|
void |
increaseSentenceCount()
Increases the sentence counter of this instance by 1. |
static java.lang.String |
pseudoString2String(java.lang.String source,
java.lang.String eightbitencoding)
Utility method that turns an incorrectly encoded (converted) String into a correctly encoded Java Unicode String according to the specified encoding. |
int |
queryProcessed(java.lang.String sid,
java.lang.String did,
int startSpan,
int endSpan,
int depth)
|
static java.lang.String |
sayHello()
Return a greeting ( String ). |
void |
setServer(MoCoManServer server)
Links the given XML-RPC server to this instance. |
boolean |
shutdown()
Shuts down MoCoMan. |
static java.lang.String |
String2pseudoString(java.lang.String source,
java.lang.String eightbitencoding)
Utility method that turns a Java Unicode String into a pseudo 8 bit encoded String according to the specified encoding. |
void |
writeEncodedFile(java.lang.String sFilename,
java.lang.String sContent,
java.lang.String encoding)
|
java.lang.String |
xml2htmlTransformer(java.lang.String sid,
java.lang.String acid,
java.lang.String aid,
java.lang.String stylesheetName,
java.lang.String insertText)
Transform an annotation to HTML with special handling for RMRS, where a <text> element is inserted iff insertText==1 |
java.lang.String |
xml2htmlTransformer7bit(java.lang.String sid,
java.lang.String acid,
java.lang.String aid,
java.lang.String stylesheetName,
java.lang.String insertText)
Transform an annotation to HTML with special handling for RMRS, where a <text> element is inserted iff insertText==1 |
byte[] |
xmlTransformerBinary(java.lang.String sid,
java.lang.String acid,
java.lang.String aid,
java.lang.String stylesheetName,
java.lang.String insertText)
Transform an annotation to HTML with special handling for RMRS, where a <text> element is inserted iff insertText==1 |
byte[] |
xmlTransformerBinary(java.lang.String sid,
java.lang.String acid,
java.lang.String aid,
java.lang.String stylesheetName,
java.lang.String insertText,
java.lang.String encoding)
Transform an annotation to HTML with special handling for RMRS, where a <text> element is inserted iff insertText==1 |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected MoCoMan()
MoCoMan
.
Reads the config file, derives a Properties
object from it, sets up a logger, an XML-RPC server and the
XML:DB annotation database.
gregul: changed from private to protected for tomcat version of hog
Method Detail |
---|
public static MoCoMan getInstance()
MoCoMan
if none exists.
This controls access to the instance of MoCoMan
.
MoCoMan
protected java.util.Properties getConfig()
MoCoMan
as Properties
object.
public static java.util.Hashtable getSessions()
Session
objects stored in a
Hashtable
.
public java.lang.String hasSession(java.lang.String sessionId)
public XMLDBAnnotationDatabase getDatabase()
public java.lang.String getDatabaseLocation()
public java.lang.String createSession(java.lang.String configFileName)
Session
configured through
a config file from which
Properties
are derived.
A topologically sorted dependency graph is created and stored
as an array.
configFileName
- a configuration file name
Session
public java.lang.String createSession(java.lang.String configFileName, java.lang.String sessionId)
Session
configured through a config file from
which Properties
are derived. A topologically sorted
dependency graph is created and stored as an array.
configFileName
- a configuration file namenamePrefix
- a prefix to the sessionId
Session
public boolean closeSession(java.lang.String sessionId)
close()
method of the Session
object to be closed. Removes
this Session
from the sessions Hashtable
sessionId
- the Session to be closedpublic java.lang.String createAnnotationCollection(java.lang.String sessionId)
true
also a annotation collection is created in the XML:DB annotation
database.
sessionId
- a session ID to specify a session for which a
collection shall be created
public java.lang.String createAnnotation(java.lang.String sessionId, java.lang.String annCollId, java.lang.String ann, java.lang.String language, java.lang.String anId)
true
the in the XML:DB
annotation database is also created an annotation.
The given annotation text is stored in an
Annotation
object along with its language and
ID which is usually the processing component or rawtext.
sessionId
- session ID referring to the session for which
an annotation shall be createdannCollId
- annotation collection ID referring to the session
for which an annotation shall be createdann
- annotation textlanguage
- annotation languageanId
- annotation ID
public java.lang.String createInitialAnnotation(java.lang.String sessionId, java.lang.String annCollId, java.lang.String rawtext, java.lang.String language, java.lang.String component)
sessionId
- session ID referring to the session for which
an annotation shall be createdannCollId
- annotation collection ID referring to the session
for which an annotation shall be createdrawtext
- the raw input textlanguage
- annatiotion languagecomponent
- the invoking component ID
public java.lang.String createInitialAnnotation(java.lang.String sessionId, java.lang.String annCollId, byte[] rawtext, java.lang.String language, java.lang.String component)
sessionId
- session ID referring to the session for which
an annotation shall be createdannCollId
- annotation collection ID referring to the session
for which an annotation shall be createdrawtext
- the raw input text (as UTF-8 byte array for XML-RPC)language
- annatiotion languagecomponent
- the invoking component ID
public java.lang.String createInitialAnnotation(java.lang.String sessionId, java.lang.String annCollId, byte[] rawtext, java.lang.String language, java.lang.String component, java.lang.String encoding)
sessionId
- session ID referring to the session for which
an annotation shall be createdannCollId
- annotation collection ID referring to the session
for which an annotation shall be createdrawtext
- the raw input text (byte array for XML-RPC)language
- annatiotion languagecomponent
- the invoking component IDencoding
- encoding of the String in byte array rawtext
public void clearAnnotationCollection(java.lang.String sessionId, java.lang.String annCollId)
public java.lang.String createInitialAnnotation(java.lang.String sessionId, java.lang.String annCollId, java.lang.String rawtext, java.lang.String language, java.lang.String component, java.lang.String encoding)
sessionId
- session ID referring to the session for which
an annotation shall be createdannCollId
- annotation collection ID referring to the session
for which an annotation shall be createdrawtext
- the raw input textlanguage
- annatiotion languagecomponent
- the invoking component IDencoding
- name of the 8 bit encoding rawtext is encoded in
public static java.lang.String pseudoString2String(java.lang.String source, java.lang.String eightbitencoding) throws java.io.UnsupportedEncodingException
source
- source string with incorrect encodingeightbitencoding
- name of encoding the source originally had
java.io.UnsupportedEncodingException
public static java.lang.String String2pseudoString(java.lang.String source, java.lang.String eightbitencoding) throws java.io.UnsupportedEncodingException
source
- source string with normal Java Unicode encodingeightbitencoding
- name of encoding the target should have
java.io.UnsupportedEncodingException
public java.lang.String analyse(java.lang.String sessionId, java.lang.String annCollId, java.lang.String annId, java.lang.Integer startSpan, java.lang.Integer endSpan, java.lang.Integer depth)
Vector
object which cannot store simple
int
values. Just calls analyse(String
sessionId, String annCollId, String annId, int startSpan,
int endSpan, int depth)
for analysis.
sessionId
- session ID of annotationannCollId
- annotation collection IDstartSpan
- endSpan
- depth
-
public byte[] analyseBinary(java.lang.String sessionId, java.lang.String annCollId, java.lang.String annId, java.lang.Integer startSpan, java.lang.Integer endSpan, java.lang.Integer depth)
Vector
object which cannot store simple
int
values. Just calls analyse(String
sessionId, String annCollId, String annId, int startSpan,
int endSpan, int depth)
for analysis.
sessionId
- session ID of annotationannCollId
- annotation collection IDstartSpan
- endSpan
- depth
-
public byte[] analyseBinary(java.lang.String sessionId, java.lang.String annCollId, java.lang.String annId, int startSpan, int endSpan, int depth)
Vector
object which cannot store simple
int
values. Just calls analyse(String
sessionId, String annCollId, String annId, int startSpan,
int endSpan, int depth)
for analysis.
sessionId
- session ID of annotationannCollId
- annotation collection IDstartSpan
- endSpan
- depth
-
public byte[] analyseBinary(java.lang.String sessionId, java.lang.String annCollId, java.lang.String annId, java.lang.Integer startSpan, java.lang.Integer endSpan, java.lang.Integer depth, java.lang.String encoding)
Vector
object which cannot store simple
int
values. Just calls analyse(String
sessionId, String annCollId, String annId, int startSpan,
int endSpan, int depth)
for analysis.
sessionId
- session ID of annotationannCollId
- annotation collection IDstartSpan
- endSpan
- depth
- encoding
- encoding of the returned byte array string
public java.lang.String analyse(java.lang.String sessionId, java.lang.String annCollId, java.lang.String annId, int startSpan, int endSpan, int depth)
sessionId
- session ID of annotationannCollId
- annotation collection IDstartSpan
- endSpan
- depth
-
public org.w3c.dom.Node analyseDOMTree(java.lang.String sid, java.lang.String aid, int startSpan, int endSpan, int depth)
sid
- session ID of annotationaid
- annotation IDstartSpan
- endSpan
- depth
-
public java.lang.String getAnnotation(java.lang.String sessId, java.lang.String annCollId, java.lang.String annId)
sessId
- session ID referring to the session for which
an annotation was createdannCollId
- annotation collection ID referring to the
annotation collection for which
an annotation was createdannId
- the ID of the annotation
public byte[] getAnnotationBinary(java.lang.String sessId, java.lang.String annCollId, java.lang.String annId)
sessId
- session ID referring to the session for which
an annotation was createdannCollId
- annotation collection ID referring to the
annotation collection for which
an annotation was createdannId
- the ID of the annotation
public byte[] getAnnotationBinary(java.lang.String sessId, java.lang.String annCollId, java.lang.String annId, java.lang.String encoding)
sessId
- session ID referring to the session for which
an annotation was createdannCollId
- annotation collection ID referring to the
annotation collection for which
an annotation was createdannId
- the ID of the annotationencoding
- encoding for byte array to return
public java.lang.String getAnnotation7bit(java.lang.String sessId, java.lang.String annCollId, java.lang.String annId)
public int queryProcessed(java.lang.String sid, java.lang.String did, int startSpan, int endSpan, int depth)
public MoCoManServer getServer()
public void setServer(MoCoManServer server)
server
- An XML-RPC server using this instance.public boolean shutdown()
null
which
is not supported by XML-RPC.
true
if the shutdown process was successful.public static java.lang.String sayHello()
String
). Use this method to conveniently
test a XML-RPC connection.
String
).public long getUptime()
public void increaseSentenceCount()
public int getSentenceCount()
public java.lang.String getFormatedUptime()
public java.lang.String getStatus()
Uptime: 4 minutes 44 seconds 816 milliseconds logger.host: localhost logger.path: log xmldb.usage: false xmldb.location: xmldb:xindice://clavinova:8080/db logger.port: 4445 logger.level: DEBUG logger.file: hoglog.html logger.format: html xmlrpc.server.port: 8411 |--session3 |--session2 | |--collection2 | | |--rawtext | | |--xmltext | |--collection1 |--session1 | |--collection2 | |--collection1 | | |--rawtext | | |--xmltext
public java.lang.String getStatusXml()
public java.lang.String getAnnotationIds(java.lang.String sessionId, java.lang.String collectionId)
public java.lang.String getXmlAnnotationIds(java.lang.String sessionId, java.lang.String collectionId)
public java.lang.String xml2htmlTransformer7bit(java.lang.String sid, java.lang.String acid, java.lang.String aid, java.lang.String stylesheetName, java.lang.String insertText)
sid
- session IDacid
- annotation collection IDaid
- annotation IDstyleSheetName
- name of the stylesheet to apply on the serverinsertText
- =="yes" means do insert the <text> elementpublic byte[] xmlTransformerBinary(java.lang.String sid, java.lang.String acid, java.lang.String aid, java.lang.String stylesheetName, java.lang.String insertText)
sid
- session IDacid
- annotation collection IDaid
- annotation IDstyleSheetName
- name of the stylesheet to apply on the serverinsertText
- =="yes" means do insert the <text> elementpublic byte[] xmlTransformerBinary(java.lang.String sid, java.lang.String acid, java.lang.String aid, java.lang.String stylesheetName, java.lang.String insertText, java.lang.String encoding)
sid
- session IDacid
- annotation collection IDaid
- annotation IDstyleSheetName
- name of the stylesheet to apply on the serverinsertText
- =="yes" means do insert the <text> elementencoding
- encoding of the returned byte array stringpublic java.lang.String xml2htmlTransformer(java.lang.String sid, java.lang.String acid, java.lang.String aid, java.lang.String stylesheetName, java.lang.String insertText)
sid
- session IDacid
- annotation collection IDaid
- annotation IDstyleSheetName
- name of the stylesheet to apply on the serverinsertText
- =="yes" means do insert the <text> elementpublic java.lang.String getLogString()
public java.lang.String getNumLogMesgs()
public java.lang.String getLastLogMessage(int n)
public java.lang.String getAllLogMessages()
public java.lang.String getLastLogMessage()
public java.lang.String getLast5LogMessages()
public java.lang.String getLast20LogMessages()
public java.lang.String getLast100LogMessages()
public java.lang.String getLast500LogMessages()
public long getUniqueID()
public void writeEncodedFile(java.lang.String sFilename, java.lang.String sContent, java.lang.String encoding)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |