public void onTransition(String phaseName, MuleContext muleContext) throws MuleException { muleContext.getRegistry().fireLifecycle(phaseName); } }
@Override public Object transform(Object input) { String token = (String) input; if (muleContext.getExpressionManager().isExpression(token)) { token = muleContext.getExpressionManager().parse(token, event, true); } return token; } }, URL_ENCODER);
protected synchronized OutboundEndpoint getEndpoint(MuleContext muleContext, String uri) throws MuleException { if (endpoints.get(uri) != null) { return endpoints.get(uri); } OutboundEndpoint endpoint = muleContext.getEndpointFactory().getOutboundEndpoint(uri); endpoints.put(uri, endpoint); return endpoint; }
public void destroy() { if (muleContext != null) { if (!muleContext.isDisposing() || !muleContext.isDisposed()) { muleContext.dispose(); } } } }
public void killMule(MuleContext muleContext) { try { if (muleContext != null && !muleContext.isStopped()) { muleContext.stop(); stopPlugins(); } } catch (Throwable e1) { } if (muleContext != null && !muleContext.isDisposed()) { muleContext.dispose(); disposePlugins(); } clearLogginConfiguration(); }
protected static String generateId(MuleContext context) { MuleConfiguration conf = context.getConfiguration(); return String.format("%s.%s.%s", conf.getDomainId(), context.getClusterId(), conf.getId()); }
public Object doGetObject() throws Exception { // If this is a meta endpoint, then we can wrap it using the meta endpoint builder from the TransportServiceDescriptor String scheme = getEndpointBuilder().getEndpoint().getFullScheme(); TransportServiceDescriptor tsd = (TransportServiceDescriptor) muleContext.getRegistry().lookupServiceDescriptor(ServiceType.TRANSPORT, scheme, null); EndpointBuilder endpointBuilder = tsd.createEndpointBuilder(this, muleContext); OutboundEndpoint outboundEndpoint = muleContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder); if (outboundEndpoint instanceof AbstractEndpoint) { AbstractEndpoint.class.cast(outboundEndpoint).setAnnotations(getAnnotations()); } return outboundEndpoint; }
public MuleConfiguration getConfiguration() { return muleContext.getConfiguration(); } }
@Override public MuleEvent handleException(Exception exception, MuleEvent event) { event.getMuleContext().getExceptionListener().handleException(exception); return event; } }
protected RemoteDispatcher(String endpoint, MuleContext muleContext) throws MuleException { this.muleContext = muleContext; serializer = muleContext.getObjectSerializer(); EndpointFactory endpointFactory = muleContext.getEndpointFactory(); asyncServerEndpoint = endpointFactory.getOutboundEndpoint(endpoint); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(endpoint); endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE); syncServerEndpoint = muleContext.getEndpointFactory().getOutboundEndpoint( endpointBuilder); wireFormat = requestWireFormat(); }
protected void doShutdown() { if (muleContext != null) { muleContext.dispose(); muleContext = null; } }
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()); } }
private boolean useExtendedTransformations() { boolean result = true; if (muleContext != null && muleContext.getConfiguration() != null) { result = muleContext.getConfiguration().useExtendedTransformations(); } return result; }
private void doOnConnectException(ConnectException ce) { MuleContext muleContext = ((AbstractConnector) ce.getFailed()).getMuleContext(); muleContext.getExceptionListener().handleException(ce); }
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(); }
public void dispose() throws MuleException { muleContext.dispose(); }
public String getProperty(String key) { Object oval = super.get(key); if (oval == null) { oval = muleContext.getRegistry().lookupObject(key); } String sval = (oval instanceof String) ? (String)oval : null; return ((sval == null) && (defaults != null)) ? defaults.getProperty(key) : sval; } }
@Override public void initialise() throws InitialisationException { if (value != null) { value.initialize(muleContext.getExpressionManager()); } }
private boolean useExtendedTransformations() { boolean result = true; if (muleContext != null && muleContext.getConfiguration() != null) { result = muleContext.getConfiguration().useExtendedTransformations(); } return result; }
public OutboundEndpoint load(String key) throws Exception { EndpointFactory endpointFactory = muleContext.getEndpointFactory(); EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(key); return endpointFactory.getOutboundEndpoint(endpointBuilder); } };