KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > softpkg > gui > SoftpkgZipper


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 Contreras
23 Contributor(s):
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.descriptor.softpkg.gui;
28
29 import org.objectweb.openccm.descriptor.softpkg.beans.*;
30 import org.objectweb.openccm.descriptor.softpkg.*;
31
32 /**
33  * This is an extension to the Apollon generated framework around softpkg DTD
34  * it looks for subelements that could contain files to archive
35  * and calls their own zipper extensions to do the same job
36  * any found file name is sent to a zip factory
37  *
38  */

39 public class SoftpkgZipper
40 {
41     // ==================================================================
42
//
43
// Internal state.
44
//
45
// ==================================================================
46

47     // ==================================================================
48
//
49
// Constructors.
50
//
51
// ==================================================================
52

53     /**
54      * The constructor taking an event as parameter
55      */

56     public void
57     zipCall(
58         SoftpkgBean softpkg
59         , org.objectweb.openccm.packaging.ZipFactory zip_factory
60         )
61     {
62         // retrieves the elements that may contain files to zip and call their extension
63
java.util.List JavaDoc subelement_list;
64
65         // dependencies
66
subelement_list
67          = softpkg.getDependencyList();
68
69         // goes through each elements and call its zip method
70
for (java.util.Iterator JavaDoc i = subelement_list.iterator() ; i.hasNext() ; )
71         {
72             DependencyBean sub_element
73              = (DependencyBean) i.next();
74
75             DependencyZipper sub_zipper
76              = (DependencyZipper) sub_element
77                 .getExtensionManager()
78                 .getExtensionByName("gui.Zipper")
79                 .getInstance();
80
81             sub_zipper.zipCall(sub_element, zip_factory);
82         }
83
84         // CCD descriptors
85
subelement_list
86          = softpkg.getDescriptorList();
87         // goes through each elements and call its zip method
88
for (java.util.Iterator JavaDoc i = subelement_list.iterator() ; i.hasNext() ; )
89         {
90             DescriptorBean sub_element
91              = (DescriptorBean) i.next();
92
93             DescriptorZipper sub_zipper
94              = (DescriptorZipper) sub_element
95                 .getExtensionManager()
96                 .getExtensionByName("gui.Zipper")
97                 .getInstance();
98
99             sub_zipper.zipCall(sub_element, zip_factory);
100         }
101
102         // IDL files
103
subelement_list
104          = softpkg.getIdlList();
105         // goes through each elements and call its zip method
106
for (java.util.Iterator JavaDoc i = subelement_list.iterator() ; i.hasNext() ; )
107         {
108             IdlBean sub_element
109              = (IdlBean) i.next();
110
111             IdlZipper sub_zipper
112              = (IdlZipper) sub_element
113                 .getExtensionManager()
114                 .getExtensionByName("gui.Zipper")
115                 .getInstance();
116
117             sub_zipper.zipCall(sub_element, zip_factory);
118         }
119
120         // Properties Files
121
subelement_list
122          = softpkg.getPropertyfileList();
123         // goes through each elements and call its zip method
124
for (java.util.Iterator JavaDoc i = subelement_list.iterator() ; i.hasNext() ; )
125         {
126             PropertyfileBean sub_element
127              = (PropertyfileBean) i.next();
128
129             PropertyfileZipper sub_zipper
130              = (PropertyfileZipper) sub_element
131                 .getExtensionManager()
132                 .getExtensionByName("gui.Zipper")
133                 .getInstance();
134
135             sub_zipper.zipCall(sub_element, zip_factory);
136         }
137
138         // implementations
139
subelement_list
140          = softpkg.getImplementationList();
141         // goes through each elements and call its zip method
142
for (java.util.Iterator JavaDoc i = subelement_list.iterator() ; i.hasNext() ; )
143         {
144             ImplementationBean sub_element
145              = (ImplementationBean) i.next();
146
147             ImplementationZipper sub_zipper
148              = (ImplementationZipper) sub_element
149                 .getExtensionManager()
150                 .getExtensionByName("gui.Zipper")
151                 .getInstance();
152
153             sub_zipper.zipCall(sub_element, zip_factory);
154         }
155     }
156 }
157
Popular Tags