001: // Copyright 2004, 2005 The Apache Software Foundation
002: //
003: // Licensed under the Apache License, Version 2.0 (the "License");
004: // you may not use this file except in compliance with the License.
005: // You may obtain a copy of the License at
006: //
007: // http://www.apache.org/licenses/LICENSE-2.0
008: //
009: // Unless required by applicable law or agreed to in writing, software
010: // distributed under the License is distributed on an "AS IS" BASIS,
011: // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
012: // See the License for the specific language governing permissions and
013: // limitations under the License.
014:
015: package org.apache.hivemind.parse;
016:
017: import java.util.Collection;
018:
019: import org.apache.hivemind.Location;
020: import org.apache.hivemind.Resource;
021: import org.apache.hivemind.impl.MessageFormatter;
022: import org.apache.hivemind.schema.ElementModel;
023: import org.apache.hivemind.schema.Schema;
024:
025: /**
026: * Messages for the parse package.
027: *
028: * @author Howard Lewis Ship
029: */
030: class ParseMessages {
031: protected static MessageFormatter _formatter = new MessageFormatter(
032: ParseMessages.class);
033:
034: static String dupeAttributeMapping(
035: AttributeMappingDescriptor newDescriptor,
036: AttributeMappingDescriptor existingDescriptor) {
037: return _formatter.format("dupe-attribute-mapping",
038: newDescriptor.getAttributeName(), existingDescriptor
039: .getLocation());
040: }
041:
042: static String extraMappings(Collection extraNames,
043: ElementModel model) {
044: return _formatter.format("extra-mappings", extraNames, model
045: .getElementName());
046: }
047:
048: static String multipleContributionsSchemas(String configurationId,
049: Location location) {
050: return _formatter.format("multiple-contributions-schemas",
051: configurationId, location);
052: }
053:
054: static String multipleParametersSchemas(String serviceId,
055: Location location) {
056: return _formatter.format("multiple-parameters-schemas",
057: serviceId, location);
058: }
059:
060: static String notModule(String elementName, Location location) {
061: return _formatter.format("not-module", elementName, location);
062: }
063:
064: static String requiredAttribute(String name, String path,
065: Location location) {
066: return _formatter.format("required-attribute", name, path,
067: location);
068: }
069:
070: static String unknownAttribute(String name, String path) {
071: return _formatter.format("unknown-attribute", name, path);
072: }
073:
074: static String booleanAttribute(String value, String name,
075: String path) {
076: return _formatter.format("boolean-attribute", new Object[] {
077: value, name, path });
078: }
079:
080: static String invalidAttributeValue(String value, String name,
081: String path) {
082: return _formatter.format("invalid-attribute-value",
083: new Object[] { value, name, path });
084:
085: }
086:
087: static String invalidNumericValue(String value, String name,
088: String path) {
089: return _formatter.format("invalid-numeric-value", new Object[] {
090: value, name, path });
091: }
092:
093: static String unableToInitialize(Throwable cause) {
094: return _formatter.format("unable-to-initialize", cause);
095: }
096:
097: static String badRuleClass(String className, Location location,
098: Throwable cause) {
099: return _formatter.format("bad-rule-class", className, location,
100: cause);
101: }
102:
103: static String errorReadingDescriptor(Resource resource,
104: Throwable cause) {
105: return _formatter.format("error-reading-descriptor", resource,
106: cause);
107: }
108:
109: static String missingResource(Resource resource) {
110: return _formatter.format("missing-resource", resource);
111: }
112:
113: static String unexpectedElement(String elementName,
114: String elementPath) {
115: return _formatter.format("unexpected-element", elementName,
116: elementPath);
117: }
118:
119: static String invalidAttributeFormat(String attributeName,
120: String value, String elementPath, String formatKey) {
121: String inputValueFormat = _formatter.getMessage(formatKey);
122:
123: return _formatter.format("invalid-attribute-format",
124: new Object[] { attributeName, value, elementPath,
125: inputValueFormat });
126: }
127:
128: static String duplicateSchema(String schemaId, Schema existingSchema) {
129: return _formatter.format("duplicate-schema", schemaId,
130: existingSchema.getLocation());
131: }
132:
133: static String invalidElementKeyAttribute(String schemaId,
134: Throwable cause) {
135: return _formatter.format("invalid-element-key-attribute",
136: schemaId, cause);
137: }
138: }
|