use of com.adaptris.core.CoreException in project interlok by adaptris.
the class ComponentManagerImpl method requestInit.
@Override
public void requestInit(final long timeout) throws CoreException, TimeoutException {
checkTransitionTo(InitialisedState.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());
try {
LifecycleHelper.init(getWrappedComponent());
} catch (CoreException e) {
current.getUncaughtExceptionHandler().uncaughtException(current, e);
} catch (Throwable t) {
current.getUncaughtExceptionHandler().uncaughtException(current, new CoreException(t));
}
try {
barrier.await(timeout, TimeUnit.MILLISECONDS);
} catch (Exception e) {
current.getUncaughtExceptionHandler().uncaughtException(current, e);
}
}
});
sendLifecycleNotification(NOTIF_MSG_INITIALISED, getComponentState());
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class ComponentManagerImpl method sendConfigUpdateNotification.
protected void sendConfigUpdateNotification() {
try {
Notification n = new Notification(getNotificationType(ComponentNotificationType.CONFIG), createObjectName(), sequenceNumber.getAndIncrement(), NOTIF_MSG_CONFIG_UPDATED);
n.setUserData(getConfiguration());
sendNotification(n);
} catch (MalformedObjectNameException | CoreException e) {
// Don't care about notifications really.
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class WorkflowManager method initMembers.
private void initMembers() throws MalformedObjectNameException, CoreException {
if (isEmpty(managedWorkflow.getUniqueId())) {
throw new CoreException("No UniqueID, this workflow cannot be managed");
}
// Builds up a name com.adaptris:type=Workflow, adapter=<adapter-id,>, id=<channel-id>, workflow=<workflow-id>
myObjectName = ObjectName.getInstance(JMX_WORKFLOW_TYPE + ADAPTER_PREFIX + getParent().getParent().getUniqueId() + CHANNEL_PREFIX + getParent().getUniqueId() + ID_PREFIX + getWrappedComponent().getUniqueId());
configureDefaultInterceptors();
Collection<AdaptrisComponent> runtimeCandidates = CollectionUtils.union(managedWorkflow.getInterceptors(), Arrays.asList(new AdaptrisComponent[] { managedWorkflow.getConsumer(), managedWorkflow.getProducer(), defaultIfNull(managedWorkflow.getMessageErrorHandler()) }));
for (AdaptrisComponent c : runtimeCandidates) {
addChildJmxComponentQuietly((ChildRuntimeInfoComponent) RuntimeInfoComponentFactory.create(this, c));
}
marshalConfig();
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class AggregatingConsumeServiceImpl method start.
protected void start(ComponentLifecycle ac) throws ServiceException {
try {
LifecycleHelper.prepare(ac);
LifecycleHelper.init(ac);
LifecycleHelper.start(ac);
} catch (CoreException e) {
throw new ServiceException(e);
}
}
use of com.adaptris.core.CoreException in project interlok by adaptris.
the class RegexpMetadataQuery method doQuery.
/**
* <p>
* Performs the query against the payload of the supplied String and
* constructs a MetdataElement with the configured Key and the result as the
* Value.
* </p>
* @param message the String to run the Query on
* @return a MetadataElement with the configured Key and the result of the
* Query as it's Value <b>NOTE: the Value of the MetadataElement will be null
* if nulls have been allowed</b>
* @throws CoreException wrapping any underlying Exception
*/
public synchronized MetadataElement doQuery(String message) throws Exception {
Args.notBlank(getMetadataKey(), "metadata-key");
Args.notBlank(getQueryExpression(), "query-expression");
if (pattern == null) {
pattern = Pattern.compile(getQueryExpression());
}
Matcher matcher = pattern.matcher(message);
MetadataElement elem = new MetadataElement();
elem.setKey(getMetadataKey());
if (matcher.find()) {
elem.setValue(matcher.group(1));
} else {
if (!allowNullResults()) {
throw new CoreException("Failed to match pattern [" + metadataKey + "] to input string");
}
}
return elem;
}
Aggregations