Package org.mule.api

Examples of org.mule.api.MuleContext


    protected Object sendAction(RemoteDispatcherNotification action, MuleEventContext context) throws MuleException
    {
        MuleMessage result = null;
        OutboundEndpoint endpoint = null;
        MuleContext managementContext = context.getMuleContext();
        try
        {
            if (RemoteDispatcherNotification.ACTION_DISPATCH == action.getAction())
            {
                endpoint = managementContext.getEndpointFactory().getOutboundEndpoint(
                    action.getResourceIdentifier());
                context.dispatchEvent(action.getMessage(), endpoint);
                return null;
            }
            else
            {
                EndpointFactory endpointFactory = managementContext.getEndpointFactory();

                EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(action.getResourceIdentifier());
                endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);

                endpoint = managementContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder);
                result = context.sendEvent(action.getMessage(), endpoint);
                if (result == null)
                {
                    return null;
                }
View Full Code Here


            setCurrentPhase(phase);
        }
        // In the case of a connection exception, trigger the reconnection strategy.
        catch (ConnectException ce)
        {
            MuleContext muleContext = ((AbstractConnector) ce.getFailed()).getMuleContext();
            muleContext.getExceptionListener().handleException(ce);
        }
        catch (LifecycleException le)
        {
            throw le;
        }
View Full Code Here

    }

    protected MuleContext createMuleContext() throws Exception
    {
        // Should we set up the manager for every method?
        MuleContext context;
        if (isDisposeContextPerClass() && muleContext != null)
        {
            context = muleContext;
        }
        else
        {
            MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
            List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
            builders.add(new SimpleConfigurationBuilder(getStartUpProperties()));
            //If the annotations module is on the classpath, add the annotations config builder to the list
            //This will enable annotations config for this instance
            if (ClassUtils.isClassOnPath(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass()))
            {
                builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
                                                                                ClassUtils.NO_ARGS, getClass()));
            }
            builders.add(getBuilder());
            addBuilders(builders);
            MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
            configureMuleContext(contextBuilder);
            context = muleContextFactory.createMuleContext(builders, contextBuilder);
            if (!isGracefulShutdown())
            {
                ((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0);
            }
        }
        return context;
    }
View Full Code Here

    }

    protected MuleContext createMuleContext() throws Exception
    {
        // Should we set up the manager for every method?
        MuleContext context;
        if (getTestInfo().isDisposeManagerPerSuite() && muleContext != null)
        {
            context = muleContext;
        }
        else
        {
            MuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
            List<ConfigurationBuilder> builders = new ArrayList<ConfigurationBuilder>();
            builders.add(new SimpleConfigurationBuilder(getStartUpProperties()));
            //If the annotations module is on the classpath, add the annotations config builder to the list
            //This will enable annotations config for this instance
            if (ClassUtils.isClassOnPath(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER, getClass()))
            {
                builders.add((ConfigurationBuilder) ClassUtils.instanciateClass(CLASSNAME_ANNOTATIONS_CONFIG_BUILDER,
                        ClassUtils.NO_ARGS, getClass()));
            }
            builders.add(getBuilder());
            addBuilders(builders);
            MuleContextBuilder contextBuilder = new DefaultMuleContextBuilder();
            configureMuleContext(contextBuilder);
            context = muleContextFactory.createMuleContext(builders, contextBuilder);
            if (!isGracefulShutdown())
            {
                ((DefaultMuleConfiguration) context.getConfiguration()).setShutdownTimeout(0);
            }
        }
        return context;
    }
View Full Code Here

    setProperty("ebms.mode",new String[]{"normal","oracle"},"normal");
    setProperty("ebms.protocol",new String[]{"http","https"},"http");
    setProperty("ebms.database",new String[]{"hsqldb","mysql","postgresql","mssql","oracle"},"hsqldb");
    DefaultMuleContextFactory muleContextFactory = new DefaultMuleContextFactory();
    SpringXmlConfigurationBuilder configBuilder = new SpringXmlConfigurationBuilder(args.length == 0 ? "main.xml" : args[0]);
    MuleContext muleContext = muleContextFactory.createMuleContext(configBuilder);
    muleContext.start();
  }
View Full Code Here

                // the processing is stopped so that the result is not passed through the
                // outbound router but will be passed back as a result
                eventContext.setStopFurtherProcessing(true);
                return wsdlFileContents;
            }
            MuleContext muleContext = eventContext.getMuleContext();
            InboundEndpoint webServiceEndpoint =
                muleContext.getEndpointFactory().getInboundEndpoint(this.wsdlEndpoint);

            MuleMessage replyWSDL = eventContext.requestEvent(webServiceEndpoint, eventContext.getTimeout());

            wsdlString = replyWSDL.getPayloadAsString();
View Full Code Here

    protected Object sendAction(RemoteDispatcherNotification action, MuleEventContext context) throws MuleException
    {
        MuleMessage result = null;
        OutboundEndpoint endpoint = null;
        MuleContext managementContext = context.getMuleContext();
        try
        {
            if (RemoteDispatcherNotification.ACTION_DISPATCH == action.getAction())
            {
                endpoint = managementContext.getEndpointFactory().getOutboundEndpoint(
                    action.getResourceIdentifier());
                context.dispatchEvent(action.getMessage(), endpoint);
                return null;
            }
            else
            {
                EndpointFactory endpointFactory = managementContext.getEndpointFactory();

                EndpointBuilder endpointBuilder = endpointFactory.getEndpointBuilder(action.getResourceIdentifier());
                endpointBuilder.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);

                endpoint = managementContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder);
                result = context.sendEvent(action.getMessage(), endpoint);
                if (result == null || VoidMuleEvent.getInstance().equals(result))
                {
                    return null;
                }
View Full Code Here

    public static final String NAME = "process";

    public Object evaluate(String expression, MuleMessage message)
    {
        MuleContext muleContext = message.getMuleContext();

        String processorName;
        String processorArgExpression = null;
        MuleMessage messageToProcess = message;
View Full Code Here

            {
                name = new QName(attribute.getNamespaceURI(), attribute.getLocalName());
            }
            Object value = beanConfig.translateValue(oldName, oldValue);
            addAnnotationValue(beanDefinition.getPropertyValues(), name, value);
            MuleContext muleContext = MuleArtifactContext.getCurrentMuleContext().get();
            if (muleContext != null)
            {
                Map<QName, Set<Object>> annotations = muleContext.getConfigurationAnnotations();
                Set<Object> values = annotations.get(name);
                if (values == null)
                {
                    values = new HashSet<Object>();
                    annotations.put(name, values);
View Full Code Here

     * @throws Exception
     */
    ImmutableEndpoint createDummyEndpoint() throws Exception
    {
        ImmutableEndpoint endpoint = mock(ImmutableEndpoint.class);
        MuleContext muleContext = mock(MuleContext.class);
        when(endpoint.getEndpointURI()).thenReturn(new MuleEndpointURI("http://dummy.endpoint/", muleContext));
        AbstractConnector connector = mock(AbstractConnector.class);
        when(endpoint.getConnector()).thenReturn(connector);

        RetryPolicyTemplate retryPolicyTemplate = mock(RetryPolicyTemplate.class);
View Full Code Here

TOP

Related Classes of org.mule.api.MuleContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.