@Override
public Result execute(Session session) throws StatementException {
Cache<Object, Object> cache = session.getCache(siteData != null ? siteData.getCacheName() : null);
String siteName = siteData != null ? siteData.getSiteName() : null;
XSiteAdminOperations xsiteAdmin = cache.getAdvancedCache().getComponentRegistry().getComponent(XSiteAdminOperations.class);
for (Option opt : options) {
switch (opt.toEnum(Options.class)) {
case STATUS: {
String status = siteName == null ? xsiteAdmin.status() : xsiteAdmin.siteStatus(siteName);
return new StringResult(status);
}
case ONLINE: {
if (siteName != null) {
return new StringResult(xsiteAdmin.bringSiteOnline(siteName));
} else {
throw log.siteNameNotSpecified();
}
}
case OFFLINE: {
if (siteName != null) {
return new StringResult(xsiteAdmin.takeSiteOffline(siteName));
} else {
throw log.siteNameNotSpecified();
}
}
}