KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > ir3 > ExtInitializer_impl


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

26
27 package org.objectweb.openccm.ir3;
28
29 // Package dependencies
30
import org.omg.CORBA.*;
31
32 /**
33  * Implementation of the CORBA::ExtInitializer helper class.
34  *
35  * @author <a HREF="mailto:Philippe.Merle@lifl.fr">Philippe Merle</a>
36  * <a HREF="mailto:Mathieu.Vadet@lifl.fr">Mathieu Vadet</a>
37  *
38  * @version 0.4
39  */

40
41 public class ExtInitializer_impl
42      extends Initializer_impl
43 {
44     // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49

50     /** List of exceptions. */
51     protected ExceptionDef_ref[] exceptions_;
52
53     // ==================================================================
54
//
55
// Constructor.
56
//
57
// ==================================================================
58

59     /** The default contructor. */
60     public
61     ExtInitializer_impl(ValueDef_impl owner)
62     {
63         super(owner);
64
65         // Inits internal state.
66
exceptions_ = null;
67     }
68
69     // ==================================================================
70
//
71
// Internal methods.
72
//
73
// ==================================================================
74

75     // ==================================================================
76
//
77
// Public methods.
78
//
79
// ==================================================================
80

81     /**
82      * Obtain as CORBA::Initializer.
83      */

84     public Initializer
85     getInitializer()
86     {
87         return new Initializer(getStructMemberSeq(), name_);
88     }
89
90     /**
91      * Set as CORBA::Initializer.
92      */

93     public void
94     setInitializer(Initializer val)
95     {
96         setStructMemberSeq(val.members);
97         name_ = val.name;
98         exceptions_ = new ExceptionDef_ref[0];
99     }
100
101     /**
102      * Obtain as CORBA::Initializer.
103      */

104     public ExtInitializer
105     getExtInitializer()
106     {
107         ExceptionDef[] exceptions = new ExceptionDef[exceptions_.length];
108         for (int i=0;i<exceptions.length;i++)
109             exceptions[i] = exceptions_[i].asExceptionDef();
110
111         return new ExtInitializer(getStructMemberSeq(),
112                                   exceptions,
113                                   ExceptionDef_impl.compute_ExcDescriptionSeq(exceptions_),
114                                   name_);
115     }
116
117     /**
118      * Set as CORBA::Initializer.
119      */

120     public void
121     setExtInitializer(ExtInitializer val)
122     {
123         setStructMemberSeq(val.members);
124         name_ = val.name;
125
126         ExceptionDef_impl[] exceptions = new ExceptionDef_impl[val.exceptions_def.length];
127         for (int i=0; i<val.exceptions_def.length; i++)
128             exceptions[i] = contained_.castToLocal(val.exceptions_def[i]);
129
130         ExceptionDef_ref[] refs = new ExceptionDef_ref[exceptions.length];
131         for (int i=0; i<exceptions.length; i++)
132             refs[i] = new ExceptionDef_ref(contained_, exceptions[i]);
133
134         // cut the previous dependency to exceptions.
135
ExceptionDef_ref.cutDependencies(exceptions_);
136
137         exceptions_ = refs;
138     }
139 }
140
Popular Tags