KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > openccm > descriptor > componentassembly > ccm > deployer > base > InitializationError


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.base;
27
28 /**
29  * The InitializationError is thrown during the building of the
30  * deployment machine if an error occured.
31  *
32  * @author <a HREF="mailto:briclet@lifl.fr">Frederic Briclet</a>
33  *
34  * @version 0.1
35  */

36 public class InitializationError
37        extends DeployerFailureException
38     {
39     
40     // ==================================================================
41
//
42
// Internal state.
43
//
44
// ==================================================================
45
private int gravity=0;
46     // ==================================================================
47
//
48
// Constructors.
49
//
50
// ==============================s====================================
51
/**
52      * This constructor is used when the deployment machine detect a problem
53      * and want to signal it.
54      * @param deployer The deployer concern by the error
55      * @param message the error explaination message
56      */

57     public InitializationError(DeployerContext deployer,
58                                String JavaDoc message)
59     {
60         super(deployer,null,message);
61     }
62     /**
63      * This constructor is used when an unwanted exception occur during the
64      * deployment machine building.
65      *
66      * @param deployer The deployer concern by the exception
67      * @param e The exception that occured
68      * @param message An explaination message
69      */

70     public InitializationError(DeployerContext deployer,
71                                Exception JavaDoc e,
72                                String JavaDoc message)
73     {
74         super(deployer,e,message);
75     }
76
77     /**
78      * This constructor is used when an unwanted exception occur during the
79      * deployment machine building.
80      *
81      * @param deployer The deployer concern by the exception
82      * @param e The exception that occured
83      * @param message An explaination message
84      */

85     public InitializationError(DeployerContext deployer,
86                                Exception JavaDoc e,
87                                String JavaDoc message,
88                                int gravity)
89     {
90         super(deployer,e,message);
91         this.gravity=gravity;
92     }
93     // ==================================================================
94
//
95
// Internal methods.
96
//
97
// ==================================================================
98

99     // ==================================================================
100
//
101
// Public methods
102
//
103
// ==================================================================
104

105     public void
106     printStackTrace()
107     {
108         
109         
110         System.err.println(getMessage());
111         if(gravity==1&&getInitialException()!=null)
112             getInitialException().printStackTrace();
113         else
114             if(getInitialException()!=null)
115                 System.err.println(getInitialException().getMessage());
116         //comment to compile on jdk1.3.1
117
//System.err.println("\t at:"+super.getStackTrace()[0].toString());
118
//System.err.println("\t at:"+super.getStackTrace()[1].toString());
119

120     
121     }
122     
123     public String JavaDoc
124     getMessage()
125     { if(message==null)
126             message="";
127             
128         if(getDeployer()==null)
129             return "The deployment machine building was aborted during "+
130                " initialization due to\n"+message;
131                
132                            
133         return "The deployment machine building was aborted when tried "+
134                "to initialize "+getDeployer().getIdentifier()+" due to :\n"+message;
135     }
136 }
137
Popular Tags