KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ungoverned > moduleloader > search > ValidationException


1 /*
2  * ModuleLoader - A generic, policy-driven class loader.
3  * Copyright (c) 2004, Richard S. Hall
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
10  * * Redistributions of source code must retain the above copyright
11  * notice, this list of conditions and the following disclaimer.
12  * * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in
14  * the documentation and/or other materials provided with the
15  * distribution.
16  * * Neither the name of the ungoverned.org nor the names of its
17  * contributors may be used to endorse or promote products derived
18  * from this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  *
32  * Contact: Richard S. Hall (heavy@ungoverned.org)
33  * Contributor(s):
34  *
35 **/

36 package org.ungoverned.moduleloader.search;
37
38 import org.ungoverned.moduleloader.Module;
39
40 /**
41  * <p>
42  * This exception is thrown if a module cannot be validated. The module
43  * that failed to be validated is recorded, along with the failed import target
44  * identifier and version number. If the error was a result of a propagation
45  * conflict, then the propagation error flag is set.
46  * </p>
47  * @see org.ungoverned.moduleloader.search.ImportSearchPolicy#validate(org.ungoverned.moduleloader.Module)
48 **/

49 public class ValidationException extends Exception JavaDoc
50 {
51     private Module m_module = null;
52     private Object JavaDoc m_identifier = null;
53     private Object JavaDoc m_version = null;
54     private boolean m_isPropagation = false;
55
56     /**
57      * Constructs an exception with the specified message, module,
58      * import identifier, import version number, and propagation flag.
59     **/

60     public ValidationException(String JavaDoc msg, Module module,
61         Object JavaDoc identifier, Object JavaDoc version, boolean isPropagation)
62     {
63         super(msg);
64         m_module = module;
65         m_identifier = identifier;
66         m_version = version;
67         m_isPropagation = isPropagation;
68     }
69
70     /**
71      * Returns the module that was being validated.
72      * @return the module that was being validated.
73     **/

74     public Module getModule()
75     {
76         return m_module;
77     }
78
79     /**
80      * Returns the identifier of the import target that could not be resolved.
81      * @return the identifier of the import target that could not be resolved.
82     **/

83     public Object JavaDoc getIdentifier()
84     {
85         return m_identifier;
86     }
87
88     /**
89      * Returns the version number of the import target that could not be resolved.
90      * @return the version number of the import target that could not be resolved.
91     **/

92     public Object JavaDoc getVersion()
93     {
94         return m_version;
95     }
96
97     /**
98      * Returns a flag indicating whether the exception was caused by a
99      * a propagation conflict.
100      * @return <tt>true</tt> if the exception was thrown due to a propagation
101      * conflict, <tt>false</tt> otherwise.
102     **/

103     public boolean isPropagationError()
104     {
105         return m_isPropagation;
106     }
107 }
Popular Tags