View Javadoc

1   /**
2    * Copyright 2005-2014 The Kuali Foundation
3    *
4    * Licensed under the Educational Community License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    * http://www.opensource.org/licenses/ecl2.php
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.kuali.rice.ksb.api.bus.support;
17  
18  import javax.xml.bind.annotation.XmlAccessType;
19  import javax.xml.bind.annotation.XmlAccessorType;
20  import javax.xml.bind.annotation.XmlElement;
21  import javax.xml.bind.annotation.XmlRootElement;
22  import javax.xml.bind.annotation.XmlType;
23  
24  @XmlRootElement(name = SoapServiceConfiguration.Constants.ROOT_ELEMENT_NAME)
25  @XmlAccessorType(XmlAccessType.NONE)
26  @XmlType(name = SoapServiceConfiguration.Constants.TYPE_NAME, propOrder = {
27  		SoapServiceConfiguration.Elements.SERVICE_INTERFACE,
28  		SoapServiceConfiguration.Elements.JAX_WS_SERVICE
29  })
30  public class SoapServiceConfiguration extends AbstractServiceConfiguration {
31  
32  	private static final long serialVersionUID = -4226512121638441108L;
33  
34  	@XmlElement(name = Elements.SERVICE_INTERFACE, required = true)
35  	private final String serviceInterface;
36  	
37  	@XmlElement(name = Elements.JAX_WS_SERVICE, required = true)
38  	private final boolean jaxWsService;
39  	
40  	/**
41       * Private constructor used only by JAXB.
42       */
43  	private SoapServiceConfiguration() {
44  		super();
45  		this.serviceInterface = null;
46  		this.jaxWsService = false;
47  	}
48  	
49  	private SoapServiceConfiguration(Builder builder) {
50  		super(builder);
51  		this.serviceInterface = builder.getServiceInterface();
52  		this.jaxWsService = builder.isJaxWsService();
53  	}
54  	
55  	public static SoapServiceConfiguration fromServiceDefinition(SoapServiceDefinition soapServiceDefinition) {
56  		return Builder.create(soapServiceDefinition).build();
57  	}
58  	
59  	public String getServiceInterface() {
60  		return serviceInterface;
61  	}
62  
63  	public boolean isJaxWsService() {
64  		return jaxWsService;
65  	}
66  	
67  	public static final class Builder extends AbstractServiceConfiguration.Builder<SoapServiceConfiguration> {
68  
69  		private static final long serialVersionUID = 722267174667364588L;
70  
71  		private String serviceInterface;
72  		private boolean jaxWsService = false;		
73  				
74  		public String getServiceInterface() {
75  			return serviceInterface;
76  		}
77  
78  		public void setServiceInterface(String serviceInterface) {
79  			this.serviceInterface = serviceInterface;
80  		}
81  
82  		public boolean isJaxWsService() {
83  			return jaxWsService;
84  		}
85  
86  		public void setJaxWsService(boolean jaxWsService) {
87  			this.jaxWsService = jaxWsService;
88  		}
89  
90  		private Builder() {}
91  		
92  		public static Builder create() {
93  			return new Builder();
94  		}
95  		
96  		public static Builder create(SoapServiceDefinition soapServiceDefinition) {
97  			Builder builder = create();
98  			builder.copyServiceDefinitionProperties(soapServiceDefinition);
99  			builder.setServiceInterface(soapServiceDefinition.getServiceInterface());
100 			builder.setJaxWsService(soapServiceDefinition.isJaxWsService());
101 			return builder;
102 		}
103 
104 		@Override
105 		public SoapServiceConfiguration build() {
106 			return new SoapServiceConfiguration(this);
107 		}
108 		
109 	}
110 	
111 	/**
112      * Defines some internal constants used on this class.
113      */
114     static class Constants {
115     	final static String ROOT_ELEMENT_NAME = "soapServiceConfiguration";
116         final static String TYPE_NAME = "SoapServiceConfigurationType";
117     }
118 
119     /**
120      * A private class which exposes constants which define the XML element names to use
121      * when this object is marshalled to XML.
122      */
123      static class Elements {
124     	protected final static String SERVICE_INTERFACE = "serviceInterface";
125     	protected final static String JAX_WS_SERVICE = "jaxWsService";
126     }
127 	
128 }