org.hwo.pulscounter/src/org/hwo/pulscounter/ui/BatchRunner.java

67 lines
1.6 KiB
Java
Raw Normal View History

2016-09-06 16:49:11 +02:00
package org.hwo.pulscounter.ui;
import org.hwo.pulscounter.ExportSetting;
2016-09-08 18:47:31 +02:00
import org.hwo.pulscounter.PulsCounterApplication;
2016-09-06 16:49:11 +02:00
import org.hwo.pulscounter.PulsCounterApplicationListener;
import org.hwo.pulscounter.SnapshotManager.Notification;
import org.hwo.servicelink.ServiceLinkException;
public class BatchRunner implements PulsCounterApplicationListener{
2016-09-08 18:47:31 +02:00
private PulsCounterApplication pulsCounterApplication;
2016-09-06 16:49:11 +02:00
2016-09-08 18:47:31 +02:00
public BatchRunner(PulsCounterApplication pulsCounterApplication){
this.pulsCounterApplication = pulsCounterApplication;
pulsCounterApplication.addPulsCounterApplicationListener(this);
pulsCounterApplication.notifyUiIsFinished(true);
2016-09-06 16:49:11 +02:00
2016-09-08 18:47:31 +02:00
// run();
2016-09-06 16:49:11 +02:00
}
public void run(){
try {
2016-09-08 18:47:31 +02:00
pulsCounterApplication.getServiceLink().open();
2016-09-06 16:49:11 +02:00
Thread.sleep(500);
2016-09-08 18:47:31 +02:00
pulsCounterApplication.getSnapshotManager().doFullSync();
2016-09-06 16:49:11 +02:00
2016-09-08 18:47:31 +02:00
for (ExportSetting es: pulsCounterApplication.getExportSettings()){
2016-09-06 16:49:11 +02:00
if (es.getAutostart()){
es.export();
}
}
} catch (ServiceLinkException e) {
e.printStackTrace();
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
2016-09-08 18:47:31 +02:00
pulsCounterApplication.notifyUiIsFinished(false);
2016-09-06 16:49:11 +02:00
}
@Override
public void messageArrived(String message) {
System.err.println(message);
}
2016-09-08 18:47:31 +02:00
@Override
public void interfaceClassesChanged(PulsCounterApplication pulsCounterApplication) {
// TODO Auto-generated method stub
}
@Override
public void interfacesChanged(PulsCounterApplication pulsCounterApplication) {
// TODO Auto-generated method stub
}
2016-09-06 16:49:11 +02:00
}