Rad, the callback listener is registered with the CPE to receive
notifications. The example code uses class StatusCallbackListenerImpl() but
you can create your own listener and plug it into the CPE. Just
implement StatusCallbackListener interface. Look at the java docs for
details.
The listener's methods are called to make the application aware of certain
CPE events like:

- CPE initialization complete
- when a CAS is processed
- when there is an exception while processing a CAS
- when the collection is completed

Again look at the java docs and also check:

org.apache.uima.examples.cpe.SimpleRunCPE.java in the
%UIMA_HOME%\examples\src directory for the complete code

Regards, Jerry C

On Thu, Jan 14, 2010 at 10:20 AM, Radwen ANIBA <[email protected]> wrote:

> yes, thank you I think a combination of the two last answers were right.
>
> but now i'm facing another problem
>
> package org.apache.uima.al;
>
> import org.apache.uima.UIMAFramework;
> import org.apache.uima.collection.CollectionProcessingEngine;
> import org.apache.uima.collection.metadata.CpeDescription;
> import org.apache.uima.util.*;
> import org.apache.uima.collection.StatusCallbackListener;
>
> public class RunAlexsys {
>
>
>    void RunAlexSys(){
>
>    XMLInputSource in = new XMLInputSource("MyDescriptor.xml");
>    CpeDescription cpeDesc =
> UIMAFramework.getXMLParser().parseCpeDescription(in);
>
>          //instantiate CPE
>    CollectionProcessingEngine mCPE =
> UIMAFramework.produceCollectionProcessingEngine(cpeDesc);
>
>          //Create and register a Status Callback Listener
>    mCPE.addStatusCallbackListener(new StatusCallbackListenerImpl());
>
>          //Start Processing
>    mCPE.process();
>
>
>
> }
> }
>
>
>
> in   mCPE.addStatusCallbackListener(new StatusCallbackListenerImpl());
>
> What is the role of this line exactely ?
>
>
> Rad
>
> 2010/1/14 LeHouillier, Frank D <[email protected]>
>
> > Maybe you need to be using a org.apache.uima.util.XMLInputSource instead
> of
> > a
> > com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource
> > ________________________________________
> > From: Radwen ANIBA [[email protected]]
> > Sent: Thursday, January 14, 2010 9:34 AM
> > To: [email protected]
> > Subject: Re: Calling CPE from a java application
> >
> > No I verified that, here is the code
> >
> > package org.apache.uima.al;
> >
> > import org.apache.uima.UIMAFramework;
> > import org.apache.uima.collection.CollectionProcessingEngine;
> > import org.apache.uima.collection.metadata.CpeDescription;
> > import org.apache.uima.util.*;
> > import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
> >
> > public class RunAlexsys {
> >
> >
> >
> >
> >    CpeDescription cpeDesc =
> > UIMAFramework.getXMLParser().parseCpeDescription(new
> > XMLInputSource("filename"));
> >
> >          //instantiate CPE
> >    mCPE = UIMAFramework.produceCollectionProcessingEngine(cpeDesc);
> >
> >          //Create and register a Status Callback Listener
> >    mCPE.addStatusCallbackListener(new StatusCallbackListenerImpl());
> >
> >          //Start Processing
> >    mCPE.process();
> >
> >
> >
> > }
> >
> >
> >
> >
> > 2010/1/14 Jörn Kottmann <[email protected]>
> >
> > > Radwen ANIBA wrote:
> > >
> > >> I dont really get error since I dont run the application yet but in
> > >> eclipse
> > >> it is marked with red cross telling me that's wrong and proposing me
> to
> > >> change the parseCpeDescription !!
> > >>
> > >>
> > >>
> > > There is usually an error message attached to the error marker
> > > in eclipse. In your case it will contain the reason why it cannot
> > > compile the class.
> > >
> > > Maybe you are missing an import for CpeDescription, UIMAFramework,
> > > XMLInputSource ?
> > >
> > > Jörn
> > >
> >
>

Reply via email to