Search in sources :

Example 71 with SoapProvisioning

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

the class ProvUtil method lookupAlwaysOnCluster.

private AlwaysOnCluster lookupAlwaysOnCluster(String key) throws ServiceException {
    AlwaysOnCluster cluster;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        cluster = soapProv.get(guessAlwaysOnClusterBy(key), key);
    } else {
        cluster = prov.get(guessAlwaysOnClusterBy(key), key);
    }
    if (cluster == null) {
        throw AccountServiceException.NO_SUCH_ALWAYSONCLUSTER(key);
    } else {
        return cluster;
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 72 with SoapProvisioning

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

the class ProvUtil method doGetAllAdminAccounts.

private void doGetAllAdminAccounts(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;
    }
    List<Account> accounts;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        accounts = soapProv.getAllAdminAccounts(applyDefault);
    } else {
        accounts = prov.getAllAdminAccounts();
    }
    Set<String> attrNames = getArgNameSet(args, i);
    for (Account account : accounts) {
        if (verbose) {
            dumpAccount(account, applyDefault, attrNames);
        } else {
            console.println(account.getName());
        }
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 73 with SoapProvisioning

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

the class ProvUtil method doReloadMemcachedClientConfig.

private void doReloadMemcachedClientConfig(String[] args) throws ServiceException {
    List<Pair<String, Integer>> servers = getMailboxServersFromArgs(args);
    // Send command to each server.
    for (Pair<String, Integer> server : servers) {
        String hostname = server.getFirst();
        int port = server.getSecond();
        if (verboseMode) {
            console.print("Updating " + hostname + " ... ");
        }
        boolean success = false;
        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();
            }
            sp.reloadMemcachedClientConfig();
            success = true;
        } catch (ServiceException e) {
            if (verboseMode) {
                console.println("fail");
                e.printStackTrace(console);
            } else {
                console.println("Error updating " + hostname + ": " + e.getMessage());
            }
        } finally {
            if (verboseMode && success) {
                console.println("ok");
            }
        }
    }
}
Also used : ServiceException(com.zimbra.common.service.ServiceException) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) Pair(com.zimbra.common.util.Pair)

Example 74 with SoapProvisioning

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

the class ProvUtil method doGetAllAlwaysOnClusters.

private void doGetAllAlwaysOnClusters(String[] args) throws ServiceException {
    boolean verbose = false;
    int i = 1;
    while (i < args.length) {
        String arg = args[i];
        if (arg.equals("-v")) {
            verbose = true;
        }
        i++;
    }
    List<AlwaysOnCluster> clusters;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        clusters = soapProv.getAllAlwaysOnClusters();
    } else {
        clusters = prov.getAllAlwaysOnClusters();
    }
    for (AlwaysOnCluster cluster : clusters) {
        if (verbose) {
            dumpAlwaysOnCluster(cluster, null);
        } else {
            console.println(cluster.getName());
        }
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 75 with SoapProvisioning

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

the class ProvUtil method doGetIndexStats.

private void doGetIndexStats(String[] args) throws ServiceException {
    if (!(prov instanceof SoapProvisioning)) {
        throwSoapOnly();
    }
    SoapProvisioning sp = (SoapProvisioning) prov;
    Account acct = lookupAccount(args[1]);
    IndexStatsInfo stats = sp.getIndexStats(acct);
    console.printf("stats: maxDocs:%d numDeletedDocs:%d\n", stats.getMaxDocs(), stats.getNumDeletedDocs());
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) IndexStatsInfo(com.zimbra.cs.account.soap.SoapProvisioning.IndexStatsInfo)

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