View Javadoc

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