Search in sources :

Example 6 with VolumeManager

use of com.zimbra.cs.volume.VolumeManager in project zm-mailbox by Zimbra.

the class DeleteVolume method redo.

@Override
public void redo() throws Exception {
    VolumeManager mgr = VolumeManager.getInstance();
    try {
        // make sure it exists
        mgr.getVolume(mId);
        mgr.delete(mId, getUnloggedReplay());
    } catch (VolumeServiceException e) {
        if (e.getCode() != VolumeServiceException.NO_SUCH_VOLUME) {
            throw e;
        }
    }
}
Also used : VolumeServiceException(com.zimbra.cs.volume.VolumeServiceException) VolumeManager(com.zimbra.cs.volume.VolumeManager)

Example 7 with VolumeManager

use of com.zimbra.cs.volume.VolumeManager in project zm-mailbox by Zimbra.

the class ModifyVolume method handle.

private ModifyVolumeResponse handle(ModifyVolumeRequest req, Map<String, Object> ctx) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
    checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Admin.R_manageVolume);
    VolumeManager mgr = VolumeManager.getInstance();
    Volume.Builder builder = Volume.builder(mgr.getVolume(req.getId()));
    VolumeInfo vol = req.getVolume();
    if (vol == null) {
        throw ServiceException.INVALID_REQUEST("must specify a volume Element", null);
    }
    if (vol.getType() > 0) {
        builder.setType(vol.getType());
    }
    if (vol.getName() != null) {
        builder.setName(vol.getName());
    }
    if (vol.getRootPath() != null) {
        builder.setPath(vol.getRootPath(), true);
    }
    if (vol.getCompressBlobs() != null) {
        builder.setCompressBlobs(vol.getCompressBlobs());
    }
    if (vol.getCompressionThreshold() > 0) {
        builder.setCompressionThreshold(vol.getCompressionThreshold());
    }
    mgr.update(builder.build());
    return new ModifyVolumeResponse();
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) VolumeInfo(com.zimbra.soap.admin.type.VolumeInfo) ModifyVolumeResponse(com.zimbra.soap.admin.message.ModifyVolumeResponse)

Example 8 with VolumeManager

use of com.zimbra.cs.volume.VolumeManager in project zm-mailbox by Zimbra.

the class ModifyVolume method redo.

@Override
public void redo() throws Exception {
    VolumeManager mgr = VolumeManager.getInstance();
    // make sure it exists
    mgr.getVolume(id);
    Volume vol = Volume.builder().setId(id).setType(type).setName(name).setPath(rootPath, false).setMboxGroupBits(mboxGroupBits).setMboxBit(mboxBits).setFileGroupBits(fileGroupBits).setFileBits(fileBits).setCompressBlobs(compressBlobs).setCompressionThreshold(compressionThreshold).build();
    mgr.update(vol, getUnloggedReplay());
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) Volume(com.zimbra.cs.volume.Volume)

Example 9 with VolumeManager

use of com.zimbra.cs.volume.VolumeManager in project zm-mailbox by Zimbra.

the class DeleteVolume method handle.

private DeleteVolumeResponse handle(DeleteVolumeRequest req, Map<String, Object> ctx) throws ServiceException {
    ZimbraSoapContext zsc = getZimbraSoapContext(ctx);
    checkRight(zsc, ctx, Provisioning.getInstance().getLocalServer(), Admin.R_manageVolume);
    VolumeManager mgr = VolumeManager.getInstance();
    // make sure the volume exists before doing anything heavyweight...
    mgr.getVolume(req.getId());
    mgr.delete(req.getId());
    return new DeleteVolumeResponse();
}
Also used : VolumeManager(com.zimbra.cs.volume.VolumeManager) ZimbraSoapContext(com.zimbra.soap.ZimbraSoapContext) DeleteVolumeResponse(com.zimbra.soap.admin.message.DeleteVolumeResponse)

Aggregations

VolumeManager (com.zimbra.cs.volume.VolumeManager)9 Volume (com.zimbra.cs.volume.Volume)7 ZimbraSoapContext (com.zimbra.soap.ZimbraSoapContext)3 VolumeServiceException (com.zimbra.cs.volume.VolumeServiceException)2 Mailbox (com.zimbra.cs.mailbox.Mailbox)1 WikiItem (com.zimbra.cs.mailbox.WikiItem)1 DeleteVolumeResponse (com.zimbra.soap.admin.message.DeleteVolumeResponse)1 GetCurrentVolumesResponse (com.zimbra.soap.admin.message.GetCurrentVolumesResponse)1 ModifyVolumeResponse (com.zimbra.soap.admin.message.ModifyVolumeResponse)1 VolumeInfo (com.zimbra.soap.admin.type.VolumeInfo)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 Test (org.junit.Test)1