Package org.apache.uima.adapter.vinci
Class VinciBinaryAnalysisEngineService_impl
- java.lang.Object
-
- org.apache.vinci.transport.VinciServableAdapter
-
- org.apache.uima.adapter.vinci.VinciBinaryAnalysisEngineService_impl
-
- All Implemented Interfaces:
TransportableFactory,VinciServable
public class VinciBinaryAnalysisEngineService_impl extends VinciServableAdapter
Main class for a Vinci Analysis Engine service that uses the binary CAS serialization, rather than XCAS. This class can also be used to deploy CAS Consumers as Vinci Services. The main method takes one argument - the path to the service deployment descriptor.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classVinciBinaryAnalysisEngineService_impl.ShutdownHookClass that handles service shutdowns (including Ctrl-C).
-
Field Summary
Fields Modifier and Type Field Description private VinciServer_serverThe server.private booleandebugThe debug.private DescriptordescriptorThe descriptor.private AnalysisEnginemAEThe m AE.private CasPoolmCasPoolThe m cas pool.private intserviceInstanceIdThe service instance id.
-
Constructor Summary
Constructors Constructor Description VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath)Instantiate Analysis Engine from a given descriptor.VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath, boolean debug)Instantiate Analysis Engine from a given descriptor - possibly in debug mode.VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath, boolean debug, java.lang.String instanceId)Instantiate Analysis Engine from a given descriptor - possibly in debug mode.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private Transportableanalyze(AFrame aRequestFrame)Analyzes a given document by a CasObjectProcessor.Transportableeval(Transportable doc)Main method called by the Vinci Service Layer.DescriptorgetDescriptor()Gets the descriptor.private FramegetMetaData()Extracts AE metadata.static voidmain(java.lang.String[] args)The main method.TransportablemakeTransportable()Make transportable.private static voidredirectLoggerOutput(java.io.OutputStream out)Redirects all logger output for this JVM to the given output stream.protected voidstart()Starts this service and associates a ShutdownHook to handle gracefull shutdown.voidstop()Terminate this service.-
Methods inherited from class org.apache.vinci.transport.VinciServableAdapter
cleanExit
-
-
-
-
Field Detail
-
_server
private VinciServer _server
The server.
-
mAE
private AnalysisEngine mAE
The m AE.
-
mCasPool
private CasPool mCasPool
The m cas pool.
-
descriptor
private Descriptor descriptor
The descriptor.
-
debug
private boolean debug
The debug.
-
serviceInstanceId
private int serviceInstanceId
The service instance id.
-
-
Constructor Detail
-
VinciBinaryAnalysisEngineService_impl
public VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath, boolean debug, java.lang.String instanceId) throws java.lang.ExceptionInstantiate Analysis Engine from a given descriptor - possibly in debug mode.- Parameters:
serviceConfigPath- descriptor locationdebug- the debuginstanceId- the instance id- Throws:
java.lang.Exception- the exception
-
VinciBinaryAnalysisEngineService_impl
public VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath, boolean debug) throws java.lang.ExceptionInstantiate Analysis Engine from a given descriptor - possibly in debug mode.- Parameters:
serviceConfigPath- descriptor locationdebug- the debug- Throws:
java.lang.Exception- the exception
-
VinciBinaryAnalysisEngineService_impl
public VinciBinaryAnalysisEngineService_impl(java.lang.String serviceConfigPath) throws java.lang.ExceptionInstantiate Analysis Engine from a given descriptor.- Parameters:
serviceConfigPath- descriptor location- Throws:
java.lang.Exception- the exception
-
-
Method Detail
-
getMetaData
private Frame getMetaData() throws java.lang.Exception
Extracts AE metadata.- Returns:
- Frame containing extracted meta data
- Throws:
java.lang.Exception- the exception
-
getDescriptor
public Descriptor getDescriptor()
Gets the descriptor.- Returns:
- the descriptor
-
analyze
private Transportable analyze(AFrame aRequestFrame) throws ServiceException
Analyzes a given document by a CasObjectProcessor. When completed this method returns a VinciFrame containing XCAS translated into a set of Vinci subFrames. Each subframe containing one annotation with all its attributes.- Parameters:
aRequestFrame- request frame- Returns:
- VinciFrame containing XCAS translated into a set of Vinci subframes.
- Throws:
ServiceException- the service exception
-
eval
public Transportable eval(Transportable doc) throws ServiceException
Main method called by the Vinci Service Layer. All requests coming in from clients go through this method. Each request comes in as a VinciFrame and is expected to contain a valid VINCI:COMMAND. Currently, two such operations are supported: 1) Annotate - triggers document analysis 2) GetData - triggers return of the AE meta data ( descriptor)- Specified by:
evalin interfaceVinciServable- Specified by:
evalin classVinciServableAdapter- Parameters:
doc-Transportable- a VinciFrame containing client request- Returns:
Transportable- a VinciFrame containg result of performing the service- Throws:
ServiceException- the service exception
-
start
protected void start()
Starts this service and associates a ShutdownHook to handle gracefull shutdown.
-
stop
public void stop()
Terminate this service.
-
main
public static void main(java.lang.String[] args)
The main method.- Parameters:
args- the arguments
-
redirectLoggerOutput
private static void redirectLoggerOutput(java.io.OutputStream out)
Redirects all logger output for this JVM to the given output stream.- Parameters:
out- the out
-
makeTransportable
public Transportable makeTransportable()
Make transportable.- Specified by:
makeTransportablein interfaceTransportableFactory- Overrides:
makeTransportablein classVinciServableAdapter- Returns:
- the transportable
- See Also:
TransportableFactory.makeTransportable()
-
-