KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > beehive > wsm > axis > databinding > SystemTypeLookupService


1 /*
2  *
3  * Copyright 2001-2004 The Apache Software Foundation.
4  *
5  *
6  * Licensed under the Apache License, Version 2.0 (the "License");
7  * you may not use this file except in compliance with the License.
8  * You may obtain a copy of the License at
9  *
10  * http://www.apache.org/licenses/LICENSE-2.0
11  *
12  * Unless required by applicable law or agreed to in writing, software
13  * distributed under the License is distributed on an "AS IS" BASIS,
14  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15  * See the License for the specific language governing permissions and
16  * limitations under the License.
17  *
18  *
19  */

20 package org.apache.beehive.wsm.axis.databinding;
21
22 import java.util.ArrayList JavaDoc;
23 import java.util.List JavaDoc;
24
25 import javax.xml.namespace.QName JavaDoc;
26 import javax.xml.rpc.encoding.XMLType JavaDoc;
27
28 import org.apache.beehive.wsm.databinding.BindingLookupService;
29 import org.apache.beehive.wsm.databinding.xmlbeans.XmlBeanTypeLookup;
30
31
32 public class SystemTypeLookupService implements BindingLookupService {
33
34     List JavaDoc<BindingLookupService> lookupServiceList = new ArrayList JavaDoc<BindingLookupService>();
35
36     /**
37      *
38      */

39     public SystemTypeLookupService() {
40         lookupServiceList.add(new XmlBeanTypeLookup());
41         lookupServiceList.add(new AxisTypeLookup());
42
43     }
44
45     /*
46      * (non-Javadoc)
47      *
48      * @see TypeLookUpServices#getClassQName(java.lang.Class)
49      */

50     public QName JavaDoc class2qname(Class JavaDoc cls) {
51         QName JavaDoc qname = null;
52
53         for (BindingLookupService lookUpService : lookupServiceList) {
54             if (null != (qname = lookUpService.class2qname(cls)))
55                 break;
56         }
57         return qname;
58     }
59
60     /*
61      * (non-Javadoc)
62      *
63      * @see TypeLookUpServices#getClassQName(java.lang.Class)
64      */

65     public QName JavaDoc class2qname(Class JavaDoc cls, String JavaDoc namespace) {
66         QName JavaDoc qname = null;
67
68         for (BindingLookupService lookUpService : lookupServiceList) {
69             if (null != (qname = lookUpService.class2qname(cls, namespace)))
70                 break;
71         }
72         return qname;
73     }
74
75     /*
76      * (non-Javadoc)
77      *
78      * @see TypeLookUpServices#Qname2Class(javax.xml.namespace.QName)
79      */

80     public Class JavaDoc qname2class(QName JavaDoc qname) {
81         Class JavaDoc cls = null;
82         for (BindingLookupService lookUpService : lookupServiceList) {
83             if (null != (cls = lookUpService.qname2class(qname)))
84                 break;
85         }
86         if (null == cls)
87             cls = Object JavaDoc.class;
88         return cls;
89     }
90
91 }
92
Popular Tags