Search in sources :

Example 1 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method execute.

private boolean execute(String[] args) throws ServiceException, ArgException, IOException {
    String[] members;
    Account account;
    AccountLoggerOptions alo;
    command = lookupCommand(args[0]);
    if (command == null) {
        return false;
    }
    Command.Via violatedVia = violateVia(command);
    if (violatedVia != null) {
        usage(violatedVia);
        return true;
    }
    if (!command.checkArgsLength(args)) {
        usage();
        return true;
    }
    if (command.needsSchemaExtension()) {
        loadLdapSchemaExtensionAttrs();
    }
    switch(command) {
        case ADD_ACCOUNT_ALIAS:
            prov.addAlias(lookupAccount(args[1]), args[2]);
            break;
        case ADD_ACCOUNT_LOGGER:
            alo = parseAccountLoggerOptions(args);
            if (!command.checkArgsLength(alo.args)) {
                usage();
                return true;
            }
            doAddAccountLogger(alo);
            break;
        case AUTO_COMPLETE_GAL:
            doAutoCompleteGal(args);
            break;
        case AUTO_PROV_CONTROL:
            prov.autoProvControl(args[1]);
            break;
        case COPY_COS:
            console.println(prov.copyCos(lookupCos(args[1]).getId(), args[2]).getId());
            break;
        case COUNT_ACCOUNT:
            doCountAccount(args);
            break;
        case COUNT_OBJECTS:
            doCountObjects(args);
            break;
        case CREATE_ACCOUNT:
            console.println(prov.createAccount(args[1], args[2].equals("") ? null : args[2], getMapAndCheck(args, 3, true)).getId());
            break;
        case CREATE_ALIAS_DOMAIN:
            console.println(doCreateAliasDomain(args[1], args[2], getMapAndCheck(args, 3, true)).getId());
            break;
        case CREATE_ALWAYSONCLUSTER:
            console.println(prov.createAlwaysOnCluster(args[1], getMapAndCheck(args, 2, true)).getId());
            break;
        case CREATE_COS:
            console.println(prov.createCos(args[1], getMapAndCheck(args, 2, true)).getId());
            break;
        case CREATE_DOMAIN:
            console.println(prov.createDomain(args[1], getMapAndCheck(args, 2, true)).getId());
            break;
        case CREATE_IDENTITY:
            prov.createIdentity(lookupAccount(args[1]), args[2], getMapAndCheck(args, 3, true));
            break;
        case CREATE_SIGNATURE:
            console.println(prov.createSignature(lookupAccount(args[1]), args[2], getMapAndCheck(args, 3, true)).getId());
            break;
        case CREATE_DATA_SOURCE:
            console.println(prov.createDataSource(lookupAccount(args[1]), DataSourceType.fromString(args[2]), args[3], getMapAndCheck(args, 4, true)).getId());
            break;
        case CREATE_SERVER:
            console.println(prov.createServer(args[1], getMapAndCheck(args, 2, true)).getId());
            break;
        case CREATE_UC_SERVICE:
            console.println(prov.createUCService(args[1], getMapAndCheck(args, 2, true)).getId());
            break;
        case CREATE_XMPP_COMPONENT:
            doCreateXMPPComponent(args);
            break;
        case DESCRIBE:
            doDescribe(args);
            break;
        case EXIT:
            System.exit(errorOccursDuringInteraction ? 2 : 0);
            break;
        case FLUSH_CACHE:
            doFlushCache(args);
            break;
        case GENERATE_DOMAIN_PRE_AUTH_KEY:
            doGenerateDomainPreAuthKey(args);
            break;
        case GENERATE_DOMAIN_PRE_AUTH:
            doGenerateDomainPreAuth(args);
            break;
        case GET_ACCOUNT:
            doGetAccount(args);
            break;
        case GET_ACCOUNT_MEMBERSHIP:
            doGetAccountMembership(args);
            break;
        case GET_ALWAYSONCLUSTER:
            doGetAlwaysOnCluster(args);
            break;
        case GET_IDENTITIES:
            doGetAccountIdentities(args);
            break;
        case GET_SIGNATURES:
            doGetAccountSignatures(args);
            break;
        case GET_DATA_SOURCES:
            doGetAccountDataSources(args);
            break;
        case GET_ACCOUNT_LOGGERS:
            alo = parseAccountLoggerOptions(args);
            if (!command.checkArgsLength(alo.args)) {
                usage();
                return true;
            }
            doGetAccountLoggers(alo);
            break;
        case GET_ALL_ACCOUNT_LOGGERS:
            alo = parseAccountLoggerOptions(args);
            if (!command.checkArgsLength(alo.args)) {
                usage();
                return true;
            }
            doGetAllAccountLoggers(alo);
            break;
        case GET_ALL_ACCOUNTS:
            doGetAllAccounts(args);
            break;
        case GET_ALL_ACTIVE_SERVERS:
            doGetAllActiveServers(args);
            break;
        case GET_ALL_ADMIN_ACCOUNTS:
            doGetAllAdminAccounts(args);
            break;
        case GET_ALL_ALWAYSONCLUSTERS:
            doGetAllAlwaysOnClusters(args);
            break;
        case GET_ALL_CONFIG:
            dumpAttrs(prov.getConfig().getAttrs(), getArgNameSet(args, 1));
            break;
        case GET_ALL_COS:
            doGetAllCos(args);
            break;
        case GET_ALL_DOMAINS:
            doGetAllDomains(args);
            break;
        case GET_ALL_FREEBUSY_PROVIDERS:
            doGetAllFreeBusyProviders();
            break;
        case GET_ALL_RIGHTS:
            doGetAllRights(args);
            break;
        case GET_ALL_SERVERS:
            doGetAllServers(args);
            break;
        case GET_ALL_UC_SERVICES:
            doGetAllUCServices(args);
            break;
        case GET_CONFIG:
            doGetConfig(args);
            break;
        case GET_COS:
            dumpCos(lookupCos(args[1]), getArgNameSet(args, 2));
            break;
        case GET_DISTRIBUTION_LIST_MEMBERSHIP:
            doGetDistributionListMembership(lookupGroup(args[1]));
            break;
        case GET_DOMAIN:
            doGetDomain(args);
            break;
        case GET_DOMAIN_INFO:
            doGetDomainInfo(args);
            break;
        case GET_CONFIG_SMIME_CONFIG:
            doGetConfigSMIMEConfig(args);
            break;
        case GET_DOMAIN_SMIME_CONFIG:
            doGetDomainSMIMEConfig(args);
            break;
        case GET_FREEBUSY_QUEUE_INFO:
            doGetFreeBusyQueueInfo(args);
            break;
        case GET_RIGHT:
            doGetRight(args);
            break;
        case GET_RIGHTS_DOC:
            doGetRightsDoc(args);
            break;
        case GET_SERVER:
            doGetServer(args);
            break;
        case GET_UC_SERVICES:
            dumpUCService(lookupUCService(args[1]), getArgNameSet(args, 2));
            break;
        case GET_XMPP_COMPONENT:
            doGetXMPPComponent(args);
            break;
        case CHECK_RIGHT:
            doCheckRight(args);
            break;
        case GET_ALL_EFFECTIVE_RIGHTS:
            doGetAllEffectiveRights(args);
            break;
        case GET_EFFECTIVE_RIGHTS:
            doGetEffectiveRights(args);
            break;
        case GET_CREATE_OBJECT_ATTRS:
            doGetCreateObjectAttrs(args);
            break;
        case GET_GRANTS:
            doGetGrants(args);
            break;
        case GRANT_RIGHT:
            doGrantRight(args);
            break;
        case REVOKE_RIGHT:
            doRevokeRight(args);
            break;
        case HELP:
            doHelp(args);
            break;
        case MODIFY_ACCOUNT:
            prov.modifyAttrs(lookupAccount(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case MODIFY_ALWAYSONCLUSTER:
            prov.modifyAttrs(lookupAlwaysOnCluster(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case MODIFY_DATA_SOURCE:
            account = lookupAccount(args[1]);
            prov.modifyDataSource(account, lookupDataSourceId(account, args[2]), getMapAndCheck(args, 3, false));
            break;
        case MODIFY_IDENTITY:
            account = lookupAccount(args[1]);
            prov.modifyIdentity(account, args[2], getMapAndCheck(args, 3, false));
            break;
        case MODIFY_SIGNATURE:
            account = lookupAccount(args[1]);
            prov.modifySignature(account, lookupSignatureId(account, args[2]), getMapAndCheck(args, 3, false));
            break;
        case MODIFY_COS:
            prov.modifyAttrs(lookupCos(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case MODIFY_CONFIG:
            prov.modifyAttrs(prov.getConfig(), getMapAndCheck(args, 1, false), true);
            break;
        case MODIFY_DOMAIN:
            prov.modifyAttrs(lookupDomain(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case MODIFY_CONFIG_SMIME_CONFIG:
            doModifyConfigSMIMEConfig(args);
            break;
        case MODIFY_DOMAIN_SMIME_CONFIG:
            doModifyDomainSMIMEConfig(args);
            break;
        case MODIFY_SERVER:
            prov.modifyAttrs(lookupServer(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case MODIFY_UC_SERVICE:
            prov.modifyAttrs(lookupUCService(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case DELETE_ACCOUNT:
            doDeleteAccount(args);
            break;
        case DELETE_ALWAYSONCLUSTER:
            prov.deleteAlwaysOnCluster(lookupAlwaysOnCluster(args[1]).getId());
            break;
        case DELETE_COS:
            prov.deleteCos(lookupCos(args[1]).getId());
            break;
        case DELETE_DOMAIN:
            prov.deleteDomain(lookupDomain(args[1]).getId());
            break;
        case DELETE_IDENTITY:
            prov.deleteIdentity(lookupAccount(args[1]), args[2]);
            break;
        case DELETE_SIGNATURE:
            account = lookupAccount(args[1]);
            prov.deleteSignature(account, lookupSignatureId(account, args[2]));
            break;
        case DELETE_DATA_SOURCE:
            account = lookupAccount(args[1]);
            prov.deleteDataSource(account, lookupDataSourceId(account, args[2]));
            break;
        case DELETE_SERVER:
            prov.deleteServer(lookupServer(args[1]).getId());
            break;
        case DELETE_UC_SERVICE:
            prov.deleteUCService(lookupUCService(args[1]).getId());
            break;
        case DELETE_XMPP_COMPONENT:
            prov.deleteXMPPComponent(lookupXMPPComponent(args[1]));
            break;
        case PUSH_FREEBUSY:
            doPushFreeBusy(args);
            break;
        case PUSH_FREEBUSY_DOMAIN:
            doPushFreeBusyForDomain(args);
            break;
        case PURGE_FREEBUSY_QUEUE:
            doPurgeFreeBusyQueue(args);
            break;
        case PURGE_ACCOUNT_CALENDAR_CACHE:
            doPurgeAccountCalendarCache(args);
            break;
        case REMOVE_ACCOUNT_ALIAS:
            Account acct = lookupAccount(args[1], false);
            prov.removeAlias(acct, args[2]);
            // this is so dangling aliases can be cleaned up as much as possible
            if (acct == null) {
                throw AccountServiceException.NO_SUCH_ACCOUNT(args[1]);
            }
            break;
        case REMOVE_ACCOUNT_LOGGER:
            alo = parseAccountLoggerOptions(args);
            if (!command.checkArgsLength(alo.args)) {
                usage();
                return true;
            }
            doRemoveAccountLogger(alo);
            break;
        case REMOVE_CONFIG_SMIME_CONFIG:
            doRemoveConfigSMIMEConfig(args);
            break;
        case REMOVE_DOMAIN_SMIME_CONFIG:
            doRemoveDomainSMIMEConfig(args);
            break;
        case RENAME_ACCOUNT:
            doRenameAccount(args);
            break;
        case RENAME_COS:
            prov.renameCos(lookupCos(args[1]).getId(), args[2]);
            break;
        case RENAME_DOMAIN:
            doRenameDomain(args);
            break;
        case RENAME_UCSERVICE:
            prov.renameUCService(lookupUCService(args[1]).getId(), args[2]);
            break;
        case SET_ACCOUNT_COS:
            prov.setCOS(lookupAccount(args[1]), lookupCos(args[2]));
            break;
        case SET_SERVER_OFFLINE:
            doSetServerOffline(args);
            break;
        case SET_LOCAL_SERVER_ONLINE:
            doSetLocalServerOnline();
            break;
        case SEARCH_ACCOUNTS:
            doSearchAccounts(args);
            break;
        case SEARCH_GAL:
            doSearchGal(args);
            break;
        case SYNC_GAL:
            doSyncGal(args);
            break;
        case SET_PASSWORD:
            SetPasswordResult result = prov.setPassword(lookupAccount(args[1]), args[2]);
            if (result.hasMessage()) {
                console.println(result.getMessage());
            }
            break;
        case CHECK_PASSWORD_STRENGTH:
            prov.checkPasswordStrength(lookupAccount(args[1]), args[2]);
            console.println("Password passed strength check.");
            break;
        case CREATE_DISTRIBUTION_LIST:
            console.println(prov.createGroup(args[1], getMapAndCheck(args, 2, true), false).getId());
            break;
        case CREATE_DYNAMIC_DISTRIBUTION_LIST:
            console.println(prov.createGroup(args[1], getMapAndCheck(args, 2, true), true).getId());
            break;
        case CREATE_DISTRIBUTION_LISTS_BULK:
            doCreateDistributionListsBulk(args);
            break;
        case GET_ALL_DISTRIBUTION_LISTS:
            doGetAllDistributionLists(args);
            break;
        case GET_DISTRIBUTION_LIST:
            dumpGroup(lookupGroup(args[1]), getArgNameSet(args, 2));
            break;
        case GET_ALL_XMPP_COMPONENTS:
            doGetAllXMPPComponents();
            break;
        case MODIFY_DISTRIBUTION_LIST:
            prov.modifyAttrs(lookupGroup(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case DELETE_DISTRIBUTION_LIST:
            prov.deleteGroup(lookupGroup(args[1]).getId());
            break;
        case ADD_DISTRIBUTION_LIST_MEMBER:
            members = new String[args.length - 2];
            System.arraycopy(args, 2, members, 0, args.length - 2);
            prov.addGroupMembers(lookupGroup(args[1]), members);
            break;
        case REMOVE_DISTRIBUTION_LIST_MEMBER:
            members = new String[args.length - 2];
            System.arraycopy(args, 2, members, 0, args.length - 2);
            prov.removeGroupMembers(lookupGroup(args[1]), members);
            break;
        case CREATE_BULK_ACCOUNTS:
            doCreateAccountsBulk(args);
            break;
        case ADD_DISTRIBUTION_LIST_ALIAS:
            prov.addGroupAlias(lookupGroup(args[1]), args[2]);
            break;
        case REMOVE_DISTRIBUTION_LIST_ALIAS:
            Group dl = lookupGroup(args[1], false);
            // with the named/id entered on the comand line.
            try {
                prov.removeGroupAlias(dl, args[2]);
            } catch (ServiceException e) {
                if (!(dl == null && AccountServiceException.NO_SUCH_DISTRIBUTION_LIST.equals(e.getCode()))) {
                    throw e;
                }
            // else eat the exception, we will throw below
            }
            if (dl == null) {
                throw AccountServiceException.NO_SUCH_DISTRIBUTION_LIST(args[1]);
            }
            break;
        case RENAME_DISTRIBUTION_LIST:
            prov.renameGroup(lookupGroup(args[1]).getId(), args[2]);
            break;
        case CREATE_CALENDAR_RESOURCE:
            console.println(prov.createCalendarResource(args[1], args[2].isEmpty() ? null : args[2], getMapAndCheck(args, 3, true)).getId());
            break;
        case DELETE_CALENDAR_RESOURCE:
            prov.deleteCalendarResource(lookupCalendarResource(args[1]).getId());
            break;
        case MODIFY_CALENDAR_RESOURCE:
            prov.modifyAttrs(lookupCalendarResource(args[1]), getMapAndCheck(args, 2, false), true);
            break;
        case RENAME_CALENDAR_RESOURCE:
            prov.renameCalendarResource(lookupCalendarResource(args[1]).getId(), args[2]);
            break;
        case GET_CALENDAR_RESOURCE:
            dumpCalendarResource(lookupCalendarResource(args[1]), true, getArgNameSet(args, 2));
            break;
        case GET_ALL_CALENDAR_RESOURCES:
            doGetAllCalendarResources(args);
            break;
        case SEARCH_CALENDAR_RESOURCES:
            doSearchCalendarResources(args);
            break;
        case GET_SHARE_INFO:
            doGetShareInfo(args);
            break;
        case GET_SPNEGO_DOMAIN:
            doGetSpnegoDomain();
            break;
        case GET_QUOTA_USAGE:
            doGetQuotaUsage(args);
            break;
        case GET_MAILBOX_INFO:
            doGetMailboxInfo(args);
            break;
        case REINDEX_MAILBOX:
            doReIndexMailbox(args);
            break;
        case COMPACT_INBOX_MAILBOX:
            doCompactIndexMailbox(args);
            break;
        case VERIFY_INDEX:
            doVerifyIndex(args);
            break;
        case GET_INDEX_STATS:
            doGetIndexStats(args);
            break;
        case RECALCULATE_MAILBOX_COUNTS:
            doRecalculateMailboxCounts(args);
            break;
        case SELECT_MAILBOX:
            if (!(prov instanceof SoapProvisioning)) {
                throwSoapOnly();
            }
            ZMailboxUtil util = new ZMailboxUtil();
            util.setVerbose(verboseMode);
            util.setDebug(debugLevel != SoapDebugLevel.none);
            boolean smInteractive = interactiveMode && args.length < 3;
            util.setInteractive(smInteractive);
            util.selectMailbox(args[1], (SoapProvisioning) prov);
            if (smInteractive) {
                util.interactive(cliReader);
            } else if (args.length > 2) {
                String[] newArgs = new String[args.length - 2];
                System.arraycopy(args, 2, newArgs, 0, newArgs.length);
                util.execute(newArgs);
            } else {
                throw ZClientException.CLIENT_ERROR("command only valid in interactive mode or with arguments", null);
            }
            break;
        case GET_ALL_MTA_AUTH_URLS:
            doGetAllMtaAuthURLs();
            break;
        case GET_ALL_REVERSE_PROXY_URLS:
            doGetAllReverseProxyURLs();
            break;
        case GET_ALL_REVERSE_PROXY_BACKENDS:
            doGetAllReverseProxyBackends();
            break;
        case GET_ALL_REVERSE_PROXY_DOMAINS:
            doGetAllReverseProxyDomains();
            break;
        case GET_ALL_MEMCACHED_SERVERS:
            doGetAllMemcachedServers();
            break;
        case RELOAD_MEMCACHED_CLIENT_CONFIG:
            doReloadMemcachedClientConfig(args);
            break;
        case GET_MEMCACHED_CLIENT_CONFIG:
            doGetMemcachedClientConfig(args);
            break;
        case GET_AUTH_TOKEN_INFO:
            doGetAuthTokenInfo(args);
            break;
        case UPDATE_PRESENCE_SESSION_ID:
            doUpdatePresenceSessionId(args);
            break;
        case SOAP:
            // HACK FOR NOW
            SoapProvisioning sp = new SoapProvisioning();
            sp.soapSetURI("https://localhost:" + serverPort + AdminConstants.ADMIN_SERVICE_URI);
            sp.soapZimbraAdminAuthenticate();
            prov = sp;
            break;
        case LDAP:
            // HACK FOR NOW
            prov = Provisioning.getInstance();
            break;
        case RESET_ALL_LOGGERS:
            doResetAllLoggers(args);
            break;
        case UNLOCK_MAILBOX:
            doUnlockMailbox(args);
            break;
        default:
            return false;
    }
    return true;
}
Also used : ServiceException(com.zimbra.common.service.ServiceException) RightCommand(com.zimbra.cs.account.accesscontrol.RightCommand) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) SetPasswordResult(com.zimbra.cs.account.Provisioning.SetPasswordResult) ZMailboxUtil(com.zimbra.cs.zclient.ZMailboxUtil)

Example 2 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method doGetMemcachedClientConfig.

private void doGetMemcachedClientConfig(String[] args) throws ServiceException {
    List<Pair<String, Integer>> servers = getMailboxServersFromArgs(args);
    // Send command to each server.
    int longestHostname = 0;
    for (Pair<String, Integer> server : servers) {
        String hostname = server.getFirst();
        longestHostname = Math.max(longestHostname, hostname.length());
    }
    String hostnameFormat = String.format("%%-%ds", longestHostname);
    boolean consistent = true;
    String prevConf = null;
    for (Pair<String, Integer> server : servers) {
        String hostname = server.getFirst();
        int port = server.getSecond();
        try {
            SoapProvisioning sp = new SoapProvisioning();
            sp.soapSetURI(LC.zimbra_admin_service_scheme.value() + hostname + ":" + port + AdminConstants.ADMIN_SERVICE_URI);
            if (debugLevel != SoapDebugLevel.none) {
                sp.soapSetHttpTransportDebugListener(this);
            }
            if (account != null && password != null) {
                sp.soapAdminAuthenticate(account, password);
            } else if (authToken != null) {
                sp.soapAdminAuthenticate(authToken);
            } else {
                sp.soapZimbraAdminAuthenticate();
            }
            MemcachedClientConfig config = sp.getMemcachedClientConfig();
            String serverList = config.serverList != null ? config.serverList : "none";
            if (verboseMode) {
                console.printf(hostnameFormat + " => serverList=[%s], hashAlgo=%s, binaryProto=%s, expiry=%ds, timeout=%dms\n", hostname, serverList, config.hashAlgorithm, config.binaryProtocol, config.defaultExpirySeconds, config.defaultTimeoutMillis);
            } else if (config.serverList != null) {
                if (DefaultHashAlgorithm.KETAMA_HASH.toString().equals(config.hashAlgorithm)) {
                    // Don't print the default hash algorithm to keep the output clutter-free.
                    console.printf(hostnameFormat + " => %s\n", hostname, serverList);
                } else {
                    console.printf(hostnameFormat + " => %s (%S)\n", hostname, serverList, config.hashAlgorithm);
                }
            } else {
                console.printf(hostnameFormat + " => none\n", hostname);
            }
            String listAndAlgo = serverList + "/" + config.hashAlgorithm;
            if (prevConf == null) {
                prevConf = listAndAlgo;
            } else if (!prevConf.equals(listAndAlgo)) {
                consistent = false;
            }
        } catch (ServiceException e) {
            console.printf(hostnameFormat + " => ERROR: unable to get configuration\n", hostname);
            if (verboseMode) {
                e.printStackTrace(console);
            }
        }
    }
    if (!consistent) {
        console.println("Inconsistency detected!");
    }
}
Also used : ServiceException(com.zimbra.common.service.ServiceException) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) Pair(com.zimbra.common.util.Pair) MemcachedClientConfig(com.zimbra.cs.account.soap.SoapProvisioning.MemcachedClientConfig)

Example 3 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method doRecalculateMailboxCounts.

private void doRecalculateMailboxCounts(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    SoapProvisioning sp = (SoapProvisioning) prov;
    Account account = lookupAccount(args[1]);
    long quotaUsed = sp.recalculateMailboxCounts(account);
    console.printf("account: " + account.getName() + "\nquotaUsed: " + quotaUsed + "\n");
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 4 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method doGetAllDomains.

private void doGetAllDomains(String[] args) throws ServiceException {
    boolean verbose = false;
    boolean applyDefault = true;
    int i = 1;
    while (i < args.length) {
        String arg = args[i];
        if (arg.equals("-v")) {
            verbose = true;
        } else if (arg.equals("-e")) {
            applyDefault = false;
        } else {
            break;
        }
        i++;
    }
    if (!applyDefault && !verbose) {
        console.println(ERR_INVALID_ARG_EV);
        usage();
        return;
    }
    Set<String> attrNames = getArgNameSet(args, i);
    List<Domain> domains;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        domains = soapProv.getAllDomains(applyDefault);
    } else {
        domains = prov.getAllDomains();
    }
    for (Domain domain : domains) {
        if (verbose) {
            dumpDomain(domain, attrNames);
        } else {
            console.println(domain.getName());
        }
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 5 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method doGetMailboxInfo.

private void doGetMailboxInfo(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    SoapProvisioning sp = (SoapProvisioning) prov;
    Account acct = lookupAccount(args[1]);
    MailboxInfo info = sp.getMailbox(acct);
    console.printf("mailboxId: %s\nquotaUsed: %d\n", info.getMailboxId(), info.getUsed());
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) MailboxInfo(com.zimbra.cs.account.soap.SoapProvisioning.MailboxInfo)

Aggregations

SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)78 Test (org.junit.Test)18 SoapFaultException (com.zimbra.common.soap.SoapFaultException)14 Account (com.zimbra.cs.account.Account)13 Attr (com.zimbra.soap.admin.type.Attr)10 ServiceException (com.zimbra.common.service.ServiceException)9 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)6 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)6 AccountLogger (com.zimbra.common.util.AccountLogger)5 Server (com.zimbra.cs.account.Server)5 CreateCalendarResourceRequest (com.zimbra.soap.admin.message.CreateCalendarResourceRequest)4 CreateCalendarResourceResponse (com.zimbra.soap.admin.message.CreateCalendarResourceResponse)4 DeleteCalendarResourceRequest (com.zimbra.soap.admin.message.DeleteCalendarResourceRequest)4 List (java.util.List)4 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 Provisioning (com.zimbra.cs.account.Provisioning)3 CacheEntry (com.zimbra.cs.account.Provisioning.CacheEntry)3 DeleteAccountRequest (com.zimbra.soap.admin.message.DeleteAccountRequest)3 DeleteAccountResponse (com.zimbra.soap.admin.message.DeleteAccountResponse)3