public KeyedPoolMessageDispatcherFactoryAdapter(MessageDispatcherFactory factory) { super(); if (factory == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("factory").toString()); } this.factory = factory; }
public void setCookieSpec(String cookieSpec) { if (!(COOKIE_SPEC_NETSCAPE.equalsIgnoreCase(cookieSpec) || COOKIE_SPEC_RFC2109.equalsIgnoreCase(cookieSpec))) { throw new IllegalArgumentException( CoreMessages.propertyHasInvalidValue("cookieSpec", cookieSpec).toString()); } this.cookieSpec = cookieSpec; }
public KeyedPoolMessageRequesterFactoryAdapter(MessageRequesterFactory factory) { super(); if (factory == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("factory").toString()); } this.factory = factory; }
/** * An optional error message can be set if the invocation state is not {@link org.mule.api.model.InvocationResult.State#SUCCESSFUL} * * @param message the error message */ public void setErrorMessage(String message) { if (state == State.SUCCESSFUL) { throw new IllegalStateException(CoreMessages.invocationSuccessfulCantSetError().toString()); } errorMessage = message; }
@Override public void setName(String newName) { if (newName == null) { throw new IllegalArgumentException(CoreMessages.objectIsNull("Connector name").toString()); } if (logger.isDebugEnabled()) { logger.debug("Set Connector name to: " + newName); } name = newName; }
public static Properties loadProperties(InputStream is) throws IOException { if (is == null) { Message error = CoreMessages.objectIsNull("input stream"); throw new IOException(error.toString()); } try { Properties props = new Properties(); props.load(is); return props; } finally { is.close(); } }
public void setErrorNoMatchingMethodsCalled(Object component, String methods) { setErrorMessage(CoreMessages.noMatchingMethodsOnObjectCalledUsingResolver( component.getClass().getName(), methods).toString()); }
public static Properties loadProperties(URL url) throws IOException { if (url == null) { Message error = CoreMessages.objectIsNull("url"); throw new IOException(error.toString()); } return loadProperties(url.openStream()); }
public void setErrorNoMatchingMethods(Object component, Class<?>[] args) { setErrorMessage(CoreMessages.noEntryPointFoundWithArgsUsingResolver( component.getClass().getName(), args).toString()); }
public void setErrorTooManyMatchingMethods(Object component, Class<?>[] argTypes, String methods) { setErrorMessage(CoreMessages.tooManyAcceptableMethodsOnObjectUsingResolverForTypes( component.getClass().getName(), argTypes, methods).toString()); }
protected void init() { if (monitorFrequency <= 0) { throw new IllegalArgumentException(CoreMessages.propertyHasInvalidValue("monitorFrequency", new Integer(monitorFrequency)).toString()); } monitors = new ConcurrentHashMap(); if (scheduler == null) { this.scheduler = new ScheduledThreadPoolExecutor(1); scheduler.setThreadFactory(new DaemonThreadFactory(name + ".expiry.monitor", contextClassLoader)); scheduler.scheduleWithFixedDelay(this, 0, monitorFrequency, TimeUnit.MILLISECONDS); } }
private void checkNull(Scheduler postProcessedScheduler) { if (postProcessedScheduler == null) { throw new SchedulerCreationException(objectIsNull("scheduler").toString()); } }
public String getScheme(Method method) { InterfaceBinding router = routers.get(method.toString()); if (router == null) { throw new IllegalArgumentException(CoreMessages.cannotFindBindingForMethod(method.getName()).toString()); } return router.getEndpoint().getEndpointURI().getScheme(); }
/** * Will get the output stream for this type of transport. Typically this will be * called only when Streaming is being used on an outbound endpoint. If Streaming * is not supported by this transport an {@link UnsupportedOperationException} is * thrown. Note that the stream MUST release resources on close. For help doing * so, see {@link org.mule.model.streaming.CallbackOutputStream}. * * @param endpoint the endpoint that releates to this Dispatcher * @param event the current event being processed * @return the output stream to use for this request * @throws MuleException in case of any error */ @Override public OutputStream getOutputStream(OutboundEndpoint endpoint, MuleEvent event) throws MuleException { throw new UnsupportedOperationException(CoreMessages.streamingNotSupported(this.getProtocol()).toString()); }
public void initialise() throws InitialisationException { if (name == null) { name = UUID.getUUID(); } if (expirationInterval <= 0) { throw new IllegalArgumentException(CoreMessages.propertyHasInvalidValue("expirationInterval", new Integer(expirationInterval)).toString()); } if (scheduler == null) { this.scheduler = new ScheduledThreadPoolExecutor(1); scheduler.setThreadFactory(new DaemonThreadFactory(name + "-Monitor", this.getClass().getClassLoader())); scheduler.scheduleWithFixedDelay(this, 0, expirationInterval, TimeUnit.MILLISECONDS); } }
@Override public void initialise() throws InitialisationException { if (name == null) { name = UUID.getUUID(); } if (expirationInterval <= 0) { throw new IllegalArgumentException(CoreMessages.propertyHasInvalidValue("expirationInterval", new Integer(expirationInterval)).toString()); } if (scheduler == null) { this.scheduler = new ScheduledThreadPoolExecutor(1); scheduler.setThreadFactory(new DaemonThreadFactory(name + "-Monitor", context.getExecutionClassLoader())); scheduler.scheduleWithFixedDelay(this, 0, expirationInterval, TimeUnit.MILLISECONDS); } }
public InvocationResult invoke(Object component, MuleEventContext context) throws Exception { if (component instanceof Callable) { Object result = ((Callable) component).onCall(context); return new InvocationResult(this, result, callableMethod); } else { InvocationResult result = new InvocationResult(this, InvocationResult.State.NOT_SUPPORTED); result.setErrorMessage(CoreMessages.objectDoesNotImplementInterface(component, Callable.class).toString()); return result; } }
protected HttpResponse doBad(RequestLine requestLine) throws MuleException { MuleMessage message = createMuleMessage(null); MuleEvent event = new DefaultMuleEvent(message, (InboundEndpoint) endpoint, flowConstruct); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_BAD_REQUEST); response.setBody(HttpMessages.malformedSyntax().toString() + HttpConstants.CRLF); return transformResponse(response, event); }
protected HttpResponse doOtherValid(RequestLine requestLine, String method) throws MuleException { MuleMessage message = createMuleMessage(null); MuleEvent event = new DefaultMuleEvent(message, (InboundEndpoint) endpoint, flowConstruct); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_METHOD_NOT_ALLOWED); response.setBody(HttpMessages.methodNotAllowed(method).toString() + HttpConstants.CRLF); return transformResponse(response, event); }
protected HttpResponse doBad(RequestLine requestLine) throws MuleException { MuleMessage message = getMessageReceiver().createMuleMessage(null); MuleEvent event = new DefaultMuleEvent(message, getInboundEndpoint(), getFlowConstruct()); OptimizedRequestContext.unsafeSetEvent(event); HttpResponse response = new HttpResponse(); response.setStatusLine(requestLine.getHttpVersion(), HttpConstants.SC_BAD_REQUEST); response.setBody(HttpMessages.malformedSyntax().toString() + HttpConstants.CRLF); return transformResponse(response); }