View Javadoc
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.config.spring.parsers.specific.endpoint;
8   
9   import org.mule.api.endpoint.ImmutableEndpoint;
10  import org.mule.config.spring.parsers.specific.endpoint.support.AddressedEndpointDefinitionParser;
11  import org.mule.config.spring.parsers.specific.endpoint.support.ChildEndpointDefinitionParser;
12  import org.mule.endpoint.URIBuilder;
13  
14  /**
15   * This is intended for use by endpoint-specific parsers for non-global endpoint
16   * elements.
17   *
18   * <p>It generates both an endpoint (which should subclass {@link ImmutableEndpoint}) and a
19   * {@link URIBuilder}.  The URI is then injected into the endpoint. So the associated schema 
20   * can enable any of the suitable {@link URIBuilder#ALL_ATTRIBUTES} or add appropriate mappings.
21   */
22  public class TransportEndpointDefinitionParser extends AddressedEndpointDefinitionParser
23  {
24  
25      public TransportEndpointDefinitionParser(String protocol, Class endpoint, String[] requiredAddressAttributes)
26      {
27          this(protocol, PROTOCOL, endpoint, requiredAddressAttributes);
28      }
29  
30      public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint,
31                                               String[] requiredAddressAttributes)
32      {
33          this(metaOrProtocol, isMeta, endpoint, requiredAddressAttributes, new String[]{});
34      }
35  
36      /**
37       * @param metaOrProtocol The transport metaOrProtocol ("tcp" etc)
38       * @param isMeta Whether transport is "meta" or not (eg cxf)
39       * @param endpoint The endpoint class to construct
40       * @param requiredAddressAttributes A list of attribute names that are required if "address"
41       * isn't present
42       * @param requiredProperties A list of property names that are required if "address" isn't present
43       */
44      public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint,
45                                               String[] requiredAddressAttributes, String[] requiredProperties)
46      {
47          super(metaOrProtocol, isMeta, new ChildEndpointDefinitionParser(endpoint),
48                  requiredAddressAttributes, requiredProperties);
49      }
50  
51      public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint,
52                                               String[] endpointAttributes,
53                                               String[][] requiredAddressAttributes,
54                                               String[][] requiredProperties)
55      {
56          this(metaOrProtocol, isMeta, endpoint, endpointAttributes, URIBuilder.ALL_ATTRIBUTES,
57                  requiredAddressAttributes, requiredProperties);
58      }
59  
60      public TransportEndpointDefinitionParser(String metaOrProtocol, boolean isMeta, Class endpoint,
61                                               String[] endpointAttributes,
62                                               String[] addressAttributes,
63                                               String[][] requiredAddressAttributes,
64                                               String[][] requiredProperties)
65      {
66          super(metaOrProtocol, isMeta, new ChildEndpointDefinitionParser(endpoint),
67                  endpointAttributes, addressAttributes, requiredAddressAttributes, requiredProperties);
68      }
69  
70  }