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