Package com.hetty.plugin

Source Code of com.hetty.plugin.XmlConfigPlugin

package com.hetty.plugin;

import java.util.List;

import com.hetty.conf.HettyConfig;
import com.hetty.conf.XmlConfigParser;
import com.hetty.core.HettySecurity;
import com.hetty.core.ServiceHandler;
import com.hetty.object.Application;
import com.hetty.object.Service;
import com.hetty.object.ServiceVersion;

public class XmlConfigPlugin implements IPlugin{

  @Override
  public boolean start() {
    String configFile = HettyConfig.getInstance().getpropertiesFile();
    String[] fileArr = configFile.split(",");
   
    for(String file:fileArr){
      XmlConfigParser configParser = new XmlConfigParser(file);
     
      List<Application> appList = configParser.parseApplication();
      for(Application app:appList){
        HettySecurity.addToApplicationMap(app);
      }
     
      List<Service> serviceList = configParser.parseService();
      for(Service service:serviceList){
        ServiceHandler.addToServiceMap(service);
      }
     
      List<ServiceVersion>  versionList = configParser.parseSecurity();
      if(versionList != null){
        for(ServiceVersion version:versionList){
          ServiceHandler.addToVersionMap(version);
        }
      }
    }
    return true;
  }

  @Override
  public boolean stop() {
    // TODO Auto-generated method stub
    return false;
  }

}
TOP

Related Classes of com.hetty.plugin.XmlConfigPlugin

TOP
Copyright © 2018 www.massapi.com. 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.