Revision: 16730
http://sourceforge.net/p/gate/code/16730
Author: johann_p
Date: 2013-07-08 18:13:09 +0000 (Mon, 08 Jul 2013)
Log Message:
-----------
Make sure that if a subpipeline gets notified, its
corpus is set correctly.
Modified Paths:
--------------
gate/trunk/src/gate/creole/ConditionalSerialAnalyserController.java
gate/trunk/src/gate/creole/SerialAnalyserController.java
Modified: gate/trunk/src/gate/creole/ConditionalSerialAnalyserController.java
===================================================================
--- gate/trunk/src/gate/creole/ConditionalSerialAnalyserController.java
2013-07-08 15:57:00 UTC (rev 16729)
+++ gate/trunk/src/gate/creole/ConditionalSerialAnalyserController.java
2013-07-08 18:13:09 UTC (rev 16730)
@@ -98,6 +98,15 @@
// running as a subpipeline of another corpus pipeline.
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is
set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to
know about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionStarted(this);
}
}
@@ -119,7 +128,17 @@
// successfully completed
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionFinished(this);
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
}
@@ -127,7 +146,17 @@
// aborted
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionAborted(this, thrown);
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
// rethrow the aborting exception or error
@@ -426,6 +455,15 @@
public void controllerExecutionStarted(Controller c)
throws ExecutionException {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionStarted(this);
}
@@ -435,7 +473,22 @@
public void controllerExecutionFinished(Controller c)
throws ExecutionException {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionFinished(this);
+ // after notification, set the corpus back to null
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
@@ -443,7 +496,22 @@
public void controllerExecutionAborted(Controller c, Throwable t)
throws ExecutionException {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionAborted(c, t);
+ // after notification, set the corpus back to null
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
}
Modified: gate/trunk/src/gate/creole/SerialAnalyserController.java
===================================================================
--- gate/trunk/src/gate/creole/SerialAnalyserController.java 2013-07-08
15:57:00 UTC (rev 16729)
+++ gate/trunk/src/gate/creole/SerialAnalyserController.java 2013-07-08
18:13:09 UTC (rev 16730)
@@ -92,6 +92,11 @@
// running as a subpipeline of another corpus pipeline.
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionStarted(this);
}
}
@@ -113,7 +118,17 @@
// successfully completed
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionFinished(this);
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
}
@@ -121,7 +136,17 @@
// aborted
if(!runningAsSubPipeline) {
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionAborted(this, thrown);
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
}
}
// rethrow the aborting exception or error
@@ -380,24 +405,63 @@
@Override
public void controllerExecutionStarted(Controller c)
throws ExecutionException {
- // TODO Auto-generated method stub
for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
pr.controllerExecutionFinished(this);
}
-
}
@Override
public void controllerExecutionFinished(Controller c)
throws ExecutionException {
- // TODO Auto-generated method stub
-
+ for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
+ pr.controllerExecutionFinished(this);
+ // after notification, set the corpus back to null
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
+ }
}
@Override
public void controllerExecutionAborted(Controller c, Throwable t)
throws ExecutionException {
- // TODO Auto-generated method stub
-
+ for(ControllerAwarePR pr : getControllerAwarePRs()) {
+ // If the pr is a nested corpus controller, make sure its corpus is set
+ // This is necessary because the nested corpus controller will
immediately
+ // notify its own controller aware PRs and those should be able to know
about
+ // the corpus.
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(corpus);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(corpus);
+ }
+ pr.controllerExecutionAborted(c, t);
+ // after notification, set the corpus back to null
+ if(pr instanceof ConditionalSerialAnalyserController) {
+ ((ConditionalSerialAnalyserController)pr).setCorpus(null);
+ } else if(pr instanceof SerialAnalyserController) {
+ ((SerialAnalyserController)pr).setCorpus(null);
+ }
+ }
}
}
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:
Build for Windows Store.
http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
GATE-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gate-cvs