KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > ccm > visitorIDL3 > xmi > XMIPrinter


1 /*====================================================================
2
3 OpenCCM: The Open CORBA Component Model Platform
4 Copyright (C) 2000-2002 USTL - LIFL - GOAL
5 Contact: openccm-team@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): Mathieu Vadet
23                       Tran Huynh (tran.huynh@fr.thalesgroup.com)
24 Contributor(s): .
25
26 ====================================================================*/

27
28 package org.objectweb.ccm.visitorIDL3.xmi;
29
30 // ************** This code needs some optimizations ****************
31

32 /**
33  * This class takes a template file, visits the IR and generates a file.
34  */

35 public class XMIPrinter
36     extends org.objectweb.ccm.visitorIDL3.common.Printer {
37
38     protected XMITranslator translator_;
39     protected org.objectweb.ccm.util.Table stereotypes_;
40     protected org.objectweb.ccm.util.Table types_;
41     protected org.objectweb.ccm.util.Vector external_refs_;
42     protected org.objectweb.ccm.util.Table generalizations_;
43     protected org.objectweb.ccm.util.Table dependencies_tree_;
44     protected org.objectweb.ccm.util.Table associations_;
45     protected org.objectweb.ccm.util.Table assoc_ccm_manages_;
46     protected org.objectweb.ccm.util.Table assoc_union_members_;
47     protected org.objectweb.ccm.util.Table assoc_typedefs_;
48     protected org.objectweb.ccm.util.Table constants_;
49     protected long id_counter_;
50     protected java.lang.String JavaDoc root_id_;
51
52     private int depth_ = 0;
53
54     /**
55      * Constructor.
56      *
57      * @param gen The generator to use.
58      * @param indent The identation to use.
59      *
60      * @exception fr.lifl.cim.jidlscript.lang.JISError
61      */

62     public XMIPrinter(org.objectweb.ccm.visitorIDL3.common.Generator gen,
63                       java.lang.String JavaDoc indent)
64         throws fr.lifl.cim.jidlscript.lang.JISError {
65
66         super(gen, '$', '#', indent);
67
68         // Init internal state.
69
translator_ = new XMITranslator();
70         id_counter_ = java.lang.System.currentTimeMillis();
71         external_refs_ = new org.objectweb.ccm.util.Vector();
72         dependencies_tree_ = new org.objectweb.ccm.util.Table();
73         generalizations_ = new org.objectweb.ccm.util.Table();
74         associations_ = new org.objectweb.ccm.util.Table();
75         assoc_ccm_manages_ = new org.objectweb.ccm.util.Table();
76         assoc_union_members_ = new org.objectweb.ccm.util.Table();
77         assoc_typedefs_ = new org.objectweb.ccm.util.Table();
78         constants_ = new org.objectweb.ccm.util.Table();
79         initStereotypes();
80         initTypes();
81
82         // Set the "self" alias in root scope on this object.
83
super.setAlias("self", this);
84         
85         // Load template
86
super.loadFile("xmi.template");
87     }
88
89     /**
90      * This method prints a string to the standard error
91      * output stream with indents.
92      *
93      * @param msg The string to print out.
94      */

95    private void log(java.lang.String JavaDoc msg) {
96         java.lang.String JavaDoc tab = "";
97         
98         for (int i = 0; i < depth_; i++) {
99             tab = tab + " ";
100         }
101
102         System.err.println(tab + msg);
103     }
104
105     /**
106      * This methid increments the depth of indents.
107      */

108     private void incDepth() {
109         depth_++;
110     }
111
112     /**
113      * Decrement depth for indents.
114      */

115     private void decDepth() {
116         depth_--;
117     }
118
119     /**
120      * This method initializes the stereotypes.
121      */

122     protected void initStereotypes() {
123         stereotypes_ = new org.objectweb.ccm.util.Table();
124
125         // packages
126
stereotypes_.put("CORBAModule", "Package");
127
128         // classes
129
stereotypes_.put("CORBAAlias", "Class");
130         stereotypes_.put("CORBAArray", "Class");
131         stereotypes_.put("CORBABoxedValue", "Class");
132         stereotypes_.put("CORBAConstants", "Class");
133         stereotypes_.put("CORBAEnum", "Class");
134         stereotypes_.put("CORBAException", "Class");
135         stereotypes_.put("CORBAInterface", "Class");
136         stereotypes_.put("CORBASequence", "Class");
137         stereotypes_.put("CORBAStruct", "Class");
138         stereotypes_.put("CORBATypedef", "Class");
139         stereotypes_.put("CORBAUnion", "Class");
140         stereotypes_.put("CORBAValue", "Class");
141         stereotypes_.put("CORBAValueFactory", "Class");
142         stereotypes_.put("CORBAValueSupports", "Class");
143
144         // attributes
145
stereotypes_.put("CORBAConstant", "Attribute");
146
147         // datatypes
148
stereotypes_.put("null", "DataType");
149         stereotypes_.put("void", "DataType");
150         stereotypes_.put("CORBAFixed", "DataType");
151         stereotypes_.put("CORBAObject", "DataType");
152         stereotypes_.put("CORBAany", "DataType");
153         stereotypes_.put("CORBAboolean", "DataType");
154         stereotypes_.put("CORBAchar", "DataType");
155         stereotypes_.put("CORBAdouble", "DataType");
156         stereotypes_.put("CORBAfloat", "DataType");
157         stereotypes_.put("CORBAlong", "DataType");
158         stereotypes_.put("CORBAlongdouble", "DataType");
159         stereotypes_.put("CORBAlonglong", "DataType");
160         stereotypes_.put("CORBAoctet", "DataType");
161         stereotypes_.put("CORBAshort", "DataType");
162         stereotypes_.put("CORBAstring", "DataType");
163         stereotypes_.put("CORBAunsignedlong", "DataType");
164         stereotypes_.put("CORBAunsignedshort", "DataType");
165         stereotypes_.put("CORBAwchar", "DataType");
166         stereotypes_.put("CORBAwstring", "DataType");
167
168         // CCM Specific
169

170         // classes
171
stereotypes_.put("CCMComponent", "Class");
172         stereotypes_.put("CCMHome", "Class");
173         stereotypes_.put("CCMEvent", "Class");
174         stereotypes_.put("CCMPrimaryKey", "Class");
175
176         // operations
177
stereotypes_.put("CCMHomeFactory", "Class");
178         stereotypes_.put("CCMHomeFinder", "Class");
179
180         // associations
181
stereotypes_.put("CCMManages", "Association");
182         stereotypes_.put("CCMProvides", "Association");
183         stereotypes_.put("CCMUses", "Association");
184         stereotypes_.put("CCMPublishes", "Association");
185         stereotypes_.put("CCMConsumes", "Association");
186         stereotypes_.put("CCMEmits", "Association");
187
188         //
189
stereotypes_.put("readonly", "null");
190         stereotypes_.put("readonlyEnd", "null");
191
192         //
193
stereotypes_.put("CORBATypeCode", "DataType");
194         stereotypes_.put("CORBAPrincipal", "DataType");
195     }
196
197     /**
198      * This method creates a new xmi.id for each stereotype.
199      */

200     protected void initTypes() {
201         types_ = new org.objectweb.ccm.util.Table();
202
203         java.util.Enumeration JavaDoc keys = stereotypes_.keys();
204
205         while (keys.hasMoreElements()) {
206             types_.put(keys.nextElement(), newId());
207         }
208     }
209
210     /**
211      * This method returns an xmi.id for a declaration
212      * considered as an external reference.
213      *
214      * @param decl The declaration to visit.
215      */

216     protected java.lang.String JavaDoc getExternalId(
217         org.objectweb.ccm.IDL3.Declaration decl) {
218         
219         java.lang.String JavaDoc id = newId(decl);
220
221         org.objectweb.ccm.IDL3.Declaration[] depend = null;
222
223         // Get the first non module scope that contains the target declaration.
224
// The reason is that only modules get have their content generated partially.
225
// For example, we can't generate only one operation in an interface ; the interface
226
// must be fully generated. But we can generate only one interface in a module as modules
227
// can be reopened. So, dependency check is done on the first non module scope.
228
org.objectweb.ccm.IDL3.Declaration decl2 = decl;
229         while ((decl2.getParent().getDeclKind() != org.objectweb.ccm.IDL3.DeclarationKind._dk_module) &&
230                (decl2.getParent().getDeclKind() != org.objectweb.ccm.IDL3.DeclarationKind._dk_repository)) {
231             
232             decl2 = decl2.getParent();
233         }
234
235         if (decl == decl2) {
236             external_refs_.add(decl);
237         } else if (!types_.containsKey(decl2.getId())) {
238             external_refs_.add(decl2);
239             newId(decl2);
240         } else {
241             return id;
242         }
243
244         depend = decl2.getDependencies();
245
246         for (int i = 0; i < depend.length; i++) {
247             if (!types_.containsKey(depend[i].getId())) {
248                 getExternalId(depend[i]);
249             }
250         }
251
252         return id;
253     }
254
255     /**
256      * This method returns a reference to the XMI translator.
257      */

258     public XMITranslator getXMITranslator() {
259         return translator_;
260     }
261
262     /**
263      * Modify strings in the template to :
264      * <ul>
265      * <li>increase indents,
266      * <li>decrease indents,
267      * <li>add carriage return.
268      * </ul>
269      *
270      * @param str The string to modify.
271      */

272     public java.lang.String JavaDoc modifyCurrentLine(java.lang.String JavaDoc str) {
273         int l = str.length();
274
275         if (l == 0) {
276             return "";
277         }
278
279         if ((l > 2) && (str.charAt(0) == '<') &&
280             ((str.charAt(1) == '!') || (str.charAt(1) == '?'))) {
281             
282             return str + "\\n";
283         }
284
285         if ((l > 2) &&
286             (str.charAt(l - 1) == '>') &&
287             (str.charAt(l - 2) != '/') &&
288             (str.indexOf("</") == -1)) {
289             
290             return str + "\\n$self.inc()$";
291         }
292
293         if ((l > 2) && (str.charAt(0) == '<') &&
294             (str.charAt(1) == '/')) {
295             
296             return "$self.dec()$" + str + "\\n";
297         }
298
299         if ((str.charAt(0) != getCallChar()) ||
300             (str.charAt(l - 1) != getCallChar())) {
301             
302             return str+"\\n";
303         }
304
305         return str;
306     }
307
308     /**
309      * This method generates a new xmi.id.
310      */

311     public java.lang.String JavaDoc newId() {
312         id_counter_++;
313
314         return "xmi." + java.lang.Long.toString(id_counter_);
315     }
316
317     /**
318      * This method creates a new xmi.id only if the
319      * Declartion is a new one and stores the newly
320      * created xmi.id in a hashtable.
321      */

322     public java.lang.String JavaDoc newId(org.objectweb.ccm.IDL3.Declaration decl) {
323         java.lang.String JavaDoc res = (java.lang.String JavaDoc) types_.get(decl.getId());
324
325         if (res != null) {
326             return res;
327         }
328
329         res = newId();
330         types_.put(decl.getId(), res);
331
332         return res;
333     }
334
335     /**
336      * This method generates a new root xmi.id.
337      */

338     public java.lang.String JavaDoc newRootId() {
339         root_id_ = newId();
340
341         return root_id_;
342     }
343
344     /**
345      * This method returns the xmi.id of the given stereotype name.
346      *
347      * @param stereo_name The name of the stereotype.
348      */

349     public java.lang.String JavaDoc getXMIId(java.lang.String JavaDoc stereo_name) {
350         java.lang.String JavaDoc res = (java.lang.String JavaDoc) types_.get(stereo_name);
351
352         if (res == null) {
353             res = "";
354         }
355
356         return res;
357     }
358
359     /**
360      * This method returns the xmi.id of the given type.
361      *
362      * @param type The TypeRef object.
363      */

364     public java.lang.String JavaDoc getXMIId(org.objectweb.ccm.IDL3.TypeRef type) {
365         if (type.isDeclaration()) {
366             org.objectweb.ccm.IDL3.Declaration decl =
367                 (org.objectweb.ccm.IDL3.Declaration) type;
368
369             java.lang.String JavaDoc res = getXMIId(decl.getId());
370
371             if (res.equals("")) {
372                 res = getExternalId(decl);
373             }
374
375             return res;
376         }
377
378         return getXMIId(getXMITranslator().toXMIString(type));
379     }
380
381     /**
382      * This method returns 'true' if the CORBA value
383      * is abstract and 'false' otherwise.
384      *
385      * @param value The ValueType object.
386      */

387     public java.lang.String JavaDoc isAbstract(org.objectweb.ccm.IDL3.ValueDecl value) {
388         if (value.isAbstract()) {
389             return "true";
390         } else {
391             return "false";
392         }
393     }
394
395     /**
396      * This method returns 'in' if the parameter mode is PARAM_IN,
397      * 'out' if PARAM_OUT and 'inout' otherwise.
398      *
399      * @param mode The parameter kind.
400      */

401     public java.lang.String JavaDoc toStringMode(int mode) {
402         if (mode == org.objectweb.ccm.IDL3.OperationDecl.PARAM_IN) {
403             return "in";
404         } else if (mode == org.objectweb.ccm.IDL3.OperationDecl.PARAM_OUT) {
405             return "out";
406         } else {
407             return "inout";
408         }
409     }
410
411     /**
412      * This method generates the XMI mapping for a stereotype.
413      */

414     public java.lang.String JavaDoc corbaStereotypes() {
415         java.util.Enumeration JavaDoc keys = stereotypes_.keys();
416         java.util.Enumeration JavaDoc values = stereotypes_.elements();
417
418         java.lang.String JavaDoc[] aliases = { "name", "base_class" };
419         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
420
421         while (keys.hasMoreElements()) {
422             objs[0] = keys.nextElement();
423             objs[1] = values.nextElement();
424             super.map("STEREOTYPE", aliases, objs);
425         }
426
427         return "";
428     }
429
430     /**
431      * This method inserts XMI generalizable element tags.
432      *
433      * @param gen_id The generalization xmi.id.
434      */

435     public java.lang.String JavaDoc insertGeneralizableElement(java.lang.String JavaDoc gen_id) {
436         java.lang.String JavaDoc[] aliases = { "gen_id" };
437         java.lang.Object JavaDoc[] objs = { gen_id };
438
439         super.map("GENERALIZABLE_ELEMENT", aliases, objs);
440
441         return "";
442     }
443
444     /**
445      * This method generates XMI mapping for all the generalizations found.
446      */

447     public java.lang.String JavaDoc generalizations() {
448         java.util.Enumeration JavaDoc keys = generalizations_.keys();
449         java.util.Enumeration JavaDoc values = generalizations_.elements();
450
451         java.lang.String JavaDoc[] aliases = { "gen_id", "child_id", "parent_id" };
452         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[3];
453
454         while (keys.hasMoreElements()) {
455             objs[1] = getXMIId((java.lang.String JavaDoc) keys.nextElement());
456             org.objectweb.ccm.util.Vector[] elems =
457                 (org.objectweb.ccm.util.Vector[]) values.nextElement();
458
459             for (int i = 0; i < elems.length; i++) {
460                 objs[0] = elems[i].get(0);
461                 objs[2] = elems[i].get(1);
462                 super.map("GENERALIZATION", aliases, objs);
463             }
464         }
465
466         return "";
467     }
468
469     /**
470      * This method generates XMI mapping for all the associations found.
471      */

472     public java.lang.String JavaDoc associations() {
473         java.util.Enumeration JavaDoc keys = associations_.keys();
474         java.util.Enumeration JavaDoc values = associations_.elements();
475
476         java.lang.String JavaDoc[] aliases = { "assoc_id", "src_elem_ref", "dest_elem_ref", "name",
477             "stereotype", "visibility", "multiplicity_src", "multiplicity_dest" };
478         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
479
480         while (keys.hasMoreElements()) {
481             objs[4] = "";
482             keys.nextElement();
483             org.objectweb.ccm.util.Vector[] elems =
484                 (org.objectweb.ccm.util.Vector[]) values.nextElement();
485
486             for (int i = 0; i < elems.length; i++) {
487                 for (int j = 0; j < elems[i].size(); j++) {
488                     objs[j] = elems[i].get(j);
489                 }
490
491                 super.map("ASSOCIATION", aliases, objs);
492             }
493         }
494
495         return "";
496     }
497
498     /**
499      * This method generates XMI mapping for all the associations found.
500      */

501     public java.lang.String JavaDoc associations_ccm_manages() {
502         java.util.Enumeration JavaDoc keys = assoc_ccm_manages_.keys();
503         java.util.Enumeration JavaDoc values = assoc_ccm_manages_.elements();
504
505         java.lang.String JavaDoc[] aliases = { "assoc_id", "home_ref", "component_ref", "pk_ref" };
506         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
507
508         // Init objs
509
for (int i = 0; i < objs.length; i++) {
510             objs[i] = "";
511         }
512
513         while (keys.hasMoreElements()) {
514             keys.nextElement();
515             org.objectweb.ccm.util.Vector[] elems =
516                 (org.objectweb.ccm.util.Vector[]) values.nextElement();
517
518             for (int i = 0; i < elems.length; i++) {
519                 for (int j = 0; j < elems[i].size(); j++) {
520                     objs[j] = elems[i].get(j);
521                 }
522
523                 if (elems[i].size() == 3) {
524                     super.map("ASSOCIATION_CCM_MANAGES", aliases, objs);
525                 } else {
526                     super.map("ASSOCIATION_CCM_MANAGES_WITH_PK", aliases, objs);
527                 }
528             }
529         }
530
531         return "";
532     }
533
534     /**
535      * This method generates XMI mappingn for all the associations found.
536      */

537     public java.lang.String JavaDoc associations_union_members() {
538         java.util.Enumeration JavaDoc keys = assoc_union_members_.keys();
539         java.util.Enumeration JavaDoc values = assoc_union_members_.elements();
540
541         java.lang.String JavaDoc[] aliases = { "assoc_id", "name", "src_elem_ref",
542             "dest_elem_ref", "idl_order", "label" };
543         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
544
545         while (keys.hasMoreElements()) {
546             keys.nextElement();
547             org.objectweb.ccm.util.Vector[] elems =
548                 (org.objectweb.ccm.util.Vector[]) values.nextElement();
549
550             for (int i = 0; i < elems.length; i++) {
551                 for (int j = 0; j < elems[i].size(); j++) {
552                     objs[j] = elems[i].get(j);
553                 }
554
555                 super.map("ASSOCIATION_UNION_MEMBER", aliases, objs);
556             }
557         }
558
559         return "";
560     }
561
562     /**
563      * This method generates XMI mapping for all the associations found.
564      */

565     public java.lang.String JavaDoc associations_typedefs() {
566         java.util.Enumeration JavaDoc keys = assoc_typedefs_.keys();
567         java.util.Enumeration JavaDoc values = assoc_typedefs_.elements();
568
569         java.lang.String JavaDoc[] aliases = { "assoc_id", "src_elem_ref",
570             "dest_elem_ref", "obj", "multiplicity" };
571         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
572
573         while (keys.hasMoreElements()) {
574             keys.nextElement();
575             org.objectweb.ccm.util.Vector[] elems =
576                 (org.objectweb.ccm.util.Vector[]) values.nextElement();
577
578             for (int i = 0; i < elems.length; i++) {
579                 for (int j = 0; j < elems[i].size() - 1; j++) {
580                     objs[j] = elems[i].get(j);
581                 }
582
583                 if (((java.lang.String JavaDoc)
584                     elems[i].get(elems[i].size() - 1)).equals("CORBASequence")) {
585         
586                     super.map("ASSOCIATION_SEQUENCE", aliases, objs);
587                 } else {
588                     super.map("ASSOCIATION_ARRAY", aliases, objs);
589                 }
590             }
591         }
592
593         return "";
594     }
595
596     /**
597      * This method returns either the namespace or
598      * the owner xmi.id for a given element.
599      *
600      * @param decl The declaration to visit.
601      */

602     public java.lang.String JavaDoc getScopeId(org.objectweb.ccm.IDL3.Declaration decl) {
603         java.lang.String JavaDoc id = "";
604         id = getXMIId(decl.getParent().getId());
605
606         if (decl.getParent().getDeclKind() ==
607             org.objectweb.ccm.IDL3.DeclarationKind._dk_repository) {
608
609             return root_id_;
610         } else {
611             return id;
612         }
613     }
614
615     /**
616      * This method maps "obj" to the module.
617      *
618      * @param decl The declaration to visit.
619      */

620     public java.lang.String JavaDoc visitModule(org.objectweb.ccm.IDL3.Declaration decl) {
621         if (decl.getDeclKind() != org.objectweb.ccm.IDL3.DeclarationKind._dk_module) {
622             java.lang.String JavaDoc msg =
623             "error in class org.objectweb.ccm.visitorIDL3.XMIPrinter\n" +
624             " operation : visitModule\n" +
625             " message : root visited object must be a module";
626             throw new Error JavaDoc(msg);
627         }
628
629         java.lang.String JavaDoc[] aliases = { "obj" };
630         java.lang.Object JavaDoc[] objs = { decl };
631         super.map("MODULE", aliases, objs);
632
633         return "";
634     }
635
636     /**
637      * This method visits all the contained elements of a given scope.
638      *
639      * @param scope The scope to visit.
640      */

641     public java.lang.String JavaDoc contents(org.objectweb.ccm.IDL3.Scope scope) {
642         org.objectweb.ccm.IDL3.Declaration[] decls = null;
643
644         decls = scope.getContents(true, org.objectweb.ccm.IDL3.DeclarationKind._dk_all);
645
646         for (int i = 0; i < decls.length; i++) {
647             visitContained(decls[i], "");
648         }
649
650         return "";
651     }
652
653     /**
654      * This method finds the corresponding mapping for a contained element and runs it.
655      *
656      * @param contained The declaration to visit.
657      * @param extension The string id extension.
658      */

659     public java.lang.String JavaDoc visitContained(org.objectweb.ccm.IDL3.Declaration contained,
660                                            java.lang.String JavaDoc extension) {
661     
662         java.lang.String JavaDoc id =
663             org.objectweb.ccm.IDL3.DeclarationKind.toString(
664                 contained.getDeclKind()).toUpperCase() + extension;
665
666         java.lang.String JavaDoc[] aliases = { "obj" };
667         java.lang.Object JavaDoc[] objs = { contained };
668         super.map(id, aliases, objs);
669
670         return "";
671     }
672
673     /**
674      * This method gets the base component and
675      * the supported interfaces of a given component.
676      *
677      * @param component The component to visit.
678      */

679     public java.lang.String JavaDoc baseComponent(
680         org.objectweb.ccm.IDL3.ComponentDecl component) {
681         
682         org.objectweb.ccm.IDL3.InterfaceDecl[] supportedInterfaces = null;
683         supportedInterfaces =
684             ((org.objectweb.ccm.IDL3.ComponentDecl) component).getSupportedInterfaces();
685
686         java.lang.String JavaDoc gen_id = "";
687         org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
688
689         for (int i = 0; i < supportedInterfaces.length; i++) {
690             gen_id = newId();
691             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
692             ids.add(gen_id);
693             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) supportedInterfaces[i]));
694             gen_bases.add(ids);
695
696             insertGeneralizableElement(gen_id);
697         }
698
699         org.objectweb.ccm.IDL3.ComponentDecl baseComponent = null;
700         baseComponent = component.getBaseComponent();
701
702         if (baseComponent != null) {
703             gen_id = newId();
704
705             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
706             ids.add(gen_id);
707             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) baseComponent));
708             gen_bases.add(ids);
709
710             insertGeneralizableElement(gen_id);
711         }
712
713         generalizations_.put(component.getId(),
714             (org.objectweb.ccm.util.Vector[])
715                 gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
716
717         return "";
718     }
719
720     /**
721      * This method gets the base home and
722      * the supported interfaces of a given home.
723      *
724      * @param home The home to visit.
725      */

726     public java.lang.String JavaDoc baseHome(org.objectweb.ccm.IDL3.HomeDecl home) {
727         org.objectweb.ccm.IDL3.InterfaceDecl[] supportedInterfaces = null;
728         supportedInterfaces =
729             ((org.objectweb.ccm.IDL3.HomeDecl) home).getSupportedInterfaces();
730
731         java.lang.String JavaDoc gen_id = "";
732         org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
733
734         for (int i = 0; i < supportedInterfaces.length; i++) {
735             gen_id = newId();
736             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
737             ids.add(gen_id);
738             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) supportedInterfaces[i]));
739             gen_bases.add(ids);
740
741             insertGeneralizableElement(gen_id);
742         }
743
744         org.objectweb.ccm.IDL3.HomeDecl baseHome = null;
745         baseHome = home.getBaseHome();
746
747         if (baseHome != null) {
748             gen_id = newId();
749             
750             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
751             ids.add(gen_id);
752             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) baseHome));
753             gen_bases.add(ids);
754
755             insertGeneralizableElement(gen_id);
756         }
757
758         generalizations_.put(home.getId(),
759             (org.objectweb.ccm.util.Vector[])
760                 gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
761
762         return "";
763     }
764
765     /**
766      * This component visits the managed component and the primary key.
767      *
768      * @param home The home to visit.
769      */

770     public java.lang.String JavaDoc managedComponent(org.objectweb.ccm.IDL3.HomeDecl home) {
771         org.objectweb.ccm.IDL3.ComponentDecl component = null;
772         component = home.getManagedComponent();
773         org.objectweb.ccm.IDL3.ValueDecl pk = null;
774         pk = home.getPrimaryKey();
775
776         // Association
777
java.lang.String JavaDoc assoc_id = "";
778         org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
779             
780         assoc_id = newId();
781
782         org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
783         ids.add(assoc_id);
784         ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) home));
785         ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) component));
786         
787         if (pk != null) {
788             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) pk));
789         }
790         assoc_ends.add(ids);
791
792         assoc_ccm_manages_.put(home.getId(),
793             (org.objectweb.ccm.util.Vector[])
794                 assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
795
796         return "";
797     }
798
799
800     /**
801      * This method gets the base interfaces of a given interface.
802      *
803      * @param itf The interface to visit.
804      */

805     public java.lang.String JavaDoc baseInterfaces(org.objectweb.ccm.IDL3.InterfaceDecl itf) {
806         org.objectweb.ccm.IDL3.InterfaceDecl[] bases = null;
807         bases = itf.getBaseInterfaces();
808
809         // Generalizable element
810
java.lang.String JavaDoc gen_id = "";
811         org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
812
813         for (int i = 0; i < bases.length; i++) {
814             gen_id = newId();
815             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
816             ids.add(gen_id);
817             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) bases[i]));
818             gen_bases.add(ids);
819             
820             insertGeneralizableElement(gen_id);
821         }
822
823         generalizations_.put(itf.getId(),
824             (org.objectweb.ccm.util.Vector[])
825                 gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
826
827         return "";
828     }
829
830     /**
831      * This method defines a new association when a facet is visited.
832      *
833      * @param _provides The facet to visit.
834      */

835     public java.lang.String JavaDoc provides(org.objectweb.ccm.IDL3.ProvidesDecl _provides) {
836         org.objectweb.ccm.IDL3.TypeRef type = null;
837         type = _provides.getType();
838
839         if (type != null) {
840             // Association
841
java.lang.String JavaDoc assoc_id = "";
842             org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
843             
844             assoc_id = newId();
845
846             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
847             ids.add(assoc_id);
848             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _provides.getParent()));
849             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) type));
850             ids.add(_provides.getName());
851             ids.add("stereotype='" + getXMIId("CCMProvides") + "'");
852             ids.add("public");
853             ids.add("1");
854             ids.add("1");
855             assoc_ends.add(ids);
856
857             associations_.put(_provides.getId(),
858                 (org.objectweb.ccm.util.Vector[])
859                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
860         }
861
862         return "";
863     }
864
865     /**
866      * This method defines a new association when a receptacle is visited.
867      *
868      * @param _uses The receptacle to visit.
869      */

870     public java.lang.String JavaDoc uses(org.objectweb.ccm.IDL3.UsesDecl _uses) {
871         org.objectweb.ccm.IDL3.TypeRef type = null;
872         type = _uses.getType();
873
874         if (type != null) {
875             // Association
876
java.lang.String JavaDoc assoc_id = "";
877             org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
878             
879             assoc_id = newId();
880
881             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
882             ids.add(assoc_id);
883             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _uses.getParent()));
884             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) type));
885             ids.add(_uses.getName());
886             ids.add("stereotype='" + getXMIId("CCMUses") + "'");
887             ids.add("public");
888             ids.add("1");
889             ids.add(_uses.isMultiple() ? "*" : "1");
890             assoc_ends.add(ids);
891
892             associations_.put(_uses.getId(),
893                 (org.objectweb.ccm.util.Vector[])
894                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
895         }
896
897         return "";
898     }
899
900     /**
901      * This method defines a new association when an event is visited.
902      *
903      * @param _publishes The event to visit.
904      */

905     public java.lang.String JavaDoc publishes(org.objectweb.ccm.IDL3.PublishesDecl _publishes) {
906         org.objectweb.ccm.IDL3.TypeRef type = null;
907         type = _publishes.getType();
908
909         if (type != null) {
910             // Association
911
java.lang.String JavaDoc assoc_id = "";
912             org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
913             
914             assoc_id = newId();
915
916             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
917             ids.add(assoc_id);
918             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _publishes.getParent()));
919             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) type));
920             ids.add(_publishes.getName());
921             ids.add("stereotype='" + getXMIId("CCMPublishes") + "'");
922             ids.add("public");
923             ids.add("1");
924             ids.add("1");
925             assoc_ends.add(ids);
926
927             associations_.put(_publishes.getId(),
928                 (org.objectweb.ccm.util.Vector[])
929                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
930         }
931
932         return "";
933     }
934
935     /**
936      * This method defines a new association when an event is visited.
937      *
938      * @param _consumes The event to visit.
939      */

940     public java.lang.String JavaDoc consumes(org.objectweb.ccm.IDL3.ConsumesDecl _consumes) {
941         org.objectweb.ccm.IDL3.TypeRef type = null;
942         type = _consumes.getType();
943
944         if (type != null) {
945             // Association
946
java.lang.String JavaDoc assoc_id = "";
947             org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
948             
949             assoc_id = newId();
950
951             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
952             ids.add(assoc_id);
953             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _consumes.getParent()));
954             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) type));
955             ids.add(_consumes.getName());
956             ids.add("stereotype='" + getXMIId("CCMConsumes") + "'");
957             ids.add("public");
958             ids.add("1");
959             ids.add("1");
960             assoc_ends.add(ids);
961
962             associations_.put(_consumes.getId(),
963                 (org.objectweb.ccm.util.Vector[])
964                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
965         }
966
967         return "";
968     }
969
970     /**
971      * This method defines a new association when an event is visited.
972      *
973      * @param _emits The event to visit.
974      */

975     public java.lang.String JavaDoc emits(org.objectweb.ccm.IDL3.EmitsDecl _emits) {
976         org.objectweb.ccm.IDL3.TypeRef type = null;
977         type = _emits.getType();
978
979         if (type != null) {
980             // Association
981
java.lang.String JavaDoc assoc_id = "";
982             org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
983             
984             assoc_id = newId();
985
986             org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
987             ids.add(assoc_id);
988             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _emits.getParent()));
989             ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) type));
990             ids.add(_emits.getName());
991             ids.add("stereotype='" + getXMIId("CCMEmits") + "'");
992             ids.add("public");
993             ids.add("1");
994             ids.add("1");
995             assoc_ends.add(ids);
996
997             associations_.put(_emits.getId(),
998                 (org.objectweb.ccm.util.Vector[])
999                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1000        }
1001
1002        return "";
1003    }
1004
1005    /**
1006     * This method gets the exceptions raised by an operation.
1007     *
1008     * @param op The operation to visit.
1009     */

1010    public java.lang.String JavaDoc operationExceptions(org.objectweb.ccm.IDL3.OperationDecl op) {
1011        org.objectweb.ccm.IDL3.ExceptionDecl[] excs = op.getExceptions();
1012
1013        java.lang.String JavaDoc[] aliases = {"exception"};
1014        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[1];
1015
1016        for (int i = 0; i < excs.length; i++) {
1017            objs[0] = excs[i].getAbsoluteName().substring(2);
1018            super.map("OPERATION_EXCEPTION", aliases, objs);
1019        }
1020          
1021        return "";
1022    }
1023
1024    /**
1025     * This method gets the parameters of an operation.
1026     *
1027     * @param op The operation to visit.
1028     */

1029    public java.lang.String JavaDoc operationParams(org.objectweb.ccm.IDL3.OperationDecl op) {
1030        org.objectweb.ccm.IDL3.ParameterList params = op.getParameters();
1031        org.objectweb.ccm.IDL3.TypeRef[] types = params.getParamTypes();
1032        java.lang.String JavaDoc[] names = params.getParamNames();
1033        int[] modes = params.getParamModes();
1034
1035        java.lang.String JavaDoc[] aliases = {"name", "kind", "operation", "type"};
1036        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[4];
1037        objs[2] = getXMIId(op.getId());
1038
1039        for (int i = 0; i < names.length; i++) {
1040            objs[0] = names[i];
1041            objs[1] = toStringMode(modes[i]);
1042            objs[3] = getXMIId(types[i]);
1043
1044            super.map("OPERATION_PARAMETER", aliases, objs);
1045        }
1046          
1047        return "";
1048    }
1049
1050    /**
1051     * This method maps an IDL attribute either to a UML attribute or to a UML association.
1052     *
1053     * @param attrib The attribute to visit.
1054     */

1055    public java.lang.String JavaDoc attribute(org.objectweb.ccm.IDL3.AttributeDecl attrib) {
1056        org.objectweb.ccm.IDL3.TypeRef attrib_type = attrib.getType();
1057        java.lang.String JavaDoc id = "";
1058        id = newId(attrib);
1059
1060        if (attrib_type.isDeclaration()) {
1061            // Association
1062
org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1063
1064            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1065            ids.add(id);
1066            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) attrib.getParent()));
1067            ids.add(getXMIId(attrib_type));
1068            ids.add(attrib.getName());
1069            ids.add(attrib.isReadonly() ? ("stereotype='" + getXMIId("readonlyEnd") + "'") : "");
1070            ids.add("public");
1071            ids.add("1");
1072            ids.add("1");
1073            assoc_ends.add(ids);
1074
1075            associations_.put(attrib.getId(),
1076                (org.objectweb.ccm.util.Vector[])
1077                    assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1078        } else {
1079            java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1080                "multiplicity", "stereotype", "scope_id", "type" };
1081            java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1082
1083            objs[0] = id;
1084            objs[1] = attrib.getName();
1085            objs[2] = "public";
1086            objs[3] = "";
1087            objs[4] = attrib.isReadonly() ? ("stereotype='" + getXMIId("readonly") + "'") : "";
1088            objs[5] = getScopeId(attrib);
1089            objs[6] = getXMIId(attrib_type);
1090
1091            super.map("ATTRIBUTE_BASIC_TYPES", aliases, objs);
1092        }
1093
1094        return "";
1095    }
1096
1097    /**
1098     * This method generates XMI mappings for the enum members.
1099     *
1100     * @param enum The enum to visit.
1101     */

1102    public java.lang.String JavaDoc enumMembers(org.objectweb.ccm.IDL3.EnumDecl enumDecl) {
1103        java.lang.String JavaDoc[] names = enumDecl.getMembers();
1104
1105        java.lang.String JavaDoc[] aliases = {"name", "owner_id", "idl_order"};
1106        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1107
1108        objs[1] = getXMIId(enumDecl.getId());
1109
1110        for (int i = 0; i < names.length; i++)
1111        {
1112            objs[0] = names[i];
1113            objs[2] = java.lang.Integer.toString(i);
1114            super.map("ENUM_MEMBER", aliases, objs);
1115        }
1116
1117        return "";
1118    }
1119
1120    /**
1121     * This method generates XMI mappings for struct members.
1122     *
1123     * @param struct_id The xmi.id of the struct to visit.
1124     * @param members The struct members.
1125     */

1126    public java.lang.String JavaDoc structMembers(java.lang.String JavaDoc struct_id,
1127                                          org.objectweb.ccm.IDL3.StructMembers members) {
1128                                          
1129        org.objectweb.ccm.IDL3.TypeRef[] types = members.getMemberTypes();
1130        java.lang.String JavaDoc[] names = members.getMemberNames();
1131        boolean is_inner = false;
1132
1133        org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1134        java.lang.String JavaDoc id = "";
1135
1136        for (int i = 0; i < names.length; i++) {
1137            // Check for inner struct, union or enum members
1138
if ((types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_struct) ||
1139                (types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_union) ||
1140                (types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_enum)) {
1141
1142                org.objectweb.ccm.IDL3.Declaration decl = null;
1143                decl = (org.objectweb.ccm.IDL3.Declaration) types[i];
1144
1145                if (decl.getParent().getId().equals(struct_id)) {
1146                    is_inner = true;
1147                } else {
1148                    is_inner = false;
1149                }
1150            } else {
1151                is_inner = false;
1152            }
1153
1154            if (is_inner) {
1155                switch (types[i].getTypeKind()) {
1156                    case org.objectweb.ccm.IDL3.TypeKind._tk_struct :
1157                        {
1158                            java.lang.String JavaDoc[] aliases = { "obj" };
1159                            java.lang.Object JavaDoc[] objs = { (org.objectweb.ccm.IDL3.StructDecl) types[i] };
1160                            super.map("STRUCT", aliases, objs);
1161                        }
1162                        break;
1163                    case org.objectweb.ccm.IDL3.TypeKind._tk_union :
1164                        {
1165                            java.lang.String JavaDoc[] aliases = { "obj" };
1166                            java.lang.Object JavaDoc[] objs = { (org.objectweb.ccm.IDL3.UnionDecl) types[i] };
1167                            super.map("UNION", aliases, objs);
1168                        }
1169                        break;
1170                    case org.objectweb.ccm.IDL3.TypeKind._tk_enum :
1171                        {
1172                            java.lang.String JavaDoc[] aliases = { "obj" };
1173                            java.lang.Object JavaDoc[] objs = { (org.objectweb.ccm.IDL3.EnumDecl) types[i] };
1174                            super.map("ENUM", aliases, objs);
1175                        }
1176                        break;
1177                    default :
1178                        break;
1179                }
1180            }
1181
1182            id = newId();
1183            
1184            if (types[i].isDeclaration()) {
1185                // Association
1186
org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1187                ids.add(id);
1188                ids.add(getXMIId(struct_id));
1189                ids.add(getXMIId(types[i]));
1190                ids.add(names[i]);
1191                ids.add("");
1192                ids.add("public");
1193                ids.add("1");
1194                ids.add("1");
1195                assoc_ends.add(ids);
1196            } else {
1197                // Attribute
1198
java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1199                    "multiplicity", "stereotype", "scope_id", "type" };
1200                java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1201
1202                objs[0] = id;
1203                objs[1] = names[i];
1204                objs[2] = "public";
1205                objs[3] = "multiplicity='1..1'";
1206                objs[4] = "";
1207                objs[5] = getXMIId(struct_id);
1208                objs[6] = getXMIId(types[i]);
1209
1210                super.map("ATTRIBUTE_BASIC_TYPES", aliases, objs);
1211            }
1212        }
1213
1214        associations_.put(struct_id,
1215            (org.objectweb.ccm.util.Vector[])
1216                assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1217
1218        return "";
1219    }
1220
1221    /**
1222     * This method generates XMI mappings for union members.
1223     *
1224     * @param union The union to visit.
1225     */

1226    public java.lang.String JavaDoc unionMembers(org.objectweb.ccm.IDL3.UnionDecl union) {
1227        boolean is_inner = false;
1228
1229        // Discriminator
1230
org.objectweb.ccm.IDL3.TypeRef discriminator = union.getType();
1231
1232        java.lang.String JavaDoc owner_id = "";
1233        owner_id = getXMIId((org.objectweb.ccm.IDL3.TypeRef) union);
1234
1235        java.lang.String JavaDoc id = "";
1236        id = newId();
1237
1238        if (discriminator.isDeclaration()) {
1239            // Association
1240
org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1241
1242            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1243            ids.add(id);
1244            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) union));
1245            ids.add(getXMIId(discriminator));
1246            ids.add(getXMITranslator().toXMI(discriminator) + "_switch");
1247            ids.add("");
1248            ids.add("public");
1249            ids.add("1");
1250            ids.add("1");
1251            assoc_ends.add(ids);
1252
1253            associations_.put(union.getId(),
1254                (org.objectweb.ccm.util.Vector[])
1255                    assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1256        } else {
1257            java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1258                "multiplicity", "stereotype", "scope_id", "type" };
1259            java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1260
1261            objs[0] = id;
1262            objs[1] = getXMITranslator().toXMI(discriminator) + "_switch";
1263            objs[2] = "public";
1264            objs[3] = "multiplicity='1..1'";
1265            objs[4] = "";
1266            objs[5] = owner_id;
1267            objs[6] = getXMIId(discriminator);
1268
1269            super.map("ATTRIBUTE_BASIC_TYPES", aliases, objs);
1270        }
1271
1272        // Other members
1273
org.objectweb.ccm.IDL3.TypeRef[] types = union.getMembers().getMemberTypes();
1274        org.objectweb.ccm.IDL3.AnyValue[] labels = union.getMembers().getMemberValues();
1275        java.lang.String JavaDoc[] names = union.getMembers().getMemberNames();
1276        int default_index = union.getDefaultIndex();
1277
1278        java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "scope_id",
1279            "type", "idl_order", "label" };
1280        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1281
1282        org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1283
1284        for (int i = 0; i < names.length; i++) {
1285            // Check for inner struct, union or enum members
1286
if ((types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_struct) ||
1287                (types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_union) ||
1288                (types[i].getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_enum)) {
1289
1290                org.objectweb.ccm.IDL3.Declaration decl = null;
1291                decl = (org.objectweb.ccm.IDL3.Declaration) types[i];
1292
1293                if (decl.getParent().getId().equals(union.getId())) {
1294                    is_inner = true;
1295                } else {
1296                    is_inner = false;
1297                }
1298            } else {
1299                is_inner = false;
1300            }
1301
1302            if (is_inner) {
1303                switch (types[i].getTypeKind()) {
1304                    case org.objectweb.ccm.IDL3.TypeKind._tk_struct :
1305                        {
1306                            java.lang.String JavaDoc[] aliases_ = { "obj" };
1307                            java.lang.Object JavaDoc[] objs_ = { (org.objectweb.ccm.IDL3.StructDecl) types[i] };
1308                            super.map("STRUCT", aliases_, objs_);
1309                        }
1310                        break;
1311                    case org.objectweb.ccm.IDL3.TypeKind._tk_union :
1312                        {
1313                            java.lang.String JavaDoc[] aliases_ = { "obj" };
1314                            java.lang.Object JavaDoc[] objs_ = { (org.objectweb.ccm.IDL3.UnionDecl) types[i] };
1315                            super.map("UNION", aliases_, objs_);
1316                        }
1317                        break;
1318                    case org.objectweb.ccm.IDL3.TypeKind._tk_enum :
1319                        {
1320                            java.lang.String JavaDoc[] aliases_ = { "obj" };
1321                            java.lang.Object JavaDoc[] objs_ = { (org.objectweb.ccm.IDL3.EnumDecl) types[i] };
1322                            super.map("ENUM", aliases_, objs_);
1323                        }
1324                        break;
1325                    default :
1326                        break;
1327                }
1328            }
1329
1330            id = newId();
1331            
1332            if (types[i].isDeclaration()) {
1333                // Association
1334
org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1335                ids.add(id);
1336                ids.add(names[i]);
1337                ids.add(owner_id);
1338                ids.add(getXMIId(types[i]));
1339                ids.add(java.lang.Integer.toString(i));
1340                if (default_index == i) {
1341                    ids.add("default");
1342                } else {
1343                    ids.add(getXMITranslator().toString(labels[i], discriminator));
1344                }
1345                assoc_ends.add(ids);
1346            } else {
1347                objs[0] = id;
1348                objs[1] = names[i];
1349                objs[2] = owner_id;
1350                objs[3] = getXMIId(types[i]);
1351                objs[4] = java.lang.Integer.toString(i);
1352                if (default_index == i) {
1353                    objs[5] = "default";
1354                } else {
1355                    objs[5] = getXMITranslator().toString(labels[i], discriminator);
1356                }
1357                super.map("ATTRIBUTE_UNION_MEMBER", aliases, objs);
1358            }
1359        }
1360
1361        assoc_union_members_.put(union.getId(),
1362            (org.objectweb.ccm.util.Vector[])
1363                assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1364
1365        return "";
1366    }
1367
1368    /**
1369     * This method gets the base values of an eventtype or a CORBA value.
1370     *
1371     * @param value The value type to visit.
1372     */

1373    public java.lang.String JavaDoc baseValues(org.objectweb.ccm.IDL3.ValueDecl value) {
1374        org.objectweb.ccm.IDL3.ValueDecl[] bases = null;
1375        bases = value.getAbstractValues();
1376
1377        // Generalizable element
1378
java.lang.String JavaDoc gen_id = "";
1379        org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
1380
1381        for (int i = 0; i < bases.length; i++) {
1382            gen_id = newId();
1383            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1384            ids.add(gen_id);
1385            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) bases[i]));
1386            gen_bases.add(ids);
1387            
1388            insertGeneralizableElement(gen_id);
1389        }
1390
1391        org.objectweb.ccm.IDL3.ValueDecl base = value.getBaseValue();
1392          
1393        if (base != null) {
1394            gen_id = newId();
1395            
1396            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1397            ids.add(gen_id);
1398            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) base));
1399            gen_bases.add(ids);
1400              
1401            insertGeneralizableElement(gen_id);
1402        }
1403
1404        generalizations_.put(value.getId(),
1405            (org.objectweb.ccm.util.Vector[])
1406                gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
1407
1408        return "";
1409    }
1410
1411    /**
1412     * This method generates XMI mappings for a value type factory.
1413     *
1414     * @param value The value type to visit.
1415     */

1416    public java.lang.String JavaDoc initializer(org.objectweb.ccm.IDL3.ValueDecl value) {
1417        org.objectweb.ccm.IDL3.Initializer[] initializers = value.getInitializers();
1418
1419        if (initializers.length == 0) {
1420            return "";
1421        }
1422
1423        java.lang.String JavaDoc[] aliases = { "init", "owner_id" };
1424        java.lang.Object JavaDoc[] objs = { initializers[0],
1425            getXMIId((org.objectweb.ccm.IDL3.TypeRef) value) };
1426          
1427        super.map("INITIALIZER", aliases, objs);
1428
1429        return "";
1430    }
1431
1432    /**
1433     * This method gets the value type factory parameters.
1434     *
1435     * @param initializerId The value type factory xmi.id.
1436     * @param params The list of parameters.
1437     */

1438    public java.lang.String JavaDoc
1439    initializerParams(java.lang.String JavaDoc initializerId,
1440                      org.objectweb.ccm.IDL3.ParameterList params) {
1441                      
1442        org.objectweb.ccm.IDL3.TypeRef[] types = params.getParamTypes();
1443        java.lang.String JavaDoc[] names = params.getParamNames();
1444        int[] modes = params.getParamModes();
1445
1446        java.lang.String JavaDoc[] aliases = {"name", "kind", "operation", "type"};
1447        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[4];
1448        objs[2] = initializerId;
1449
1450        for (int i = 0; i < names.length; i++) {
1451            objs[0] = names[i];
1452            objs[1] = toStringMode(modes[i]);
1453            objs[3] = getXMIId(types[i]);
1454
1455            super.map("OPERATION_PARAMETER", aliases, objs);
1456        }
1457          
1458        return "";
1459    }
1460
1461    /**
1462     * This method maps a value member either to a UML attribute or to a UML association.
1463     *
1464     * @param member The value type member to visit.
1465     */

1466    public java.lang.String JavaDoc valueMember(org.objectweb.ccm.IDL3.ValueMemberDecl member) {
1467        org.objectweb.ccm.IDL3.TypeRef member_type = member.getType();
1468        java.lang.String JavaDoc id = "";
1469        id = newId(member);
1470
1471        if (member_type.isDeclaration()) {
1472            // Association
1473
org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1474
1475            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1476            ids.add(id);
1477            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) member.getParent()));
1478            ids.add(getXMIId(member_type));
1479            ids.add(member.getName());
1480            ids.add("");
1481            ids.add(member.isPrivate() ? "private" : "public");
1482            ids.add("1");
1483            ids.add("1");
1484            assoc_ends.add(ids);
1485
1486            associations_.put(member.getId(),
1487                (org.objectweb.ccm.util.Vector[])
1488                    assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1489        } else {
1490            java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1491                "multiplicity", "stereotype", "scope_id", "type" };
1492            java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1493
1494            objs[0] = id;
1495            objs[1] = member.getName();
1496            objs[2] = member.isPrivate() ? "private" : "public";
1497            objs[3] = "multiplicity='1..1'";
1498            objs[4] = "";
1499            objs[5] = getScopeId(member);
1500            objs[6] = getXMIId(member_type);
1501
1502            super.map("ATTRIBUTE_BASIC_TYPES", aliases, objs);
1503        }
1504
1505        return "";
1506    }
1507
1508    /**
1509     * This method creates a UML generalization for the boxed value.
1510     *
1511     * @param valuebox The boxed value to visit.
1512     */

1513    public java.lang.String JavaDoc boxedType(org.objectweb.ccm.IDL3.ValueBoxDecl valuebox) {
1514        java.lang.String JavaDoc gen_id = "";
1515        gen_id = newId();
1516
1517        org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
1518        org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1519        ids.add(gen_id);
1520        ids.add(getXMIId(valuebox.getType()));
1521        gen_bases.add(ids);
1522
1523        insertGeneralizableElement(gen_id);
1524
1525        return "";
1526    }
1527
1528    /**
1529     * This method maps a constant to an attribute when defined within
1530     * the scope of an IDL interface or to a class containing an attribute
1531     * when defined within a module scope.
1532     *
1533     * @param _constant The constant to visit.
1534     */

1535    public java.lang.String JavaDoc
1536    constant(org.objectweb.ccm.IDL3.ConstantDecl _constant)
1537    {
1538        org.objectweb.ccm.IDL3.TypeRef type = null;
1539        type = _constant.getType();
1540        org.objectweb.ccm.IDL3.AnyValue value = null;
1541        value = _constant.getAnyValue();
1542
1543        java.lang.String JavaDoc id = "";
1544        id = newId();
1545
1546        java.lang.String JavaDoc initvalue = "";
1547        if (value.isInteger()) {
1548            initvalue = java.lang.Long.toString(value.getAsInteger());
1549        } else if (value.isString()) {
1550            initvalue = value.getAsString();
1551        } else if (value.isWString()) {
1552            initvalue = value.getAsWString();
1553        } else if (value.isChar()) {
1554            initvalue = java.lang.String.valueOf(value.getAsChar());
1555        } else if (value.isWChar()) {
1556            initvalue = java.lang.String.valueOf(value.getAsWChar());
1557        } else if (value.isFixed()) {
1558            initvalue = value.getAsFixed();
1559        } else if (value.isFloating()) {
1560            initvalue = java.lang.Double.toString(value.getAsFloating());
1561        } else if (value.isBoolean()) {
1562            initvalue = java.lang.String.valueOf(value.getAsBoolean());
1563        } else if (value.isEnum()) {
1564            initvalue = value.getAsEnum();
1565        }
1566
1567        if ((_constant.getParent().getDeclKind() == org.objectweb.ccm.IDL3.DeclarationKind._dk_module) ||
1568            (_constant.getParent().getDeclKind() == org.objectweb.ccm.IDL3.DeclarationKind._dk_repository)) {
1569            
1570            org.objectweb.ccm.util.Vector v = new org.objectweb.ccm.util.Vector();
1571
1572            org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1573            ids.add(id);
1574            ids.add(_constant.getName());
1575            ids.add("public");
1576            ids.add(getXMIId((org.objectweb.ccm.IDL3.TypeRef) _constant.getParent()));
1577            ids.add(getXMIId(type));
1578            ids.add(initvalue);
1579            v.add(ids);
1580
1581            constants_.put(_constant.getId(),
1582                (org.objectweb.ccm.util.Vector[])
1583                    v.toArray(new org.objectweb.ccm.util.Vector[0]));
1584        } else {
1585            java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1586                "scope_id", "type", "init_value" };
1587            java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1588
1589            objs[0] = id;
1590            objs[1] = _constant.getName();
1591            objs[2] = "public";
1592            objs[3] = getXMIId((org.objectweb.ccm.IDL3.TypeRef) _constant.getParent());
1593            objs[4] = getXMIId(type);
1594            objs[5] = initvalue;
1595            
1596            super.map("ATTRIBUTE_CONSTANT", aliases, objs);
1597        }
1598
1599        return "";
1600    }
1601
1602    /**
1603     * This method generates XMI mappings for the class CORBAConstants.
1604     *
1605     * @param scope_id The xmi.id of the scope to visit.
1606     */

1607    public java.lang.String JavaDoc corbaConstants(java.lang.String JavaDoc scope_id) {
1608        if (constants_.size() > 0) {
1609            java.lang.String JavaDoc[] aliases = { "scope_id" };
1610            java.lang.Object JavaDoc[] objs = { scope_id };
1611
1612            super.map("CONSTANT_IN_MODULE_SCOPE", aliases, objs);
1613        }
1614
1615        return "";
1616    }
1617
1618    /**
1619     * This method generates attributes of the class CORBAConstants.
1620     *
1621     * @param owner_id The xmi.id of the container.
1622     */

1623    public java.lang.String JavaDoc constants_in_module_scope(java.lang.String JavaDoc owner_id) {
1624        java.util.Enumeration JavaDoc keys = constants_.keys();
1625        java.util.Enumeration JavaDoc values = constants_.elements();
1626
1627        java.lang.String JavaDoc[] aliases = { "attrib_id", "name", "visibility",
1628            "scope_id", "type", "init_value" };
1629        java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1630
1631        while (keys.hasMoreElements()) {
1632            keys.nextElement();
1633            org.objectweb.ccm.util.Vector[] elems =
1634                (org.objectweb.ccm.util.Vector[]) values.nextElement();
1635
1636            for (int i = 0; i < elems.length; i++) {
1637                for (int j = 0; j < elems[i].size(); j++) {
1638                    objs[j] = elems[i].get(j);
1639                }
1640                objs[3] = owner_id;
1641
1642                super.map("ATTRIBUTE_CONSTANT", aliases, objs);
1643            }
1644        }
1645
1646        return "";
1647    }
1648
1649    /**
1650     * This method visits the external references.
1651     *
1652     * @param vect The list of declarations to visit.
1653     */

1654    public java.lang.String JavaDoc visit(org.objectweb.ccm.util.Vector vect) {
1655        org.objectweb.ccm.IDL3.Declaration[] decls = (org.objectweb.ccm.IDL3.Declaration[])
1656            vect.toArray(new org.objectweb.ccm.IDL3.Declaration[0]);
1657
1658        for (int i = 0; i < decls.length; i++) {
1659            if (decls[i].getDeclKind() == org.objectweb.ccm.IDL3.DeclarationKind._dk_module) {
1660                java.lang.String JavaDoc[] aliases = { "obj", "vect" };
1661                java.lang.Object JavaDoc[] objs = { decls[i], dependencies_tree_.get(decls[i]) };
1662                super.map("MODULE_EXT_REFS", aliases, objs);
1663            } else {
1664                visitContained(decls[i], "");
1665            }
1666        }
1667
1668        return "";
1669    }
1670
1671    /**
1672     * This method generates XMI mappings for the external references.
1673     */

1674    public java.lang.String JavaDoc externalTypes() {
1675        // Build the dependencies tree
1676
org.objectweb.ccm.IDL3.Declaration[] depend = null;
1677        org.objectweb.ccm.IDL3.Scope parent = null;
1678        org.objectweb.ccm.util.Vector childs = null;
1679        org.objectweb.ccm.IDL3.Declaration obj1 = null;
1680        org.objectweb.ccm.util.Vector root_dependencies = new org.objectweb.ccm.util.Vector();
1681
1682        depend = (org.objectweb.ccm.IDL3.Declaration[])
1683            external_refs_.toArray(new org.objectweb.ccm.IDL3.Declaration[0]);
1684
1685        for (int i = 0; i < depend.length; i++) {
1686            obj1 = depend[i];
1687            parent = obj1.getParent();
1688
1689            while (parent.getDeclKind() !=
1690                org.objectweb.ccm.IDL3.DeclarationKind._dk_repository) {
1691                
1692                if (dependencies_tree_.containsKey(parent)) {
1693                    childs = (org.objectweb.ccm.util.Vector)
1694                        dependencies_tree_.get(parent);
1695                    if (childs.indexOf(obj1) == -1) {
1696                        childs.add(obj1);
1697                    }
1698                } else {
1699                    childs = new org.objectweb.ccm.util.Vector();
1700                    childs.add(obj1);
1701                    dependencies_tree_.put(parent, childs);
1702                }
1703
1704                obj1 = parent;
1705                parent = obj1.getParent();
1706            }
1707
1708            if (root_dependencies.indexOf(obj1) == -1) {
1709                root_dependencies.add(obj1);
1710            }
1711        }
1712
1713        visit(root_dependencies);
1714
1715        return "";
1716    }
1717
1718    /**
1719     * This method creates a new UML class for the anonymous type if any,
1720     * creates an UML class that specializes the type.
1721     *
1722     * @param _alias The alias to visit.
1723     */

1724    public java.lang.String JavaDoc
1725    alias(org.objectweb.ccm.IDL3.AliasDecl _alias) {
1726        java.lang.String JavaDoc anon_id = newId(_alias);
1727        java.lang.String JavaDoc gen_id = newId();
1728        java.lang.String JavaDoc name = _alias.getName();
1729        java.lang.String JavaDoc scope_id = getScopeId(_alias);
1730        java.lang.String JavaDoc type_id = _alias.getId();
1731
1732        org.objectweb.ccm.util.Vector ids = new org.objectweb.ccm.util.Vector();
1733        org.objectweb.ccm.util.Vector gen_bases = new org.objectweb.ccm.util.Vector();
1734        org.objectweb.ccm.util.Vector assoc_ends = new org.objectweb.ccm.util.Vector();
1735        ids.add(gen_id);
1736
1737        // Typedefed anonymous template types
1738
org.objectweb.ccm.IDL3.TypeRef type = _alias.getType();
1739
1740        org.objectweb.ccm.IDL3.TypeRefImpl impl = null;
1741
1742        if (type.getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_sequence) {
1743            java.lang.String JavaDoc[] aliases = { "seq_id", "name", "scope_id", "type_id" };
1744            java.lang.Object JavaDoc[] objs = { anon_id, name, scope_id, type_id };
1745
1746            super.map("TYPEDEF_SEQUENCE", aliases, objs);
1747
1748            impl = (org.objectweb.ccm.IDL3.TypeRefImpl) type;
1749            org.objectweb.ccm.IDL3.TypeRef implType = impl.getContentType();
1750            ids.add(anon_id);
1751            ids.add(getXMIId(implType));
1752            ids.add(impl);
1753            if (implType.getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_value_box) {
1754                ids.add("0..1");
1755            } else {
1756                ids.add("1..1");
1757            }
1758            ids.add("CORBASequence");
1759
1760            // Add an association
1761
assoc_ends.add(ids);
1762            assoc_typedefs_.put(type_id,
1763               (org.objectweb.ccm.util.Vector[])
1764                   assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1765        } else if (type.getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_array) {
1766            java.lang.String JavaDoc[] aliases = { "array_id", "name", "scope_id", "type_id" };
1767            java.lang.Object JavaDoc[] objs = { anon_id, name, scope_id, type_id };
1768
1769            super.map("TYPEDEF_ARRAY", aliases, objs);
1770
1771            impl = (org.objectweb.ccm.IDL3.TypeRefImpl) type;
1772            while (impl.getContentType().getTypeKind() ==
1773                org.objectweb.ccm.IDL3.TypeKind._tk_array) {
1774                
1775                impl = (org.objectweb.ccm.IDL3.TypeRefImpl) impl.getContentType();
1776            }
1777
1778            ids.add(anon_id);
1779
1780            if (impl.getContentType().getTypeKind() !=
1781               org.objectweb.ccm.IDL3.TypeKind._tk_sequence) {
1782   
1783               ids.add(getXMIId(impl.getContentType()));
1784            } else {
1785               impl = (org.objectweb.ccm.IDL3.TypeRefImpl) impl.getContentType();
1786
1787               java.lang.String JavaDoc anon_seq_id = newId();
1788
1789               java.lang.String JavaDoc[] aliases_ = { "seq_id", "scope_id" };
1790               java.lang.Object JavaDoc[] objs_ = { anon_seq_id, scope_id };
1791
1792               super.map("ANONYMOUS_SEQUENCE", aliases_, objs_);
1793
1794               org.objectweb.ccm.util.Vector ids2 = new org.objectweb.ccm.util.Vector();
1795               org.objectweb.ccm.IDL3.TypeRef implType = impl.getContentType();
1796
1797               ids2.add(newId());
1798               ids2.add(anon_seq_id);
1799               ids2.add(getXMIId(implType));
1800               ids2.add(impl);
1801               if (implType.getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_value_box) {
1802                  ids2.add("0..1");
1803               } else {
1804                  ids2.add("1..1");
1805               }
1806               ids2.add("CORBASequence");
1807
1808               // Add an association
1809
assoc_ends.add(ids2);
1810               assoc_typedefs_.put(type_id,
1811                  (org.objectweb.ccm.util.Vector[])
1812                     assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1813
1814               ids.add(anon_seq_id);
1815            }
1816
1817            ids.add(type);
1818            ids.add("1..1");
1819            ids.add("CORBAArray");
1820
1821            // Add association
1822
assoc_ends.add(ids);
1823            assoc_typedefs_.put(type_id,
1824               (org.objectweb.ccm.util.Vector[])
1825                    assoc_ends.toArray(new org.objectweb.ccm.util.Vector[0]));
1826        } else if (type.getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_fixed) {
1827            impl = (org.objectweb.ccm.IDL3.TypeRefImpl) type;
1828            java.lang.String JavaDoc digits = java.lang.String.valueOf(impl.getDigits());
1829            java.lang.String JavaDoc scale = java.lang.String.valueOf(impl.getScale());
1830                     
1831            java.lang.String JavaDoc[] aliases = { "fixed_id", "name", "scope_id", "type_id", "digits", "scale" };
1832            java.lang.Object JavaDoc[] objs = { anon_id, name, scope_id, type_id, digits, scale };
1833
1834            super.map("TYPEDEF_FIXED", aliases, objs);
1835            
1836            ids.add(getXMIId("CORBAFixed"));
1837
1838            // Add generalization
1839
gen_bases.add(ids);
1840            generalizations_.put(type_id,
1841                (org.objectweb.ccm.util.Vector[])
1842                    gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
1843        } else {
1844            java.lang.String JavaDoc[] aliases = { "alias_id", "name", "scope_id", "gen_id", "type_id" };
1845            java.lang.Object JavaDoc[] objs = { anon_id, name, scope_id, gen_id, type_id };
1846
1847            super.map("TYPEDEF", aliases, objs);
1848
1849            ids.add(getXMIId(type));
1850
1851            // add generalization
1852
gen_bases.add(ids);
1853            generalizations_.put(type_id,
1854                (org.objectweb.ccm.util.Vector[])
1855                    gen_bases.toArray(new org.objectweb.ccm.util.Vector[0]));
1856        }
1857
1858        return "";
1859    }
1860
1861    /**
1862     * This method generates XMI mappings for an attribute of a qualified association.
1863     *
1864     * @param kind The kind of the association.
1865     * @param impl The object to visit.
1866     */

1867    public java.lang.String JavaDoc
1868    qualifierAttribute(java.lang.String JavaDoc kind,
1869                       org.objectweb.ccm.IDL3.TypeRefImpl impl) {
1870         
1871         java.lang.String JavaDoc[] aliases = { "name", "value" };
1872         java.lang.Object JavaDoc[] objs = new java.lang.Object JavaDoc[aliases.length];
1873
1874         if (kind.equals("CORBASequence")) {
1875              objs[0] = "index";
1876              int upperBound = impl.getLength();
1877              objs[1] = (upperBound == 0) ? "*" : java.lang.String.valueOf(upperBound);
1878
1879              super.map("ATTRIBUTE_ASSOCIATION_QUALIFIER", aliases, objs);
1880         } else {
1881              org.objectweb.ccm.util.Vector arrayDims = new org.objectweb.ccm.util.Vector();
1882              arrayDims.add(new java.lang.Integer JavaDoc(impl.getLength()));
1883
1884              while (impl.getContentType().getTypeKind() == org.objectweb.ccm.IDL3.TypeKind._tk_array) {
1885                    impl = (org.objectweb.ccm.IDL3.TypeRefImpl) impl.getContentType();
1886                    arrayDims.add(new java.lang.Integer JavaDoc(impl.getLength()));
1887              }
1888
1889              for (int i = 0; i < arrayDims.size(); i++) {
1890                    objs[0] = "index" + java.lang.String.valueOf(i);
1891                    objs[1] = java.lang.String.valueOf(arrayDims.get(arrayDims.size() - 1 - i));
1892                    
1893                    super.map("ATTRIBUTE_ASSOCIATION_QUALIFIER", aliases, objs);
1894              }
1895         }
1896
1897         return "";
1898    }
1899
1900    /**
1901     * This method returns the basename of a filename.
1902     *
1903     * @param filename The file name.
1904     */

1905    public java.lang.String JavaDoc
1906    printShortFileName(java.lang.String JavaDoc filename) {
1907        java.io.File JavaDoc f = new java.io.File JavaDoc(filename);
1908
1909        return f.getName();
1910    }
1911}
1912
Popular Tags