public void afterPropertiesSet() throws Exception { if (interf == null && service == null && uri == null) { throw new MessagingException("interface, service or uri should be specified"); } }
/** * Check if the <code>DeliveryChannel</code> is opened * * @throws MessagingException */ public void checkDeliveryChannelIsOpened() throws MessagingException { if (!this.opened) { throw new MessagingException("DeliveryChannel is closed"); } }
protected void checkNotClosed() throws MessagingException { if (closed.get()) { throw new MessagingException("DeliveryChannel has been closed."); } }
/** * @inheritDoc */ public void removeAttachment(String id) throws MessagingException { Object att = attachments.remove(id); if (att == null) { throw new MessagingException(id + " attachment does not exist."); } }
protected void sendSync(MessageExchange me) throws MessagingException { if (!channel.sendSync(me)) { throw new MessagingException("SendSync failed"); } }
/** * Handles errors. * * @param message * a message * @param exchange * the exchange whose processing resulted in an error */ private void handleError(String message, Exchange exchange) { this.handleError(new MessagingException(message), exchange); }
public Map<String, Long> getExchangeHistory(String exchangeId) throws MessagingException { final Map<String, Long> result; try { result = this.persistenceService.getMessageExchangeHistory(exchangeId); } catch (SQLException e) { throw new MessagingException(e); } return result; }
public void unmonitorExchanges(QName interfaceName, QName serviceName, String endpointName, QName operationName) throws MessagingException { final RouterMonitorFilter routerMonitorFilter = new RouterMonitorFilter(interfaceName, serviceName, endpointName, operationName, true); if (!this.routerMonitorFilters.remove(routerMonitorFilter)) { throw new MessagingException("The Router Monitor filter " + routerMonitorFilter + " is not registered"); } }
@Override public boolean match(final Node source) throws MessagingException { try { return this.condition.evaluate(source); } catch (final ConditionRuntimeException e) { throw new MessagingException(e); } }
/** * Check if the exchange is still valid. * * @throws MessagingException */ protected void checkNotTerminated() throws MessagingException { if (isTerminated()) { throw new MessagingException("The Exchange is terminated."); } }
@Override public boolean match(final Node source) throws MessagingException { try { return this.condition.evaluate(source); } catch (final ConditionRuntimeException e) { throw new MessagingException(e); } }
public void monitorExchanges(QName interfaceName, QName serviceName, String endpointName, QName operationName, boolean storeExchanges) throws MessagingException { this.log.call(); final RouterMonitorFilter routerMonitorFilter = new RouterMonitorFilter(interfaceName, serviceName, endpointName, operationName, storeExchanges); if (this.routerMonitorFilters.contains(routerMonitorFilter)) { throw new MessagingException("The Router Monitor filter " + routerMonitorFilter + " already exist"); } else { this.routerMonitorFilters.add(routerMonitorFilter); } }
public Object getMessagesAs(Class format) throws MessagingException { if (format == DOMSource.class) { return getDOMSource(); } else if (format == StringSource.class) { return getStringSource(); } else if (format == String.class) { return getMessagesWithRootElement(); } throw new MessagingException("Unsupported message format: " + format.getName()); }
public void setFault(Fault message) throws MessagingException { if (exchange.getFault(false) != null) { throw new MessagingException("Fault message already set"); } FaultImpl msg = (FaultImpl) message; exchange.setFault(msg.getInternalMessage()); }
/** * Create a Fault. */ public Fault createFault() throws MessagingException { if (!can(CREATE_FAULT)) { throw new javax.jbi.messaging.MessagingException( Translator.translate(LocalStringKeys.FAULT_NOT_SUPPORTED, this.getPattern().toString())); } return (new FaultImpl()); }
public void setOutMessage(NormalizedMessage message) throws MessagingException { if (exchange.getOut(false) != null) { throw new MessagingException("Out message already set"); } NormalizedMessageImpl msg = (NormalizedMessageImpl) message; exchange.setOut(msg.getInternalMessage()); }
private static DataSource copyDataSource(DataSource source) throws MessagingException { try { ByteArrayOutputStream baos = new ByteArrayOutputStream(); FileUtil.copyInputStream(source.getInputStream(), baos); ByteArrayDataSource bads = new ByteArrayDataSource(baos.toByteArray(), source.getContentType()); bads.setName(source.getName()); return bads; } catch (IOException e) { throw new MessagingException(e); } }
private void checkCallerIsAllowedToSetOut() throws MessagingException { // we can set an out if there is a fault (but it will be removed!) if (isProvider() && (isInOut() || isInOptionalOut())) { return; } // all other cases are incorrect throw new MessagingException( "The MessageExchange state does not allow this operation: setting OUT on: " + getRoleStatusAndState()); }
private static void copyContent(NormalizedMessage from, NormalizedMessage to) throws MessagingException { String str = null; try { str = new SourceTransformer().toString(from.getContent()); } catch (Exception e) { throw new MessagingException(e); } if (str != null) { to.setContent(new StringSource(str)); } }
private void checkCallerIsAllowedToCreateFault() throws MessagingException { if (!doChecks()) { return; } if ((isRobustInOnly() && isProvider()) || (isInOut() && isProvider()) || isInOptionalOut()) { return; } throw new MessagingException( "The MessageExchange state does not allow this operation: create FAULT on: " + getRoleStatusAndState()); }