Package org.mule.transport

Examples of org.mule.transport.AbstractConnector


        return "issues/service-overrides-mule-1770-test.xml";
    }

    public void testServiceOverrides()
    {
        AbstractConnector c = (AbstractConnector)muleContext.getRegistry().lookupConnector("test");
        assertNotNull("Connector should not be null", c);
        assertNotNull("Service overrides should not be null", c.getServiceOverrides());
        String temp =  (String)c.getServiceOverrides().get(MuleProperties.CONNECTOR_DISPATCHER_FACTORY);
        assertNotNull("DispatcherFactory override should not be null", temp);
        assertEquals(TestMessageDispatcherFactory.class.getName(), temp);
        Transformer transformer = TransformerUtils.firstOrNull(c.getDefaultInboundTransformers(null));
        assertNotNull("InboundTransformer should not be null", transformer);
        assertEquals(NoActionTransformer.class, transformer.getClass());
    }
View Full Code Here



    // MULE-1878
    public void testDuplicate()
    {
        AbstractConnector c1 = (AbstractConnector)muleContext.getRegistry().lookupConnector("test");
        assertNotNull("Connector should not be null", c1);
        Transformer t1 = TransformerUtils.firstOrNull(c1.getDefaultInboundTransformers(null));
        assertNotNull("InboundTransformer should not be null", t1);
        assertEquals(NoActionTransformer.class, t1.getClass());

        AbstractConnector c2 = (AbstractConnector)muleContext.getRegistry().lookupConnector("second");
        assertNotNull("Connector should not be null", c2);
        Transformer t2 = TransformerUtils.firstOrNull(c2.getDefaultInboundTransformers(null));
        assertNull("InboundTransformer should be null", t2);
    }
View Full Code Here

            {
                scheme = address.substring(0, i);
                address = scheme + "://dynamic";
                //This is used for creating the connector, since we don't know if the actual URI address is a vaild URI.
                EndpointURI tempUri = new MuleEndpointURI(address, context);
                AbstractConnector cnn = null;

                if (epData.getConnectorName() != null)
                {
                    cnn = (AbstractConnector) context.getRegistry().lookupConnector(epData.getConnectorName());
                }
                if (cnn == null)
                {
                    cnn = (AbstractConnector) new TransportFactory(context).createConnector(tempUri);
                    if (epData.getConnectorName() != null)
                    {
                        cnn.setName(epData.getConnectorName());
                    }
                    context.getRegistry().registerConnector(cnn);
                }

                //This allows connector properties to be set as properties on the endpoint
View Full Code Here

     * @throws TransportServiceException if the connector cannot be created
     */
    @Override
    public Connector createConnector() throws TransportServiceException
    {
        AbstractConnector c = (AbstractConnector) super.createConnector();
        c.registerSupportedMetaProtocol(metaScheme);
        return c;
    }
View Full Code Here

        this.endpoint = endpoint;
    }

    public MuleEvent process(MuleEvent event) throws MuleException
    {
        AbstractConnector connector = (AbstractConnector) endpoint.getConnector();
        if (connector.isEnableMessageEvents())
        {
            String component = null;
            if (event.getFlowConstruct() != null)
            {
                component = event.getFlowConstruct().getName();
            }

            int notificationAction;
            if (endpoint.getExchangePattern().hasResponse())
            {
                notificationAction = EndpointMessageNotification.MESSAGE_SENT;
            }
            else
            {
                notificationAction = EndpointMessageNotification.MESSAGE_DISPATCHED;
            }
            connector.fireNotification(new EndpointMessageNotification(event.getMessage(), endpoint,
                component, notificationAction));
        }

        return event;
    }
View Full Code Here

        assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
        assertEquals(defaultThreadPoolExhaustedAction, tp.getPoolExhaustedAction());
        assertEquals(defaultThreadTTL, tp.getThreadTTL());

        // test that unset values retain a default value
        AbstractConnector c = (AbstractConnector) muleContext.getRegistry().lookupConnector("dummyConnector");
        tp = c.getDispatcherThreadingProfile();
        // this value is configured
        assertEquals(connectorMaxBufferSize, tp.getMaxBufferSize());
        // these values are inherited
        assertEquals(defaultMaxThreadsActive, tp.getMaxThreadsActive());
        assertEquals(defaultMaxThreadsIdle, tp.getMaxThreadsIdle());
View Full Code Here

                                                                   String protocol,
                                                                   MuleContext context,
                                                                   EndpointSource source) throws Exception
    {
        // need to build endpoint this way to avoid depenency to any endpoint jars
        final AbstractConnector connector = (AbstractConnector) ClassUtils.loadClass(
            "org.mule.tck.testmodels.mule.TestConnector", AbstractMuleTestCase.class).newInstance();

        connector.setName("testConnector");
        context.getRegistry().applyLifecycle(connector);
        connector.registerSupportedProtocol(protocol);

        final EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
            "test:" + protocol + "://test", context);
        endpointBuilder.setConnector(connector);
        endpointBuilder.setName(name);
View Full Code Here

    }

    @Override
    protected Connector getConnector() throws EndpointException
    {
        AbstractConnector c = (AbstractConnector) super.getConnector();
        EndpointURI endpointURI = uriBuilder.getEndpoint();
        if(!c.supportsProtocol(endpointURI.getFullScheme()))
        {
            c.registerSupportedMetaProtocol(endpointURI.getSchemeMetaInfo());
        }
        return c;
    }
View Full Code Here

        handleException(ex, null);
    }
   
    protected void handleReconnection(ConnectException ex)
    {
        final AbstractConnector connector = (AbstractConnector) ex.getFailed();

        // Make sure the connector is not already being reconnected by another receiver thread.
        if (connector.isConnecting())
        {
            return;
        }
           
        logger.info("Exception caught is a ConnectException, attempting to reconnect...");
       
        // Disconnect
        try
        {
            logger.debug("Disconnecting " + connector.getName());
            connector.stop();
            connector.disconnect();
        }
        catch (Exception e1)
        {
            logger.error(e1.getMessage());
        }

        // Reconnect (retry policy will go into effect here if configured)
        try
        {
            connector.getMuleContext().getWorkManager().scheduleWork(new Work()
            {
                @Override
                public void release()
                {
                }

                @Override
                public void run()
                {
                    try
                    {
                        logger.debug("Reconnecting " + connector.getName());
                        connector.start();
                    }
                    catch (Exception e)
                    {
                        if (logger.isDebugEnabled())
                        {
View Full Code Here

                                                                   String protocol,
                                                                   MuleContext context,
                                                                   EndpointSource source) throws Exception
    {
        // need to build endpoint this way to avoid depenency to any endpoint jars
        final AbstractConnector connector = (AbstractConnector) ClassUtils.loadClass(
                "org.mule.tck.testmodels.mule.TestConnector", AbstractMuleTestCase.class).newInstance();

        connector.setName("testConnector");
        context.getRegistry().applyLifecycle(connector);
        connector.registerSupportedProtocol(protocol);

        final EndpointBuilder endpointBuilder = new EndpointURIEndpointBuilder(
                "test:" + protocol + "://test", context);
        endpointBuilder.setConnector(connector);
        endpointBuilder.setName(name);
View Full Code Here

TOP

Related Classes of org.mule.transport.AbstractConnector

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.