package io.polestar.data.scriptRuntime;

import org.netkernel.layer0.nkf.INKFRequest;
import org.netkernel.layer0.nkf.INKFRequestContext;
import org.netkernel.mod.hds.HDSFactory;
import org.netkernel.mod.hds.IHDSDocument;
import org.netkernel.mod.hds.IHDSMutator;
import org.netkernel.mod.hds.IHDSReader;
import org.netkernel.module.standard.endpoint.StandardAccessorImpl;

public class RuntimeLookupAccessor extends StandardAccessorImpl {

	@Override
	public void onSource(INKFRequestContext aContext) throws Exception {
		INKFRequest req = aContext.createRequest("active:spaceAggregateHDS");
		req.setRepresentationClass(IHDSDocument.class);
		req.addArgument("uri", "res:/etc/system/PolestarScriptConfig.xml");
		IHDSDocument runtimeConfigs = (IHDSDocument)aContext.issueRequest(req);

		IHDSMutator resBuilder = HDSFactory.newDocument();

		resBuilder.pushNode("languages");
		for (IHDSReader spaceNode : runtimeConfigs.getReader().getNodes("/spaces/space[config]")) {
			String id = (String) spaceNode.getFirstValue("id");
			String version = (String) spaceNode.getFirstValue("version");
			String name = (String) spaceNode.getFirstValue("config/name");
			String endpoint = (String) spaceNode.getFirstValue("config/endpoint");

			resBuilder.pushNode("language");
			resBuilder.addNode("id", id);
			resBuilder.addNode("version", version);
			resBuilder.addNode("name", name);
			resBuilder.addNode("endpoint", endpoint);
			resBuilder.popNode();
		}

		aContext.createResponseFrom(resBuilder.toDocument(false));
	}
}

@@ -434,16 +434,84 @@
 Impl %7B%0A%0A
+%09public RuntimeLookupAccessor()%0A%09%7B%09this.declareThreadSafe();%0A%09%7D%0A%09%0A%09%0A
 %09@Overri

Fix for PS-6