private boolean useExtendedTransformations() { boolean result = true; if (muleContext != null && muleContext.getConfiguration() != null) { result = muleContext.getConfiguration().useExtendedTransformations(); } return result; }
private boolean useExtendedTransformations() { boolean result = true; if (muleContext != null && muleContext.getConfiguration() != null) { result = muleContext.getConfiguration().useExtendedTransformations(); } return result; }
/** * Generate a generic thread name prefix for this context. * @param muleContext context to generate the name prefix for * @return "[appName]." if Mule is running as a container, otherwise empty string */ public static String getPrefix(MuleContext muleContext) { final boolean containerMode = muleContext.getConfiguration().isContainerMode(); final String id = muleContext.getConfiguration().getId(); return containerMode ? String.format("[%s].", id) : StringUtils.EMPTY; } }
@Override protected void doHeader(MuleContext context) { header.add("Application: " + context.getConfiguration().getId()); header.add(String.format("OS encoding: %s, Mule encoding: %s", SystemUtils.FILE_SEPARATOR, context.getConfiguration().getDefaultEncoding())); header.add(" "); }
public void setMuleContext(MuleContext context) { // override only if not set in config if (this.timeout == null) { this.timeout = context.getConfiguration().getDefaultTransactionTimeout(); } }
private void moveToCorruptedFilesFolder(File file) throws IOException { String workingDirectory = (new File(muleContext.getConfiguration().getWorkingDirectory())) .toPath().normalize().toString(); String diffFolder = file.getAbsolutePath().split(workingDirectory)[1]; File corruptedFile = new File(muleContext.getConfiguration().getWorkingDirectory() + File.separator + CORRUPTED_FOLDER + diffFolder); moveFileToDirectory(file, corruptedFile.getParentFile(), true); }
/** * WARNING: Only use this constructor if the instance of MuleSession has a flowConstruct set. This * constructor is only here for backwards compatibility. */ @Deprecated public DefaultMuleEvent(MuleMessage message, MessageExchangePattern exchangePattern, MuleSession session) { this(message, exchangePattern, session, message.getMuleContext() .getConfiguration() .getDefaultResponseTimeout(), null, null); }
protected void initialiseProcessingStrategy() { if (processingStrategy == null) { processingStrategy = muleContext.getConfiguration().getDefaultProcessingStrategy(); if (processingStrategy == null) { processingStrategy = createDefaultProcessingStrategy(); } } }
/** * Constructor used to create an event with no message source with minimal arguments and a {@link org.mule.api.MuleSession} */ public DefaultMuleEvent(MuleMessage message, MessageExchangePattern exchangePattern, FlowConstruct flowConstruct, MuleSession session) { this(message, exchangePattern, flowConstruct, session, message.getMuleContext() .getConfiguration() .getDefaultResponseTimeout(), null, null); }
public MuleContextNotification(MuleContext context, int action) { super(generateId(context), action); this.muleContext = context; this.resourceIdentifier = context.getConfiguration().getId(); this.clusterId = context.getClusterId(); this.domain = context.getConfiguration().getDomainId(); }
protected static String generateId(MuleContext context) { MuleConfiguration conf = context.getConfiguration(); return String.format("%s.%s.%s", conf.getDomainId(), context.getClusterId(), conf.getId()); }
@Override public void onNotification(MuleContextNotification notification) { if (notification.getAction() == MuleContextNotification.CONTEXT_DISPOSED) { clearCacheFor(muleContext); disposeListenerRegistered.remove(notification.getMuleContext().getConfiguration().getId()); } } };
protected long getAsyncReplyTimeout() { if (asyncReplyMessageSource.getTimeout() != null) { return asyncReplyMessageSource.getTimeout().longValue(); } else { return muleContext.getConfiguration().getDefaultResponseTimeout(); } }
public synchronized void start() throws MuleException { gracefulShutdownTimeout = getMuleContext().getConfiguration().getShutdownTimeout(); if (workExecutorService == null) { workExecutorService = threadingProfile.createPool(name); } }
/** * Uses this object's {@link MuleMessageFactory} to create a new {@link MuleMessage} instance. * Uses the default encoding. * * @see MuleConfiguration#getDefaultEncoding() */ public MuleMessage createMuleMessage(Object transportMessage) throws MuleException { String encoding = endpoint.getMuleContext().getConfiguration().getDefaultEncoding(); return createMuleMessage(transportMessage, encoding); }
private WorkManager createWorkManager() { int shutdownTimeout = endpoint.getMuleContext().getConfiguration().getShutdownTimeout(); return new TrackingWorkManager(new WorkManagerHolder() { @Override public WorkManager getWorkManager() { return getConnectorWorkManager(); } }, shutdownTimeout); }
protected void doHeader(MuleContext context) { long currentTime = System.currentTimeMillis(); header.add(CoreMessages.applicationShutdownNormally(context.getConfiguration().getId(), new Date()).getMessage()); long duration = 10; if (context.getStartDate() > 0) { duration = currentTime - context.getStartDate(); } header.add(CoreMessages.applicationWasUpForDuration(duration).getMessage()); } }
/** * Constructor used to create an event with no message source with minimal arguments */ public DefaultMuleEvent(MuleMessage message, MessageExchangePattern exchangePattern, FlowConstruct flowConstruct) { this(message, exchangePattern, flowConstruct, new DefaultMuleSession(), message.getMuleContext() .getConfiguration() .getDefaultResponseTimeout(), null, null); }
protected AsyncInterceptingMessageProcessor createAsyncMessageProcessor(org.mule.api.processor.StageNameSource nameSource, MuleContext muleContext) { return new AsyncInterceptingMessageProcessor(createThreadingProfile(muleContext), getThreadPoolName( nameSource.getName(), muleContext), muleContext.getConfiguration().getShutdownTimeout()); }
@Override public void initialise() throws InitialisationException { String workingDirectory = getMuleContext().getConfiguration().getWorkingDirectory(); int queueTransactionFilesSizeInMegabytes = getMuleContext().getConfiguration().getMaxQueueTransactionFilesSizeInMegabytes(); localTxTransactionJournal = new LocalTxQueueTransactionJournal(workingDirectory + File.separator + "queue-tx-log", getMuleContext(), queueTransactionFilesSizeInMegabytes); localTxQueueTransactionRecoverer = new LocalTxQueueTransactionRecoverer(localTxTransactionJournal, this); xaTransactionJournal = new XaTxQueueTransactionJournal(workingDirectory + File.separator + "queue-xa-tx-log", getMuleContext(), queueTransactionFilesSizeInMegabytes); xaTransactionRecoverer = new XaTransactionRecoverer(xaTransactionJournal, this); }