class RegistryConnection {

	public String getAddress(String name) {

		Location address = null;

		List<Location> locations = this.locationRegistry.getEntitiesWithTag(name);
		if (!locations.isEmpty()) {
			address = locations.get(0);
		} else {
			// Try to find by name or tag ignoring case
			for (Location location : this.locationRegistry.getAll()) {
				if (name.equalsIgnoreCase(location.getName()) || name.equalsIgnoreCase(location.getTag())) {
					address = location;
					break;
				}
			}
		}

		if (address == null) {
			return name;
		}

		return address.getAddressString();
	}

}