View Javadoc

1   /*
2    * $Id: DefaultOutboundEndpoint.java 11311 2008-03-10 20:15:57Z 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.endpoint;
12  
13  import org.mule.api.MuleContext;
14  import org.mule.api.MuleEvent;
15  import org.mule.api.MuleMessage;
16  import org.mule.api.endpoint.EndpointURI;
17  import org.mule.api.endpoint.OutboundEndpoint;
18  import org.mule.api.routing.filter.Filter;
19  import org.mule.api.security.EndpointSecurityFilter;
20  import org.mule.api.transaction.TransactionConfig;
21  import org.mule.api.transport.ConnectionStrategy;
22  import org.mule.api.transport.Connector;
23  import org.mule.api.transport.DispatchException;
24  import org.mule.config.MuleManifest;
25  
26  import java.util.List;
27  import java.util.Map;
28  
29  public class DefaultOutboundEndpoint extends AbstractEndpoint implements OutboundEndpoint
30  {
31  
32      private static final long serialVersionUID = 8860985949279708638L;
33  
34      public DefaultOutboundEndpoint(Connector connector,
35                                     EndpointURI endpointUri,
36                                     List transformers,
37                                     List responseTransformers,
38                                     String name,
39                                     Map properties,
40                                     TransactionConfig transactionConfig,
41                                     Filter filter,
42                                     boolean deleteUnacceptedMessage,
43                                     EndpointSecurityFilter securityFilter,
44                                     boolean synchronous,
45                                     boolean remoteSync,
46                                     int remoteSyncTimeout,
47                                     String initialState,
48                                     String endpointEncoding,
49                                     MuleContext muleContext,
50                                     ConnectionStrategy connectionStrategy)
51      {
52          super(connector, endpointUri, transformers, responseTransformers, name, properties, transactionConfig, filter,
53              deleteUnacceptedMessage, securityFilter, synchronous, remoteSync, remoteSyncTimeout, initialState,
54              endpointEncoding, muleContext, connectionStrategy);
55      }
56  
57      public void dispatch(MuleEvent event) throws DispatchException
58      {
59          if (getConnector() != null)
60          {
61              getConnector().dispatch(this, event);
62          }
63          else
64          {
65              // TODO Either remove because this should never happen or i18n the
66              // message
67              throw new IllegalStateException("The connector on the endpoint: " + toString()
68                                              + " is null. Please contact " + MuleManifest.getDevListEmail());
69          }
70      }
71  
72      public MuleMessage send(MuleEvent event) throws DispatchException
73      {
74          if (getConnector() != null)
75          {
76              return getConnector().send(this, event);
77          }
78          else
79          {
80              // TODO Either remove because this should never happen or i18n the
81              // message
82              throw new IllegalStateException("The connector on the endpoint: " + toString()
83                                              + " is null. Please contact " + MuleManifest.getDevListEmail());
84          }
85      }
86  }