use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.
the class VolumeCLI method setCurrentVolume.
private void setCurrentVolume() throws ParseException, SoapFaultException, IOException, ServiceException, NumberFormatException, HttpException {
if (id == null) {
throw new ParseException("id is missing");
}
auth(auth);
GetVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(new GetVolumeRequest(Short.valueOf(id)))));
VolumeInfo vol = resp.getVolume();
SetCurrentVolumeRequest req = new SetCurrentVolumeRequest(vol.getId(), vol.getType());
getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req));
System.out.println("Volume " + id + " is now the current " + toTypeName(vol.getType()) + " volume.");
}
use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.
the class VolumeCLI method getVolume.
private void getVolume() throws IOException, ServiceException, HttpException {
if (id == null) {
GetAllVolumesRequest req = new GetAllVolumesRequest();
auth(auth);
GetAllVolumesResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
for (VolumeInfo vol : resp.getVolumes()) {
print(vol);
}
} else {
GetVolumeRequest req = new GetVolumeRequest(Short.parseShort(id));
auth(auth);
GetVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
print(resp.getVolume());
}
}
use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.
the class Volume method toJAXB.
public VolumeInfo toJAXB() {
VolumeInfo jaxb = new VolumeInfo();
jaxb.setId(id);
jaxb.setType(type);
jaxb.setName(name);
jaxb.setRootPath(rootPath);
jaxb.setMgbits(mboxGroupBits);
jaxb.setMbits(mboxBits);
jaxb.setFgbits(fileGroupBits);
jaxb.setFbits(fileBits);
jaxb.setCompressBlobs(compressBlobs);
jaxb.setCompressionThreshold(compressionThreshold);
jaxb.setCurrent(VolumeManager.getInstance().isCurrent(this));
return jaxb;
}
use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.
the class VolumeCLI method editVolume.
private void editVolume() throws ParseException, SoapFaultException, IOException, ServiceException, HttpException {
if (Strings.isNullOrEmpty(id)) {
throw new ParseException("id is missing");
}
VolumeInfo vol = new VolumeInfo();
if (!Strings.isNullOrEmpty(type)) {
vol.setType(toType(type));
}
if (!Strings.isNullOrEmpty(name)) {
vol.setName(name);
}
if (!Strings.isNullOrEmpty(path)) {
vol.setRootPath(path);
}
if (!Strings.isNullOrEmpty(compress)) {
vol.setCompressBlobs(Boolean.parseBoolean(compress));
}
if (!Strings.isNullOrEmpty(compressThreshold)) {
vol.setCompressionThreshold(Long.parseLong(compressThreshold));
}
ModifyVolumeRequest req = new ModifyVolumeRequest(Short.parseShort(id), vol);
auth(auth);
getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req));
System.out.println("Edited volume " + id);
}
use of com.zimbra.soap.admin.type.VolumeInfo in project zm-mailbox by Zimbra.
the class VolumeCLI method addVolume.
private void addVolume() throws ParseException, SoapFaultException, IOException, ServiceException, HttpException {
if (id != null) {
throw new ParseException("id cannot be specified when adding a volume");
}
if (Strings.isNullOrEmpty(type)) {
throw new ParseException("type is missing");
}
if (Strings.isNullOrEmpty(name)) {
throw new ParseException("name is missing");
}
if (Strings.isNullOrEmpty(path)) {
throw new ParseException("path is missing");
}
VolumeInfo vol = new VolumeInfo();
vol.setType(toType(type));
vol.setName(name);
vol.setRootPath(path);
vol.setCompressBlobs(compress != null ? Boolean.parseBoolean(compress) : false);
vol.setCompressionThreshold(compressThreshold != null ? Long.parseLong(compressThreshold) : 4096L);
CreateVolumeRequest req = new CreateVolumeRequest(vol);
auth();
CreateVolumeResponse resp = JaxbUtil.elementToJaxb(getTransport().invokeWithoutSession(JaxbUtil.jaxbToElement(req)));
System.out.println("Volume " + resp.getVolume().getId() + " is created");
}
Aggregations