1 /* 2 * Copyright (c) MuleSoft, Inc. All rights reserved. http://www.mulesoft.com 3 * The software in this package is published under the terms of the CPAL v1.0 4 * license, a copy of which has been included with this distribution in the 5 * LICENSE.txt file. 6 */ 7 package org.mule.api.endpoint; 8 9 import org.mule.api.MuleException; 10 import org.mule.api.context.MuleContextAware; 11 import org.mule.api.registry.Registry; 12 import org.mule.endpoint.EndpointURIEndpointBuilder; 13 14 /** 15 * Endpoint factory creates immutable instances of {@link ImmutableEndpoint}. These endpoints may be <br/> 16 * <li> Endpoints created by uri string of the type requested. 17 * <li> Endpoints of the type requested created based on a given global endpoint identified by global endpoint 18 * name. 19 * <li> Endpoints of the type requested based on an existing configured endpoint instance that has been given 20 * a name in configuration. <br/> <br/> This factory always returns new unique endpoint instances. The 21 * {@link Registry} should be used to lookup/create endpoints. 22 */ 23 public interface EndpointFactory extends MuleContextAware 24 { 25 26 /** 27 * Creates an endpoint with the "INBOUND" role. <br/><br/> The uri parameter can either be a uri, or a 28 * (global) endpoint identifier or name. <br/><br/> The {@link InboundEndpoint} interface is 29 * currently used as the return type but this will be replaces by and more specific interface. SEE 30 * MULE-2292 31 * 32 * @param uri endpoint identifier or uri 33 * @throws MuleException 34 */ 35 InboundEndpoint getInboundEndpoint(String uri) throws MuleException; 36 37 /** 38 * Creates an endpoint with the "OUTBOUND" role. <br/><br/> The uri parameter can either be a uri, or a 39 * (global) endpoint identifier or name. <br/><br/> The {@link OutboundEndpoint} interface is 40 * currently used as the return type but this will be replaces by and more specific interface. SEE 41 * MULE-2292 42 * 43 * @param uri endpoint identifier or uri 44 * @throws MuleException 45 */ 46 OutboundEndpoint getOutboundEndpoint(String uri) throws MuleException; 47 48 /** 49 * Creates an endpoint with the "INBOUND" role using the builder provided. 50 * 51 * @param builder 52 * @throws MuleException 53 */ 54 InboundEndpoint getInboundEndpoint(EndpointBuilder builder) throws MuleException; 55 56 /** 57 * Creates an endpoint with the "OUTBOUND" role using the builder provided. 58 * 59 * @param builder 60 * @throws MuleException 61 */ 62 OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder) throws MuleException; 63 64 /** 65 * @param endpointUri 66 * @throws MuleException 67 * @deprecated 68 */ 69 @Deprecated 70 InboundEndpoint getInboundEndpoint(EndpointURI endpointUri) throws MuleException; 71 72 /** 73 * @param endpointUri 74 * @throws MuleException 75 * @deprecated 76 */ 77 @Deprecated 78 OutboundEndpoint getOutboundEndpoint(EndpointURI endpointUri) throws MuleException; 79 80 /** 81 * Used to retrieve the an EndpointBuilder equal to the one would be used to create an endpoint.<br/><br/> 82 * This is 83 * useful if you need to customize a builder before creation of an endpoint as you can use this method to 84 * obtain the endpoint builder, custommize it and then call the factory methods that take a 85 * EndpointBuilder rather than a String. <br/><br/><i>(Of course if you know the uri is a uri rather than a global 86 * endpoint identifier you could create your own EndpointURIEndpointBuilder locally, this method allows 87 * the uri to be substituted with a global endpoint name and returns it's builder if this is the case. 88 * allow the uri parameter to be either a uri or a global endpoint identifier you need this method.</i> <br/><br/> 89 * Each and every call to this method, even if it is for the same uri/global endpoint name will return a new EndpoointBuilder instance. 90 * 91 * @param uri endpoint identifier or uri 92 * @throws MuleException 93 * @see EndpointBuilder 94 * @see EndpointURIEndpointBuilder 95 */ 96 EndpointBuilder getEndpointBuilder(String uri) throws MuleException; 97 98 }