/** * 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; }
/** * 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 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); }
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 void addDependency(Node n) { if (n.isReachable(this)) throw new ApplicationRuntimeException( "A cycle has been detected from the initial object [" + _name + "]", HiveMind.getLocation(_object), null); _dependencies.add(n); }
private void processResource(Resource resource) { try { ModuleDescriptor md = _processor.processResource(resource); _moduleDescriptors.add(md); // After parsing a module, parse any additional modules identified // within the module (using the <sub-module> element) recursively. processSubModules(md); } catch (RuntimeException ex) { _errorHandler.error(LOG, ex.getMessage(), HiveMind.getLocation(ex), ex); } }
private void fireResetEvent() { try { _resetEventHub.fireResetEvent(); } catch (Exception ex) { _errorLog.error(ImplMessages.errorResetting(ex), HiveMind.getLocation(ex), ex); } }
private void fireResetEvent() { try { _resetEventHub.fireResetEvent(); } catch (Exception ex) { _errorLog.error(ImplMessages.errorResetting(ex), HiveMind.getLocation(ex), ex); } }
HiveMind.getLocation(object), null);
private void addNodes() { Iterator i = _orderingsList.iterator(); while (i.hasNext()) { ObjectOrdering o = (ObjectOrdering) i.next(); Node node = new Node(o.getObject(), o.getName()); _nodeMap.put(o, node); if ("*".equals(o.getPostreqs())) { if (_leader == null) _leader = node; else _errorLog.error(OrdererMessages.dupeLeader(_objectType, o, getOrderable(_leader .getName())), HiveMind.getLocation(o.getObject()), null); } if ("*".equals(o.getPrereqs())) { if (_trailer == null) _trailer = node; else _errorLog.error( OrdererMessages.dupeTrailer(_objectType, o, getOrderable(_trailer .getName())), HiveMind.getLocation(o.getObject()), null); } } }
HiveMind.getLocation(ordering.getObject()), null); continue; HiveMind.getLocation(ordering.getObject()), ex);
HiveMind.getLocation(ordering.getObject()), null); HiveMind.getLocation(ordering.getObject()), ex);
private void addDependencies(ObjectOrdering orderable, Node node) { addPreRequisites(orderable, node); addPostRequisites(orderable, node); try { if (node != _leader) node.addDependency(_leader); if (node != _trailer) _trailer.addDependency(node); } catch (ApplicationRuntimeException ex) { // This code is unreachable ... but nonetheless. String name = node.getName(); ObjectOrdering trigger = getOrderable(name); _errorLog.error(OrdererMessages.dependencyCycle(_objectType, orderable, ex), HiveMind .getLocation(trigger.getObject()), ex); } }