Search in sources :

Example 1 with InputArgumentException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException in project UVMS-ExchangeModule-APP by UnionVMS.

the class PluginServiceBean method stop.

@Override
public boolean stop(String serviceClassName) throws ExchangeServiceException {
    if (serviceClassName == null) {
        throw new InputArgumentException("No service to stop");
    }
    try {
        if (isServiceRegistered(serviceClassName)) {
            String text = ExchangePluginRequestMapper.createStopRequest();
            producer.sendEventBusMessage(text, serviceClassName);
            return true;
        } else {
            throw new ExchangeServiceException("Service with service class name: " + serviceClassName + " does not exist");
        }
    } catch (ExchangeModelMarshallException e) {
        throw new ExchangeServiceException("[ Couldn't map stop request for " + serviceClassName + " ]");
    } catch (ExchangeMessageException e) {
        throw new ExchangeServiceException("[ Couldn't send stop request for " + serviceClassName + " ]");
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) InputArgumentException(eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 2 with InputArgumentException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException in project UVMS-ExchangeModule-APP by UnionVMS.

the class PluginServiceBean method start.

@Override
public boolean start(String serviceClassName) throws ExchangeServiceException {
    if (serviceClassName == null) {
        throw new InputArgumentException("No service to start");
    }
    try {
        if (isServiceRegistered(serviceClassName)) {
            String text = ExchangePluginRequestMapper.createStartRequest();
            producer.sendEventBusMessage(text, serviceClassName);
            return true;
        } else {
            throw new ExchangeServiceException("Service with service class name: " + serviceClassName + " does not exist");
        }
    } catch (ExchangeModelMarshallException e) {
        throw new ExchangeServiceException("[ Couldn't map start request for " + serviceClassName + " ]");
    } catch (ExchangeMessageException e) {
        throw new ExchangeServiceException("[ Couldn't send start request for " + serviceClassName + " ]");
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) InputArgumentException(eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Example 3 with InputArgumentException

use of eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException in project UVMS-ExchangeModule-APP by UnionVMS.

the class PluginServiceBean method ping.

@Override
public boolean ping(String serviceClassName) throws ExchangeServiceException {
    if (serviceClassName == null) {
        throw new InputArgumentException("No service to ping");
    }
    try {
        String text = ExchangePluginRequestMapper.createPingRequest();
        producer.sendEventBusMessage(text, serviceClassName);
        return true;
    } catch (ExchangeModelMarshallException e) {
        throw new ExchangeServiceException("[ Couldn't map ping request for " + serviceClassName + " ]");
    } catch (ExchangeMessageException e) {
        throw new ExchangeServiceException("[ Couldn't send ping request for " + serviceClassName + " ]");
    }
}
Also used : ExchangeModelMarshallException(eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException) InputArgumentException(eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException) ExchangeMessageException(eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException) ExchangeServiceException(eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)

Aggregations

ExchangeMessageException (eu.europa.ec.fisheries.uvms.exchange.message.exception.ExchangeMessageException)3 ExchangeModelMarshallException (eu.europa.ec.fisheries.uvms.exchange.model.exception.ExchangeModelMarshallException)3 ExchangeServiceException (eu.europa.ec.fisheries.uvms.exchange.service.exception.ExchangeServiceException)3 InputArgumentException (eu.europa.ec.fisheries.uvms.exchange.service.exception.InputArgumentException)3