KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > softpkg > ccm > DependencyDeployer


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): Briclet Fr?d?ric.
23 Contributor(s): ______________________________________.
24
25 ====================================================================*/

26
27 package org.objectweb.openccm.descriptor.softpkg.ccm;
28
29 //import the needed packages
30
import org.objectweb.openccm.descriptor.softpkg.*;
31
32 /**
33  * Process and traduce the component dependency to a
34  * configvalue array that the target container cannot use.
35  *
36  * @author <a HREF="mailto:frederic.briclet@lifl.fr">Briclet Frederic</a>
37  *
38  * @version 0.1
39  */

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

50     // ==================================================================
51
//
52
// Internal methods.
53
//
54
// ==================================================================
55

56     // ==================================================================
57
//
58
// Constructor.
59
//
60
// ==================================================================
61

62     // ==================================================================
63
//
64
// Public methods.
65
//
66
// ==================================================================
67

68     /**
69      * Resolve a depency converting it into a configvalue.
70      *
71      * @param server_inst The ComponentInstallation to use to install the
72      * dependency archive
73      * @return A configuration value to use in the Container::install_home
74      * method if the dependency action is "install" and type is "Java Class".
75      */

76     public org.omg.Components.ConfigValue
77     resolveDependency(org.omg.Components.Deployment.ComponentInstallation server_inst)
78     throws DependencyResolutionFailureException
79     {
80         try{
81         
82             org.omg.Components.ConfigValue config = null;
83             Dependency dep=getDependency();
84             if ((dep.getAction().compareToIgnoreCase("install") == 0)
85                 && (dep.getFileinarchive()!=null)
86                 && (dep.getFileinarchive().getName()!=null||(dep.getFileinarchive().getLink()!=null))
87                 /*&& (dep.getName()!=null)
88                 && (dep.getName().getValue()!=null)*/

89                 )
90                 {
91                     String JavaDoc fileAdress =
92                         getFileinarchiveDeployer()
93                         .provideRessource();
94                     
95                     server_inst.install
96                         (/*dep.getName().getValue()*/
97                          dep.getFileinarchive().getName()
98                         ,fileAdress);
99                     /*server_inst.install(dep.getName().getValue(),
100                       absolutePath); */

101
102                     // Set up the dependency as config value for home
103
// installation if the dependency is java classes
104
if (dep.getType().trim().
105                         compareToIgnoreCase("Java Class") == 0)
106                     {
107                         config = new org.objectweb.openccm.Components.ConfigValueImpl();
108                         config.name = "load_lib_dependency";
109                         config.value = org.objectweb.openccm.corba.TheORB.getORB().create_any();
110                         config.value.insert_string(dep.getFileinarchive().getName()/*dep.getName().getValue()*/);
111                     }
112                 }
113             return config;
114         }
115         catch(Exception JavaDoc e){
116             e.printStackTrace();
117             throw new DependencyResolutionFailureException(this,e);
118         }
119     }
120
121
122 }
123
Popular Tags