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;
}
}
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());
}
}
}
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");
}
}
}
}
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());
}
}
}
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());
}
Aggregations