this.status = status.toUpperCase().trim();
}
public void setStatus(String status) throws ConfigurationException {
if (!STATUS.contains(status.toUpperCase()))
throw new ConfigurationException("failed to set volume status {newstatus='"+status+"'}",logger);
int newStatusID = STATUS.indexOf(status);
int oldStatusID = STATUS.indexOf(this.status);
logger.debug("setStatus {newstatusid='"+newStatusID+"',oldstatusid='"+oldStatusID+"'}");
if (newStatusID==oldStatusID)
return;
switch(oldStatusID) {
case CLOSED: throw new ConfigurationException("failed to change volume status. it is closed {newstatus='"+status+"'}",logger);
case ACTIVE: if (newStatusID!=CLOSED)
throw new ConfigurationException("failed to change volume status. it can only be closed {newstatus='"+status+"'}",logger);
break;
case UNUSED: if (newStatusID!=ACTIVE)
throw new ConfigurationException("failed to change volume status. it can only be made active {newstatus='"+status+"'}",logger);
break;
case NEW: if (newStatusID!=UNUSED)
throw new ConfigurationException("failed to change volume status. it can only be made active {newstatus='"+status+"'}",logger);
break;
default: throw new ConfigurationException("failed to change volume status. internal status is set to invalid value.",logger);
}
this.status = status.toUpperCase().trim();
}