FileDocCategorySizeDatePackage
LBInfo.javaAPI DocGlassfish v2 API4845Fri May 04 22:35:04 BST 2007com.sun.enterprise.tools.upgrade.cluster

LBInfo

public class LBInfo extends Object
This class represents Loadbalancer.xml file
author
prakash

Fields Summary
private List
clusters
private Properties
lbProperties
private static Logger
log
private com.sun.enterprise.util.i18n.StringManager
stringManager
Constructors Summary
public LBInfo()
Creates a new instance of LBInfo


           
      
        clusters = new ArrayList();
        lbProperties = new Properties();
    
Methods Summary
public java.util.ListgetClusters()

        return clusters;
    
public java.util.PropertiesgetLbProperties()

        return lbProperties;
    
public booleanprocessLoadBalancerFile(java.lang.String lbFile)

        DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
        //factory.setValidating(false);
        factory.setNamespaceAware(true);
        try {
           DocumentBuilder builder = factory.newDocumentBuilder();
           DocumentBuilder builderDomainXml = factory.newDocumentBuilder();
           builderDomainXml.setEntityResolver((org.xml.sax.helpers.DefaultHandler)Class.forName
                ("com.sun.enterprise.config.serverbeans.ServerValidationHandler").newInstance());
           Element docEle = builderDomainXml.parse(new File(lbFile)).getDocumentElement();
           NodeList clEles = docEle.getElementsByTagName("cluster");
           for(int lh =0; lh < clEles.getLength(); lh++){
               clusters.add(new LBCluster((Element)clEles.item(lh)));
           }
           NodeList propEles = docEle.getElementsByTagName("cluster");
           for(int ph =0; ph < propEles.getLength(); ph++){
               Element propsEle = (Element)propEles.item(ph);
               lbProperties.setProperty(propsEle.getAttribute("name"),propsEle.getAttribute("value"));
           }
        }catch (Exception ex){
            log.severe(stringManager.getString("upgrade.transform.startFailureMessage", ex.getMessage()));
            log.severe(stringManager.getString("upgrade.transform.startFailureCheckAccessMessage"));
            //ex.printStackTrace();  
            return false;
        }
        return true;