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.axis2.jaxws.description;
020:
021: import org.apache.axis2.context.ConfigurationContext;
022: import org.apache.axis2.jaxws.ExceptionFactory;
023:
024: import javax.xml.namespace.QName;
025: import java.net.URL;
026:
027: public class DescriptionKey {
028:
029: private QName serviceName = null;
030:
031: private URL wsdlUrl = null;
032:
033: private Class serviceClass = null;
034:
035: private ConfigurationContext configContext = null;
036:
037: public DescriptionKey(QName serviceName, URL wsdlUrl,
038: Class serviceClass, ConfigurationContext configContext) {
039: super ();
040: this .serviceName = serviceName;
041: this .wsdlUrl = wsdlUrl;
042: this .serviceClass = serviceClass;
043: this .configContext = configContext;
044:
045: }
046:
047: @Override
048: public boolean equals(Object o) {
049: if (this == o) {
050: return true;
051: }
052:
053: if (!(o instanceof DescriptionKey)) {
054: return false;
055: }
056:
057: DescriptionKey description = (DescriptionKey) o;
058:
059: if (serviceName == null) {
060: throw ExceptionFactory
061: .makeWebServiceException(org.apache.axis2.i18n.Messages
062: .getMessage("DescriptionRegistryErr0"));
063: }
064:
065: return description.serviceName.equals(this .serviceName)
066: && description.wsdlUrl != null ? description.wsdlUrl
067: .equals(this .wsdlUrl) : this .wsdlUrl == null
068: && description.serviceClass == this .serviceClass
069: && description.configContext == this .configContext;
070: }
071:
072: @Override
073: public int hashCode() {
074:
075: int hash = 1;
076: hash = 31 * hash
077: + ((serviceName == null) ? 0 : serviceName.hashCode());
078: hash = hash + ((wsdlUrl == null) ? 0 : wsdlUrl.hashCode());
079: hash = hash
080: + ((serviceClass == null) ? 0 : serviceClass.hashCode());
081: hash = hash
082: + ((configContext == null) ? 0 : configContext
083: .hashCode());
084: return hash;
085:
086: }
087:
088: public ConfigurationContext getConfigContext() {
089: return configContext;
090: }
091:
092: public void setConfigContext(ConfigurationContext configContext) {
093: this .configContext = configContext;
094: }
095:
096: public QName getServiceName() {
097: return serviceName;
098: }
099:
100: public void setServiceName(QName serviceName) {
101: this .serviceName = serviceName;
102: }
103:
104: public URL getWsdlUrl() {
105: return wsdlUrl;
106: }
107:
108: public void setWsdlUrl(URL wsdlUrl) {
109: this .wsdlUrl = wsdlUrl;
110: }
111:
112: public Class getServiceClass() {
113: return serviceClass;
114: }
115:
116: public void setServiceClass(Class serviceClass) {
117: this .serviceClass = serviceClass;
118: }
119:
120: public String printKey() {
121:
122: String sName = (serviceName != null) ? serviceName.toString()
123: : "";
124: String sWsdlURL = (wsdlUrl != null) ? wsdlUrl.toString() : "";
125: String sClass = (serviceClass != null) ? serviceClass
126: .toString() : "";
127: String sConfig = (configContext != null) ? configContext
128: .toString() : "";
129: String key = sName + sWsdlURL + sClass + sConfig;
130: return key;
131: }
132: }
|