KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > util > FileinarchiveDeployerContext


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 package org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.util;
27
28 import java.net.ServerSocket JavaDoc;
29
30 import org.objectweb.openccm.descriptor.componentassembly.beans.FileinarchiveBean;
31 import org.objectweb.openccm.descriptor.componentassembly.ccm.deployer.base.*;
32
33 /**
34  * The fileinarchive deployer context defines all the connection requires for
35  * browse the current archive and retrieve a specific entry. There is also
36  * connection to start an HTTP server to upload file.
37  *
38  * @author <a HREF="mailto:briclet@lifl.fr">Briclet Frédéric</a>
39  *
40  * @version 0.1
41  */

42 public class FileinarchiveDeployerContext
43        extends ChildDeployerContext
44     {
45     // ==================================================================
46
//
47
// Internal state.
48
//
49
// ==================================================================
50
private FileinarchiveBean fileinarchive;
51     //Reference on a possible linkDeployer child
52
private LinkDeployer linkDeployer;
53     // ==================================================================
54
//
55
// Constructors.
56
//
57
// ==================================================================
58
// ==================================================================
59
//
60
// Internal methods.
61
//
62
// ==================================================================
63
// ==================================================================
64
//
65
// Public accessors methods.
66
//
67
// ==================================================================
68
/**
69      * @return
70      */

71     public FileinarchiveBean
72     getFileinarchive()
73     {
74         return fileinarchive;
75     }
76
77     /**
78      * @param bean
79      */

80     public void
81     connectFileinarchive(FileinarchiveBean bean)
82     {
83         fileinarchive = bean;
84         connectDeployerDescription(fileinarchive);
85     }
86
87     public void
88     connectLinkDeployer(LinkDeployer linkDeployer)
89     {
90         this.linkDeployer=linkDeployer;
91     }
92
93     public LinkDeployer
94     getLinkDeployer()
95     {
96         return linkDeployer;
97     }
98     public ServerSocket JavaDoc
99     getServerSocket()
100     {
101         return getRootDeployerContext().getServerSocket();
102     }
103     
104     /**
105      * This initialization method is used to check that all the services and
106      * information required to deploy are presents. If all is OK the deployer
107      * is put in inactive deployer state waiting for the deployment processing.
108      *
109      * @exception InitializationError is thrown if a problem is detected
110      */

111     public void
112     initialize()
113     throws InitializationError
114     {
115         // TODO Auto-generated method stub
116
if(getFileinarchive()==null)
117             getErrorManager()
118             .submitException(new InitializationError(this,"Connection on fileinarchive bean is required"+
119                                                     "check the handler code it must specify this connection"));
120         if(getZipEntryRetriever()==null)
121             getErrorManager()
122             .submitException(new InitializationError(this,"Connection on zipentryretriever is required"+
123                                                      "check the handler code it must specify this connection"));
124                                                     
125         if((getFileinarchive().getName()==null||
126             getFileinarchive().getName()=="")&&getLinkDeployer()==null)
127               getErrorManager()
128               .submitException(new InitializationError(this,"The name attribute of fileinarchive element msut be fullfilled"+
129                                                        "check the fileinarchive element"+
130                                                        "description\n."+getStringifiedDeployerDescription()));
131                                                        
132          getLifeCycleManager().stepEndedSuccessFully();
133     }
134
135
136 }
137
Popular Tags