KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > speedo > generation > mivisitor > MetaInfoVisitors


1 /**
2  * Copyright (C) 2001-2004 France Telecom R&D
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18 package org.objectweb.speedo.generation.mivisitor;
19
20 import org.objectweb.speedo.api.SpeedoException;
21 import org.objectweb.speedo.api.SpeedoProperties;
22 import org.objectweb.speedo.generation.enhancer.MetaDataAnalyzer;
23 import org.objectweb.speedo.generation.lib.AbstractGeneratorComponent;
24
25 /**
26  * Visit the speedo meta information in order to fill the meta information with
27  * the part forgotten by the user.
28  * - ReverseFieldAdder
29  * @see ReverseFieldAdder
30  * @author S.Chassande-Barrioz
31  */

32 public class MetaInfoVisitors extends AbstractGeneratorComponent {
33
34     public final static String JavaDoc LOGGER_NAME
35             = SpeedoProperties.LOGGER_NAME + ".generation.compiler";
36     private AbstractMetaInfoVisitor[] modifiers;
37
38     public boolean init() throws SpeedoException {
39         if (scp.getXmldescriptor().isEmpty()) {
40             return false;
41         }
42         logger = scp.loggerFactory.getLogger(LOGGER_NAME);
43         modifiers = new AbstractMetaInfoVisitor[] {
44             new MetaInfoVisitorImpl(),
45             new TupleExtensionCopier(),
46             new KeyFieldChecker(),
47             new ReverseFieldAdder(),
48             new InheritanceVisitor(),
49             new MetaDataAnalyzer(),
50             new PrimaryKeyFieldAdder(),
51             new JavaLangShorcutVisitor(),
52             new VersionFieldAdder(),
53             new DataStoreIdAdder(),
54             new FieldConverterVisitor(),
55             new ExtensionVerifier()
56         };
57         for(int i=1; i<modifiers.length; i++) {
58             modifiers[i-1].setSpeedoCompilerParameter(scp);
59             modifiers[i-1].init();
60             modifiers[i-1].setNext(modifiers[i]);
61         }
62         return true;
63     }
64
65     public void process() throws SpeedoException {
66         modifiers[0].visitCompilerParameter(scp);
67     }
68 }
69
Popular Tags