org.jboss.as.console.client.shared.state.ReloadState Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of switchyard-console-as7-core
Show all versions of switchyard-console-as7-core
Bundles the core AS7 console as a GWT module. Includes minor customizations to support extensions.
package org.jboss.as.console.client.shared.state;
import org.jboss.as.console.client.Console;
import javax.inject.Singleton;
import java.util.HashMap;
import java.util.Map;
/**
* @author Heiko Braun
* @date 12/14/11
*/
@Singleton
public class ReloadState {
private Map serverStates = new HashMap();
private int lastFiredSize = 0;
public boolean isStaleModel() {
return serverStates.size()>0;
}
public void reset() {
serverStates.clear();
lastFiredSize = 0;
}
public void setReloadRequired(String name, boolean willBeRequired) {
if(willBeRequired)
{
ServerState state = new ServerState(name);
state.setReloadRequired(true);
serverStates.put(name, state);
}
}
public void setRestartRequired(String name, boolean willBeRequired) {
if(willBeRequired)
{
ServerState state = new ServerState(name);
state.setRestartRequired(true);
serverStates.put(name, state);
}
}
public void propagateChanges() {
if(isStaleModel() && lastFiredSize");
for(ServerState server : serverStates.values())
{
sb.append("").append(server.getName());
}
sb.append("");
// state update, fire notification
Console.warning(Console.CONSTANTS.server_instance_reloadRequired(), sb.toString(), true);
}
}
public void resetServer(String name) {
serverStates.remove(name);
lastFiredSize--;
}
}