KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > corba > generator > cif_idl > lib > CompositionMapping


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): Christophe Demarey.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.corba.generator.cif_idl.lib;
28
29 // Package dependencies.
30
import org.objectweb.openccm.ast.utils.api.CompositionInfo;
31 import org.objectweb.openccm.ast.api.CompositionDecl;
32 import org.objectweb.openccm.ast.api.ModuleDecl;
33 import org.objectweb.openccm.ast.api.Declaration;
34 import org.objectweb.corba.generator.cif_idl.api.ProxyHomeMapping;
35 import org.objectweb.corba.generator.cif_idl.api.HomeExecutorMapping;
36
37 /**
38  * This class generates CIF IDL for an OMG CIDL Composition.
39  *
40  * @author <a HREF="mailto:Christophe.Demarey@lifl.fr">Christophe Demarey</a>
41  *
42  * @version 0.1
43  */

44
45 public class CompositionMapping
46   implements org.objectweb.corba.generator.cif_idl.api.CompositionMapping
47 {
48     // ==================================================================
49
//
50
// Internal state.
51
//
52
// ==================================================================
53

54     /** The composition to map. */
55     private CompositionInfo comp_;
56
57     // ==================================================================
58
//
59
// Constructors.
60
//
61
// ==================================================================
62

63     /**
64      * The default constructor.
65      *
66      * @param composition - The composition to map.
67      */

68     public CompositionMapping(CompositionDecl composition)
69     {
70         // Init internal states
71
comp_ = new org.objectweb.openccm.ast.utils.lib.CompositionInfo(composition);
72     }
73
74     // ==================================================================
75
//
76
// Internal methods.
77
//
78
// ==================================================================
79

80
81     // ==================================================================
82
//
83
// Public methods for org.objectweb.openccm.generator.cif_idl.api.CompositionMapping.
84
//
85
// ==================================================================
86

87     /**
88      * Declare CIF interfaces into Interface Repository.
89      *
90      * @return The new created CIF Module.
91      */

92     public ModuleDecl
93     declareCIF()
94     {
95         ModuleDecl parent, module;
96         Declaration[] decls = null;
97         ProxyHomeMapping ph_mapping = null;
98         HomeExecutorMapping he_mapping = null;
99
100         // Get the composition parent module
101
parent = (org.objectweb.openccm.ast.api.ModuleDecl)
102                     comp_.getComposition().getParent();
103
104         // Declare the CIF Module
105
module = parent.declareModule( comp_.getComposition().getName() );
106         module.create();
107
108         // Call mapping for home executor
109
he_mapping = new org.objectweb.corba.generator.cif_idl.lib.HomeExecutorMapping( comp_.getHomeExecutor() );
110         he_mapping.declareCIF(module, comp_);
111
112         // Call mapping for proxy home
113
if (comp_.getProxyHome() != null)
114         {
115             ph_mapping = new org.objectweb.corba.generator.cif_idl.lib.ProxyHomeMapping( comp_.getProxyHome() );
116             ph_mapping.declareCIF( module,
117                                    comp_,
118                                    he_mapping.getCIFMapping() );
119         }
120
121         return module;
122     }
123
124     // ==================================================================
125
//
126
// Public methods.
127
//
128
// ==================================================================
129

130 }
131
Popular Tags