@Test public void testIntegration() throws CryptoException, InternalSecurityException, AgentAlreadyRegisteredException, AgentException, AliasNotFoundException, AgentAccessDeniedException { LocalNode node = new LocalNodeManager().launchNode(); node.startService(ServiceNameVersion.fromString("i5.las2peer.api.TestService@1.0"), "asdf"); assertEquals("i5.las2peer.api.TestService", node.getServiceAliasManager().resolvePathToServiceName("test").getServiceName()); }
public AliasResolveResponse resolvePathToServiceName(String path) throws AliasNotFoundException { List<String> split = splitPath(path); int level = 0; String currentKey = null; while (level < split.size() && level < MAX_PATH_LEVEL) { if (currentKey == null) { currentKey = split.get(level); } else { currentKey += SEPERATOR + split.get(level); } String currentEntry = null; try { currentEntry = getEntry(currentKey); } catch (EnvelopeException | CryptoException | AgentAccessDeniedException | SerializationException e) { throw new AliasNotFoundException("Path does not exist.", e); } if (!currentEntry.equals(BLANK)) { return new AliasResolveResponse(currentEntry, level + 1); } level++; } if (level == MAX_PATH_LEVEL) { throw new AliasNotFoundException("Given path is too long."); } throw new AliasNotFoundException("Given path does not fit any alias."); }
ServiceAliasManager { public AliasResolveResponse resolvePathToServiceName(String path) throws AliasNotFoundException { List<String> split = splitPath(path); int level = 0; String currentKey = null; while (level < split.size() && level < MAX_PATH_LEVEL) { if (currentKey == null) { currentKey = split.get(level); } else { currentKey += SEPERATOR + split.get(level); } String currentEntry = null; try { currentEntry = getEntry(currentKey); } catch (EnvelopeException | CryptoException | AgentAccessDeniedException | SerializationException e) { throw new AliasNotFoundException("Path does not exist.", e); } if (!currentEntry.equals(BLANK)) { return new AliasResolveResponse(currentEntry, level + 1); } level++; } if (level == MAX_PATH_LEVEL) { throw new AliasNotFoundException("Given path is too long."); } throw new AliasNotFoundException("Given path does not fit any alias."); } }
ServiceAliasManager { public AliasResolveResponse resolvePathToServiceName(String path) throws AliasNotFoundException { List<String> split = splitPath(path); int level = 0; String currentKey = null; while (level < split.size() && level < MAX_PATH_LEVEL) { if (currentKey == null) { currentKey = split.get(level); } else { currentKey += SEPERATOR + split.get(level); } String currentEntry = null; try { currentEntry = getEntry(currentKey); } catch (EnvelopeException | CryptoException | AgentAccessDeniedException | SerializationException e) { throw new AliasNotFoundException("Path does not exist.", e); } if (!currentEntry.equals(BLANK)) { return new AliasResolveResponse(currentEntry, level + 1); } level++; } if (level == MAX_PATH_LEVEL) { throw new AliasNotFoundException("Given path is too long."); } throw new AliasNotFoundException("Given path does not fit any alias."); } ServiceAliasManager(Node node); }
ServiceAliasManager { public AliasResolveResponse resolvePathToServiceName(String path) throws AliasNotFoundException { List<String> split = splitPath(path); int level = 0; String currentKey = null; while (level < split.size() && level < MAX_PATH_LEVEL) { if (currentKey == null) { currentKey = split.get(level); } else { currentKey += SEPERATOR + split.get(level); } String currentEntry = null; try { currentEntry = getEntry(currentKey); } catch (EnvelopeException | CryptoException | AgentAccessDeniedException | SerializationException e) { throw new AliasNotFoundException("Path does not exist.", e); } if (!currentEntry.equals(BLANK)) { return new AliasResolveResponse(currentEntry, level + 1); } level++; } if (level == MAX_PATH_LEVEL) { throw new AliasNotFoundException("Given path is too long."); } throw new AliasNotFoundException("Given path does not fit any alias."); } ServiceAliasManager(Node node); void registerServiceAlias(ServiceAgentImpl agent, String alias); AliasResolveResponse resolvePathToServiceName(String path); }
ServiceAliasManager { public AliasResolveResponse resolvePathToServiceName(String path) throws AliasNotFoundException { List<String> split = splitPath(path); int level = 0; String currentKey = null; while (level < split.size() && level < MAX_PATH_LEVEL) { if (currentKey == null) { currentKey = split.get(level); } else { currentKey += SEPERATOR + split.get(level); } String currentEntry = null; try { currentEntry = getEntry(currentKey); } catch (EnvelopeException | CryptoException | AgentAccessDeniedException | SerializationException e) { throw new AliasNotFoundException("Path does not exist.", e); } if (!currentEntry.equals(BLANK)) { return new AliasResolveResponse(currentEntry, level + 1); } level++; } if (level == MAX_PATH_LEVEL) { throw new AliasNotFoundException("Given path is too long."); } throw new AliasNotFoundException("Given path does not fit any alias."); } ServiceAliasManager(Node node); void registerServiceAlias(ServiceAgentImpl agent, String alias); AliasResolveResponse resolvePathToServiceName(String path);  }