KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > modfact > corba > xmiio > importer > AbstractXMIImportApplication


1 /**
2  * copyright 2002 2003 Laboratoire d'Informatique Paris 6 (LIP6)
3  *
4  * This file is part of ModFact.
5  *
6  * ModFact is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * at your option) any later version.
10  *
11  * ModFact 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
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with ModFact; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19  */

20 package org.objectweb.modfact.corba.xmiio.importer;
21
22 import org.objectweb.modfact.corba.service.cmdline.common.ModfactApplicationBase;
23 import org.objectweb.modfact.corba.service.cmdline.io.OptionInput;
24 import org.objectweb.modfact.corba.service.cmdline.xmiio.OptionIORFile;
25 import org.objectweb.modfact.corba.service.cmdline.xmiio.OptionNameService;
26 import org.objectweb.modfact.corba.service.cmdline.xmiio.OptionPrintIOR;
27 import org.objectweb.modfact.corba.service.cmdline.xmiio.XMIImportApplication;
28
29 /**
30  * An abstract implementation of an XMI Import application.
31  * This class provides methods for all XMI importers.
32  */

33 public abstract class AbstractXMIImportApplication
34     extends ModfactApplicationBase
35     implements XMIImportApplication {
36
37     /** The PrintIOR flag. */
38     protected boolean printIOR_ = false;
39
40     /** The IOR file. */
41     protected String JavaDoc iorFile_ = new String JavaDoc();
42
43     /** The input file. */
44     protected String JavaDoc inputFile_ = new String JavaDoc();
45
46     /** The name in the name service. */
47     protected String JavaDoc nameService_ = new String JavaDoc();
48
49     /**
50      * XMIImportApplication constructor.
51      * @param package_name The package name.
52      * @param class_name The class name.
53      * @param default_ior_file The default IOR file.
54      */

55     protected AbstractXMIImportApplication(String JavaDoc package_name, String JavaDoc class_name, String JavaDoc default_ior_file) {
56         this(new org.objectweb.util.cmdline.lib.DefaultCommandLine(new String JavaDoc[] { class_name }, new String JavaDoc[0], new String JavaDoc[] { "Import an XMI file for the model " + package_name + "." }, true));
57         setIORFile(default_ior_file);
58     }
59
60     /**
61      * XMIImportApplication constructor.
62      * @param commandLine The command line manager.
63      */

64     private AbstractXMIImportApplication(org.objectweb.util.cmdline.lib.DefaultCommandLine commandLine) {
65         super(commandLine);
66         // Creates the XMIImportApplication options
67
commandLine.addOption(new OptionInput(this));
68         commandLine.addOption(new OptionIORFile(this));
69         commandLine.addOption(new OptionPrintIOR(this));
70         commandLine.addOption(new OptionNameService(this));
71     }
72
73     /**
74      * Set the IOR file.
75      * @param filename The IOR filename.
76      */

77     public void setIORFile(String JavaDoc filename) {
78         iorFile_ = filename;
79     }
80
81     /**
82      * Set the input file.
83      * @param filename The input filename.
84      */

85     public void setInputFile(String JavaDoc filename) {
86         inputFile_ = filename;
87     }
88
89     /**
90      * Set the PrintIOR flag.
91      * @param print TRUE to display the IOR on the console.
92      */

93     public void setPrintIOR(boolean print) {
94         printIOR_ = print;
95     }
96
97     /**
98      * Set the name in the Name Service.
99      * @param nameService The name in the Name Service.
100      */

101     public void setNameService(String JavaDoc nameService) {
102         nameService_ = nameService;
103     }
104
105 }
106
Popular Tags