use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class BlobConsistencyUtil method checkMailbox.
private void checkMailbox(int mboxId, SoapProvisioning prov) throws ServiceException {
XMLElement request = new XMLElement(AdminConstants.CHECK_BLOB_CONSISTENCY_REQUEST);
for (short volumeId : volumeIds) {
request.addElement(AdminConstants.E_VOLUME).addAttribute(AdminConstants.A_ID, volumeId);
}
request.addElement(AdminConstants.E_MAILBOX).addAttribute(AdminConstants.A_ID, mboxId);
request.addAttribute(AdminConstants.A_CHECK_SIZE, !skipSizeCheck);
request.addAttribute(AdminConstants.A_REPORT_USED_BLOBS, outputUsedBlobs || usedBlobWriter != null);
Element response = prov.invoke(request);
for (Element mboxEl : response.listElements(AdminConstants.E_MAILBOX)) {
// Print results.
BlobConsistencyChecker.Results results = new BlobConsistencyChecker.Results(mboxEl);
for (BlobInfo blob : results.missingBlobs.values()) {
System.out.format("Mailbox %d, item %d, rev %d, %s: blob not found.\n", results.mboxId, blob.itemId, blob.modContent, locatorText(blob));
}
for (BlobInfo blob : results.incorrectSize.values()) {
System.out.format("Mailbox %d, item %d, rev %d, %s: incorrect data size. Expected %d, was %d. File size is %d.\n", results.mboxId, blob.itemId, blob.modContent, locatorText(blob), blob.dbSize, blob.fileDataSize, blob.fileSize);
}
for (BlobInfo blob : results.unexpectedBlobs.values()) {
System.out.format("Mailbox %d, %s: unexpected blob. File size is %d.\n", results.mboxId, locatorText(blob), blob.fileSize);
if (unexpectedBlobWriter != null) {
unexpectedBlobWriter.println(blob.path);
}
}
for (BlobInfo blob : results.incorrectModContent.values()) {
System.out.format("Mailbox %d, item %d, rev %d, %s: file has incorrect revision.\n", results.mboxId, blob.itemId, blob.modContent, locatorText(blob));
}
for (BlobInfo blob : results.usedBlobs.values()) {
if (outputUsedBlobs) {
System.out.format("Used blob: Mailbox %d, item %d, rev %d, %s.\n", results.mboxId, blob.itemId, blob.version, locatorText(blob));
}
if (usedBlobWriter != null) {
usedBlobWriter.println(blob.path);
}
}
// Fix inconsistencies.
if (missingBlobDeleteItem && results.missingBlobs.size() > 0) {
exportAndDelete(prov, results);
}
if (incorrectRevisionRenameFile) {
for (BlobInfo blob : results.incorrectModContent.values()) {
File file = new File(blob.path);
File dir = file.getParentFile();
if (dir != null) {
File newFile = new File(dir, FileBlobStore.getFilename(blob.itemId, blob.modContent));
System.out.format("Renaming %s to %s.\n", file.getAbsolutePath(), newFile.getAbsolutePath());
if (!file.renameTo(newFile)) {
System.err.format("Unable to rename %s to %s.\n", file.getAbsolutePath(), newFile.getAbsolutePath());
}
} else {
System.err.format("Could not determine parent directory of %s.\n", file.getAbsolutePath());
}
}
}
}
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class TestAccess method SearchCalendarResources.
public void SearchCalendarResources(Role role, Perm perm) throws Exception {
XMLElement req = new XMLElement(AccountConstants.SEARCH_CALENDAR_RESOURCES_REQUEST);
Element sf = req.addElement(AccountConstants.E_ENTRY_SEARCH_FILTER);
Element cond = sf.addElement(AccountConstants.E_ENTRY_SEARCH_FILTER_SINGLECOND);
cond.addAttribute(AccountConstants.A_ENTRY_SEARCH_FILTER_ATTR, Provisioning.A_zimbraCalResType);
cond.addAttribute(AccountConstants.A_ENTRY_SEARCH_FILTER_OP, "eq");
cond.addAttribute(AccountConstants.A_ENTRY_SEARCH_FILTER_VALUE, "Equipment");
accessTest(role, perm, req);
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class TestAccess method GetDataSourcess.
public void GetDataSourcess(Role role, Perm perm) throws Exception {
XMLElement req = new XMLElement(MailConstants.GET_DATA_SOURCES_REQUEST);
accessTest(role, perm, req);
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class TestAccess method GetInfo.
public void GetInfo(Role role, Perm perm) throws Exception {
XMLElement req = new XMLElement(AccountConstants.GET_INFO_REQUEST);
accessTest(role, perm, req);
}
use of com.zimbra.common.soap.Element.XMLElement in project zm-mailbox by Zimbra.
the class TestAccess method AutoCompleteGal.
public void AutoCompleteGal(Role role, Perm perm) throws Exception {
XMLElement req = new XMLElement(AccountConstants.AUTO_COMPLETE_GAL_REQUEST);
req.addElement(AdminConstants.E_NAME).setText("phoebe");
req.addAttribute(AdminConstants.A_TYPE, "all");
req.addAttribute(AdminConstants.A_LIMIT, "10");
accessTest(role, perm, req);
}
Aggregations