package org.jboss.as.console.client.v3.stores.domain;
import javax.annotation.Generated;
import javax.enterprise.context.ApplicationScoped;
import javax.inject.Inject;
import org.jboss.gwt.circuit.Action;
import org.jboss.gwt.circuit.Agreement;
import org.jboss.gwt.circuit.Dispatcher;
import org.jboss.gwt.circuit.PropagatesChange.Handler;
import org.jboss.gwt.circuit.StoreCallback;
/*
* WARNING! This class is generated. Do not modify.
*/
@ApplicationScoped
@Generated("org.jboss.gwt.circuit.processor.StoreProcessor")
public class HostStoreAdapter {
private final HostStore delegate;
@Inject
public HostStoreAdapter(final HostStore delegate, final Dispatcher dispatcher) {
this.delegate = delegate;
dispatcher.register(HostStore.class, new StoreCallback() {
@Override
public Agreement voteFor(final Action action) {
if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RefreshServer) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RemoveServer) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RefreshHosts) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.HostSelection) {
return new Agreement(true);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.SelectServerInstance) {
return new Agreement(true);
}
else {
return Agreement.NONE;
}
}
@Override
public void complete(final Action action, final Dispatcher.Channel channel) {
if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RefreshServer) {
delegate.onRefreshServer(channel);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RemoveServer) {
delegate.onRemoveServer(((org.jboss.as.console.client.v3.stores.domain.actions.RemoveServer)action).getPayload(), channel);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.RefreshHosts) {
delegate.onRefreshHosts(channel);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.HostSelection) {
delegate.onSelectHost(((org.jboss.as.console.client.v3.stores.domain.actions.HostSelection)action).getPayload(), channel);
}
else if (action instanceof org.jboss.as.console.client.v3.stores.domain.actions.SelectServerInstance) {
delegate.onSelectedServer(((org.jboss.as.console.client.v3.stores.domain.actions.SelectServerInstance)action).getPayload(), channel);
}
else {
System.out.println("WARN: Unmatched action " + action.getClass().getName() + " in store " + delegate.getClass());
channel.ack();
}
}
@Override
public void signalChange(final Action action) {
Class<? extends Action> actionType = action.getClass();
Iterable<Handler> actionHandlers = delegate.getActionHandler(actionType);
for (Handler actionHandler : actionHandlers) {
actionHandler.onChange(actionType);
}
Iterable<Handler> storeHandlers = delegate.getHandler();
for (Handler storeHandler : storeHandlers) {
storeHandler.onChange(actionType);
}
}
});
}
}