@Override
  public Map<String, DeploymentGroup> getDeploymentGroups() {
    log.debug("getting deployment groups");
    final String folder = Paths.configDeploymentGroups();
    final ZooKeeperClient client = provider.get("getDeploymentGroups");
    try {
      final List<String> names;
      try {
        names = client.getChildren(folder);
      } catch (NoNodeException e) {
        return Maps.newHashMap();
      }
      final Map<String, DeploymentGroup> descriptors = Maps.newHashMap();
      for (final String name : names) {
        final String path = Paths.configDeploymentGroup(name);
        try {
          final byte[] data = client.getData(path);
          final DeploymentGroup descriptor = parse(data, DeploymentGroup.class);
          descriptors.put(descriptor.getName(), descriptor);
        } catch (NoNodeException e) {
          // Ignore, the deployment group was deleted before we had a chance to read it.
          log.debug("Ignoring deleted deployment group {}", name);
        }
      }
      return descriptors;
    } catch (KeeperException | IOException e) {
      throw new HeliosRuntimeException("getting deployment groups failed", e);
    }
  }
@ Override public Map < String , DeploymentGroup > getDeploymentGroups ( ) { log . debug ( "getting deployment groups" ) ; final String folder = Paths . configDeploymentGroups ( ) ; final ZooKeeperClient client = provider . get ( "getDeploymentGroups" ) ; try { final List < String > names ; try { names = client . getChildren ( folder ) ; } catch ( NoNodeException e ) { return Maps . newHashMap ( ) ; } final Map < String , DeploymentGroup > descriptors = Maps . newHashMap ( ) ; for ( final String name : names ) { final String path = Paths . configDeploymentGroup ( name ) ; try { final byte [ ] data = client . getData ( path ) ; final DeploymentGroup descriptor = parse ( data , DeploymentGroup . class ) ; descriptors . put ( descriptor . getName ( ) , descriptor ) ; } catch ( NoNodeException e ) { log . debug ( "Ignoring deleted deployment group {}" , name ) ; } } return descriptors ; } catch ( KeeperException | IOException e ) { throw new HeliosRuntimeException ( "getting deployment groups failed" , e ) ; } }
Returns a {@link Map} of deployment group name to {@link DeploymentGroup} objects for all of
the deployment groups known.