예제 #1
0
 private List<Owner> toOverrideLiset(List<Provider> pList, List<Override> cList) {
   Map<String, Owner> oList = new HashMap<String, Owner>();
   for (Provider p : pList) {
     if (p.getUsername() != null) {
       for (String username : Constants.COMMA_SPLIT_PATTERN.split(p.getUsername())) {
         Owner o = new Owner();
         o.setService(p.getService());
         o.setUsername(username);
         oList.put(o.getService() + "/" + o.getUsername(), o);
       }
     }
   }
   for (Override c : cList) {
     Map<String, String> params = StringUtils.parseQueryString(c.getParams());
     String usernames = params.get("owner");
     if (usernames != null && usernames.length() > 0) {
       for (String username : Constants.COMMA_SPLIT_PATTERN.split(usernames)) {
         Owner o = new Owner();
         o.setService(c.getService());
         o.setUsername(username);
         oList.put(o.getService() + "/" + o.getUsername(), o);
       }
     }
   }
   return new ArrayList<Owner>(oList.values());
 }
 @Override
 public void afterPropertiesSet() throws Exception {
   String zookeepers = ConfigUtils.getProperty("peeper.zookeepers");
   if (!StringUtils.isEmpty(zookeepers)) {
     String[] zookeeperArray = Constants.COMMA_SPLIT_PATTERN.split(zookeepers);
     for (String zk : zookeeperArray) {
       ZooKeeper zooKeeper =
           new ZooKeeper(
               zk,
               Integer.parseInt(
                   ConfigUtils.getProperty("peeper.zookeeper.session.timeout", "60000")),
               new ZkWatcher(zk));
       ZK_CLIENT_MAP.put(zk, zooKeeper);
     }
   }
 }