KickJava   Java API By Example, From Geeks To Geeks.

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


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 /**
39  * <p>
40  * This interface represents the naming and version numbering policy of
41  * import and export identifiers for the <tt>ImportSearchPolicy</tt>. A concrete
42  * implementation of this interface is required to create an instance
43  * of <tt>ImportSearchPolicy</tt>. The sole purpose of this interface
44  * is to allow the <tt>ImportSearchPolicy</tt> to determine if one
45  * import/export identifier and version is compatible with another.
46  * </p>
47  * @see org.ungoverned.moduleloader.search.ImportSearchPolicy
48 **/

49 public interface CompatibilityPolicy
50 {
51     /**
52      * Compares two import/export identifiers.
53      * @param leftId the identifier to test for compatibility.
54      * @param leftVersion the version number to test for compatibility.
55      * @param rightId the identifier used as the compatibility base line.
56      * @param rightVersion the version used as the compatibility base line.
57      * @return <tt>0</tt> if the identifiers are equal, <tt>-1</tt> if the
58      * left identifier is less then the right identifier, and <tt>1</tt>
59      * if the left identifier is greater than the right identifier.
60      * @throws java.lang.IllegalArgumentException if the two identifiers
61      * are not comparable, i.e., they refer to intrinsically different
62      * entities.
63     **/

64     public int compare(
65         Object JavaDoc leftId, Object JavaDoc leftVersion,
66         Object JavaDoc rightId, Object JavaDoc rightVersion);
67
68     /**
69      * Returns whether the first import/export identifer is compatible
70      * with the second; this method should not throw any exceptions.
71      * @param leftId the identifier to test for compatibility.
72      * @param leftVersion the version number to test for compatibility.
73      * @param rightId the identifier used as the compatibility base line.
74      * @param rightVersion the version used as the compatibility base line.
75      * @return <tt>true</tt> if the left version number object is compatible
76      * with the right version number object, otherwise <tt>false</tt>.
77     **/

78     public boolean isCompatible(
79         Object JavaDoc leftId, Object JavaDoc leftVersion,
80         Object JavaDoc rightId, Object JavaDoc rightVersion);
81 }
Popular Tags