001    /**
002     * Licensed to the Apache Software Foundation (ASF) under one
003     * or more contributor license agreements. See the NOTICE file
004     * distributed with this work for additional information
005     * regarding copyright ownership. The ASF licenses this file
006     * to you under the Apache License, Version 2.0 (the
007     * "License"); you may not use this file except in compliance
008     * with the License. You may obtain a copy of the License at
009     *
010     * http://www.apache.org/licenses/LICENSE-2.0
011     *
012     * Unless required by applicable law or agreed to in writing,
013     * software distributed under the License is distributed on an
014     * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
015     * KIND, either express or implied. See the License for the
016     * specific language governing permissions and limitations
017     * under the License.
018     */
019    package org.apache.geronimo.cxf;
020    
021    import java.net.URL;
022    
023    import javax.xml.namespace.QName;
024    
025    import org.apache.cxf.service.factory.AbstractServiceConfiguration;
026    import org.apache.geronimo.jaxws.PortInfo;
027    
028    /**
029     * Used to overwrite serviceName and portName values of WebService annotation.
030     */
031    public class CXFServiceConfiguration extends AbstractServiceConfiguration {
032    
033        private PortInfo portInfo;
034        private URL wsdlURL;
035        
036        public CXFServiceConfiguration(PortInfo portInfo, URL wsdlURL) {
037            this.portInfo = portInfo;        
038            this.wsdlURL = wsdlURL;
039        }
040        
041        public String getServiceName() {
042            if (this.portInfo.getWsdlService() != null) {          
043                return this.portInfo.getWsdlService().getLocalPart();
044            } else {
045                return null;
046            }
047        }
048        
049        public String getServiceNamespace() {
050            if (this.portInfo.getWsdlService() != null) {
051                return this.portInfo.getWsdlService().getNamespaceURI();
052            } else {
053                return null;
054            }
055        }
056        
057        public QName getEndpointName() {
058            return this.portInfo.getWsdlPort();
059        }
060        
061        public String getWsdlURL() {
062            return (this.wsdlURL == null) ? null : this.wsdlURL.toString();
063        }
064        
065    }