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