KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.io.IOException JavaDoc;
30 import java.io.InputStream JavaDoc;
31 import java.util.LinkedList JavaDoc;
32 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.DeployerInactiveState;
33 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.installer.DependencyDeployerVisitor;
34 import org.omg.Components.ConfigValue;
35 import org.omg.Components.Deployment.ComponentInstallation;
36
37 /**
38  * The softpkg deployer root.
39  *
40  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
41  *
42  * @version 0.1
43  */

44 public class SoftpkgDeployer
45        extends SoftpkgDeployerContext
46 {
47     // ==================================================================
48
//
49
// Internal state.
50
//
51
// ==================================================================
52
private LinkedList JavaDoc configValues;
53     private ComponentInstallation componentInstallation;
54     // ==================================================================
55
//
56
// Constructors.
57
//
58
// ==================================================================
59
public SoftpkgDeployer(){
60         configValues=new LinkedList JavaDoc();
61     }
62     // ==================================================================
63
//
64
// Internal methods.
65
//
66
// ==================================================================
67
// ==================================================================
68
//
69
// Public methods.
70
//
71
// ==================================================================
72
/**
73      * resolve all the sub dependencies and return the produce config value
74      * @return the config value produce
75      * @throws DependencyResolutionFailureException if the resolution failed
76      */

77     public ConfigValue[]
78     processDependencies(ComponentInstallation componentInstallation)
79     throws DependencyResolutionFailureException
80     {
81      
82         try{
83             this.componentInstallation=componentInstallation;
84             traverse(this,getDependencyDeployers());
85             return (ConfigValue[])configValues.toArray(new ConfigValue[configValues.size()]);
86         }
87         catch(Exception JavaDoc e){
88            throw (DependencyResolutionFailureException)e;
89         }
90     }
91     /**
92      * The dependency visitor to resolve a dependency.
93      *
94      * @param deployer The dependency deployer to execute
95      * @param status The softpkg current status
96      * @throws DependencyResolutionFailureException
97      */

98     public void
99     visit(DependencyDeployer deployer, DeployerInactiveState status)
100     throws DependencyResolutionFailureException
101     {
102         configValues.add(deployer.resolveDependency(componentInstallation));
103     }
104     /**
105      * Return an input stream on the current component archive.
106      *
107      * @return the input stream on the current archive
108      * @throws IOException
109      */

110     public InputStream JavaDoc
111     getComponentArchiveStream()
112     throws IOException JavaDoc
113     {
114         return getZipEntryRetriever().getNewInputStream();
115     }
116     
117     /**
118      * The dependency visitor method taking in parameter the visitor
119      * to execute on all the dependencies.
120      * @param depVisitor the visitor to use.
121      * @throws DependencyResolutionFailureException
122      */

123     public void
124     visitDependencyDeployers(DependencyDeployerVisitor depVisitor)
125     throws DependencyResolutionFailureException
126     {
127         DependencyDeployer depDepl[]=getDependencyDeployers();
128         for(int i=0;i<depDepl.length;i++)
129             depVisitor.visit(depDepl[i]);
130     }
131 }
132
Popular Tags