Clover Coverage Report - KS Common 1.2-M6-SNAPSHOT (Aggregated)
Coverage timestamp: Mon Sep 12 2011 05:50:56 EDT
../../../../../../img/srcFileCovDistChart5.png 23% of files have more coverage
24   143   18   1.71
6   75   0.75   14
14     1.29  
1    
 
  JaxWsClientFactoryBean       Line # 26 24 0% 18 23 47.7% 0.47727272
 
No Tests
 
1    /**
2    * Copyright 2010 The Kuali Foundation Licensed under the
3    * Educational Community License, Version 2.0 (the "License"); you may
4    * not use this file except in compliance with the License. You may
5    * obtain a copy of the License at
6    *
7    * http://www.osedu.org/licenses/ECL-2.0
8    *
9    * Unless required by applicable law or agreed to in writing,
10    * software distributed under the License is distributed on an "AS IS"
11    * BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
12    * or implied. See the License for the specific language governing
13    * permissions and limitations under the License.
14    */
15   
16    package org.kuali.student.common.ws.beans;
17   
18    import java.net.URL;
19   
20    import javax.xml.namespace.QName;
21    import javax.xml.ws.BindingProvider;
22    import javax.xml.ws.Service;
23   
24    import org.springframework.core.io.ClassPathResource;
25   
 
26    public class JaxWsClientFactoryBean implements JaxWsClientFactory {
27    private Class<?> serviceEndpointInterface = null;
28    private String wsdlDocumentLocation = "";
29    private QName serviceQName = null;
30    private String serviceUrl = "";
31    private static final String CLASSPATH_PREFIX = "classpath:";
32    private Object client;
33   
 
34  147 toggle @Override
35    public synchronized Object getObject() throws Exception {
36  147 if(client==null){
37  147 URL url;
38  147 if (wsdlDocumentLocation.startsWith(CLASSPATH_PREFIX)) {
39  0 ClassPathResource cpr = new ClassPathResource(wsdlDocumentLocation.substring(CLASSPATH_PREFIX.length()));
40  0 url = cpr.getURL();
41    } else {
42  147 url = new URL(wsdlDocumentLocation);
43    }
44  147 Service service = Service.create(url, serviceQName);
45  147 client = service.getPort(serviceEndpointInterface);
46    // Override the service URL
47  147 if (this.serviceUrl != null && !"".equals(this.serviceUrl)) {
48  147 ((BindingProvider) client).getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, this.serviceUrl);
49    }
50    }
51   
52  147 return client;
53    }
54   
 
55  0 toggle @Override
56    public Class<?> getObjectType() {
57  0 return serviceEndpointInterface;
58    }
59   
60    /**
61    * @return the serviceEndpointInterface
62    */
 
63  0 toggle public Class<?> getServiceEndpointInterface() {
64  0 return serviceEndpointInterface;
65    }
66   
67    /**
68    * @param serviceEndpointInterface
69    * the serviceEndpointInterface to set
70    */
 
71  147 toggle public void setServiceEndpointInterface(Class<?> serviceEndpointInterface) {
72  147 this.serviceEndpointInterface = serviceEndpointInterface;
73    }
74   
75   
76    /**
77    * @param serviceName
78    * the serviceName to set
79    */
 
80  0 toggle public void setServiceQNameString(String serviceName) {
81  0 this.serviceQName = QName.valueOf(serviceName);
82    }
83   
 
84  0 toggle @Override
85    public boolean isSingleton() {
86  0 return true;
87    }
88   
89    /**
90    * @return the wsdlDocumentLocation
91    */
 
92  0 toggle public String getWsdlLocation() {
93  0 return wsdlDocumentLocation;
94    }
95   
96    /**
97    * @param wsdlDocumentLocation
98    * the wsdlDocumentLocation to set
99    */
 
100  147 toggle public void setWsdlLocation(String wsdlDocumentLocation) {
101  147 this.wsdlDocumentLocation = wsdlDocumentLocation;
102    }
103   
104    /**
105    * @return the serviceUrl
106    */
 
107  0 toggle public String getAddress() {
108  0 return serviceUrl;
109    }
110   
111    /**
112    * @param serviceUrl
113    * the serviceUrl to set
114    */
 
115  147 toggle public void setAddress(String add) {
116  147 this.serviceUrl = add;
117    }
118   
119    /**
120    * @return the serviceQName
121    */
 
122  0 toggle public QName getServiceQName() {
123  0 return serviceQName;
124    }
125   
126    /**
127    * @param serviceQName the serviceQName to set
128    */
 
129  0 toggle public void setServiceQName(QName serviceQName) {
130  0 this.serviceQName = serviceQName;
131    }
132   
 
133  0 toggle @Override
134    public QName getServiceName() {
135  0 return serviceQName;
136    }
137   
 
138  147 toggle @Override
139    public void setServiceName(QName serviceName) {
140  147 this.serviceQName = serviceName;
141    }
142   
143    }