Package com.taobao.zeus.model

Examples of com.taobao.zeus.model.GroupDescriptor


    }

    @Override
    public GroupBean getDownstreamGroupBean(String groupId) {
      ReadOnlyGroupDescriptor readGd=null;
      GroupDescriptor group=getGroupDescriptor(groupId);
      if(group instanceof ReadOnlyGroupDescriptor){
        readGd=(ReadOnlyGroupDescriptor) group;
      }else{
        readGd=new ReadOnlyGroupDescriptor(group);
      }
View Full Code Here


 
  public static GroupDescriptor convert(GroupPersistence persist){
    if(persist==null){
      return null;
    }
    GroupDescriptor gd=new GroupDescriptor();
    gd.setId(String.valueOf(persist.getId()));
    gd.setParent(persist.getParent()==null?null:String.valueOf(persist.getParent()));
    gd.setName(persist.getName());
    gd.setOwner(persist.getOwner());
    gd.setDesc(persist.getDescr());
    gd.setDirectory(persist.getDirectory()==0?true:false);
    if(persist.getConfigs()!=null){
      JSONObject object=JSONObject.fromObject(persist.getConfigs());
      gd.setProperties(new HashMap<String, String>());
      for(Object key:object.keySet()){
        gd.getProperties().put(key.toString(), object.getString(key.toString()));
      }
    }
    String cp=persist.getResources();
    gd.setResources(new ArrayList<Map<String,String>>());
   
    if(persist.getResources()!=null){
      JSONArray resArray=JSONArray.fromObject(cp);
      for(int i=0;i<resArray.size();i++){
        Map<String, String> map=new HashMap<String, String>();
        JSONObject o=resArray.getJSONObject(i);
        for(Object key:o.keySet()){
          map.put(key.toString(), o.getString(key.toString()));
        }
        gd.getResources().add(map);
      }
    }
   
    return gd;
  }
View Full Code Here

  }


  @Override
  public GroupBean getDownstreamGroupBean(String groupId) {
    GroupDescriptor group=getGroupDescriptor(groupId);
    GroupBean result=new GroupBean(group);
    return getDownstreamGroupBean(result);
  }
View Full Code Here

  public GroupDescriptor createGroup(String user, String groupName,
      String parentGroup, boolean isDirectory) throws ZeusException {
    if(parentGroup==null){
      throw new ZeusException("parent group may not be null");
    }
    GroupDescriptor group=new GroupDescriptor();
    group.setOwner(user);
    group.setName(groupName);
    group.setParent(parentGroup);
    group.setDirectory(isDirectory);
   
   
   
    GroupValidate.valide(group);
   
View Full Code Here

  }

  @Override
  public JobDescriptor createJob(String user, String jobName,
      String parentGroup,JobRunType jobType) throws ZeusException {
    GroupDescriptor parent=getGroupDescriptor(parentGroup);
    if(parent.isDirectory()){
      throw new ZeusException("目录组下不得创建Job");
    }
    JobDescriptor job=new JobDescriptor();
    job.setOwner(user);
    job.setName(jobName);
View Full Code Here

    return tuple.getY();
  }

  @Override
  public void grantGroupOwner(String granter, String uid, String groupId) throws ZeusException {
    GroupDescriptor gd=getGroupDescriptor(groupId);
    if(gd!=null){
      updateGroup(granter, gd,uid,gd.getParent());
    }
  }
View Full Code Here

  }

  @Override
  public void moveJob(String uid,String jobId, String groupId) throws ZeusException {
    JobDescriptor jd=getJobDescriptor(jobId).getX();
    GroupDescriptor gd=getGroupDescriptor(groupId);
    if(gd.isDirectory()){
      throw new ZeusException("非法操作");
    }
    updateJob(uid, jd, jd.getOwner(), groupId);
  }
View Full Code Here

  }

  @Override
  public void moveGroup(String uid,String groupId, String newParentGroupId)
      throws ZeusException {
    GroupDescriptor gd=getGroupDescriptor(groupId);
    GroupDescriptor parent=getGroupDescriptor(newParentGroupId);
    if(!parent.isDirectory()){
      throw new ZeusException("非法操作");
    }
    updateGroup(uid, gd, gd.getOwner(), newParentGroupId);
  }
View Full Code Here

    return list;
  }

  @Override
  public GroupBean getDownstreamGroupBean(String groupId) {
    GroupDescriptor group=getGroupDescriptor(groupId);
    GroupBean result=new GroupBean(group);
    return getDownstreamGroupBean(result);
  }
View Full Code Here

import com.taobao.zeus.util.Tuple;

public class GroupManagerTool {

  public static GroupBean getUpstreamGroupBean(String groupId,GroupManager groupManager) {
    GroupDescriptor group=groupManager.getGroupDescriptor(groupId);
    GroupBean result=new GroupBean(group);
    if(group.getParent()!=null){
      GroupBean parent=groupManager.getUpstreamGroupBean(group.getParent());
      result.setParentGroupBean(parent);
    }
    return result;
  }
View Full Code Here

TOP

Related Classes of com.taobao.zeus.model.GroupDescriptor

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.