/** * As with {@link #isBlank(String)}, but inverts the response. */ public static boolean isNonBlank(String string) { return !isBlank(string); }
public Object convertValue(Object value) { String s = (String) value; boolean b = HiveMind.isNonBlank(s) && !s.equals("false"); // JDK 1.4 has a Boolean.valueOf(), but we're trying for 1.3 compatibility return b ? Boolean.TRUE : Boolean.FALSE; }
public ApplicationRuntimeException(String message, Object component, Location location, Throwable rootCause) { super(message); _rootCause = rootCause; _component = component; _location = HiveMind.findLocation(new Object[] { location, rootCause, component }); }
static String dupeComponentId(String id, IContainedComponent containedComponent) { return _formatter.format("dupe-component-id", id, HiveMind .getLocationString(containedComponent)); }
/** * Selects the first {@link Location} in an array of objects. Skips over nulls. The objects may * be instances of Location or {@link Locatable}. May return null if no Location can be found. */ public static Location findLocation(Object[] locations) { for (int i = 0; i < locations.length; i++) { Object location = locations[i]; Location result = getLocation(location); if (result != null) return result; } return null; }
private void checkShutdown() { if (_shutdown) throw HiveMind.createRegistryShutdownException(); }
private List orderInterceptors() { if (HiveMind.isEmpty(_interceptorContributions)) return null; // Any error logging should go to the extension point // we're constructing. Log log = LogFactory.getLog(getExtensionPointId()); Orderer orderer = new Orderer(log, getModule().getErrorHandler(), ImplMessages .interceptorContribution()); Iterator i = _interceptorContributions.iterator(); while (i.hasNext()) { ServiceInterceptorContribution sic = (ServiceInterceptorContribution) i.next(); // Sort them into runtime excecution order. When we build // the interceptor stack we'll apply them in reverse order, // building outward from the core service implementation. orderer.add(sic, sic.getName(), sic.getPrecedingInterceptorIds(), sic .getFollowingInterceptorIds()); } return orderer.getOrderedObjects(); }
static String duplicateTranslatorName(String name, Location oldLocation) { return _formatter.format("duplicate-translator-name", name, HiveMind .getLocationString(oldLocation)); }
/** * Invokes {@link #getLocation(Object)}, then translate the result to a string value, or * "unknown location" if null. */ public static String getLocationString(Object object) { Location l = getLocation(object); if (l != null) return l.toString(); return HiveMindMessages.unknownLocation(); }
private void checkShutdown() { if (_shutdown) throw HiveMind.createRegistryShutdownException(); }
public Object convertValue(Object value) { String s = (String) value; boolean b = HiveMind.isNonBlank(s) && !s.equals("false"); // JDK 1.4 has a Boolean.valueOf(), but we're trying for 1.3 compatibility return b ? Boolean.TRUE : Boolean.FALSE; }
private String extractName(String uri, String localName, String qName) { return HiveMind.isBlank(localName) ? qName : localName; }
static String claimedProperty(String propertyName, Object existing) { return _formatter.format("claimed-property", propertyName, HiveMind .getLocationString(existing)); }
private void claimProperty(String propertyName, Object subSpecification) { if (propertyName == null) return; if (_claimedProperties == null) _claimedProperties = new HashMap(); Object existing = _claimedProperties.get(propertyName); if (existing != null) throw new ApplicationRuntimeException(SpecMessages.claimedProperty( propertyName, existing), HiveMind.getLocation(subSpecification), null); _claimedProperties.put(propertyName, subSpecification); }
public BindingException( String message, Object component, Location location, IBinding binding, Throwable rootCause) { super( message, component, HiveMind.findLocation(new Object[] { location, binding, component }), rootCause); _binding = binding; }
private String extractMessage(Throwable t) { String message = t.getMessage(); return HiveMind.isNonBlank(message) ? message : t.getClass().getName(); }
private String extractName(String uri, String localName, String qName) { return HiveMind.isBlank(localName) ? qName : localName; }
public static Object listenerBindingUnsupported(Location location) { return _formatter.format("listener-binding-unsupported", HiveMind .getLocationString(location)); } }
private void claimProperty(String propertyName, Object subSpecification) { if (propertyName == null) return; if (_claimedProperties == null) _claimedProperties = new HashMap(); Object existing = _claimedProperties.get(propertyName); if (existing != null) throw new ApplicationRuntimeException(SpecMessages.claimedProperty( propertyName, existing), HiveMind.getLocation(subSpecification), null); _claimedProperties.put(propertyName, subSpecification); }
public BindingException( String message, Object component, Location location, IBinding binding, Throwable rootCause) { super( message, component, HiveMind.findLocation(new Object[] { location, binding, component }), rootCause); _binding = binding; }