KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > metadata > SpeedoMetaInfo


1 /**
2  * Speedo: an implementation of JDO compliant personality on top of JORM generic
3  * I/O sub-system.
4  * Copyright (C) 2001-2004 France Telecom R&D
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2 of the License, or (at your option) any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  *
20  *
21  *
22  * Contact: speedo@objectweb.org
23  *
24  * Authors: S.Chassande-Barrioz.
25  *
26  */

27
28 package org.objectweb.speedo.metadata;
29
30 import java.util.Iterator JavaDoc;
31 import java.util.Map JavaDoc;
32
33 /**
34  * @author S.Chassande-Barrioz
35  */

36 public class SpeedoMetaInfo {
37
38     /**
39      * This fields is used by the Speedo to reference the SpeedoXMLDescriptor.
40      * This field is filled by the JDOParser.
41      * key = jdo File Name
42      * value = SpeedoXMLDescriptor
43      */

44     public Map JavaDoc xmldescriptor = null;
45
46
47     public SpeedoClass getSpeedoClass(String JavaDoc className) {
48         return getSpeedoClass(className, (SpeedoXMLDescriptor) null);
49     }
50
51     public SpeedoClass getSpeedoClass(String JavaDoc className, SpeedoXMLDescriptor xml) {
52         //System.out.println("SMI.getSpeedoClass(" + className + ", " + xml.xmlFile + "): ");
53
SpeedoClass sc = null;
54         if (xml != null) {
55             sc = xml.getSpeedoClass(className, false);
56             if (sc != null) {
57                 //System.out.println("SMI.getSpeedoClass(XML): return " + sc);
58
return sc;
59             }
60         }
61         //Try in other xml
62
for(Iterator JavaDoc it = xmldescriptor.values().iterator();
63             it.hasNext() && sc == null;) {
64             SpeedoXMLDescriptor _xml = (SpeedoXMLDescriptor) it.next();
65             if (xml == _xml) {
66                 continue;
67             }
68             sc = _xml.getSpeedoClass(className, false);
69         }
70         //System.out.println("SMI.getSpeedoClass(): return " + sc);
71
return sc;
72     }
73
74     public SpeedoClass getSpeedoClass(String JavaDoc className, SpeedoPackage sp) {
75         //System.out.println("SMI.getSpeedoClass(" + className + ", " + sp.name + "): ");
76
SpeedoXMLDescriptor xml = null;
77         if (sp != null) {
78             xml = sp.jdoXMLDescriptor;
79         }
80         SpeedoClass sc = getSpeedoClass(className, xml);
81         if (sc == null) {
82             sc = getSpeedoClass(sp.name + '.' + className, xml);
83         }
84         //System.out.println("SMI.getSpeedoClass(P): return " + sc);
85
return sc;
86     }
87
88 }
89
Popular Tags