View Javadoc

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