use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class QueuePreventingScanSubmitter method getSubmitter.
private ISubmitter<ScanBean> getSubmitter() throws EventException {
if (submitter == null) {
Objects.requireNonNull(eventService, "Event service is not set - check OSGi settings");
try {
URI queueServerURI = new URI(LocalProperties.getActiveMQBrokerURI());
submitter = eventService.createSubmitter(queueServerURI, EventConstants.SUBMISSION_QUEUE);
} catch (URISyntaxException e) {
throw new EventException("URI syntax problem", e);
}
}
return submitter;
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class NexusExperimentController method closeNode.
private NodeFileCreationRequest closeNode(ExperimentNode node) throws ExperimentControllerException {
NodeFileCreationRequest job = null;
// no need to create a node file if the node is childless
if (!node.hasChildren())
return job;
job = createNodeFileCreationRequestJob(node);
try {
job = nodeFileRequesterService.getNodeFileCreationRequestResponse(job);
if (job.getStatus() == Status.FAILED) {
throw new ExperimentControllerException(job.getMessage());
}
} catch (EventException | InterruptedException e) {
// NOSONAR please, since we are rethrowing
throw new ExperimentControllerException(e);
}
return job;
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class ScanningAcquisitionService method run.
/**
* Submits the acquisition request to an {@link IScanBeanSubmitter}
*
* @param message
* the scanning acquisition message
* @throws ScanningAcquisitionServiceException
* if not {@link IRunnableDeviceService} is available or if {@link ISubmitter#submit(Object)} raises an
* {@link EventException}
*/
public void run(AcquisitionBase<? extends AcquisitionConfigurationBase<? extends AcquisitionParametersBase>> acquisition) throws ScanningAcquisitionServiceException {
try {
// default path name
var pathName = "ScanningAcquisition";
var scanBean = new ScanBean();
scanBean.setName(String.format("%s - %s Scan", acquisition.getName(), pathName));
scanBean.setFilePath(acquisition.getAcquisitionLocation().toExternalForm());
scanBean.setBeamline(System.getProperty("BEAMLINE", "dummy"));
var tsr = new ScanRequestFactory(acquisition);
scanBean.setScanRequest(tsr.createScanRequest(getRunnableDeviceService()));
getScanBeanSubmitter().submit(scanBean);
} catch (Exception e) {
throw new ScanningAcquisitionServiceException("Cannot submit acquisition", e);
}
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class MappingTriggerProcessor method process.
@Override
public IdBean process(Triggerable triggerable) {
TriggerableMap map = (TriggerableMap) triggerable;
ScanBean scanBean = map.trigger();
try {
URL url = SpringApplicationContextFacade.getBean(ExperimentController.class).prepareAcquisition(map.getName());
scanBean.getScanRequest().setFilePath(url.getFile());
} catch (ExperimentControllerException e) {
logger.error("Error getting URL for triggered scan - data will not reflect experiment structure", e);
}
try {
if (map.isImportant()) {
scanSubmitter.submitImportantScan(scanBean);
} else {
scanSubmitter.submitScan(scanBean);
}
} catch (ScanningException | EventException e) {
logger.error("Could not submit scan", e);
}
return scanBean;
}
use of org.eclipse.scanning.api.event.EventException in project gda-core by openGDA.
the class FocusScanResultPage method startFocusScan.
private void startFocusScan() {
// set the page as incomplete, disables Finish button while scan is running
setPageComplete(false);
plotTraceRunnable.set(null);
initialMapFile = null;
// add a listener for map file events
if (mapFileEventListener == null) {
mapFileEventListener = this::handleMapEvent;
mapFileController.addListener(mapFileEventListener);
}
// create the ScanBean from the focus scan bean
final ScanBean scanBean = new ScanBean();
scanBean.setName(String.format("%s - Focus Scan", getSampleName()));
scanBean.setBeamline(System.getProperty("BEAMLINE"));
ScanRequest scanRequest = converter.convertToScanRequest(focusScanBean);
scanBean.setScanRequest(scanRequest);
// submit the ScanBean
try {
statusBean = scanBean;
submitter.submitScan(scanBean);
messageLabel.setText("Waiting for scan to start");
startScanButton.setEnabled(false);
stopScanButton.setEnabled(true);
} catch (EventException e) {
logger.error("Scan submission failed", e);
MessageDialog.openError(getShell(), "Error Submitting Scan", "The scan could not be submitted. See the error log for more details.");
}
}
Aggregations