@Override public Object set(ATTRIBUTES attribute, Object value) throws IOException { if (attribute == null) throw new IllegalArgumentException("attribute is null"); final String stringValue = value != null ? value.toString() : null; switch (attribute) { case STATUS: { if (stringValue == null) throw new IllegalStateException("Value of attribute is null."); return storageLocal.setClusterStatus(id, OStorageClusterConfiguration.STATUS .valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance()))); } default: throw new IllegalArgumentException( "Runtime change of attribute '" + attribute + " is not supported on Offline cluster " + getName()); } }
status = OStorageClusterConfiguration.STATUS.valueOf(read(values[index++]));
write(buffer, paginatedClusterConfiguration.conflictStrategy); if (iNetworkVersion > 25) write(buffer, paginatedClusterConfiguration.getStatus().name());
.valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance())));
.valueOf(stringValue.toUpperCase(storageLocal.getConfiguration().getLocaleInstance())));
/** * Execute the ALTER CLASS. */ public Object execute(final Map<Object, Object> iArgs) { if (attribute == null) throw new OCommandExecutionException("Cannot execute the command because it has not been parsed yet"); final List<OCluster> clusters = getClusters(); if (clusters.isEmpty()) throw new OCommandExecutionException("Cluster '" + clusterName + "' not found"); Object result = null; for (OCluster cluster : getClusters()) { if (clusterId > -1 && clusterName.equals(String.valueOf(clusterId))) { clusterName = cluster.getName(); } else { clusterId = cluster.getId(); } try { if (attribute == ATTRIBUTES.STATUS && OStorageClusterConfiguration.STATUS.OFFLINE.toString().equalsIgnoreCase(value)) // REMOVE CACHE OF COMMAND RESULTS IF ACTIVE getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName); if (attribute == ATTRIBUTES.NAME) // REMOVE CACHE OF COMMAND RESULTS IF ACTIVE getDatabase().getMetadata().getCommandCache().invalidateResultsOfCluster(clusterName); result = cluster.set(attribute, value); } catch (IOException ioe) { throw OException.wrapException(new OCommandExecutionException("Error altering cluster '" + clusterName + "'"), ioe); } } return result; }