Package com.taobao.zeus.store

Examples of com.taobao.zeus.store.JobBean


                + File.separator + date + File.separator
                + "manual-" + history.getId());
            if (!direcotry.exists()) {
              direcotry.mkdirs();
            }
            JobBean jb = context.getGroupManager()
                .getUpstreamJobBean(history.getJobId());

            final Job job = JobUtils.createJob(new JobContext(JobContext.MANUAL_RUN),
                jb, history, direcotry.getAbsolutePath(),
                context.getApplicationContext());
View Full Code Here


            history.setExecuteHost(WorkerContext.host);
            history.setStartTime(new Date());
            context.getJobHistoryManager()
                .updateJobHistory(history);

            JobBean jb = context.getGroupManager()
                .getUpstreamJobBean(history.getJobId());
            String date = new SimpleDateFormat("yyyy-MM-dd")
                .format(new Date());
            File direcotry = new File(Environment.getDownloadPath()
                + File.separator + date + File.separator
View Full Code Here

  public GroupJobTreeModel getMyTreeData() {
    String uid=LoginUser.getUser().getUid();
    GroupBean rootGroup=readOnlyGroupManager.getGlobeGroupBeanForTreeDisplay(true);
    Map<String, JobBean> allJobs=rootGroup.getAllSubJobBeans();
    for(String key:allJobs.keySet()){
      JobBean bean=allJobs.get(key);
      //不是owner,删除
      if(!bean.getJobDescriptor().getOwner().equals(uid)){
        bean.getGroupBean().getJobBeans().remove(key);
      }
    }
   
    Map<String, GroupBean> allGroups=rootGroup.getAllSubGroupBeans();
    List<GroupBean> leafGroups=new ArrayList<GroupBean>();
    for(GroupBean bean:allGroups.values()){
      if(!bean.isDirectory() || bean.getChildrenGroupBeans().isEmpty()){
        leafGroups.add(bean);
      }
    }
    for(GroupBean bean:leafGroups){
      recursionRemove(bean, uid);
View Full Code Here

  }

  @Override
  public GroupJobTreeModel getDependeeTree(String jobId) {
    GroupBean globe=readOnlyGroupManager.getGlobeGroupBean();
    JobBean jb=globe.getAllSubJobBeans().get(jobId);
    if(jb!=null){
      GroupJobTreeModel root=new GroupJobTreeModel();
      root.setName(jb.getJobDescriptor().getName());
      root.setId(jb.getJobDescriptor().getId());
      root.setGroup(false);
      root.setDirectory(jb.getDependee().isEmpty()?false:true);
      root.setJob(true);
      root.setOwner(jb.getJobDescriptor().getOwner());
     
      setJob(root,jb.getDependee(),true);
      return root;
    }
    return null;
  }
View Full Code Here

  }

  @Override
  public GroupJobTreeModel getDependerTree(String jobId) {
    GroupBean globe=readOnlyGroupManager.getGlobeGroupBean();
    JobBean jb=globe.getAllSubJobBeans().get(jobId);
    if(jb!=null){
      GroupJobTreeModel root=new GroupJobTreeModel();
      root.setName(jb.getJobDescriptor().getName());
      root.setId(jb.getJobDescriptor().getId());
      root.setGroup(false);
      root.setDirectory(jb.getDepender().isEmpty()?false:true);
      root.setJob(true);
      root.setOwner(jb.getJobDescriptor().getOwner());
     
      setJob(root,jb.getDepender(),false);
      return root;
    }
    return null;
  }
View Full Code Here

  }
  private Boolean isGroupOwner(String uid,String groupId){
    return isGroupOwner(uid, groupManager.getUpstreamGroupBean(groupId));
  }
  private Boolean isJobOwner(String uid,String jobId){
    JobBean jb=groupManager.getUpstreamJobBean(jobId);
    if(jb.getJobDescriptor().getOwner().equalsIgnoreCase(uid)){
      return true;
    }
    return isGroupOwner(uid, jb.getGroupBean());
  }
View Full Code Here

      throw new ZeusException("您无权操作");
    }
  }
  @Override
  public void grantJobOwner(String granter, String uid, String jobId) throws ZeusException{
    JobBean jb=groupManager.getUpstreamJobBean(jobId);
    List<String> owners=new ArrayList<String>();
    owners.add(jb.getJobDescriptor().getOwner());
    GroupBean gb=jb.getGroupBean();
    while(gb!=null){
      if(!owners.contains(gb.getGroupDescriptor().getOwner())){
        owners.add(gb.getGroupDescriptor().getOwner());
      }
      gb=gb.getParentGroupBean();
View Full Code Here

      throw new GwtException(e.getMessage());
    }
  }
  @Override
  public JobModel getUpstreamJob(String jobId) throws GwtException {
    JobBean jobBean=permissionGroupManager.getUpstreamJobBean(jobId);
    JobModel jobModel=new JobModel();
   
    jobModel.setCronExpression(jobBean.getJobDescriptor().getCronExpression());
    jobModel.setDependencies(jobBean.getJobDescriptor().getDependencies());
    jobModel.setDesc(jobBean.getJobDescriptor().getDesc());
    jobModel.setGroupId(jobBean.getJobDescriptor().getGroupId());
    jobModel.setId(jobBean.getJobDescriptor().getId());
    String jobRunType=null;
    if(jobBean.getJobDescriptor().getJobType()==JobRunType.MapReduce){
      jobRunType=JobModel.MapReduce;
    }else if(jobBean.getJobDescriptor().getJobType()==JobRunType.Shell){
      jobRunType=JobModel.SHELL;
    }else if(jobBean.getJobDescriptor().getJobType()==JobRunType.Hive){
      jobRunType=JobModel.HIVE;
    }
    jobModel.setJobRunType(jobRunType);
    String jobScheduleType=null;
    if(jobBean.getJobDescriptor().getScheduleType()==JobScheduleType.Dependent){
      jobScheduleType=JobModel.DEPEND_JOB;
    }else if(jobBean.getJobDescriptor().getScheduleType()==JobScheduleType.Independent){
      jobScheduleType=JobModel.INDEPEN_JOB;
    }
    jobModel.setJobScheduleType(jobScheduleType);
    jobModel.setLocalProperties(jobBean.getJobDescriptor().getProperties());
    jobModel.setName(jobBean.getJobDescriptor().getName());
    jobModel.setOwner(jobBean.getJobDescriptor().getOwner());
    String ownerName=userManager.findByUid(jobModel.getOwner()).getName();
    if(ownerName==null || "".equals(ownerName.trim()) || "null".equals(ownerName)){
      ownerName=jobModel.getOwner();
    }
    jobModel.setOwnerName(ownerName);
    jobModel.setLocalResources(jobBean.getJobDescriptor().getResources());
    jobModel.setAllProperties(jobBean.getHierarchyProperties().getAllProperties());
    jobModel.setAllResources(jobBean.getHierarchyResources());
    
    jobModel.setAuto(jobBean.getJobDescriptor().getAuto());
    jobModel.setScript(jobBean.getJobDescriptor().getScript());
   
    List<String> preList=new ArrayList<String>();
    if(!jobBean.getJobDescriptor().getPreProcessers().isEmpty()){
      for(Processer p:jobBean.getJobDescriptor().getPreProcessers()){
        JSONObject o=new JSONObject();
        o.put("id", p.getId());
        o.put("config", p.getConfig());
        preList.add(o.toString());
      }
    }
    jobModel.setPreProcessers(preList);
   
    List<String> postList=new ArrayList<String>();
    if(!jobBean.getJobDescriptor().getPostProcessers().isEmpty()){
      for(Processer p:jobBean.getJobDescriptor().getPostProcessers()){
        JSONObject o=new JSONObject();
        o.put("id", p.getId());
        o.put("config", p.getConfig());
        postList.add(o.toString());
      }
    }
    jobModel.setPostProcessers(postList);
   
    jobModel.setAdmin(permissionGroupManager.hasJobPermission(LoginUser.getUser().getUid(), jobId));
   
    List<ZeusFollow> follows=followManager.findJobFollowers(jobId);
    if(follows!=null){
      List<String> followNames=new ArrayList<String>();
      for(ZeusFollow zf:follows){
        String name=userManager.findByUid(zf.getUid()).getName();
        if(name==null || "".equals(name.trim())){
          name=zf.getUid();
        }
        followNames.add(name);
      }
      jobModel.setFollows(followNames);
    }
    List<String> ladmins=permissionManager.getJobAdmins(jobId);
    List<String> admins=new ArrayList<String>();
    for(String s:ladmins){
      String name=userManager.findByUid(s).getName();
      if(name==null || "".equals(name.trim()) || "null".equals(name)){
        name=s;
      }
      admins.add(name);
    }
    jobModel.setAdmins(admins);
   
    List<String> owners=new ArrayList<String>();
    owners.add(jobBean.getJobDescriptor().getOwner());
    GroupBean parent=jobBean.getGroupBean();
    while(parent!=null){
      if(!owners.contains(parent.getGroupDescriptor().getOwner())){
        owners.add(parent.getGroupDescriptor().getOwner());
      }
      parent=parent.getParentGroupBean();
View Full Code Here

TOP

Related Classes of com.taobao.zeus.store.JobBean

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.