KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ast > lib > ComponentBaseImpl


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): Christophe Demarey.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.ast.lib;
28
29 /** Used to access AST InterfaceDecl. */
30 import org.objectweb.openccm.ast.api.InterfaceDecl;
31
32 /** Used to access AST InterfaceList. */
33 import org.objectweb.openccm.ast.api.InterfaceList;
34
35 /** To use CORBA::InterfaceDef. */
36 import org.omg.CORBA.InterfaceDef JavaDoc;
37
38 /**
39  * ComponentBaseImpl is a wrapper base class for
40  * IDL component and home declarations.
41  *
42  *
43  * Inherits from:
44  *
45  * - InterfaceDeclImpl as components are also interfaces.
46  *
47  * - ComponentBase as OMG IDL for component and home declarations.
48  *
49  *
50  * Provides:
51  *
52  * - The list of supported interfaces,
53  * i.e. the getSupportedInterfaceList operation.
54  *
55  *
56  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
57  *
58  * @version 0.1
59  */

60
61 public abstract class ComponentBaseImpl
62               extends InterfaceDeclImpl
63            implements org.objectweb.openccm.ast.api.ComponentBase
64 {
65     // ==================================================================
66
//
67
// Internal state.
68
//
69
// ==================================================================
70

71     /** The supported interfaces. */
72     protected InterfaceListImpl supported_interfaces_;
73
74     /** The client interface mapping. */
75     protected InterfaceDeclImpl client_mapping_;
76
77     // ==================================================================
78
//
79
// Constructor.
80
//
81
// ==================================================================
82

83     /**
84      * The constructor with the parent scope.
85      *
86      * @param rep The repository of the declaration.
87      * @param parent The parent scope of the declaration.
88      */

89     protected
90     ComponentBaseImpl(Repository rep,
91                       ScopeImpl parent)
92     {
93         // Call the InterfaceDeclImpl constructor.
94
super(rep, parent);
95
96         // Init internal state.
97
supported_interfaces_ = new InterfaceListImpl();
98         client_mapping_ = null;
99     }
100
101     // ==================================================================
102
//
103
// Internal methods.
104
//
105
// ==================================================================
106

107     /**
108      * Add an array of supported interfaces.
109      *
110      * @param supported_interfaces The supported interfaces to add.
111      */

112     protected void
113     addSupportedInterfaces(InterfaceDef JavaDoc[] supported_interfaces)
114     {
115         for (int i=0; i<supported_interfaces.length; i++)
116        {
117             // WARNING: This will break consistency of array items!!!
118
supported_interfaces_.add(
119                 (InterfaceDecl)getRepository().
120                                lookupId(supported_interfaces[i].id()));
121         }
122     }
123
124     // ==================================================================
125
//
126
// Public methods.
127
//
128
// ==================================================================
129

130     // ==================================================================
131
//
132
// Methods for org.objectweb.openccm.ast.api.ComponentBase
133
//
134
// ==================================================================
135

136     /**
137      * Obtain the list of supported interfaces.
138      *
139      * @param itf The list of supported interfaces.
140      */

141     public InterfaceList
142     getSupportedInterfaceList()
143     {
144         return supported_interfaces_;
145     }
146 }
147
Popular Tags