View Javadoc

1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one
3    * or more contributor license agreements.  See the NOTICE file
4    * distributed with this work for additional information
5    * regarding copyright ownership.  The ASF licenses this file
6    * to you under the Apache License, Version 2.0 (the
7    * "License"); you may not use this file except in compliance
8    * with the License.  You may obtain a copy of the License at
9    *
10   *   http://www.apache.org/licenses/LICENSE-2.0
11   *
12   * Unless required by applicable law or agreed to in writing,
13   * software distributed under the License is distributed on an
14   * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15   * KIND, either express or implied.  See the License for the
16   * specific language governing permissions and limitations
17   * under the License.
18   */
19  package org.apache.myfaces.shared_orchestra.util;
20  
21  import java.util.MissingResourceException;
22  import java.util.ResourceBundle;
23  
24  /**
25   *
26   * <p>This contains all of the non-public constants, including
27   * messsage strings read from the resource file.
28   * 
29   * This is a copy from commons-el PrimitiveObjects class
30   *
31   * @author Nathan Abramson - Art Technology Group
32   * @author Shawn Bayern
33   *
34   * @version $Change: 181177 $$DateTime: 2001/06/26 08:45:09 $$Author$
35   **/
36  
37  class _Constants
38  {
39    //-------------------------------------
40    // Resources
41  
42    static ResourceBundle sResources =
43    ResourceBundle.getBundle ("org.apache.commons.el.Resources");
44  
45    //-------------------------------------
46    // Messages from the resource bundle
47    //-------------------------------------
48  
49    public static final String EXCEPTION_GETTING_BEANINFO =
50      getStringResource ("EXCEPTION_GETTING_BEANINFO");
51  
52    public static final String NULL_EXPRESSION_STRING =
53      getStringResource ("NULL_EXPRESSION_STRING");
54  
55    public static final String PARSE_EXCEPTION =
56      getStringResource ("PARSE_EXCEPTION");
57  
58    public static final String CANT_GET_PROPERTY_OF_NULL =
59      getStringResource ("CANT_GET_PROPERTY_OF_NULL");
60  
61    public static final String NO_SUCH_PROPERTY =
62      getStringResource ("NO_SUCH_PROPERTY");
63  
64    public static final String NO_GETTER_METHOD =
65      getStringResource ("NO_GETTER_METHOD");
66  
67    public static final String ERROR_GETTING_PROPERTY =
68      getStringResource ("ERROR_GETTING_PROPERTY");
69  
70    public static final String CANT_GET_INDEXED_VALUE_OF_NULL =
71      getStringResource ("CANT_GET_INDEXED_VALUE_OF_NULL");
72  
73    public static final String CANT_GET_NULL_INDEX =
74      getStringResource ("CANT_GET_NULL_INDEX");
75  
76    public static final String NULL_INDEX =
77      getStringResource ("NULL_INDEX");
78  
79    public static final String BAD_INDEX_VALUE =
80      getStringResource ("BAD_INDEX_VALUE");
81  
82    public static final String EXCEPTION_ACCESSING_LIST =
83      getStringResource ("EXCEPTION_ACCESSING_LIST");
84  
85    public static final String EXCEPTION_ACCESSING_ARRAY =
86      getStringResource ("EXCEPTION_ACCESSING_ARRAY");
87  
88    public static final String CANT_FIND_INDEX =
89      getStringResource ("CANT_FIND_INDEX");
90  
91    public static final String TOSTRING_EXCEPTION =
92      getStringResource ("TOSTRING_EXCEPTION");
93  
94    public static final String BOOLEAN_TO_NUMBER =
95      getStringResource ("BOOLEAN_TO_NUMBER");
96  
97    public static final String STRING_TO_NUMBER_EXCEPTION =
98      getStringResource ("STRING_TO_NUMBER_EXCEPTION");
99  
100   public static final String COERCE_TO_NUMBER =
101     getStringResource ("COERCE_TO_NUMBER");
102 
103   public static final String BOOLEAN_TO_CHARACTER =
104     getStringResource ("BOOLEAN_TO_CHARACTER");
105 
106   public static final String EMPTY_STRING_TO_CHARACTER =
107     getStringResource ("EMPTY_STRING_TO_CHARACTER");
108 
109   public static final String COERCE_TO_CHARACTER =
110     getStringResource ("COERCE_TO_CHARACTER");
111 
112   public static final String NULL_TO_BOOLEAN =
113     getStringResource ("NULL_TO_BOOLEAN");
114 
115   public static final String STRING_TO_BOOLEAN =
116     getStringResource ("STRING_TO_BOOLEAN");
117 
118   public static final String COERCE_TO_BOOLEAN =
119     getStringResource ("COERCE_TO_BOOLEAN");
120 
121   public static final String COERCE_TO_OBJECT =
122     getStringResource ("COERCE_TO_OBJECT");
123 
124   public static final String NO_PROPERTY_EDITOR =
125     getStringResource ("NO_PROPERTY_EDITOR");
126 
127   public static final String PROPERTY_EDITOR_ERROR =
128     getStringResource ("PROPERTY_EDITOR_ERROR");
129 
130   public static final String ARITH_OP_NULL =
131     getStringResource ("ARITH_OP_NULL");
132 
133   public static final String ARITH_OP_BAD_TYPE =
134     getStringResource ("ARITH_OP_BAD_TYPE");
135 
136   public static final String ARITH_ERROR =
137     getStringResource ("ARITH_ERROR");
138 
139   public static final String ERROR_IN_EQUALS =
140     getStringResource ("ERROR_IN_EQUALS");
141 
142   public static final String UNARY_OP_BAD_TYPE =
143     getStringResource ("UNARY_OP_BAD_TYPE");
144 
145   public static final String NAMED_VALUE_NOT_FOUND =
146     getStringResource ("NAMED_VALUE_NOT_FOUND");
147 
148   public static final String CANT_GET_INDEXED_PROPERTY =
149     getStringResource ("CANT_GET_INDEXED_PROPERTY");
150 
151   public static final String COMPARABLE_ERROR =
152     getStringResource ("COMPARABLE_ERROR");
153 
154   public static final String BAD_IMPLICIT_OBJECT =
155     getStringResource ("BAD_IMPLICIT_OBJECT");
156 
157   public static final String ATTRIBUTE_EVALUATION_EXCEPTION =
158     getStringResource ("ATTRIBUTE_EVALUATION_EXCEPTION");
159 
160   public static final String ATTRIBUTE_PARSE_EXCEPTION =
161     getStringResource ("ATTRIBUTE_PARSE_EXCEPTION");
162 
163   public static final String UNKNOWN_FUNCTION =
164     getStringResource ("UNKNOWN_FUNCTION");
165 
166   public static final String INAPPROPRIATE_FUNCTION_ARG_COUNT =
167     getStringResource ("INAPPROPRIATE_FUNCTION_ARG_COUNT");
168 
169   public static final String FUNCTION_INVOCATION_ERROR =
170     getStringResource ("FUNCTION_INVOCATION_ERROR");
171 
172 
173   //-------------------------------------
174   // Getting resources
175   //-------------------------------------
176   /**
177    *
178    * 
179    **/
180   public static String getStringResource (String pResourceName)
181     throws MissingResourceException
182   {
183     try {
184       String ret = sResources.getString (pResourceName);
185       if (ret == null) {
186     String str = "ERROR: Unable to load resource " + pResourceName;
187     System.err.println (str);
188     throw new MissingResourceException 
189       (str, 
190        "org.apache.commons.el.Constants",
191        pResourceName);
192       }
193       else {
194     return ret;
195       }
196     }
197     catch (MissingResourceException exc) {
198       System.err.println ("ERROR: Unable to load resource " +
199               pResourceName +
200               ": " +
201               exc);
202       throw exc;
203     }
204   }
205 
206   //-------------------------------------
207 }