KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > command > lib > CommandOnIR3Base


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2004 INRIA & USTL - LIFL - GOAL
5 Contact: openccm@objectweb.org
6
7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or any later version.
11
12 This library is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with this library; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA
21
22 Initial developer(s): Philippe Merle.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.command.lib;
28
29 // Package dependencies.
30
import org.objectweb.openccm.command.api.CommandOnIR3;
31 import org.objectweb.util.cmdline.api.CommandLine;
32
33 /**
34  * Abstract base class for commands using the OpenCCM Interface Repository.
35  *
36  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
37  *
38  * @version 0.3
39  */

40
41 abstract public class CommandOnIR3Base
42               extends ApplicationBase
43            implements CommandOnIR3
44 {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50

51     /** The OpenCCM Interface Repository. */
52     private org.objectweb.openccm.ir3.api.ComponentRepository componentRepository_;
53
54     // ==================================================================
55
//
56
// Constructors.
57
//
58
// ==================================================================
59

60     /** The default constructor. */
61     public
62     CommandOnIR3Base()
63     {
64         // Calls the ApplicationBase constructor.
65
super();
66
67         // Inits internal state.
68
componentRepository_ = null;
69     }
70
71     /**
72      * The constructor with the command line manager.
73      *
74      * @param commandLine The command line manager.
75      */

76     public
77     CommandOnIR3Base(CommandLine commandLine)
78     {
79         // Calls the ApplicationBase constructor.
80
super(commandLine);
81
82         // Inits internal state.
83
componentRepository_ = null;
84     }
85
86     // ==================================================================
87
//
88
// Internal methods.
89
//
90
// ==================================================================
91

92     // ==================================================================
93
//
94
// Public methods.
95
//
96
// ==================================================================
97

98     // ==================================================================
99
//
100
// Public methods for org.objectweb.util.cmdline.api.Application
101
//
102
// ==================================================================
103

104     // ==================================================================
105
//
106
// Public methods for org.objectweb.openccm.command.api.Application
107
//
108
// ==================================================================
109

110     // ==================================================================
111
//
112
// Public methods for org.objectweb.openccm.command.api.CommandOnIR3
113
//
114
// ==================================================================
115

116     /**
117      * Checks availability of the OpenCCM Interface Repository.
118      *
119      * @return True if ok, else false.
120      */

121     public boolean
122     checkComponentRepository()
123     {
124         try
125         {
126             // Obtains the OpenCCM Interface Repository.
127
componentRepository_ = org.objectweb.openccm.ir3.api.ComponentRepositoryHelper.narrow(
128                                    org.objectweb.openccm.corba.TheInterfaceRepository.getRepository());
129         }
130         catch(Exception JavaDoc ex)
131         {
132             getConsole().error("Problem to obtain the OpenCCM Interface Repository reference!");
133             report_exception(ex);
134             return false;
135         }
136         return true;
137     }
138
139     /**
140      * Obtains the OpenCCM Interface Repository reference.
141      *
142      * @return The OpenCCM Interface Repository reference.
143      */

144     public org.objectweb.openccm.ir3.api.ComponentRepository
145     getComponentRepository()
146     {
147         if(componentRepository_ == null) {
148             checkComponentRepository();
149         }
150         return componentRepository_;
151     }
152
153     // ==================================================================
154
//
155
// Other public methods.
156
//
157
// ==================================================================
158
}
159
Popular Tags