public void declareResource(String name, CogaenId groupId, ResourceHandle handle) {
		ResourceHandle old = this.resourceMap.put(name, handle);
		if (old != null) {
			this.resourceMap.put(name, old);
			throw new RuntimeException("ambiguous resource name " + name);
		}
		assert(!this.invResourceMap.containsKey(handle));
		this.invResourceMap.put(handle, name);
		
		List<ResourceHandle> group = this.groups.get(groupId);
		if (group == null) {
			this.resourceMap.remove(name);
			throw new RuntimeException("resource group does not exist " + groupId);
		}
		
		group.add(handle);
		this.logger.logDebug(LOGGING_SOURCE, "new resource defined " + name);
	}