Package org.platformlayer.client.cli.commands

Source Code of org.platformlayer.client.cli.commands.ListServices

package org.platformlayer.client.cli.commands;

import java.io.PrintWriter;

import org.platformlayer.PlatformLayerClient;
import org.platformlayer.PlatformLayerClientException;
import org.platformlayer.core.model.ServiceInfo;

public class ListServices extends PlatformLayerCommandRunnerBase {
  public ListServices() {
    super("list", "services");
  }

  @Override
  public Object runCommand() throws PlatformLayerClientException {
    PlatformLayerClient client = getPlatformLayerClient();

    return client.listServices(true);
  }

  @Override
  public void formatRaw(Object o, PrintWriter writer) {
    Iterable<ServiceInfo> services = (Iterable<ServiceInfo>) o;
    for (ServiceInfo service : services) {
      for (String publicType : service.itemTypes) {
        writer.println(publicType);
      }
    }
  }

}
TOP

Related Classes of org.platformlayer.client.cli.commands.ListServices

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.