use of org.platformlayer.common.UntypedItem in project platformlayer by platformlayer.
the class ListTags method runCommand.
@Override
public Object runCommand() throws PlatformLayerClientException {
PlatformLayerClient client = getPlatformLayerClient();
PlatformLayerKey key = path.resolve(getContext());
UntypedItem ret = client.getItemUntyped(key, getFormat());
return ret.getTags();
}
use of org.platformlayer.common.UntypedItem in project platformlayer by platformlayer.
the class PutItem method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
UntypedItem item = (UntypedItem) o;
writer.println(item.getKey());
}
use of org.platformlayer.common.UntypedItem in project platformlayer by platformlayer.
the class HttpPlatformLayerClient method getItemUntyped.
@Override
public UntypedItem getItemUntyped(PlatformLayerKey key, Format format) throws PlatformLayerClientException {
String relativePath = buildRelativePath(key);
String data = doRequest(HttpMethod.GET, relativePath, String.class, format, null, null);
UntypedItem item;
switch(format) {
case XML:
item = UntypedItemXml.build(data);
break;
case JSON:
item = UntypedItemJson.build(data);
break;
default:
throw new IllegalArgumentException("Format not supported");
}
return item;
}
use of org.platformlayer.common.UntypedItem in project platformlayer by platformlayer.
the class PlatformLayerClientBase method listChildrenTyped.
@Override
public List<ItemBase> listChildrenTyped(PlatformLayerKey parent, boolean includeDeleted) throws OpsException {
List<ItemBase> ret = Lists.newArrayList();
for (UntypedItem item : listChildren(parent, includeDeleted).getItems()) {
ItemBase typedItem = promoteToTyped(item);
ret.add(typedItem);
}
return ret;
}
use of org.platformlayer.common.UntypedItem in project platformlayer by platformlayer.
the class ListChildren method formatRaw.
@Override
public void formatRaw(Object o, PrintWriter writer) {
Ansi ansi = new Ansi(writer);
Iterable<UntypedItem> items = (Iterable<UntypedItem>) o;
for (UntypedItem item : items) {
UntypedItemFormatter.formatItem(item, ansi, true);
}
ansi.reset();
}
Aggregations