View Javadoc

1   /*
2    * $Id: EndpointFactory.java 19191 2010-08-25 21:05:23Z tcarlson $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.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       * @throws MuleException
38       */
39      InboundEndpoint getInboundEndpoint(String uri) throws MuleException;
40  
41      /**
42       * Creates an endpoint with the "OUTBOUND" role. <br/><br/> The uri parameter can either be a uri, or a
43       * (global) endpoint identifier or name. <br/><br/> The {@link OutboundEndpoint} interface is
44       * currently used as the return type but this will be replaces by and more specific interface. SEE
45       * MULE-2292
46       * 
47       * @param uri endpoint identifier or uri
48       * @throws MuleException
49       */
50      OutboundEndpoint getOutboundEndpoint(String uri) throws MuleException;
51  
52      /**
53       * Creates an endpoint with the "INBOUND" role using the builder provided.
54       * 
55       * @param builder
56       * @throws MuleException
57       */
58      InboundEndpoint getInboundEndpoint(EndpointBuilder builder) throws MuleException;
59  
60      /**
61       * Creates an endpoint with the "OUTBOUND" role using the builder provided.
62       * 
63       * @param builder
64       * @throws MuleException
65       */
66      OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder) throws MuleException;
67  
68      /**
69       * @param endpointUri
70       * @throws MuleException
71       * @deprecated
72       */
73      @Deprecated
74      InboundEndpoint getInboundEndpoint(EndpointURI endpointUri) throws MuleException;
75  
76      /**
77       * @param endpointUri
78       * @throws MuleException
79       * @deprecated
80       */
81      @Deprecated
82      OutboundEndpoint getOutboundEndpoint(EndpointURI endpointUri) throws MuleException;
83  
84      /**
85       * Used to retrieve the an EndpointBuilder equal to the one would be used to create an endpoint.<br/><br/>
86       *  This is
87       * useful if you need to customize a builder before creation of an endpoint as you can use this method to
88       * obtain the endpoint builder, custommize it and then call the factory methods that take a
89       * EndpointBuilder rather than a String. <br/><br/><i>(Of course if you know the uri is a uri rather than a global
90       * endpoint identifier you could create your own EndpointURIEndpointBuilder locally, this method allows
91       * the uri to be substituted with a global endpoint name and returns it's builder if this is the case.
92       * allow the uri parameter to be either a uri or a global endpoint identifier you need this method.</i> <br/><br/>
93       * Each and every call to this method, even if it is for the same uri/global endpoint name will return a new EndpoointBuilder instance.
94       * 
95       * @param uri endpoint identifier or uri
96       * @throws MuleException
97       * @see EndpointBuilder
98       * @see EndpointURIEndpointBuilder
99       */
100     EndpointBuilder getEndpointBuilder(String uri) throws MuleException;
101 
102 }