/** * Whether the URN should be processed by the same engine that * generates it. * * @return true if local */ public boolean isLocal() { return getNodeName().equals("local"); }
/** * Whether the URN can be processed by any node. * * @return true if universal. */ public boolean isUniversal() { return getNodeName().equals("klab"); }
/** * Return the URL on which we should call the {@link API#GET_RESOURCE} service to * retrieve the passed URN. * * @param urn * @return a valid URL string, or null. */ public static String getNodeURLForUrn(String urn) { KlabUrn kurn = new KlabUrn(urn); if (KLAB.ENGINE.getNetwork() instanceof INodeNetwork && kurn.getNodeName().equals(KLAB.ENGINE.getName())) { return ((INodeNetwork) KLAB.ENGINE.getNetwork()).getUrl(); } /* * The call goes to the node in the URN; we authenticate with the auth token of * the node this goes to if coming from a node, or the token of the primary engine * if it comes from an engine, which should have negotiated access with all nodes * at API.CONNECT. */ INode node = KLAB.ENGINE.getNetwork().getNode(kurn.getNodeName()); if (node == null) { return null; } return node.getUrl(); }
String layerId = (urn.getNodeName() + "." + urn.getOriginator() + "." + urn.getNamespace() + "." + urn.getResourceId()).replace(".", "_"); coverageId = namespace + ":" + layerId;
boolean isSelfReference = kurn.getNodeName().equals(KLAB.ENGINE.getName());
&& kurn.getNodeName().equals(KLAB.ENGINE.getName())) { return ((INodeNetwork) KLAB.ENGINE.getNetwork()).getKey(); INode node = KLAB.ENGINE.getNetwork().getNode(kurn.getNodeName()); if (node == null) { && kurn.getNodeName().equals(((IModelingEngine) KLAB.ENGINE).getUser().getUsername())) { return ((IModelingEngine) KLAB.ENGINE).getUser().getSecurityKey();
File nodeFile = new File(topDirectory + File.separator + ".node"); try { FileUtils.writeStringToFile(nodeFile, kurn.getNodeName()); } catch (IOException e) { throw new KlabRuntimeException(e);