001: /*
002: * $Id: EndpointFactory.java 10961 2008-02-22 19:01:02Z dfeist $
003: * --------------------------------------------------------------------------------------
004: * Copyright (c) MuleSource, Inc. All rights reserved. http://www.mulesource.com
005: *
006: * The software in this package is published under the terms of the CPAL v1.0
007: * license, a copy of which has been included with this distribution in the
008: * LICENSE.txt file.
009: */
010:
011: package org.mule.api.endpoint;
012:
013: import org.mule.api.MuleException;
014: import org.mule.api.context.MuleContextAware;
015: import org.mule.api.registry.Registry;
016: import org.mule.endpoint.EndpointURIEndpointBuilder;
017:
018: /**
019: * Endpoint factory creates immutable instances of {@link ImmutableEndpoint}. These endpoints may be <br/>
020: * <li> Endpoints created by uri string of the type requested.
021: * <li> Endpoints of the type requested created based on a given global endpoint identified by global endpoint
022: * name.
023: * <li> Endpoints of the type requested based on an existing configured endpoint instance that has been given
024: * a name in configuration. <br/> <br/> This factory always returns new unique endpoint instances. The
025: * {@link Registry} should be used to lookup/create endpoints.
026: */
027: public interface EndpointFactory extends MuleContextAware {
028:
029: /**
030: * Creates an endpoint with the "INBOUND" role. <br/><br/> The uri parameter can either be a uri, or a
031: * (global) endpoint identifier or name. <br/><br/> The {@link InboundEndpoint} interface is
032: * currently used as the return type but this will be replaces by and more specific interface. SEE
033: * MULE-2292
034: *
035: * @param uri endpoint identifier or uri
036: * @param muleContext
037: * @return
038: * @throws MuleException
039: */
040: InboundEndpoint getInboundEndpoint(String uri) throws MuleException;
041:
042: /**
043: * Creates an endpoint with the "OUTBOUND" role. <br/><br/> The uri parameter can either be a uri, or a
044: * (global) endpoint identifier or name. <br/><br/> The {@link OutboundEndpoint} interface is
045: * currently used as the return type but this will be replaces by and more specific interface. SEE
046: * MULE-2292
047: *
048: * @param uri endpoint identifier or uri
049: * @param muleContext
050: * @return
051: * @throws MuleException
052: */
053: OutboundEndpoint getOutboundEndpoint(String uri)
054: throws MuleException;
055:
056: /**
057: * Creates an endpoint with the "INBOUND" role using the builder provided.
058: *
059: * @param builder
060: * @param muleContext
061: * @return
062: * @throws MuleException
063: */
064: InboundEndpoint getInboundEndpoint(EndpointBuilder builder)
065: throws MuleException;
066:
067: /**
068: * Creates an endpoint with the "OUTBOUND" role using the builder provided.
069: *
070: * @param builder
071: * @param muleContext
072: * @return
073: * @throws MuleException
074: */
075: OutboundEndpoint getOutboundEndpoint(EndpointBuilder builder)
076: throws MuleException;
077:
078: /**
079: * @param endpointUri
080: * @return
081: * @throws MuleException
082: * @deprecated
083: */
084: InboundEndpoint getInboundEndpoint(EndpointURI endpointUri)
085: throws MuleException;
086:
087: /**
088: * @param endpointUri
089: * @return
090: * @throws MuleException
091: * @deprecated
092: */
093: OutboundEndpoint getOutboundEndpoint(EndpointURI endpointUri)
094: throws MuleException;
095:
096: /**
097: * Used to retrieve the an EndpointBuilder equal to the one would be used to create an endpoint.<br/><br/>
098: * This is
099: * useful if you need to customize a builder before creation of an endpoint as you can use this method to
100: * obtain the endpoint builder, custommize it and then call the factory methods that take a
101: * EndpointBuilder rather than a String. <br/><br/><i>(Of course if you know the uri is a uri rather than a global
102: * endpoint identifier you could create your own EndpointURIEndpointBuilder locally, this method allows
103: * the uri to be substituted with a global endpoint name and returns it's builder if this is the case.
104: * allow the uri parameter to be either a uri or a global endpoint identifier you need this method.</i> <br/><br/>
105: * Each and every call to this method, even if it is for the same uri/global endpoint name will return a new EndpoointBuilder instance.
106: *
107: *
108: *
109: * @param uri endpoint identifier or uri
110: * @param muleContext
111: * @return
112: * @throws MuleException
113: * @see EndpointBuilder
114: * @see EndpointURIEndpointBuilder
115: */
116: EndpointBuilder getEndpointBuilder(String uri) throws MuleException;
117:
118: }
|