1 15 package org.apache.hivemind.service.impl; 16 17 import java.beans.EventSetDescriptor ; 18 19 import javassist.CtClass; 20 import javassist.CtMethod; 21 22 import org.apache.hivemind.InterceptorStack; 23 import org.apache.hivemind.Location; 24 import org.apache.hivemind.impl.MessageFormatter; 25 import org.apache.hivemind.service.MethodSignature; 26 27 32 class ServiceMessages 33 { 34 protected static MessageFormatter _formatter = new MessageFormatter(ServiceMessages.class); 35 36 static String unableToInitializeService(String serviceId, String methodName, 37 Class serviceClass, Throwable ex) 38 { 39 return _formatter.format("unable-to-initialize-service", new Object [] 40 { serviceId, methodName, serviceClass.getName(), ex }); 41 } 42 43 static String errorInstantiatingInterceptor(String serviceId, InterceptorStack stack, 44 Class interceptorClass, Throwable cause) 45 { 46 return _formatter.format("error-instantiating-interceptor", new Object [] 47 { serviceId, stack.getServiceInterface().getName(), stack.getServiceExtensionPointId(), 48 interceptorClass.getName(), cause }); 49 } 50 51 static String unableToAddField(String fieldName, CtClass ctClass, Throwable cause) 52 { 53 return _formatter.format("unable-to-add-field", fieldName, ctClass.getName(), cause); 54 } 55 56 static String unableToAddMethod(MethodSignature methodSignature, CtClass ctClass, 57 Throwable cause) 58 { 59 return _formatter.format("unable-to-add-method", methodSignature, ctClass.getName(), cause); 60 } 61 62 static String unableToAddConstructor(CtClass ctClass, Throwable cause) 63 { 64 return _formatter.format("unable-to-add-constructor", ctClass.getName(), cause); 65 } 66 67 static String unableToWriteClass(CtClass ctClass, Throwable cause) 68 { 69 return _formatter.format("unable-to-write-class", ctClass.getName(), cause); 70 } 71 72 static String unableToCreateClass(String name, Class superClass, Throwable cause) 73 { 74 return _formatter.format("unable-to-create-class", name, superClass.getName(), cause); 75 } 76 77 static String unableToLookupClass(String name, Throwable cause) 78 { 79 return _formatter.format("unable-to-lookup", name, cause); 80 } 81 82 static String notCompatibleWithEvent(Object consumer, EventSetDescriptor set, Object producer) 83 { 84 return _formatter.format("not-compatible-with-event", new Object [] 85 { consumer, set.getListenerType().getName(), set.getName(), producer }); 86 } 87 88 static String noSuchEventSet(Object producer, String name) 89 { 90 return _formatter.format("no-such-event-set", producer, name); 91 } 92 93 static String noEventMatches(Object consumer, Object producer) 94 { 95 return _formatter.format("no-event-matches", consumer, producer); 96 } 97 98 static String unableToAddListener(Object producer, EventSetDescriptor set, Object consumer, 99 Location location, Throwable cause) 100 { 101 return _formatter.format("unable-to-add-listener", new Object [] 102 { consumer, producer, set.getName(), location, cause }); 103 } 104 105 static String unableToIntrospectClass(Class targetClass, Throwable cause) 106 { 107 return _formatter.format("unable-to-introspect-class", targetClass.getName(), cause); 108 } 109 110 static String unableToAddCatch(Class exceptionClass, CtMethod method, Throwable cause) 111 { 112 return _formatter.format("unable-to-add-catch", exceptionClass.getName(), method 113 .getDeclaringClass().getName(), cause); 114 } 115 116 static String duplicateMethodInClass(MethodSignature ms, ClassFabImpl cf) 117 { 118 return _formatter.format("duplicate-method-in-class", ms, cf.getName()); 119 } 120 121 static String unableToExtendMethod(MethodSignature ms, String className, Throwable cause) 122 { 123 return _formatter.format("unable-to-extend-method", ms, className, cause); 124 } 125 126 static String invalidProviderSelector(String selector) 127 { 128 return _formatter.format("invalid-provider-selector", selector); 129 } 130 131 static String unknownProviderPrefix(String prefix) 132 { 133 return _formatter.format("unknown-provider-prefix", prefix); 134 } 135 136 static String duplicateProviderPrefix(String prefix, Location priorLocation) 137 { 138 return _formatter.format("duplicate-provider-prefix", prefix, priorLocation); 139 } 140 141 static String invalidServicePropertyLocator(String locator) 142 { 143 return _formatter.format("invalid-service-property-locator", locator); 144 } 145 146 static String failureBuildingService(String serviceId, Throwable cause) 147 { 148 return _formatter.format("failure-building-service", serviceId, cause); 149 } 150 151 static String autowirePropertyFailure(String propertyName, Class targetClass, Throwable cause) 152 { 153 return _formatter.format("autowire-property-failure", propertyName, targetClass.getName(), cause); 154 } 155 156 static String unableToFindAutowireConstructor() 157 { 158 return _formatter.getMessage("unable-to-find-autowire-constructor"); 159 } 160 161 static String unableToFindExplicitConstructor() 162 { 163 return _formatter.getMessage("unable-to-find-explicit-constructor"); 164 } 165 166 167 static String unableToCreateInterface(String name, Exception cause) 168 { 169 return _formatter.format("unable-to-create-interface", name, cause); 170 } 171 172 173 174 static String threadCleanupException(Throwable cause) 175 { 176 return _formatter.format("thread-cleanup-exception", cause); 177 } 178 179 static String unknownStrategy(String strategyName) 180 { 181 return _formatter.format("unknown-strategy", strategyName); 182 } 183 } | Popular Tags |