org.apache.uima.simpleserver
Class Service

java.lang.Object
  extended by org.apache.uima.simpleserver.Service

public class Service
extends java.lang.Object

This is the main class of the project. It represents a wrapper over UIMA Framework. One Server instance is able to perform one task. The Server object must be created, configured (method configure(...)) and can be used by calling process(...) method.


Field Summary
protected  org.apache.uima.cas.CAS cas
           
protected  boolean initialized
           
protected  ResultExtractor resultExtractor
           
protected  ServerSpec serviceSpec
           
 
Constructor Summary
Service()
          Default constructor.
 
Method Summary
protected  void configure(java.io.File serviceSpecFile)
           
 void configureAnalysisEngine(java.io.File descriptorFile, java.io.File resultSpecXMLFile)
          Configure service with a UIMA descriptor.
 void configurePear(java.io.File pearFile, java.io.File pearInstallationDir, java.io.File serviceSpecFile)
          Configure service with a UIMA PEAR file.
static org.apache.uima.util.Logger getLogger()
           
 java.lang.String getServiceDescription()
          Delivers the service description as an XML document.
 ServerSpec getServiceSpec()
           
 java.lang.String getXMLResultXSD()
          Gets an XSD for the output format of the service.
protected  void logInitializationError()
           
 Result process(java.lang.String text)
           
 Result process(java.lang.String text, java.lang.String lang)
          Calls the services analysis engine on the input text, filters and produces the result.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

cas

protected org.apache.uima.cas.CAS cas

serviceSpec

protected ServerSpec serviceSpec

resultExtractor

protected ResultExtractor resultExtractor

initialized

protected volatile boolean initialized
Constructor Detail

Service

public Service()
Default constructor.

Method Detail

getLogger

public static org.apache.uima.util.Logger getLogger()

configureAnalysisEngine

public void configureAnalysisEngine(java.io.File descriptorFile,
                                    java.io.File resultSpecXMLFile)
                             throws SimpleServerException,
                                    java.io.IOException,
                                    org.apache.xmlbeans.XmlException
Configure service with a UIMA descriptor. AE code must be on the classpath.

Parameters:
descriptorFile - AE descriptor file.
resultSpecXMLFile - Service specification file.
Throws:
org.apache.xmlbeans.XmlException - If service spec is not valid XML.
java.io.IOException - On I/O problems (file not found etc).
SimpleServerException - Other initialization problems.

configurePear

public void configurePear(java.io.File pearFile,
                          java.io.File pearInstallationDir,
                          java.io.File serviceSpecFile)
                   throws java.io.IOException,
                          SimpleServerException,
                          org.apache.xmlbeans.XmlException
Configure service with a UIMA PEAR file. The PEAR is installed during installation.

Parameters:
pearFile - The PEAR file.
pearInstallationDir - The installation directory for the PEAR.
serviceSpecFile - Service specification file.
Throws:
org.apache.xmlbeans.XmlException - If service spec is not valid XML.
java.io.IOException - On I/O problems (file not found etc).
SimpleServerException - Other initialization problems.

configure

protected void configure(java.io.File serviceSpecFile)
                  throws java.io.IOException,
                         SimpleServerException,
                         org.apache.xmlbeans.XmlException
Throws:
java.io.IOException
SimpleServerException
org.apache.xmlbeans.XmlException

logInitializationError

protected final void logInitializationError()

getXMLResultXSD

public java.lang.String getXMLResultXSD()
Gets an XSD for the output format of the service.

Returns:
A string representation of the XSD; serialize as utf-8.

process

public Result process(java.lang.String text,
                      java.lang.String lang)
Calls the services analysis engine on the input text, filters and produces the result.


process

public Result process(java.lang.String text)

getServiceSpec

public ServerSpec getServiceSpec()

getServiceDescription

public java.lang.String getServiceDescription()
Delivers the service description as an XML document.



Copyright © 2011. All Rights Reserved.