protected synchronized OutboundEndpoint getEndpoint(MuleEvent event, String endpointUri) throws MuleException { try { return endpointCache.get(endpointUri); } catch (Exception e) { throw new DefaultMuleException(e); } }
protected void init(String[] args) throws IllegalArgumentException { //TODO(pablo.kraan): move initialization of others classes outside this method Map<String, Object> commandlineOptions; try { commandlineOptions = SystemUtils.getCommandLineOptions(args, CLI_OPTIONS); } catch (DefaultMuleException me) { throw new IllegalArgumentException(me.toString()); } // set our own UrlStreamHandlerFactory to become more independent of system // properties MuleUrlStreamHandlerFactory.installUrlStreamHandlerFactory(); // Startup properties String propertiesFile = (String) commandlineOptions.get("props"); if (propertiesFile != null) { setStartupPropertiesFile(propertiesFile); } StartupContext.get().setStartupOptions(commandlineOptions); }
throw new IllegalArgumentException(me.toString());
@Override public void discardMessageOnThrottlingExceeded() throws MuleException { try { sendFailureResponseToClient(MESSAGE_DISCARD_STATUS_CODE, MESSAGE_THROTTLED_REASON_PHRASE); } catch (IOException e) { throw new DefaultMuleException(e); } }
@Override public MessageProcessor getMessageProcessor(final String url, final OperationOptions operationOptions, final MessageExchangePattern exchangePattern) throws MuleException { try { return cachedMessageProcessors.get(new HttpRequestCacheKey(url, operationOptions, exchangePattern)); } catch (ExecutionException e) { throw new DefaultMuleException(e); } }
private int toInt(MuleEvent event, Object source) throws MuleException { try { return (Integer) this.evaluateAndTransform(muleContext, event, Integer.class, null, source); } catch (Exception e) { throw new DefaultMuleException("Error evaluating paging expressions " + source, e); } }
@Override public void start() throws MuleException { try { super.onStart(); } catch (Exception e0) { throw new DefaultMuleException(e0); } }
@Override public MuleEvent beforeRouteEvent(MuleEvent muleEvent) throws MuleException { try { sendExpect100(request); return muleEvent; } catch (IOException e) { throw new DefaultMuleException(e); } }
/** * @return the authentication configuration */ public HttpAuthentication build() throws MuleException { try { basicAuthentication.initialise(); } catch (InitialisationException e) { throw new DefaultMuleException(e); } return basicAuthentication; }
protected void move(final File sourceFile, File destinationFile) throws DefaultMuleException { if (destinationFile != null) { // move sourceFile to new destination. Do not use FileUtils here as it ultimately // falls back to copying the file which will cause problems on large files again - // which is what we're trying to avoid in the first place boolean fileWasMoved = sourceFile.renameTo(destinationFile); // move didn't work - bail out if (!fileWasMoved) { throw new DefaultMuleException(FileMessages.failedToMoveFile(sourceFile.getAbsolutePath(), destinationFile.getAbsolutePath())); } } }
protected Properties loadOverrides() throws MuleException { Properties props = new Properties(); Enumeration e = ClassUtils.getResources(CHANNEL_OVERRIDES_FILE, getClass()); while (e.hasMoreElements()) { URL url = (URL) e.nextElement(); try { props.load(url.openStream()); } catch (IOException e1) { throw new DefaultMuleException("failed to read channel overrides from URL: " + url.toExternalForm()); } } return props; } }
private static CommandLine parseCommandLine(String args[], String opts[][]) throws DefaultMuleException { Options options = new Options(); for (int i = 0; i < opts.length; i++) { options.addOption(opts[i][0], opts[i][1].equals("true") ? true : false, opts[i][2]); } BasicParser parser = new BasicParser(); try { CommandLine line = parser.parse(options, args, true); if (line == null) { throw new DefaultMuleException("Unknown error parsing the Mule command line"); } return line; } catch (ParseException p) { throw new DefaultMuleException("Unable to parse the Mule command line because of: " + p.toString(), p); } }
/** * Invoked after deserialization. This is called when the marker interface * {@link org.mule.util.store.DeserializationPostInitialisable} is used. This will get invoked after the * object has been deserialized passing in the current MuleContext when using either * {@link org.mule.transformer.wire.SerializationWireFormat}, * {@link org.mule.transformer.wire.SerializedMuleMessageWireFormat} or the * {@link org.mule.transformer.simple.ByteArrayToSerializable} transformer. * * @param muleContext the current muleContext instance * @throws org.mule.api.MuleException if there is an error initializing */ @SuppressWarnings({"unused"}) private void initAfterDeserialisation(MuleContext muleContext) throws MuleException { if (item instanceof DeserializationPostInitialisable) { try { DeserializationPostInitialisable.Implementation.init(item, muleContext); } catch (Exception e) { throw new DefaultMuleException(e); } } } }
/** * Create an SimpleCallableJavaComponent instance using an object class. This * class should implement {@link Callable}. * * @param callable * @throws DefaultMuleException if the Class specified does not implement * {@link Callable} */ public SimpleCallableJavaComponent(Class callable) throws DefaultMuleException { if (!(Callable.class.isAssignableFrom(callable))) { throw new DefaultMuleException(CoreMessages.objectNotOfCorrectType(callable, Callable.class)); } objectFactory = new SingletonObjectFactory(callable); }
@Override public void discardMessageOnThrottlingExceeded() throws MuleException { try { servletResponseWriter.writeNonHtmlErrorResponse(servletResponse, 429, "API calls exceeded", httpThrottlingHeadersMapBuilder.build()); } catch (Exception e) { throw new DefaultMuleException(e); } }
private Connector createConnector() throws MuleException { if (connector!= null) { return this.connector; } MuleRegistry muleRegistry = muleContext.getRegistry(); Connector httpConnector = muleRegistry.lookupConnector("connector.http.mule.default"); if (httpConnector!= null) { return httpConnector; } else { LOGGER.error("Could not find connector with name 'connector.http.mule.default'"); throw new DefaultMuleException("Could not find connector with name 'connector.http.mule.default'"); } }
private Connector lookupDefaultHttpTransport() throws MuleException { Connector httpConnector = muleContext.getRegistry().lookupConnector("connector.http.mule.default"); if (httpConnector != null) { return httpConnector; } else { throw new DefaultMuleException("Could not find connector with name 'connector.http.mule.default'"); } }
@Override public void stop() throws MuleException { try { quartzScheduler.pauseAll(); } catch (SchedulerException e) { throw new DefaultMuleException(couldNotPauseSchedulers(), e); } }
public boolean isStarted() throws MuleException { try { return quartzScheduler.isStarted(); } catch (SchedulerException e) { throw new DefaultMuleException(couldNotGetSchedulerStatus(), e); } }
/** * Returns the message contents for logging * * @param encoding the encoding to use when converting bytes to a string, if necessary * @return the message contents as a string * @throws org.mule.api.MuleException if the message cannot be converted into a string */ @Override public String getMessageAsString(String encoding) throws MuleException { try { return message.getPayloadForLogging(encoding); } catch (Exception e) { throw new DefaultMuleException(CoreMessages.cannotReadPayloadAsString(message.getClass() .getName()), e); } }