Package org.mule.api.endpoint

Examples of org.mule.api.endpoint.EndpointBuilder


    {
        OutboundEndpoint endpoint = (OutboundEndpoint) outboundEndpointCache.get(uri + ":" + mep.toString()
                                                                                 + ":" + responseTimeout);
        if (endpoint == null)
        {
            EndpointBuilder endpointBuilder = muleContext.getRegistry()
                .lookupEndpointFactory()
                .getEndpointBuilder(uri);
            endpointBuilder.setExchangePattern(mep);
            if (responseTimeout != null && responseTimeout > 0)
            {
                endpointBuilder.setResponseTimeout(responseTimeout.intValue());
            }
            endpoint = muleContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder);
            OutboundEndpoint concurrentlyAddedEndpoint = (OutboundEndpoint) outboundEndpointCache.putIfAbsent(
                uri + ":" + mep.toString() + ":" + responseTimeout, endpoint);
            if (concurrentlyAddedEndpoint != null)
View Full Code Here


    public InboundEndpoint getInboundEndpoint(String uri, MessageExchangePattern mep) throws MuleException
    {
        InboundEndpoint endpoint = (InboundEndpoint) inboundEndpointCache.get(uri + ":" + mep.toString());
        if (endpoint == null)
        {
            EndpointBuilder endpointBuilder = muleContext.getRegistry()
                .lookupEndpointFactory()
                .getEndpointBuilder(uri);
            endpointBuilder.setExchangePattern(mep);
            endpoint = muleContext.getEndpointFactory().getInboundEndpoint(endpointBuilder);
            InboundEndpoint concurrentlyAddedEndpoint = (InboundEndpoint) inboundEndpointCache.putIfAbsent(
                uri + ":" + mep.toString(), endpoint);
            if (concurrentlyAddedEndpoint != null)
            {
View Full Code Here

        assertTrue(ep instanceof OutboundEndpoint);
    }

    public void testCreateInboundEndpointWithBuilder() throws Exception
    {
        EndpointBuilder builder = new EndpointURIEndpointBuilder("test://address", muleContext);
        EndpointFactory endpointFactory = new DefaultEndpointFactory();
        endpointFactory.setMuleContext(muleContext);
        ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(builder);
        assertEquals(DefaultInboundEndpoint.class, ep.getClass());
        assertEquals(ep.getEndpointURI().getUri().toString(), "test://address");
View Full Code Here

        assertTrue(ep instanceof InboundEndpoint);
    }

    public void testCreateOutboundEndpointWithBuilder() throws Exception
    {
        EndpointBuilder builder = new EndpointURIEndpointBuilder("test://address", muleContext);
        EndpointFactory endpointFactory = new DefaultEndpointFactory();
        endpointFactory.setMuleContext(muleContext);
        ImmutableEndpoint ep = endpointFactory.getOutboundEndpoint(builder);
        assertEquals(DefaultOutboundEndpoint.class, ep.getClass());
        assertEquals(ep.getEndpointURI().getUri().toString(), "test://address");
View Full Code Here

        muleContext.getRegistry().registerConnector(testConnector2);

        String globalEndpointName = "concreteEndpoint";

        // Create and register a endpoint builder (global endpoint) with connector1
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder("test://address", muleContext);
        endpointBuilder.setConnector(testConnector1);
        muleContext.getRegistry().registerObject(globalEndpointName, endpointBuilder);
        EndpointFactory endpointFactory = new DefaultEndpointFactory();
        endpointFactory.setMuleContext(muleContext);
        // Test that DefaultEndpointFactory.getEndpointBuilder() returns a new
        // EndpointBuilder instance equal to
        // the one we registered earlier
        EndpointBuilder endpointBuilder1 = endpointFactory.getEndpointBuilder(globalEndpointName);
        assertNotSame(endpointBuilder1, endpointBuilder);
        assertTrue(endpointBuilder1.equals(endpointBuilder));

        // Test that DefaultEndpointFactory.getEndpointBuilder() returns a new
        // EndpointBuilder instance equal to
        // the one we registered earlier
        EndpointBuilder endpointBuilder2 = endpointFactory.getEndpointBuilder(globalEndpointName);
        assertNotSame(endpointBuilder2, endpointBuilder);
        assertTrue(endpointBuilder2.equals(endpointBuilder));

        // Check that all EndpointBuilder's returned are unique but equal
        assertNotSame(endpointBuilder1, endpointBuilder2);
        assertTrue(endpointBuilder1.equals(endpointBuilder2));
        assertEquals(endpointBuilder1.hashCode(), endpointBuilder2.hashCode());

        // Test creating an endpoint from endpointBuilder1
        endpointBuilder1.setExchangePattern(MessageExchangePattern.REQUEST_RESPONSE);
        endpointBuilder1.setResponseTimeout(99);
        ImmutableEndpoint ep = endpointFactory.getInboundEndpoint(endpointBuilder1);
        assertEquals(ep.getEndpointURI().getUri().toString(), "test://address");
        assertEquals(MessageExchangePattern.REQUEST_RESPONSE, ep.getExchangePattern());
        assertEquals(99, ep.getResponseTimeout());
        assertNotNull(ep.getConnector());
        assertEquals(testConnector1, ep.getConnector());

        // Test creating an endpoint from endpointBuilder2
        endpointBuilder2.setExchangePattern(MessageExchangePattern.ONE_WAY);
        endpointBuilder2.setResponseTimeout(0);
        endpointBuilder2.setConnector(testConnector2);
        ImmutableEndpoint ep2 = endpointFactory.getInboundEndpoint(endpointBuilder2);
        assertEquals(ep2.getEndpointURI().getUri().toString(), "test://address");
        assertEquals(MessageExchangePattern.ONE_WAY, ep2.getExchangePattern());
        assertEquals(0, ep2.getResponseTimeout());
        assertNotNull(ep.getConnector());
View Full Code Here

    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);
       
        return muleContext.getEndpointFactory().getOutboundEndpoint(endpointBuilder);
    }
View Full Code Here

        TransactionFactory tf = getTransactionFactory();
        TransactionConfig txConfig = new MuleTransactionConfig();
        txConfig.setFactory(tf);
        txConfig.setAction(txBeginAction);
       
        EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(getInDest(), muleContext);
        endpointBuilder.setName("testIn");
        endpointBuilder.setConnector(connector);
        endpointBuilder.setTransactionConfig(txConfig);
        InboundEndpoint endpoint = muleContext.getEndpointFactory().getInboundEndpoint(
            endpointBuilder);

        EndpointBuilder endpointBuilder2 = new EndpointURIEndpointBuilder(getOutDest(), muleContext);
        endpointBuilder2.setName("testOut");
        endpointBuilder2.setConnector(connector);
        OutboundEndpoint outProvider = muleContext.getEndpointFactory().getOutboundEndpoint(
            endpointBuilder2);
       
        service.setOutboundMessageProcessor(new DefaultOutboundRouterCollection());
        OutboundPassThroughRouter router = new OutboundPassThroughRouter();
View Full Code Here

    public InboundEndpoint getInboundEndpoint(String uri)
            throws MuleException
    {
        logger.debug("DefaultEndpointFactory request for inbound endpoint for uri: " + uri);
        EndpointBuilder endpointBuilder = lookupEndpointBuilder(uri);
        if (endpointBuilder == null)
        {
            logger.debug("Named EndpointBuilder not found, creating endpoint from uri");
            endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext);
        }
View Full Code Here

    public OutboundEndpoint getOutboundEndpoint(String uri)
            throws MuleException
    {
        logger.debug("DefaultEndpointFactory request for outbound endpoint for uri: " + uri);
        EndpointBuilder endpointBuilder = lookupEndpointBuilder(uri);
        if (endpointBuilder == null)
        {
            logger.debug("Named EndpointBuilder not found, creating endpoint from uri");
            endpointBuilder = new EndpointURIEndpointBuilder(uri, muleContext);
View Full Code Here

    protected EndpointBuilder lookupEndpointBuilder(String endpointName)
    {
        logger.debug("Looking up EndpointBuilder with name:" + endpointName + " in registry");
        // TODO DF: Do some simple parsing of endpointName to not lookup endpoint builder if endpointName is
        // obviously a uri and not a substituted name ??
        EndpointBuilder endpointBuilder = muleContext.getRegistry().lookupEndpointBuilder(endpointName);
        if (endpointBuilder != null)
        {
            logger.debug("EndpointBuilder with name:" + endpointName + " FOUND");
        }
        return endpointBuilder;
View Full Code Here

TOP

Related Classes of org.mule.api.endpoint.EndpointBuilder

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.