KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > protomatter > jdbc > pool > MessageConstants


1 package com.protomatter.jdbc.pool;
2
3 /**
4  * {{{ The Protomatter Software License, Version 1.0
5  * derived from The Apache Software License, Version 1.1
6  *
7  * Copyright (c) 1998-2002 Nate Sammons. All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  *
13  * 1. Redistributions of source code must retain the above copyright
14  * notice, this list of conditions and the following disclaimer.
15  *
16  * 2. Redistributions in binary form must reproduce the above copyright
17  * notice, this list of conditions and the following disclaimer in
18  * the documentation and/or other materials provided with the
19  * distribution.
20  *
21  * 3. The end-user documentation included with the redistribution,
22  * if any, must include the following acknowledgment:
23  * "This product includes software developed for the
24  * Protomatter Software Project
25  * (http://protomatter.sourceforge.net/)."
26  * Alternately, this acknowledgment may appear in the software itself,
27  * if and wherever such third-party acknowledgments normally appear.
28  *
29  * 4. The names "Protomatter" and "Protomatter Software Project" must
30  * not be used to endorse or promote products derived from this
31  * software without prior written permission. For written
32  * permission, please contact support@protomatter.com.
33  *
34  * 5. Products derived from this software may not be called "Protomatter",
35  * nor may "Protomatter" appear in their name, without prior written
36  * permission of the Protomatter Software Project
37  * (support@protomatter.com).
38  *
39  * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
40  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
41  * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
42  * DISCLAIMED. IN NO EVENT SHALL THE PROTOMATTER SOFTWARE PROJECT OR
43  * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
44  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
45  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
46  * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
47  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
48  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
49  * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
50  * SUCH DAMAGE. }}}
51  */

52
53 import java.util.*;
54 import java.lang.reflect.*;
55
56 /**
57  * Constants for messages loaded from resource bundles.
58  */

59 public class MessageConstants
60 {
61   public static final String JavaDoc CONNECTION_CHECKOUT_TRACE_MESSAGE = "ConnectionCheckoutTrace";
62
63   public static final String JavaDoc CONNECTION_IS_CLOSED = "ConnectionIsClosed";
64
65   public static final String JavaDoc GETTING_CONNECTION_MESSAGE = "GettingConnection";
66
67   public static final String JavaDoc REFRESHING_CONNECTION_MESSAGE = "RefreshingConnection";
68
69   public static final String JavaDoc CLOSING_CONNECTION_MESSAGE = "ClosingConnection";
70
71   public static final String JavaDoc STILL_NOT_OK_MESSAGE = "StillNotOK";
72
73   public static final String JavaDoc CONNECTION_INVALID = "ConnectionInvalid";
74
75   public static final String JavaDoc CONNECTION_INVALID_REFRESH = "ConnectionInvalidRefresh";
76
77   public static final String JavaDoc CONNECTION_OK = "ConnectionOK";
78
79   public static final String JavaDoc CANNOT_RESET_CONNECTION = "CannotResetPoolConnection";
80
81   public static final String JavaDoc CANNOT_ASK_AUTOCOMMIT_MESSAGE = "CannotAskAutoCommit";
82
83   public static final String JavaDoc CANNOT_ASK_ISOLATION_MESSAGE = "CannotAskIsolation";
84
85   public static final String JavaDoc CANNOT_ASK_READONLY_MESSAGE = "CannotAskReadOnly";
86
87   public static final String JavaDoc CANNOT_CHECKIN_CONNECTION_MESSAGE = "CannotCheckinConnection";
88
89   public static final String JavaDoc EXCEPTION_RECREATING_CONNECTION_MESSAGE = "ExceptionRecreatingConnection";
90
91   public static final String JavaDoc UNKNOWN_POOL_MESSAGE = "UnknownPool";
92
93   public static final String JavaDoc CANNOT_GET_CONNECTION_TIMEOUT_MESSAGE = "CannotGetConnectionTimeout";
94
95   public static final String JavaDoc CANNOT_CLOSE_OPEN_CONNECTION_MESSAGE = "CannotCloseOpenConnection";
96
97   public static final String JavaDoc CANNOT_CHECKOUT_MESSAGE = "CannotCheckout";
98
99   public static final String JavaDoc MUST_SPECIFY_PROP_MESSAGE = "MustSpecifyProperty";
100
101   public static final String JavaDoc MUST_SPECIFY_INT_PROP_MESSAGE = "MustSpecifyIntegerProperty";
102
103   public static final String JavaDoc MUST_SPECIFY_IF_PROP_MESSAGE = "MustSpecifyIfProperty";
104
105   public static final String JavaDoc MUST_SPECIFY_LESS_THAN_IF_PROP_MESSAGE = "MustSpecifyLessThanIfProperty";
106
107   public static final String JavaDoc LOOKING_FOR_IDLE_CONNECTIONS_MESSAGE = "LookingForIdleConnections";
108
109   public static final String JavaDoc CLOSING_IDLE_CONNECTION_MESSAGE = "ClosingIdleConnection";
110
111   public static final String JavaDoc CANNOT_LOAD_DRIVER_MESSAGE = "CannotLoadDriver";
112
113   public static final String JavaDoc CONNECTION_CHECKOUT_MESSAGE = "ConnectionCheckoutHere";
114
115   public static final String JavaDoc EXCEPTION_CLOSE_CONNECTION_MESSAGE = "ExceptionClosingConnection";
116
117   public static final String JavaDoc MAID_EXCEPTION_MESSAGE = "MaidException";
118
119   public static final String JavaDoc REFRESHING_CONNECTIONS_MESSAGE = "RefreshingConnectionsInPool";
120
121   public static final String JavaDoc CONNECTION_IS_INVALID_MESSAGE = "ConnectionIsInvalid";
122
123   public static final String JavaDoc SHUTDOWN_POOLS_MESSAGE = "ShutdownPools";
124
125   public static final String JavaDoc CREATING_POOL_MESSAGE = "CreatingPool";
126
127   public static final String JavaDoc CREATING_POOLS_FAILED_MESSAGE = "CreatingPoolsFailed";
128
129   public static final String JavaDoc CANNOT_CREATE_POOL_MESSAGE = "CannotCreateConnectionPool";
130
131   public static final String JavaDoc STARTUP_SUCCESS = "StartupSuccess";
132
133   private MessageConstants()
134   {
135     super();
136   }
137
138   /**
139    * Display values for known messages.
140    */

141   public static void main(String JavaDoc args[])
142   throws Exception JavaDoc
143   {
144     Class JavaDoc c = MessageConstants.class;
145     System.out.println("Constants class: " + c.getName());
146     System.out.println("Locale: " + Locale.getDefault());
147     System.out.println("");
148     Field fields[] = c.getDeclaredFields();
149     int count = 0;
150     for (int i=0; i<fields.length; i++)
151     {
152       if (fields[i].getType() == String JavaDoc.class)
153       {
154         String JavaDoc name = fields[i].getName();
155         String JavaDoc value = (String JavaDoc)fields[i].get(null);
156         String JavaDoc val = PoolResources.getResourceString(value);
157         System.out.println("Variable name: " + name);
158         System.out.println(" value: " + value);
159         System.out.println(" property: " + val);
160         System.out.println("");
161         count++;
162       }
163     }
164     System.out.println("Found " + count + " messages.");
165   }
166 }
167
Popular Tags