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.module.cxf.support;
8   
9   import org.mule.module.cxf.builder.AbstractInboundMessageProcessorBuilder;
10  
11  import javax.xml.namespace.QName;
12  
13  import org.apache.cxf.service.factory.AbstractServiceConfiguration;
14  
15  /**
16   * This is the {@link AbstractServiceConfiguration ServiceConfiguration} that is
17   * associated to the {@link AbstractInboundMessageProcessorBuilder
18   * InboundMessageProcessorBuilder}, so it can obtain properties directly from it.
19   */
20  public class MuleServiceConfiguration extends AbstractServiceConfiguration
21  {
22      final AbstractInboundMessageProcessorBuilder builder;
23  
24      public MuleServiceConfiguration(AbstractInboundMessageProcessorBuilder builder)
25      {
26          this.builder = builder;
27      }
28  
29      @Override
30      public String getServiceNamespace()
31      {
32          final String builderNameSpace = builder.getNamespace();
33          if (builderNameSpace != null)
34          {
35              return builderNameSpace;
36          }
37          else
38          {
39              return super.getServiceNamespace();
40          }
41      }
42  
43      @Override
44      public String getServiceName()
45      {
46          final String builderServiceName = builder.getService();
47          if (builderServiceName != null)
48          {
49              return builderServiceName;
50          }
51          else
52          {
53              return super.getServiceName();
54          }
55      }
56  
57      @Override
58      public QName getEndpointName()
59      {
60          final String builderPort = builder.getPort();
61          if (builderPort != null)
62          {
63              return new QName(getServiceNamespace(), builderPort);
64          }
65          else
66          {
67              return super.getEndpointName();
68          }
69      }
70  }