Package org.jvnet.glassfish.comms.admin.clbadmin.reader.api

Examples of org.jvnet.glassfish.comms.admin.clbadmin.reader.api.LoadbalancerReader


        } else {
            filePath = newConfigFileName;
        }

        // check if the lb exists
        LoadbalancerReader lbr = getLbReader(_ctx, _name);
        FileOutputStream out = null;

        try {
            out = new FileOutputStream(filePath);

            // tranform the data using visitor pattern
            Loadbalancer _lb = new Loadbalancer();

            LoadbalancerVisitor lbVstr = new LoadbalancerVisitor(_lb);
            lbr.accept(lbVstr);

            ObjectFactory clbFactory = new ObjectFactory();
            clbFactory.store(_lb, out);
            out.flush();
            if (!ClbAdminEventHelper.isClbDebug())
View Full Code Here


    }
   
    public String getClbXML() {
        ByteArrayOutputStream baos = new ByteArrayOutputStream();
        try {
            LoadbalancerReader lbr = _clbp.getLbReader(_ctx, _name);
            // tranform the data using visitor pattern
            Loadbalancer _lb = new Loadbalancer();
            LoadbalancerVisitor lbVstr = new LoadbalancerVisitor(_lb);
            lbr.accept(lbVstr);
            ObjectFactory clbFactory = new ObjectFactory();
            clbFactory.store(_lb, baos);
        } catch (Exception e) {
            System.out.println(e.getMessage());
        }
View Full Code Here

    /**
     * Visit reader class
     */
    public void visit(BaseReader br) {
        // FIXME, make as assert here about no class cast exception
        LoadbalancerReader lbRdr = (LoadbalancerReader) br;

        try {
            _lb.setHttpPolicy(lbRdr.getHttpPolicy());
            _lb.setSipPolicy(lbRdr.getSipPolicy());
            _lb.setDcrFile(lbRdr.getDcrFile());
        } catch (LbReaderException le) {
            // XXX ignore
        }

        Property prop = null;
        PropertyReader[] pRdrs = null;

        try {
            pRdrs = lbRdr.getProperties();
        } catch (LbReaderException le) {
            // should we throw this exception XXX ???
            // or fill in with default values
        }

        if ((pRdrs != null) && (pRdrs.length > 0)) {
            for (int i = 0; i < pRdrs.length; i++) {
                prop = new Property();
                pRdrs[i].accept(new PropertyVisitor(prop));
                _lb.getProperty().add(prop);
            }
        }

        ClusterReader[] cRdrs = null;

        try {
            cRdrs = lbRdr.getClusters();
        } catch (LbReaderException le) {
            // should we throw this exception XXX ???
            // or fill in with default values
        }

View Full Code Here

TOP

Related Classes of org.jvnet.glassfish.comms.admin.clbadmin.reader.api.LoadbalancerReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.