View Javadoc

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