1 15 package org.apache.tapestry.services.impl; 16 17 import java.net.URL ; 18 import java.util.ArrayList ; 19 import java.util.Collection ; 20 import java.util.List ; 21 import java.util.Locale ; 22 23 import javax.servlet.http.HttpServlet ; 24 25 import org.apache.hivemind.HiveMind; 26 import org.apache.hivemind.Location; 27 import org.apache.hivemind.Resource; 28 import org.apache.hivemind.impl.MessageFormatter; 29 import org.apache.tapestry.IComponent; 30 import org.apache.tapestry.INamespace; 31 import org.apache.tapestry.engine.IEngineService; 32 import org.apache.tapestry.parse.OpenToken; 33 import org.apache.tapestry.services.Infrastructure; 34 import org.apache.tapestry.spec.IComponentSpecification; 35 import org.apache.tapestry.spec.IContainedComponent; 36 37 41 class ImplMessages 42 { 43 protected static MessageFormatter _formatter = new MessageFormatter(ImplMessages.class, 44 "ImplStrings"); 45 46 static String initializerContribution() 47 { 48 return _formatter.getMessage("initializer-contribution"); 49 } 50 51 static String noApplicationSpecification(HttpServlet servlet) 52 { 53 return _formatter.format("no-application-specification", servlet.getServletName()); 54 } 55 56 static String errorInstantiatingEngine(Class engineClass, Throwable cause) 57 { 58 return _formatter.format("error-instantiating-engine", engineClass.getName(), cause); 59 } 60 61 static String noTemplateForComponent(String componentId, Locale locale) 62 { 63 return _formatter.format("no-template-for-component", componentId, locale); 64 } 65 66 static String noTemplateForPage(String pageName, Locale locale) 67 { 68 return _formatter.format("no-template-for-page", pageName, locale); 69 } 70 71 static String unableToReadTemplate(Object template) 72 { 73 return _formatter.format("unable-to-read-template", template); 74 } 75 76 static String unableToParseTemplate(Resource resource) 77 { 78 return _formatter.format("unable-to-parse-template", resource); 79 } 80 81 static String unableToParseSpecification(Resource resource) 82 { 83 return _formatter.format("unable-to-parse-specification", resource); 84 } 85 86 static String unableToReadInfrastructureProperty(String propertyName, Infrastructure service, 87 Throwable cause) 88 { 89 return _formatter.format( 90 "unable-to-read-infrastructure-property", 91 propertyName, 92 service, 93 cause); 94 } 95 96 static String multipleComponentReferences(IComponent component, String id) 97 { 98 return _formatter.format("multiple-component-references", component.getExtendedId(), id); 99 } 100 101 static String dupeComponentId(String id, IContainedComponent containedComponent) 102 { 103 return _formatter.format("dupe-component-id", id, HiveMind 104 .getLocationString(containedComponent)); 105 } 106 107 static String unbalancedCloseTags() 108 { 109 return _formatter.getMessage("unbalanced-close-tags"); 110 } 111 112 static String templateBindingForInformalParameter(IComponent loadComponent, 113 String parameterName, IComponent component) 114 { 115 return _formatter.format("template-binding-for-informal-parameter", loadComponent 116 .getExtendedId(), parameterName, component.getExtendedId()); 117 } 118 119 static String templateBindingForReservedParameter(IComponent loadComponent, 120 String parameterName, IComponent component) 121 { 122 return _formatter.format("template-binding-for-reserved-parameter", loadComponent 123 .getExtendedId(), parameterName, component.getExtendedId()); 124 } 125 126 static String missingComponentSpec(IComponent component, Collection ids) 127 { 128 StringBuffer buffer = new StringBuffer (); 129 List idList = new ArrayList (ids); 130 int count = idList.size(); 131 132 for (int i = 0; i < count; i++) 133 { 134 if (i > 0) 135 buffer.append(", "); 136 137 buffer.append(idList.get(i)); 138 } 139 140 return _formatter.format("missing-component-spec", component.getExtendedId(), new Integer ( 141 count), buffer.toString()); 142 } 143 144 static String bodylessComponent() 145 { 146 return _formatter.getMessage("bodyless-component"); 147 } 148 149 static String dupeTemplateBinding(String name, IComponent component, IComponent loadComponent) 150 { 151 return _formatter.format( 152 "dupe-template-binding", 153 name, 154 component.getExtendedId(), 155 loadComponent.getExtendedId()); 156 } 157 158 static String unableToLoadProperties(URL url, Throwable cause) 159 { 160 return _formatter.format("unable-to-load-properties", url, cause); 161 } 162 163 static String noSuchService(String name) 164 { 165 return _formatter.format("no-such-service", name); 166 } 167 168 static String dupeService(String name, EngineServiceContribution existing) 169 { 170 return _formatter.format("dupe-service", name, HiveMind.getLocationString(existing)); 171 } 172 173 static String unableToParseExpression(String expression, Throwable cause) 174 { 175 return _formatter.format("unable-to-parse-expression", expression, cause); 176 } 177 178 static String parsedExpression() 179 { 180 return _formatter.getMessage("parsed-expression"); 181 } 182 183 static String unableToReadExpression(String expression, Object target, Throwable cause) 184 { 185 return _formatter.format("unable-to-read-expression", expression, target, cause); 186 } 187 188 static String unableToWriteExpression(String expression, Object target, Object value, 189 Throwable cause) 190 { 191 return _formatter.format("unable-to-write-expression", new Object [] 192 { expression, target, value, cause }); 193 } 194 195 static String isConstantExpressionError(String expression, Exception ex) 196 { 197 return _formatter.format("is-constant-expression-error", expression, ex); 198 } 199 200 static String templateParameterName(String name) 201 { 202 return _formatter.format("template-parameter-name", name); 203 } 204 205 static String componentPropertySourceDescription(IComponentSpecification spec) 206 { 207 return _formatter.format("component-property-source-description", spec 208 .getSpecificationLocation()); 209 } 210 211 static String namespacePropertySourceDescription(INamespace namespace) 212 { 213 return _formatter 214 .format("namespace-property-source-description", namespace.getExtendedId()); 215 } 216 217 static String invalidEncoding(String encoding, Throwable cause) 218 { 219 return _formatter.format("invalid-encoding", encoding, cause); 220 } 221 222 static String errorResetting(Throwable cause) 223 { 224 return _formatter.format("error-resetting", cause); 225 } 226 227 static String engineServiceInnerProxyToString(String serviceName) 228 { 229 return _formatter.format("engine-service-inner-proxy-to-string", serviceName); 230 } 231 232 static String engineServiceOuterProxyToString(String serviceName) 233 { 234 return _formatter.format("engine-service-outer-proxy-to-string", serviceName); 235 } 236 237 static String serviceNameMismatch(IEngineService service, String expectedName, String actualName) 238 { 239 return _formatter.format("service-name-mismatch", service, expectedName, actualName); 240 } 241 242 static String infrastructureAlreadyInitialized(String newMode, String initializedMode) 243 { 244 return _formatter.format("infrastructure-already-initialized", newMode, initializedMode); 245 } 246 247 static String duplicateInfrastructureContribution(InfrastructureContribution conflict, 248 Location existingLocation) 249 { 250 return _formatter.format( 251 "duplicate-infrastructure-contribution", 252 conflict.getProperty(), 253 conflict.getMode(), 254 existingLocation); 255 } 256 257 static String infrastructureNotInitialized() 258 { 259 return _formatter.getMessage("infrastructure-not-initialized"); 260 } 261 262 static String missingInfrastructureProperty(String propertyName) 263 { 264 return _formatter.format("missing-infrastructure-property", propertyName); 265 } 266 267 public static String usedTemplateParameterAlias(OpenToken token, String attributeName, 268 String parameterName) 269 { 270 return _formatter.format("used-template-parameter-alias", new Object [] 271 { HiveMind.getLocationString(token), token.getType(), attributeName, parameterName }); 272 } 273 } | Popular Tags |