KickJava   Java API By Example, From Geeks To Geeks.

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


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 import org.objectweb.openccm.descriptor.corbacomponent.beans.CorbacomponentBean;
32 import org.objectweb.openccm.descriptor.corbacomponent.beans.CorbacomponentBeanImpl;
33 import org.objectweb.openccm.descriptor.corbacomponent.gui.CorbacomponentZipper;
34
35 /**
36  * This is an extension to the Apollon generated framework around softpkg DTD
37  * it looks for subelements that could contain files to archive
38  * and calls their own zipper extensions to do the same job
39  * any found file name is sent to a zip factory
40  *
41  */

42 public class DescriptorZipper
43 {
44     // ==================================================================
45
//
46
// Internal state.
47
//
48
// ==================================================================
49

50     // ==================================================================
51
//
52
// Constructors.
53
//
54
// ==================================================================
55

56     // ==================================================================
57
//
58
// Public methods.
59
//
60
// ==================================================================
61

62     /**
63      * The zip method called from parents
64      *
65      */

66     public void
67     zipCall(
68         DescriptorBean descriptor
69         , org.objectweb.openccm.packaging.ZipFactory zip_factory
70         )
71     {
72         FileinarchiveBean fileinarchive
73          = (FileinarchiveBean)
74             descriptor.getFileinarchive();
75
76         // goes through sub element and call its zip method
77
if (fileinarchive != null)
78         {
79             FileinarchiveZipper sub_zipper
80              = (FileinarchiveZipper) fileinarchive
81                 .getExtensionManager()
82                 .getExtensionByName("gui.Zipper")
83                 .getInstance();
84
85             sub_zipper.zipCall(fileinarchive, zip_factory);
86
87
88             // unmarshal the pointed CCD file to find dependencies
89
java.io.File JavaDoc ccd_file
90                 = new java.io.File JavaDoc(fileinarchive.getName());
91
92             if (ccd_file.exists())
93             {
94                 try
95                 {
96                     CorbacomponentBean ccd_instance
97                         = CorbacomponentBeanImpl.unmarshalBean(ccd_file);
98
99                     CorbacomponentZipper ccd_zipper
100                         = (CorbacomponentZipper)
101                             ccd_instance
102                                 .getExtensionManager()
103                                 .getExtensionByName("gui.Zipper")
104                                 .getInstance();
105
106                     ccd_zipper.zipCall(ccd_instance, zip_factory);
107
108                 } catch (java.io.IOException JavaDoc exc) {
109                     System.err.println(
110                         "CCD file: "
111                         +fileinarchive.getName()
112                         +" could not be opened -> no CORBA properties dependencies to add.");
113                 }
114             }
115         }
116     }
117 }
118
Popular Tags