/*
*
* Copyright 2001-2004 The Apache Software Foundation.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
*
*/
package org.apache.beehive.wsm.axis.databinding;
import java.util.ArrayList;
import java.util.List;
import javax.xml.namespace.QName;
import javax.xml.rpc.encoding.XMLType;
import org.apache.beehive.wsm.databinding.BindingLookupService;
import org.apache.beehive.wsm.databinding.xmlbeans.XmlBeanTypeLookup;
public class SystemTypeLookupService implements BindingLookupService {
List<BindingLookupService> lookupServiceList = new ArrayList<BindingLookupService>();
/**
*
*/
public SystemTypeLookupService() {
lookupServiceList.add(new XmlBeanTypeLookup());
lookupServiceList.add(new AxisTypeLookup());
}
/*
* (non-Javadoc)
*
* @see TypeLookUpServices#getClassQName(java.lang.Class)
*/
public QName class2qname(Class cls) {
QName qname = null;
for (BindingLookupService lookUpService : lookupServiceList) {
if (null != (qname = lookUpService.class2qname(cls)))
break;
}
return qname;
}
/*
* (non-Javadoc)
*
* @see TypeLookUpServices#getClassQName(java.lang.Class)
*/
public QName class2qname(Class cls, String namespace) {
QName qname = null;
for (BindingLookupService lookUpService : lookupServiceList) {
if (null != (qname = lookUpService.class2qname(cls, namespace)))
break;
}
return qname;
}
/*
* (non-Javadoc)
*
* @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
*/
public Class qname2class(QName qname) {
Class cls = null;
for (BindingLookupService lookUpService : lookupServiceList) {
if (null != (cls = lookUpService.qname2class(qname)))
break;
}
if (null == cls)
cls = Object.class;
return cls;
}
}