use of com.adaptris.core.CoreException in project interlok by adaptris.
the class IgnoreOriginalXmlDocumentAggregator method aggregate.
@Override
public void aggregate(AdaptrisMessage original, Iterable<AdaptrisMessage> messages) throws CoreException {
try {
if (isEmpty(getTemplate())) {
throw new CoreException("Template is null / empty, cannot continue");
}
Document resultDoc = XmlHelper.createDocument(getTemplate(), documentFactoryBuilder());
for (AdaptrisMessage m : messages) {
if (filter(m)) {
Document mergeDoc = XmlHelper.createDocument(m, documentFactoryBuilder());
overwriteMetadata(m, original);
resultDoc = getMergeImplementation().merge(resultDoc, mergeDoc);
}
}
XmlHelper.writeXmlDocument(resultDoc, original, getDocumentEncoding());
} catch (Exception e) {
throw ExceptionHelper.wrapCoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class ScriptingService method initService.
@Override
protected void initService() throws CoreException {
try {
Args.notBlank(getScriptFilename(), "scriptFilename");
File f = new File(getScriptFilename());
FsWorker.isFile(FsWorker.checkReadable(f));
super.initService();
} catch (Exception e) {
throw ExceptionHelper.wrapCoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class CoreSecurityService method initService.
@Override
protected final void initService() throws CoreException {
try {
pkPassword = getPrivateKeyPasswordProvider().retrievePrivateKeyPassword();
} catch (PasswordException e) {
throw new CoreException("Could not get password using " + getPrivateKeyPasswordProvider().getClass().getCanonicalName(), e);
}
try {
if (isEmpty(localPartner)) {
throw new CoreException("No Local Partner configured");
}
localPartnerAlias = new Alias(localPartner, pkPassword);
if (isEmpty(remotePartner)) {
log.warn("Remote partner not configured, " + "must be set individually as message metadata");
} else {
remotePartnerAlias = new Alias(remotePartner);
}
SecurityServiceFactory factory = securityFactory;
if (factory == null) {
factory = SecurityServiceFactory.defaultInstance();
}
service = factory.createService();
for (Iterator i = keystoreUrls.iterator(); i.hasNext(); ) {
ConfiguredKeystore url = (ConfiguredKeystore) i.next();
service.registerKeystore(url);
}
service.setEncryptionAlgorithm(encryptionAlgorithm);
if (successId != null && failId != null) {
branchingEnabled = true;
} else {
log.debug("No Success Id or Fail Id, branching disabled");
}
} catch (AdaptrisSecurityException e) {
throw new CoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class ComponentManagerImpl method registerSelf.
/**
* Convenience method to handle {@link BaseComponentMBean#registerMBean()}
*/
protected void registerSelf() throws CoreException {
try {
ObjectName objName = createObjectName();
log.trace("Registering {} against {}", this.getClass().getName(), objName);
JmxHelper.register(objName, this);
} catch (Exception e) {
throw new CoreException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class ComponentManagerImpl method requestStop.
public void requestStop(final long timeout) throws CoreException, TimeoutException {
checkTransitionTo(StoppedState.getInstance());
final CyclicBarrier barrier = new CyclicBarrier(2);
executeAndWait(timeout, barrier, new Runnable() {
@Override
public void run() {
Thread current = Thread.currentThread();
current.setName(THREAD_NAME_PREFIX + requestNumber.getAndIncrement());
LifecycleHelper.stop(getWrappedComponent());
try {
barrier.await(timeout, TimeUnit.MILLISECONDS);
} catch (Exception e) {
current.getUncaughtExceptionHandler().uncaughtException(current, e);
}
}
});
sendLifecycleNotification(NOTIF_MSG_STOPPED, getComponentState());
}
Aggregations