Package org.apache.camel

Examples of org.apache.camel.Endpoint


    public Endpoint resolveEndpoint(String uri) {
        return route.resolveEndpoint(getCamelContext(), uri);
    }

    public Endpoint resolveEndpoint(String uri, String ref) {
        Endpoint endpoint = null;
        if (uri != null) {
            endpoint = resolveEndpoint(uri);
            if (endpoint == null) {
                throw new NoSuchEndpointException(uri);
            }
        }
        if (ref != null) {
            endpoint = lookup(ref, Endpoint.class);
            if (endpoint == null) {
                throw new NoSuchEndpointException("ref:" + ref, "check your camel registry with id " + ref);
            }
            // Check the endpoint has the right CamelContext
            if (!this.getCamelContext().equals(endpoint.getCamelContext())) {
                throw new NoSuchEndpointException("ref:" + ref, "make sure the endpoint has the same camel context as the route does.");
            }
            try {
                // need add the endpoint into service
                getCamelContext().addService(endpoint);
View Full Code Here


     * @return an expression object which will return the OUT body
     */
    public static Expression toExpression(final String uri) {
        return new ExpressionAdapter() {
            public Object evaluate(Exchange exchange) {
                Endpoint endpoint = exchange.getContext().getEndpoint(uri);
                if (endpoint == null) {
                    throw new NoSuchEndpointException(uri);
                }

                Producer producer;
                try {
                    producer = endpoint.createProducer();
                    producer.start();
                    producer.process(exchange);
                    producer.stop();
                } catch (Exception e) {
                    throw ObjectHelper.wrapRuntimeCamelException(e);
View Full Code Here

     * Returns the mandatory endpoint for the given URI or the
     * {@link org.apache.camel.NoSuchEndpointException} is thrown
     */
    public static Endpoint getMandatoryEndpoint(CamelContext camelContext, String uri)
        throws NoSuchEndpointException {
        Endpoint endpoint = camelContext.getEndpoint(uri);
        if (endpoint == null) {
            throw new NoSuchEndpointException(uri);
        } else {
            return endpoint;
        }
View Full Code Here

    /**
     * Returns the mandatory endpoint for the given URI and type or the
     * {@link org.apache.camel.NoSuchEndpointException} is thrown
     */
    public static <T extends Endpoint> T getMandatoryEndpoint(CamelContext camelContext, String uri, Class<T> type) {
        Endpoint endpoint = getMandatoryEndpoint(camelContext, uri);
        return ObjectHelper.cast(type, endpoint);
    }
View Full Code Here

    public static Endpoint getEndpointInjection(CamelContext camelContext, String uri, String ref, String injectionPointName, boolean mandatory) {
        if (ObjectHelper.isNotEmpty(uri) && ObjectHelper.isNotEmpty(ref)) {
            throw new IllegalArgumentException("Both uri and name is provided, only either one is allowed: uri=" + uri + ", ref=" + ref);
        }

        Endpoint endpoint;
        if (isNotEmpty(uri)) {
            endpoint = camelContext.getEndpoint(uri);
        } else {
            // if a ref is given then it should be possible to lookup
            // otherwise we do not catch situations where there is a typo etc
View Full Code Here

            if (parameters != null && parameters.size() > 0) {
                childUri = childUri + "?" + URISupport.createQueryString(parameters);
            }
            // need to clean the parameters to avoid default component verify parameter complain
            parameters.clear();
            Endpoint childEndpoint = context.getEndpoint(childUri);
            return new MyEndpoint(uri, childEndpoint);
        }
View Full Code Here

        Binding bindingValue = getBinding();
        ObjectHelper.notNull(bindingValue, "binding");

        CamelContext camelContext = getCamelContext();
        String delegateURI = createDelegateURI(remaining, parameters);
        Endpoint delegate = getMandatoryEndpoint(camelContext, delegateURI);
        return new BindingEndpoint(uri, this, bindingValue, delegate);
    }
View Full Code Here

        String delegateURI = remaining.substring(idx + 1);
        if (delegateURI.isEmpty()) {
            throw new IllegalArgumentException(BAD_FORMAT_MESSAGE);
        }
        Binding binding = CamelContextHelper.mandatoryLookup(camelContext, bindingName, Binding.class);
        Endpoint delegate = getMandatoryEndpoint(camelContext, delegateURI);
        return new BindingEndpoint(uri, this, binding,  delegate);
    }
View Full Code Here

        // filter endpoints
        if (filter != null) {
            Iterator<Endpoint> it = endpoints.iterator();
            while (it.hasNext()) {
                Endpoint endpoint = it.next();
                if (!EndpointHelper.matchPattern(endpoint.getEndpointUri(), filter)) {
                    // did not match
                    it.remove();
                }
            }
        }

        final PrintStream out = System.out;

        for (Endpoint endpoint : endpoints) {
            String json = camelController.explainEndpoint(endpoint.getCamelContext().getName(), endpoint.getEndpointUri(), verbose);

            out.println("Context:\t" + endpoint.getCamelContext().getName());

            // sanitize and mask uri so we dont see passwords
            String uri = URISupport.sanitizeUri(endpoint.getEndpointUri());
            String header = "Uri:            " + uri;
            out.println(header);
            for (int i = 0; i < header.length(); i++) {
                out.print('-');
            }
View Full Code Here

* Represents the component that manages {@link GitHubEndpoint}.
*/
public class GitHubComponent extends DefaultComponent {

    protected Endpoint createEndpoint(String uri, String remaining, Map<String, Object> parameters) throws Exception {
        Endpoint endpoint = new GitHubEndpoint(uri, this);
        setProperties(endpoint, parameters);
        return endpoint;
    }
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.