use of com.emc.vipr.client.exceptions.ViPRException in project coprhd-controller by CoprHD.
the class FileVirtualPools method save.
@FlashException(keep = true, referrer = { "create", "edit" })
public static void save(FileVirtualPoolForm vpool) {
if (vpool == null) {
list();
}
vpool.deserialize();
vpool.validate("vpool");
if (Validation.hasErrors()) {
Common.handleError();
}
try {
FileVirtualPoolRestRep result = vpool.save();
flash.success(MessagesUtils.get(SAVED_SUCCESS, result.getName()));
backToReferrer();
} catch (ViPRException e) {
throwFlashException(vpool, e);
}
}
use of com.emc.vipr.client.exceptions.ViPRException in project coprhd-controller by CoprHD.
the class Projects method saveProjectACLs.
@Util
private static void saveProjectACLs(String projectId, List<AclEntryForm> aclEntries) {
List<ACLEntry> currentProjectAcls = ProjectUtils.getACLs(projectId);
ACLAssignmentChanges changes = new ACLAssignmentChanges();
changes.getAdd().addAll(AclEntryForm.getAddedAcls(currentProjectAcls, aclEntries));
changes.getRemove().addAll(AclEntryForm.getRemovedAcls(currentProjectAcls, aclEntries));
try {
ProjectUtils.updateACLs(projectId, changes);
} catch (ViPRException e) {
Logger.error(e, "Failed to update Project ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("projects.updateProjectACLs.failed", errorDesc));
}
}
use of com.emc.vipr.client.exceptions.ViPRException in project coprhd-controller by CoprHD.
the class VirtualArrays method saveTenantACLs.
/**
* Saves tenant ACLs on the virtual array.
*
* @param virtualArrayId
* the virtual array ID.
* @param tenants
* the tenant ACLs.
*/
private static void saveTenantACLs(String virtualArrayId, List<String> tenants) {
Set<String> tenantIds = Sets.newHashSet();
if (tenants != null) {
tenantIds.addAll(tenants);
}
ACLUpdateBuilder builder = new ACLUpdateBuilder(VirtualArrayUtils.getACLs(virtualArrayId));
builder.setTenants(tenantIds);
try {
VirtualArrayUtils.updateACLs(virtualArrayId, builder.getACLUpdate());
} catch (ViPRException e) {
Logger.error(e, "Failed to update Virtual Array ACLs");
String errorDesc = e.getMessage();
if (e instanceof ServiceErrorException) {
errorDesc = ((ServiceErrorException) e).getDetailedMessage();
}
flash.error(MessagesUtils.get("varrays.updateVarrayACLs.failed", errorDesc));
}
}
use of com.emc.vipr.client.exceptions.ViPRException in project coprhd-controller by CoprHD.
the class Logs method getAsItems.
/**
* @deprecated Replaced by
* @see #getAsItems(ItemProcessor, Collection, Collection, Collection, Integer, String, String, String, Integer)
*/
@Deprecated
public void getAsItems(ItemProcessor<LogMessage> processor, Collection<String> nodeIds, Collection<String> logNames, Integer severity, String start, String end, String regex, Integer maxCount) {
ListProcessor<LogMessage> listProcessor = new ListProcessor<LogMessage>(LogMessage.class, processor);
InputStream in = getAsStream(nodeIds, logNames, severity, start, end, regex, maxCount);
try {
listProcessor.process(in);
} catch (Exception e) {
throw new ViPRException(e);
} finally {
try {
in.close();
} catch (IOException e) {
// Silently ignore
}
}
}
use of com.emc.vipr.client.exceptions.ViPRException in project coprhd-controller by CoprHD.
the class TaskUtil method waitForTask.
public static TaskResourceRep waitForTask(RestClient client, TaskResourceRep task, long timeoutMillis) {
long startTime = System.currentTimeMillis();
while (isRunning(task) || isSuspended(task)) {
if (timeoutMillis > 0 && (System.currentTimeMillis() - startTime) > timeoutMillis) {
throw new TimeoutException("Timed out waiting for task to complete");
}
try {
Thread.sleep(client.getConfig().getTaskPollingInterval());
} catch (InterruptedException e) {
throw new ViPRException(e);
}
refreshSession(client);
task = refresh(client, task);
}
return task;
}
Aggregations