org.infinispan.xsite.status.AbstractMixedSiteStatus Maven / Gradle / Ivy
package org.infinispan.xsite.status;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Collections;
import java.util.List;
/**
* Abstract class to create mixed {@link SiteStatus}.
*
* Mixed {@link SiteStatus} are status in which some considers the site to be online and other to be offline.
*
* @author Pedro Ruivo
* @since 8.2
*/
public abstract class AbstractMixedSiteStatus implements SiteStatus {
protected final List online;
protected final List offline;
protected AbstractMixedSiteStatus(Collection online, Collection offline) {
this.online = toImmutable(online);
this.offline = toImmutable(offline);
}
protected static List toImmutable(Collection collection) {
return Collections.unmodifiableList(new ArrayList<>(collection));
}
@Override
public final boolean isOnline() {
return false;
}
@Override
public final boolean isOffline() {
return false;
}
public List getOnline() {
return online;
}
public List getOffline() {
return offline;
}
}