001: /*
002: *
003: *
004: * Copyright 1990-2007 Sun Microsystems, Inc. All Rights Reserved.
005: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER
006: *
007: * This program is free software; you can redistribute it and/or
008: * modify it under the terms of the GNU General Public License version
009: * 2 only, as published by the Free Software Foundation.
010: *
011: * This program is distributed in the hope that it will be useful, but
012: * WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * General Public License version 2 for more details (a copy is
015: * included at /legal/license.txt).
016: *
017: * You should have received a copy of the GNU General Public License
018: * version 2 along with this work; if not, write to the Free Software
019: * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
020: * 02110-1301 USA
021: *
022: * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa
023: * Clara, CA 95054 or visit www.sun.com if you need additional
024: * information or have any questions.
025: */
026:
027: package com.sun.perseus.model;
028:
029: import com.sun.perseus.platform.MessagesSupport;
030:
031: /**
032: *
033: * @version $Id: Messages.java,v 1.5 2006/06/29 10:47:32 ln156897 Exp $
034: */
035: final class Messages {
036: /*
037: * Error message codes.
038: *
039: */
040:
041: /**
042: * Used when trying to load a file which is not an SVG resource.
043: *
044: * {0} : the invalid SVG file URI.
045: */
046: public static String ERROR_NON_SVG_RESOURCE = "error.non.svg.resource";
047:
048: /**
049: * Used when the xlink:href attribute is missing on an mpath
050: * element.
051: *
052: */
053: public static String ERROR_MISSING_MPATH_HREF = "error.missing.mpath.href";
054:
055: /**
056: * Used when the xlink:href attribute on an mpath element is
057: * invalid (i.e., when there is no element with that id or the
058: * value is not a local reference.
059: *
060: * {0} : the invalid href value.
061: */
062: public static String ERROR_INVALID_MPATH_HREF = "error.invalid.mpath.href";
063:
064: /**
065: * Used when trying to set an id on an element which already has an id.
066: *
067: * {0} : the current id on the element.
068: * {1} : the new id that cannot be set.
069: * {2} : the element's local name.
070: * {3} : the element's namespace.
071: */
072: public static String ERROR_CANNOT_MODIFY_ID = "error.cannot.modify.id";
073:
074: /**
075: * Used when trying to set an id to a value already taken by another
076: * element.
077: *
078: * {0} : the duplicate id.
079: * {1} : the element's local name.
080: * {2} : the element's namespace uri.
081: * {3} : the existing element's local name (i.e., the element which has the
082: * id already).
083: * {4} : the existing element's namespace.
084: */
085: public static String ERROR_DUPLICATE_ID_VALUE = "error.duplicate.id.value";
086:
087: /**
088: * Used when trying to create an animation for a trait that is not
089: * animatable.
090: *
091: * {0} : the trait namespace URI
092: * {1} : the trait name
093: * {2} : the element's namespace URI
094: * {3} : the element's local name.
095: */
096: public static String ERROR_TRAIT_NOT_ANIMATABLE = "error.trait.not.animatable";
097:
098: /**
099: * Used when a reference to a paint server does not point
100: * to a paint server element.
101: *
102: * {0} : the invalid reference value
103: * {1} : the invalid reference namespace URI.
104: * {2} : the invalide reference local name
105: */
106: public static final String ERROR_INVALID_PAINT_SERVER_REFERENCE = "error.invalid.paint.server.reference";
107:
108: /**
109: * Used when a trait is not supported.
110: *
111: * {0} : trait name.
112: * {1} : trait namespace.
113: * {2} : localName.
114: * {3} : namespaceURI.
115: */
116: public static final String ERROR_UNSUPPORTED_TRAIT = "error.unsupported.trait";
117:
118: /**
119: * Used when trying to get a trait with the wrong type.
120: * {0} : trait name.
121: * {1} : trait namespace.
122: * {2} : invalid type.
123: * {3} : localName
124: * {4} : namespaceURI.
125: */
126: public static final String ERROR_TRAIT_TYPE_NS_MISMATCH = "error.trait.type.ns.mismatch";
127:
128: /**
129: * Used when trying to get a trait with the wrong type.
130: * {0} : trait name.
131: * {1} : invalid type.
132: * {2} : localName
133: * {3} : namespaceURI.
134: */
135: public static final String ERROR_TRAIT_TYPE_MISMATCH = "error.trait.type.mismatch";
136:
137: /**
138: * Used when trying to set a trait to an illegal value.
139: *
140: * {0} : trait name
141: * {1} : invalid value
142: * {2} : localName
143: * {3} : namespaceURI
144: */
145: public static final String ERROR_INVALID_TRAIT_VALUE = "error.invalid.trait.value";
146:
147: /**
148: * Used when an animation has an invalid configuration, for example,
149: * if there is no to, from, by or values attribute defined.
150: *
151: * {0} : target element id (may be null)
152: * {1} : trait namespace
153: * {2} : trait name
154: * {3} : target element namespace
155: * {4} : target element local name
156: * {5} : animation id
157: * {6} : animation namespace
158: * {7} : animation local name
159: * {8} : error description
160: */
161: public static final String ERROR_INVALID_ANIMATION_CONFIGURATION = "error.invalid.animation.configuration";
162:
163: /**
164: * Used to create the error description when a from animation does not
165: * specify a to or a by attribyte.
166: */
167: public static final String ERROR_INVALID_ANIMATION_FROM_ANIM = "error.invalid.animation.from.anim";
168:
169: /**
170: * Used to create the error description when an animation does not specify
171: * any of the to, from, by or values attribute.
172: *
173: */
174: public static final String ERROR_INVALID_ANIMATION_NO_VALUES = "error.invalid.animation.no.values";
175:
176: /**
177: * Used to create an error description when an animations' keyTimes
178: * attribute is incompatible with the number of values it defines.
179: *
180: * {0} : the keyTimes attribute value
181: */
182: public static final String ERROR_INVALID_ANIMATION_KEY_TIMES = "error.invalid.animation.key.times";
183:
184: /**
185: * Used to create an error description when an animations' keySplines
186: * attribute is incompatible with animation keyTimes
187: *
188: * {0} : the keySplines attribute value
189: * {1} : the keyTimes attribute value
190: */
191: public static final String ERROR_INVALID_ANIMATION_KEY_SPLINES = "error.invalid.animation.key.splines";
192:
193: /**
194: * Used when trying to set a read-only trait.
195: *
196: * {0} : trait name
197: * {1} : localName
198: * {2} : namespaceURI
199: */
200: public static final String ERROR_READ_ONLY_TRAIT = "error.read.only.trait";
201:
202: /**
203: * Used when trying to remove a child which is not a child of
204: * the target node.
205: */
206: public static final String ERROR_NOT_A_CHILD = "error.not.a.child";
207:
208: /**
209: * Used when trying to remove a child on a node which does not
210: * support child removal (like the Document node).
211: *
212: * {0} : localName
213: * {1} : namespaceURI
214: */
215: public static final String ERROR_REMOVE_CHILD_NOT_SUPPORTED = "error.remove.child.not.supported";
216:
217: /**
218: * Used when trying to remove a node which has an id or which
219: * has descendants with ids.
220: *
221: */
222: public static final String ERROR_CANNOT_REMOVE_NODE_WITH_ID = "error.cannot.remove.node.with.id";
223:
224: /**
225: * Used when trying to insert the Document node under another
226: * node.
227: */
228: public static final String ERROR_CANNOT_INSERT_DOCUMENT_NODE = "error.cannot.insert.document.node";
229:
230: /**
231: * Used when trying to insert a node which comes from another
232: * Document.
233: */
234: public static final String ERROR_CANNOT_INSERT_FROM_OTHER_DOCUMENT = "error.cannot.insert.from.other.document";
235:
236: /**
237: * Used when trying to insert a node of an incompatible type.
238: *
239: * {0} : localName for the inserted node
240: * {1} : namespaceURI for the inserted node
241: * {2} : localName fot the target parent node
242: * {3} : namespaceURI for the target parent node.
243: */
244: public static final String ERROR_CHILD_NOT_ALLOWED = "error.child.not.allowed";
245:
246: /**
247: * Used when trying to insert an node's ancestor under the node.
248: */
249: public static final String ERROR_INSERTING_ANCESTOR = "error.inserting.ancestor";
250:
251: /**
252: * Used when trying to insert a node under the Document node.
253: */
254: public static final String ERROR_INSERTING_UNDER_DOCUMENT = "error.inserting.under.document";
255:
256: /**
257: * Used in Node.insertBefore when the refChild is not a child of
258: * the target node.
259: */
260: public static final String ERROR_REF_NODE_NOT_A_CHILD = "error.ref.node.not.a.child";
261:
262: /**
263: * Used when trying to insert the document element under another
264: * node.
265: */
266: public static final String ERROR_INSERTING_DOCUMENT_ELEMENT = "error.inserting.document.element";
267:
268: /**
269: * Used when invoking the given method on the given interface with
270: * an invalid parameter value.
271: *
272: * {0} : interface name.
273: * {1} : method name.
274: * {2} : parameter name.
275: * {3} : value.
276: */
277: public static final String ERROR_INVALID_PARAMETER_VALUE = "error.invalid.parameter.value";
278:
279: /**
280: * Used when invoking the given method on the given interface with
281: * an out of bound parameter value.
282: *
283: * {0} : interface name.
284: * {1} : method name.
285: * {2} : parameter name.
286: * {3} : value.
287: */
288: public static final String ERROR_OUT_OF_BOUND_PARAMETER_VALUE = "error.out.of.bound.parameter.value";
289:
290: /**
291: * The error code used when there are unresolved
292: * href references in the content.
293: * {0} = the list of unresolved hrefs
294: */
295: static String ERROR_UNRESOLVED_REFERENCES = "error.unresolved.href";
296:
297: /**
298: * The error code used when the xlink:href attribute is
299: * unspecified on an element which requires it.
300: *
301: * {0} = the element's namespace URI
302: * {1} = the element's local name.
303: * {2} = the element's id
304: */
305: static String ERROR_MISSING_REFERENCE = "error.missing.href";
306:
307: /**
308: * Used when the attributeName attribute is not specified on an animation
309: * element.
310: *
311: * {0} : the animation element's id
312: * {1} : the animation element's local name.
313: * {2} : the animation element's namespace URI.
314: */
315: static String ERROR_UNSPECIFIED_ATTRIBUTE_NAME = "error.unspecified.attribute.name";
316:
317: /**
318: * Used when/if trying to define from-by animation on a trait that
319: * does not have an additive type.
320: *
321: * {0} : the traitName
322: * {1} : the traitNamespace
323: * {2} : the animation localName
324: * {3} : the animation namespace URI.
325: */
326: static String ERROR_ATTRIBUTE_NOT_ADDITIVE_FROM_BY = "error.attribute.not.additive.from.by";
327:
328: /**
329: * Used when/if trying to define by animation on a trait that
330: * does not have an additive type.
331: *
332: * {0} : the traitName
333: * {1} : the traitNamespace
334: * {2} : the animation localName
335: * {3} : the animation namespace URI.
336: */
337: static String ERROR_ATTRIBUTE_NOT_ADDITIVE_BY = "error.attribute.not.additive.by";
338:
339: /**
340: * Used when/if trying to define a from-by animation with incompatible
341: * from and by values.
342: *
343: * {0} : the traitName
344: * {1} : the traitNamespace
345: * {2} : the animation localName
346: * {3} : the animation namespace URI.
347: * {4} : the from value
348: * {5} : the to value.
349: */
350: static String ERROR_INCOMPATIBLE_FROM_BY = "error.incompatible.from.by";
351:
352: /**
353: * Error when a method is called while the target object is in the
354: * wrong state.
355: *
356: * {0} : the target object class name.
357: * {1} : the target object's current state.
358: * {2} : the method name
359: * {3} : the valid state(s) for the method.
360: */
361: static String ERROR_INVALID_STATE = "error.invalid.state";
362:
363: /**
364: * This class does not need to be instantiated.
365: */
366: private Messages() {
367: }
368:
369: /**
370: * The error messages bundle class name.
371: */
372: protected static final String RESOURCES = "com.sun.perseus.model.resources.Messages";
373:
374: /**
375: * The localizable support for the error messages.
376: */
377: protected static MessagesSupport messagesSupport = new MessagesSupport(
378: RESOURCES);
379:
380: /**
381: * Formats the message identified by <tt>key</tt> with the input
382: * arguments.
383: *
384: * @param key the message's key
385: * @param args the arguments used to format the message
386: * @return the formatted message
387: */
388: public static String formatMessage(final String key,
389: final Object[] args) {
390: return messagesSupport.formatMessage(key, args);
391: }
392: }
|