Search in sources :

Example 1 with PropertyReader

use of org.glassfish.loadbalancer.admin.cli.reader.api.PropertyReader in project Payara by payara.

the class LoadbalancerVisitor 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 LoadbalancerReader) {
        LoadbalancerReader lbRdr = (LoadbalancerReader) br;
        PropertyReader[] pRdrs = lbRdr.getProperties();
        if ((pRdrs != null) && (pRdrs.length > 0)) {
            Property[] props = new Property[pRdrs.length];
            for (int i = 0; i < pRdrs.length; i++) {
                props[i] = new Property();
                pRdrs[i].accept(new PropertyVisitor(props[i]));
            }
            _lb.setProperty2(props);
        }
        ClusterReader[] cRdrs = lbRdr.getClusters();
        if ((cRdrs != null) && (cRdrs.length > 0)) {
            Cluster[] cls = new Cluster[cRdrs.length];
            for (int i = 0; i < cRdrs.length; i++) {
                cls[i] = new Cluster();
                cRdrs[i].accept(new ClusterVisitor(cls[i]));
            }
            _lb.setCluster(cls);
        }
    }
}
Also used : ClusterReader(org.glassfish.loadbalancer.admin.cli.reader.api.ClusterReader) Cluster(org.glassfish.loadbalancer.admin.cli.beans.Cluster) LoadbalancerReader(org.glassfish.loadbalancer.admin.cli.reader.api.LoadbalancerReader) PropertyReader(org.glassfish.loadbalancer.admin.cli.reader.api.PropertyReader) Property(org.glassfish.loadbalancer.admin.cli.beans.Property)

Example 2 with PropertyReader

use of org.glassfish.loadbalancer.admin.cli.reader.api.PropertyReader in project Payara by payara.

the class PropertyVisitor 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 PropertyReader) {
        PropertyReader pRdr = (PropertyReader) br;
        _prop.setName(pRdr.getName());
        _prop.setValue(pRdr.getValue());
        _prop.setDescription(pRdr.getDescription());
    }
}
Also used : PropertyReader(org.glassfish.loadbalancer.admin.cli.reader.api.PropertyReader)

Aggregations

PropertyReader (org.glassfish.loadbalancer.admin.cli.reader.api.PropertyReader)2 Cluster (org.glassfish.loadbalancer.admin.cli.beans.Cluster)1 Property (org.glassfish.loadbalancer.admin.cli.beans.Property)1 ClusterReader (org.glassfish.loadbalancer.admin.cli.reader.api.ClusterReader)1 LoadbalancerReader (org.glassfish.loadbalancer.admin.cli.reader.api.LoadbalancerReader)1