Search in sources :

Example 1 with WebModule

use of org.glassfish.loadbalancer.admin.cli.beans.WebModule in project Payara by payara.

the class ClusterVisitor method visit.

/**
 * Visit reader class
 */
@Override
public void visit(BaseReader br) throws Exception {
    // FIXME, make as assert here about no class cast exception
    if (br instanceof ClusterReader) {
        ClusterReader cRdr = (ClusterReader) br;
        _c.setName(cRdr.getName());
        _c.setPolicy(cRdr.getLbPolicy());
        _c.setPolicyModule(cRdr.getLbPolicyModule());
        InstanceReader[] iRdrs = null;
        iRdrs = cRdr.getInstances();
        if ((iRdrs != null) && (iRdrs.length > 0)) {
            boolean[] values = new boolean[iRdrs.length];
            // XXX check if setting to true is required and is ok.
            for (int i = 0; i < iRdrs.length; i++) {
                values[i] = true;
            }
            _c.setInstance(values);
            for (int i = 0; i < iRdrs.length; i++) {
                iRdrs[i].accept(new InstanceVisitor(_c, i));
            }
        }
        HealthCheckerReader hcRdr = cRdr.getHealthChecker();
        if (hcRdr != null) {
            hcRdr.accept(new HealthCheckerVisitor(_c));
        }
        WebModuleReader[] wRdrs = cRdr.getWebModules();
        if ((wRdrs != null) && (wRdrs.length > 0)) {
            WebModule[] wMods = new WebModule[wRdrs.length];
            for (int i = 0; i < wRdrs.length; i++) {
                wMods[i] = new WebModule();
                wRdrs[i].accept(new WebModuleVisitor(wMods[i], _c));
            }
            _c.setWebModule(wMods);
        }
    }
}
Also used : HealthCheckerReader(org.glassfish.loadbalancer.admin.cli.reader.api.HealthCheckerReader) WebModuleReader(org.glassfish.loadbalancer.admin.cli.reader.api.WebModuleReader) WebModule(org.glassfish.loadbalancer.admin.cli.beans.WebModule) InstanceReader(org.glassfish.loadbalancer.admin.cli.reader.api.InstanceReader) ClusterReader(org.glassfish.loadbalancer.admin.cli.reader.api.ClusterReader)

Aggregations

WebModule (org.glassfish.loadbalancer.admin.cli.beans.WebModule)1 ClusterReader (org.glassfish.loadbalancer.admin.cli.reader.api.ClusterReader)1 HealthCheckerReader (org.glassfish.loadbalancer.admin.cli.reader.api.HealthCheckerReader)1 InstanceReader (org.glassfish.loadbalancer.admin.cli.reader.api.InstanceReader)1 WebModuleReader (org.glassfish.loadbalancer.admin.cli.reader.api.WebModuleReader)1