use of com.adaptris.core.CoreException in project interlok by adaptris.
the class EmbeddedConnection method removeServlet.
@Override
public void removeServlet(ServletWrapper wrapper) throws CoreException {
try {
JettyServerManager serverManager = JettyServerManager.getInstance();
serverManager.stopDeployment(SERVER_ID, wrapper.getUrl());
serverManager.removeDeployment(SERVER_ID, wrapper.getUrl());
serverManager.removeDeployment(SERVER_ID, wrapper.getServletHolder(), wrapper.getUrl());
log.trace("Removed {} from {}", wrapper.getServletHolder(), wrapper.getUrl());
} catch (Exception ex) {
throw ExceptionHelper.wrapCoreException(ex);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class JettyConnection method initConnection.
/**
* @see com.adaptris.core.AdaptrisConnectionImp#initConnection()
*/
@Override
protected void initConnection() throws CoreException {
// Would be better to rate limit based on iptables (!).
try {
server = configure(new Server());
context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
context.addServlet(new ServletHolder(new DefaultServlet()), "/");
server.setHandler(createHandler(context));
} catch (Exception e) {
ExceptionHelper.rethrowCoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class TraversingFsConsumer method handleFile.
private int handleFile(File originalFile) throws CoreException {
int rc = 0;
logFile(originalFile, "handleFile ");
try {
if (originalFile.getName().endsWith(getWipSuffix())) {
log.debug("ignoring part-processed file [{}]", originalFile.getName());
} else if (fileFilter != null && !fileFilter.accept(originalFile)) {
log.trace("File [{}] doesn't match filter", originalFile.getName());
} else {
if (checkModified(originalFile) && isFileAccessible(originalFile)) {
File wipFile = renameFile(originalFile);
AdaptrisMessage msg = createAdaptrisMessage(wipFile);
addStandardMetadata(msg, originalFile, wipFile);
retrieveAdaptrisMessageListener().onAdaptrisMessage(msg);
fsWorker.delete(wipFile);
rc++;
} else {
log.trace("[{}] not deemed safe to process", originalFile.getName());
}
}
} catch (FsException e) {
throw new CoreException(e);
} catch (IOException e) {
throw new CoreException(e);
}
return rc;
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class JmsSyncConsumer method init.
/**
* @see com.adaptris.core.AdaptrisComponent#init()
*/
@Override
public void init() throws CoreException {
super.init();
try {
initSession();
initConsumer();
configuredMessageTranslator().registerSession(currentSession());
configuredMessageTranslator().registerMessageFactory(defaultIfNull(getMessageFactory()));
LifecycleHelper.init(configuredMessageTranslator());
} catch (JMSException e) {
throw new CoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class AggregatingQueueConsumer method aggregateMessages.
@Override
public void aggregateMessages(AdaptrisMessage msg, AggregatingJmsConsumeService cfg) throws ServiceException {
MessageConsumer consumer = null;
ArrayList<AdaptrisMessage> result = new ArrayList<>();
try {
startMessageTranslator(cfg, msg.getFactory());
consumer = cfg.getConnection().retrieveConnection(JmsConnection.class).configuredVendorImplementation().createQueueReceiver(getEndpoint(), msg.resolve(getFilterExpression()), cfg);
Message first = firstMessage(consumer);
result.add(getMessageTranslator().translate(first));
Message next = nextMessage(consumer);
while (next != null) {
result.add(getMessageTranslator().translate(next));
next = nextMessage(consumer);
}
getMessageAggregator().joinMessage(msg, result);
} catch (CoreException | JMSException e) {
rethrowServiceException(e);
} finally {
JmsUtils.closeQuietly(consumer);
stop(messageTranslator);
}
}
Aggregations