use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class BlobDeduperUtil method run.
private void run() throws Exception {
CliUtil.toolSetup();
SoapProvisioning prov = SoapProvisioning.getAdminInstance();
prov.soapZimbraAdminAuthenticate();
DedupeBlobsRequest request = new DedupeBlobsRequest(action);
for (short volumeId : volumeIds) {
request.addVolume(new IntIdAttr(volumeId));
}
Element respElem = prov.invoke(JaxbUtil.jaxbToElement(request));
DedupeBlobsResponse response = JaxbUtil.elementToJaxb(respElem);
if (action == DedupeBlobsRequest.DedupAction.start) {
System.out.println("Dedupe scheduled. Run \"zmdedupe status\" to check the status.");
} else {
System.out.println("Status = " + response.getStatus().name());
System.out.println("Total links created = " + response.getTotalCount());
System.out.println("Total size saved = " + response.getTotalSize());
VolumeIdAndProgress[] volumeBlobsProgress = response.getVolumeBlobsProgress();
if (volumeBlobsProgress != null && volumeBlobsProgress.length > 0) {
System.out.printf("%32s : %10s - %s\n", "Groups populated in volume blobs", "volumeId", "groups/total_groups");
for (VolumeIdAndProgress idAndProgress : volumeBlobsProgress) {
System.out.printf("%32s %10s - %s\n", "", idAndProgress.getVolumeId(), idAndProgress.getProgress());
}
}
VolumeIdAndProgress[] blobDigestsProgress = response.getBlobDigestsProgress();
if (blobDigestsProgress != null && blobDigestsProgress.length > 0) {
System.out.printf("%32s : %10s - %s\n", "Digests Processed", "volumeId", "digests/total_digests");
for (VolumeIdAndProgress idAndProgress : blobDigestsProgress) {
System.out.printf("%32s %10s - %s\n", "", idAndProgress.getVolumeId(), idAndProgress.getProgress());
}
}
}
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class BlobConsistencyUtil method run.
private void run() throws Exception {
if (unexpectedBlobList != null) {
unexpectedBlobWriter = new PrintWriter(new FileOutputStream(unexpectedBlobList), true);
}
if (usedBlobList != null) {
usedBlobWriter = new PrintWriter(new FileOutputStream(usedBlobList), true);
}
CliUtil.toolSetup();
SoapProvisioning prov = SoapProvisioning.getAdminInstance();
prov.soapZimbraAdminAuthenticate();
if (mailboxIds == null) {
mailboxIds = getAllMailboxIds(prov);
}
try {
DbPool.startup();
for (int mboxId : mailboxIds) {
System.out.println("Checking mailbox " + mboxId + ".");
checkMailbox(mboxId, prov);
}
} finally {
DbPool.shutdown();
}
if (unexpectedBlobWriter != null) {
unexpectedBlobWriter.close();
}
if (usedBlobWriter != null) {
usedBlobWriter.close();
}
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class TestProvisioning method setUp.
public void setUp() throws Exception {
mProv = Provisioning.getInstance();
assertTrue(mProv instanceof LdapProv);
mLdapProv = (LdapProv) mProv;
mCustomProvTester = new CustomProvTester(mProv);
mSoapProv = new SoapProvisioning();
mSoapProv.soapSetURI(TestUtil.getAdminSoapUrl());
mSoapProv.soapZimbraAdminAuthenticate();
TEST_ID = TestProvisioningUtil.genTestId();
PRE_AUTH_KEY = PreAuthKey.generateRandomPreAuthKey();
PASSWORD = "test123";
SPECIAL_CHARS_ALLOWED_IN_DOMAIN = "/";
SPECIAL_CHARS_ALLOWED_IN_USER_PART = "/";
COS_NAME = "cos-" + TEST_ID;
// DOMAIN_NAME = "domain-" + TEST_ID + ".ldap-test-domain";
// DOMAIN_NAME_SPECIAL_CHARS = "domain-" + SPECIAL_CHARS_ALLOWED_IN_DOMAIN + "-" + TEST_ID + ".ldap-test-domain";
DOMAIN_NAME = TestProvisioningUtil.baseDomainName("domain", TEST_ID);
// DOMAIN_NAME_SPECIAL_CHARS = TestProvisioningUtil.baseDomainName("domain-" + SPECIAL_CHARS_ALLOWED_IN_DOMAIN, TEST_ID);
// TODO: javamail now is more strict on domain names!!
DOMAIN_NAME_SPECIAL_CHARS = TestProvisioningUtil.baseDomainName("domain-special", TEST_ID);
OTHER_DOMAIN_NAME = "other-" + DOMAIN_NAME;
SERVER_NAME = "server-" + TEST_ID;
ZIMLET_NAME = "zimlet-" + TEST_ID;
NEW_NAME = "newname";
NEW_EMAIL = NEW_NAME + "-" + TEST_ID + "@" + DOMAIN_NAME;
NEW_EMAIL_IN_OTHER_DOMAIN = NEW_NAME + "-" + TEST_ID + "@" + OTHER_DOMAIN_NAME;
DEFAULT_LDAP_ADMIN_USER = LC.zimbra_ldap_user.value();
ADMIN_USER = "admin";
ADMIN_EMAIL = ADMIN_USER + "@" + DOMAIN_NAME;
ACCT_USER = "acct-1";
ACCT_EMAIL = ACCT_USER + "@" + DOMAIN_NAME;
ACCT_USER_SPECIAL_CHARS = "acct-special-chars-" + SPECIAL_CHARS_ALLOWED_IN_USER_PART;
ACCT_EMAIL_SPECIAL_CHARS = ACCT_USER_SPECIAL_CHARS + "@" + DOMAIN_NAME_SPECIAL_CHARS;
ACCT_ALIAS_USER = "alias-of-" + ACCT_USER;
ACCT_ALIAS_EMAIL = ACCT_ALIAS_USER + "@" + DOMAIN_NAME;
ACCT_ALIAS_AFTER_ACCOUNT_RENAME_TO_OTHER_DMAIN_EMAIL = ACCT_ALIAS_USER + "@" + OTHER_DOMAIN_NAME;
ACCT_ALIAS_IN_OTHER_DOMAIN_USER = ACCT_ALIAS_USER + "-in-other-domain";
ACCT_ALIAS_IN_OTHER_DOMAIN_EMAIL = ACCT_ALIAS_IN_OTHER_DOMAIN_USER + "@" + OTHER_DOMAIN_NAME;
ACCT_ALIAS_IN_OTHER_DOMAIN_AFTER_ACCOUNT_RENAME_TO_ORIG_DOMAIN_EMAIL = ACCT_ALIAS_IN_OTHER_DOMAIN_USER + "@" + DOMAIN_NAME;
ACCT_FULL_NAME = "Phoebe Shao";
ACCT_NAMING_ATTR = LC.get("ldap_dit_naming_rdn_attr_user");
if (StringUtil.isNullOrEmpty(ACCT_NAMING_ATTR))
ACCT_NAMING_ATTR = "uid";
ACCT_NAMING_ATTR_VALUE = namingAttrValue(ACCT_USER);
ACCT_BASE_DN = "ou=grp1,ou=mail,o=Comcast";
CR_USER = "cr-1";
CR_EMAIL = CR_USER + "@" + DOMAIN_NAME;
CR_ALIAS_USER = "alias-of-" + CR_USER;
CR_ALIAS_EMAIL = CR_ALIAS_USER + "@" + DOMAIN_NAME;
DL_USER = "dl-1";
DL_EMAIL = DL_USER + "@" + DOMAIN_NAME;
DL_USER_SPECIAL_CHARS = "dl-special-chars-" + SPECIAL_CHARS_ALLOWED_IN_USER_PART;
DL_EMAIL_SPECIAL_CHARS = DL_USER_SPECIAL_CHARS + "@" + DOMAIN_NAME_SPECIAL_CHARS;
DL_ALIAS_USER = "alias-of" + DL_USER;
DL_ALIAS_EMAIL = DL_ALIAS_USER + "@" + DOMAIN_NAME;
DL_NESTED_USER = "dl-nested";
DL_NESTED_EMAIL = DL_NESTED_USER + "@" + DOMAIN_NAME;
DL_NESTED_ALIAS_USER = "alias-of-" + DL_NESTED_USER;
DL_NESTED_ALIAS_EMAIL = DL_NESTED_ALIAS_USER + "@" + DOMAIN_NAME;
DATA_SOURCE_NAME = "datasource-1";
IDENTITY_NAME = "identity-1";
SIGNATURE_NAME = "signature-1";
SIGNATURE_VALUE = "this is my signature";
SIGNATURE_VALUE_MODIFIED = "this is my signature MODIFIED";
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class SetHeaderFilter method getResponseHeaders.
private KeyValue[] getResponseHeaders(String serverName) {
KeyValue[] headers = RESPONSE_HEADERS.get(serverName);
if (headers == null) {
headers = NO_HEADERS;
try {
SoapProvisioning provisioning = new SoapProvisioning();
String soapUri = LC.zimbra_admin_service_scheme.value() + LC.zimbra_zmprov_default_soap_server.value() + ':' + LC.zimbra_admin_service_port.intValue() + AdminConstants.ADMIN_SERVICE_URI;
provisioning.soapSetURI(soapUri);
provisioning.soapZimbraAdminAuthenticate();
Entry info = provisioning.getDomainInfo(Key.DomainBy.virtualHostname, serverName);
if (info == null) {
info = provisioning.getConfig();
}
if (info != null) {
String[] values = info.getMultiAttr(ZAttrProvisioning.A_zimbraResponseHeader, true);
headers = new KeyValue[values.length];
for (int i = 0; i < values.length; i++) {
String value = values[i];
Matcher matcher = RE_HEADER.matcher(value);
if (matcher.matches()) {
headers[i] = new KeyValue(matcher.group(1), matcher.group(2));
} else {
headers[i] = new KeyValue(value);
}
}
}
} catch (Exception e) {
getLogger().error("Unable to get domain config", e);
}
RESPONSE_HEADERS.putIfAbsent(serverName, headers);
}
return headers;
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class ZMailboxUtil method adminAuth.
private void adminAuth(ZAuthToken zat, String uri) throws ServiceException {
SoapTransport.DebugListener listener = mDebug ? this : null;
mProv = new SoapProvisioning();
mProv.soapSetURI(ZMailbox.resolveUrl(uri, true));
if (listener != null) {
mProv.soapSetTransportDebugListener(listener);
}
mProv.soapAdminAuthenticate(zat);
}
Aggregations