Package org.apache.camel

Examples of org.apache.camel.Endpoint


        assertTrue(columnNames.contains("NAME"));
    }

    @Test
    public void testJdbcRSMetaDataEmptyResult() {
        Endpoint directHelloEndpoint = context.getEndpoint("direct:hello");
        Exchange directHelloExchange = directHelloEndpoint.createExchange();

        directHelloExchange.getIn().setBody("select * from customer where id = 'cust0'");

        Exchange out = template.send(directHelloEndpoint, directHelloExchange);
        assertNotNull(out);
View Full Code Here


            return new ArrayList<Endpoint>(endpoints.values());
        }
    }

    public Endpoint addSingletonEndpoint(String uri, Endpoint endpoint) throws Exception {
        Endpoint oldEndpoint;
        synchronized (endpoints) {
            startServices(endpoint);
            oldEndpoint = endpoints.remove(uri);
            endpoints.put(uri, endpoint);
            stopServices(oldEndpoint);
View Full Code Here

        }
        return oldEndpoint;
    }

    public Endpoint removeSingletonEndpoint(String uri) throws Exception {
        Endpoint oldEndpoint;
        synchronized (endpoints) {
            oldEndpoint = endpoints.remove(uri);
            stopServices(oldEndpoint);
        }
        return oldEndpoint;
View Full Code Here

    /**
     * Resolves the given URI to an endpoint
     */
    public Endpoint getEndpoint(String uri) {
        Endpoint answer;
        synchronized (endpoints) {
            answer = endpoints.get(uri);
            if (answer == null) {
                try {

                    // Use the URI prefix to find the component.
                    String splitURI[] = ObjectHelper.splitOnCharacter(uri, ":", 2);
                    if (splitURI[1] != null) {
                        String scheme = splitURI[0];
                        Component component = getComponent(scheme);

                        // Ask the component to resolve the endpoint.
                        if (component != null) {
                            // Have the component create the endpoint if it can.
                            answer = component.createEndpoint(uri);
                        }
                    }
                    if (answer == null) {
                        answer = createEndpoint(uri);
                    }

                    // If it's a singleton then auto register it.
                    if (answer != null && answer.isSingleton()) {
                        startServices(answer);
                        endpoints.put(uri, answer);
                      lifecycleStrategy.onEndpointAdd(answer);
                    }
                } catch (Exception e) {
View Full Code Here

        }
        return answer;
    }

    public <T extends Endpoint> T getEndpoint(String name, Class<T> endpointType) {
        Endpoint endpoint = getEndpoint(name);
        if (endpointType.isInstance(endpoint)) {
            return endpointType.cast(endpoint);
        } else {
            throw new IllegalArgumentException("The endpoint is not of type: " + endpointType + " but is: "
                                               + endpoint);
View Full Code Here

        return "To[" + FromType.description(getUri(), getRef(), getEndpoint()) + "]";
    }

    @Override
    public Processor createProcessor(RouteContext routeContext) throws Exception {
        Endpoint endpoint = resolveEndpoint(routeContext);
        return new SendProcessor(endpoint);
    }
View Full Code Here

    // Implementation methods
    // -------------------------------------------------------------------------

    protected void addRoutes(Collection<Route> routes, FromType fromType) throws Exception {
        RouteContext routeContext = new RouteContext(this, fromType, routes);
        Endpoint endpoint = routeContext.getEndpoint();

        for (ProcessorType output : outputs) {
            output.addRoutes(routeContext, routes);
        }
View Full Code Here

        assertEquals("cron expression", "0 0 12 * * ?", trigger.getCronExpression());
    }

    @Override
    protected QuartzEndpoint resolveMandatoryEndpoint(String uri) {
        Endpoint endpoint = super.resolveMandatoryEndpoint(uri);
        return assertIsInstanceOf(QuartzEndpoint.class, endpoint);
    }
View Full Code Here

*/
public class UriConfigurationTest extends TestCase {
    protected CamelContext context = new DefaultCamelContext();

    public void testPrivateChatConfiguration() throws Exception {
        Endpoint endpoint = context.getEndpoint("xmpp://camel-user@localhost:123/test-user@localhost");
        assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
        XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;


        assertEquals("localhost", xmppEndpoint.getHost());
View Full Code Here

        assertEquals("camel-user", xmppEndpoint.getUser());
        assertEquals("test-user@localhost", xmppEndpoint.getParticipant());
    }

    public void testGroupChatConfiguration() throws Exception {
        Endpoint endpoint = context.getEndpoint("xmpp://camel-user@im.google.com:123?room=cheese");
        assertTrue("Endpoint not an XmppEndpoint: " + endpoint, endpoint instanceof XmppEndpoint);
        XmppEndpoint xmppEndpoint = (XmppEndpoint) endpoint;


        assertEquals("im.google.com", xmppEndpoint.getHost());
View Full Code Here

TOP

Related Classes of org.apache.camel.Endpoint

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.