Package java.lang.reflect

Examples of java.lang.reflect.InvocationTargetException


        }
    catch(Throwable t)
    {
            if( t instanceof InvocationTargetException)
            {
                InvocationTargetException ite = (InvocationTargetException) t;
                Throwable wrappedThrowable = ite.getTargetException();
                if( wrappedThrowable instanceof StandardException)
                    throw (StandardException) wrappedThrowable;
            }
      throw StandardException.unexpectedUserException(t);
    }
View Full Code Here


        BeanExchange exchange = getEndpoint().createExchange();
        exchange.setInvocation(invocation);
        getProcessor().process(exchange);
        Throwable fault = exchange.getException();
        if (fault != null) {
            throw new InvocationTargetException(fault);
        }
        return exchange.getOut().getBody();
    }
View Full Code Here

        BeanExchange exchange = getEndpoint().createExchange();
        exchange.setInvocation(invocation);
        getProcessor().process(exchange);
        Throwable fault = exchange.getException();
        if (fault != null) {
            throw new InvocationTargetException(fault);
        }
        return exchange.getOut().getBody();
    }
View Full Code Here

    }

    public void setExceptionMutableInt(int exceptionMutableInt) throws InvocationTargetException {
        this.exceptionMutableInt = exceptionMutableInt;
        if (exceptionMutableInt == -1) {
            throw new InvocationTargetException(new Exception("Thrown when -1"));
        }
        if (exceptionMutableInt == -2) {
            throw new InvocationTargetException(new Error("Thrown when -2"));
        }
        if (exceptionMutableInt == -3) {
            throw new InvocationTargetException(new Throwable("Thrown when -3"));
        }
    }
View Full Code Here

        }
    }

    public int getExceptionMutableInt() throws InvocationTargetException {
        if (this.exceptionMutableInt == -1) {
            throw new InvocationTargetException(new Exception("Thrown when -1"));
        }
        if (this.exceptionMutableInt == -2) {
            throw new InvocationTargetException(new Error("Thrown when -2"));
        }
        if (exceptionMutableInt == -3) {
            throw new InvocationTargetException(new Throwable("Thrown when -3"));
        }
        return this.exceptionMutableInt;
    }
View Full Code Here

      final IDocument doc;

      try {
        doc = documentElement.getDocument(false);
      } catch (CoreException e) {
        throw new InvocationTargetException(e);
      }

      boolean wasCasChanged = process(doc.getCAS());

      if (wasCasChanged) {
View Full Code Here

  @Override
  protected void initialize() throws InvocationTargetException {
    try {
      annotatorInstance = mAnnotatorConfiguration.createAnnotator();
    } catch (final ResourceInitializationException e) {
      throw new InvocationTargetException(e);
    }
  }
View Full Code Here

  protected boolean process(CAS cas) throws InvocationTargetException {

  try {
      annotatorInstance.process(cas);
    } catch (AnalysisEngineProcessException e) {
      throw new InvocationTargetException(e);
    }

    return true;
  }
View Full Code Here

  protected void completedProcessing(IProgressMonitor monitor)
      throws InvocationTargetException {
  try {
      annotatorInstance.collectionProcessComplete();
    } catch (AnalysisEngineProcessException e) {
      throw new InvocationTargetException(e);
    }

    annotatorInstance.destroy();
    annotatorInstance = null;
   
View Full Code Here

                    new XMLInputSource(inCollectionReaderDescripton,
                            new File("")));
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e, "CorporaCollectionReader.xml"
                    + " could ne be parsed!");
        }
       
        NlpProject project =
                mConfiguration.getConsumerElement().getNlpProject();
       
        InputStream inTypeSystemDescription;
        try
        {
            inTypeSystemDescription =
                project.getDotCorpus().getTypeSystemFile().getContents();
        }
        catch (CoreException e)
        {
            throw new InvocationTargetException(e);
        }
       
        TypeSystemDescription typeSystemDescriptor;
        try
        {
            typeSystemDescriptor = UIMAFramework.getXMLParser()
            .parseTypeSystemDescription(
                    new XMLInputSource(inTypeSystemDescription, new File("")));
           
            typeSystemDescriptor.resolveImports();
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
        }
       
//      set type system to collection reader
        ProcessingResourceMetaData collectionReaderMetaData =
            collectionReaderDescripton.getCollectionReaderMetaData();
       
        collectionReaderMetaData.setTypeSystem(typeSystemDescriptor);
       
        XMLParser xmlParser = UIMAFramework.getXMLParser();
       
        InputStream inIndex = getClass().getResourceAsStream(
                "Index.xml");

        if (inIndex == null)
        {
            throw new InvocationTargetException(null,
                    "org/apache/uima/caseditor/ui/action/Index.xml"
                    + " is missing on the classpath");
        }
       
        XMLInputSource xmlIndexSource = new XMLInputSource(inIndex,
                new File(""));
       
        FsIndexDescription indexDesciptor;
       
        try
        {
            indexDesciptor = (FsIndexDescription) xmlParser
            .parse(xmlIndexSource);
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
        }
       
        collectionReaderMetaData.setFsIndexes(new FsIndexDescription[]
                {indexDesciptor});
       
        CollectionReader collectionReader;
        try
        {
            collectionReader = UIMAFramework
                    .produceCollectionReader(collectionReaderDescripton);
        }
        catch (ResourceInitializationException e)
        {
            throw new InvocationTargetException(e);
        }
       
        ((CorporaCollectionReader) collectionReader).setCorpora(mCorpora);
       
        InputStream in = getClass().getResourceAsStream("DummyTAE.xml");
       
//      load dummy descriptor
        ResourceSpecifier textAnalysisEngineSpecifier;
        try
        {
            textAnalysisEngineSpecifier = UIMAFramework.getXMLParser()
                    .parseResourceSpecifier(
                    new XMLInputSource(in, new File("")));
        }
        catch (InvalidXMLException e)
        {
            throw new InvocationTargetException(e);
        }
       
        AnalysisEngine textAnalysisEngine;
        try
        {
            textAnalysisEngine = UIMAFramework
                    .produceAnalysisEngine(textAnalysisEngineSpecifier);
        }
        catch (ResourceInitializationException e)
        {
            throw new InvocationTargetException(e);
        }
       
        CollectionProcessingManager collectionProcessingEngine = UIMAFramework
                .newCollectionProcessingManager();
       
        try
        {
            collectionProcessingEngine.setAnalysisEngine(textAnalysisEngine);
        }
        catch (ResourceConfigurationException e)
        {
            throw new InvocationTargetException(e);
        }
       
        try
        {
            collectionProcessingEngine.addCasConsumer(mConfiguration
                    .createConsumer());
        }
        catch (ResourceConfigurationException e)
        {
            throw new InvocationTargetException(e);
        }
       
        collectionProcessingEngine.setPauseOnException(false);
       
        collectionProcessingEngine.addStatusCallbackListener(
                new StatusCallbackListener(){
           
            public void entityProcessComplete(CAS cas,
                    EntityProcessStatus status)
            {
                // not implemented
            }
           
            public void aborted()
            {
                finishProcessing();
            }
           
            public void batchProcessComplete()
            {
                // not implemented
            }
           
            public void collectionProcessComplete()
            {
                finishProcessing();
            }
           
            public void initializationComplete()
            {
                // not implemented
            }
           
            public void paused()
            {
                // not implemented
            }
           
            public void resumed()
            {
                // not implemented
            }
           
            private void finishProcessing()
            {
                synchronized (ConsumerActionRunnable.this)
                {
                    mIsProcessing = false;
                    ConsumerActionRunnable.this.notifyAll();
                }
            }
        });
       
        monitor.subTask("Feeding comsumer, please stand by.");

        try
        {
            collectionProcessingEngine.process(collectionReader);
        }
        catch (ResourceInitializationException e)
        {
            throw new InvocationTargetException(e);
        }
       
        synchronized(this)
        {
            // TODO: for cancel poll here
View Full Code Here

TOP

Related Classes of java.lang.reflect.InvocationTargetException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.