KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > jdo > api > persistence > model > ClassLoaderStrategy


1 /*
2  * The contents of this file are subject to the terms
3  * of the Common Development and Distribution License
4  * (the License). You may not use this file except in
5  * compliance with the License.
6  *
7  * You can obtain a copy of the license at
8  * https://glassfish.dev.java.net/public/CDDLv1.0.html or
9  * glassfish/bootstrap/legal/CDDLv1.0.txt.
10  * See the License for the specific language governing
11  * permissions and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL
14  * Header Notice in each file and include the License file
15  * at glassfish/bootstrap/legal/CDDLv1.0.txt.
16  * If applicable, add the following below the CDDL Header,
17  * with the fields enclosed by brackets [] replaced by
18  * you own identifying information:
19  * "Portions Copyrighted [year] [name of copyright owner]"
20  *
21  * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
22  */

23
24 /*
25  * ClassLoaderStrategy.java
26  *
27  * Created on August 29, 2003, 3:19 PM
28  */

29
30 package com.sun.jdo.api.persistence.model;
31
32 /**
33  *
34  * @author mvatkina
35  * @version %I%
36  */

37 public class ClassLoaderStrategy
38 {
39     /** System property key used to define the model behavior concerning
40      * multiple class loaders.
41      * Value should be one of
42      * {@link #MULTIPLE_CLASS_LOADERS_IGNORE},
43      * {@link #MULTIPLE_CLASS_LOADERS_RELOAD}, or
44      * {@link #MULTIPLE_CLASS_LOADERS_ERROR}
45      */

46     public static final String JavaDoc PROPERTY_MULTIPLE_CLASS_LOADERS =
47         "com.sun.jdo.api.persistence.model.multipleClassLoaders"; //NOI18N
48

49     /** Constant representing the value "ignore" of the System property
50      * com.sun.jdo.api.persistence.model.multipleClassLoaders
51      * Setting the system property to "ignore" causes the model to ignore
52      * any new class loader for the same fully qualified class name.
53      * @see RuntimeModel#findClassLoader
54      */

55     public static final String JavaDoc MULTIPLE_CLASS_LOADERS_IGNORE = "ignore"; //NOI18N
56

57     /** Constant representing the value "reload" of the System property
58      * com.sun.jdo.api.persistence.model.multipleClassLoaders
59      * Setting the system property to "reload" causes the model to reload
60      * the class mapping if it is specified with a new class loader.
61      * @see RuntimeModel#findClassLoader
62      */

63     public static final String JavaDoc MULTIPLE_CLASS_LOADERS_RELOAD = "reload"; //NOI18N
64

65     /** Constant representing the value "error" of the System property
66      * com.sun.jdo.api.persistence.model.multipleClassLoaders
67      * Setting the system property to "reload" causes the model to throw an
68      * exception if the same class is used with a diferent class loader.
69      * @see RuntimeModel#findClassLoader
70      */

71     public static final String JavaDoc MULTIPLE_CLASS_LOADERS_ERROR = "error"; //NOI18N
72

73     /** Value of the property used to define the model behavior concerning
74      * multiple class loaders.
75      */

76     private static String JavaDoc _strategy = System.getProperty(
77         PROPERTY_MULTIPLE_CLASS_LOADERS, MULTIPLE_CLASS_LOADERS_ERROR);
78
79     /** Get the value of the property
80      * {@link #PROPERTY_MULTIPLE_CLASS_LOADER} used to define the model
81      * behavior concerning multiple class loaders.
82      * @return the value of the property, one of
83      * {@link #MULTIPLE_CLASS_LOADERS_IGNORE},
84      * {@link #MULTIPLE_CLASS_LOADERS_RELOAD}, or
85      * {@link #MULTIPLE_CLASS_LOADERS_ERROR}
86      */

87     public static String JavaDoc getStrategy ()
88     {
89         return _strategy;
90     }
91
92     /** Sets the value of the property
93      * {@link #PROPERTY_MULTIPLE_CLASS_LOADER} used to define the model
94      * behavior concerning multiple class loaders.
95      * @param strategy the new value of the property. Value should be one of
96      * {@link #MULTIPLE_CLASS_LOADERS_IGNORE},
97      * {@link #MULTIPLE_CLASS_LOADERS_RELOAD}, or
98      * {@link #MULTIPLE_CLASS_LOADERS_ERROR}
99      * @see RuntimeModel#findClassLoader
100      */

101     public static void setStrategy (String JavaDoc strategy)
102     {
103         _strategy = strategy;
104     }
105
106 }
107
Popular Tags