Package com.taobao.zeus.model

Examples of com.taobao.zeus.model.FileDescriptor


  @Override
  public Integer run() throws Exception {
    String jobId=null;
    String historyId=null;
    boolean isDebug=false;
    FileDescriptor fd=null;
    if(jobContext.getDebugHistory()!=null){
      isDebug = true;
      fd = fileManager.getFile(jobContext.getDebugHistory().getFileId());
    }else {
      jobId=jobContext.getJobHistory().getJobId();
View Full Code Here


    String fileID=null;
    if(fileID==null){
      return false;
    }
    try {
      FileDescriptor file = fileManager.getFile(fileID);
      File f = new File(jobContext.getWorkDir() + File.separator
          + UDF_SQL_NAME);
      if (f.exists()) {
        f.delete();
      }
      FileWriter fos = new FileWriter(f);
      fos.write(file.getContent());
      fos.flush();
      fos.close();
      return true;
    } catch (Exception e) {
      log("获取同步表脚本失败");
View Full Code Here

 
  public static FileDescriptor convert(FilePersistence persistence){
    if(persistence==null){
      return null;
    }
    FileDescriptor file=new FileDescriptor();
    file.setId(persistence.getId()==null?null:persistence.getId().toString());
    file.setContent(persistence.getContent());
    file.setFolder(persistence.getType()==FilePersistence.FOLDER?true:false);
    file.setName(persistence.getName());
    file.setOwner(persistence.getOwner());
    file.setParent(persistence.getParent()==null?null:persistence.getParent().toString());
    file.setGmtCreate(persistence.getGmtCreate());
    file.setGmtModified(persistence.getGmtModified());
    return file;
  }
View Full Code Here

      String referScript = null;
      String path = uri.substring(uri.lastIndexOf('/')+1);
      Map<String, String> map = new HashMap<String, String>(2);
      if(uri.startsWith("doc://")){
        FileManager manager = (FileManager) context.getBean("fileManager");
        FileDescriptor fd = manager.getFile(path);
        name = fd.getName();
        // 把脚本放到map里,减少后面一次getFile调用
        referScript = fd.getContent();
      }
      if(args.length>1){
        name = "";
        for(int i=1;i<args.length;i++) {
          if(i>1) {
View Full Code Here

      }
      String historyId = entry.getKey();
      DebugHistory his = context.getDebugHistoryManager()
          .findDebugHistory(historyId);
      long maxTime;
      FileDescriptor fd;
      try {
        fd = context.getFileManager().getFile(his.getFileId());
        Profile pf = context.getProfileManager().findByUid(
            fd.getOwner());
        String maxTimeString = pf.getHadoopConf().get(
            "zeus.job.maxtime");
        if (maxTimeString == null || maxTimeString.trim().isEmpty()) {
          continue;
        }
View Full Code Here

  public void beforeDispatch(MvcEvent mvce) {
    try {
      if(mvce.getAppEvent() instanceof DebugFailEvent){
        final DebugFailEvent event=(DebugFailEvent) mvce.getAppEvent();
        DebugHistory history=event.getHistory();
        FileDescriptor fd=fileManager.getFile(history.getFileId());
       
        String msg="调试任务:"+fd.getName()+" 运行失败";
        //此处可以发送IM消息
      }else if(mvce.getAppEvent() instanceof DebugSuccessEvent){
        final DebugSuccessEvent event=(DebugSuccessEvent) mvce.getAppEvent();
        DebugHistory history=event.getHistory();
        FileDescriptor fd=fileManager.getFile(history.getFileId());
       
        String msg="调试任务:"+fd.getName()+" 运行成功";
        //此处可以发送IM消息
      }
    } catch (Exception e) {
      //处理异常,防止后续的依赖任务受此影响,无法正常执行
      log.error("失败任务,发送通知出现异常",e);
View Full Code Here

  @Qualifier("userManager")
  private UserManager userManager;
  @Override
  public FileModel addFile(String parentId, String name, boolean folder) {
    String uid=LoginUser.getUser().getUid();
    FileDescriptor parent=fileManager.getFile(parentId);
    if(Super.getSupers().contains(uid)|| parent.getOwner().equalsIgnoreCase(uid)){
      FileDescriptor fd= fileManager.addFile(uid, parentId, name, folder);
      return convert(fd);
    }else{
      throw new RuntimeException("权限不足");
    }
  }
View Full Code Here

    return fm;
  }

  @Override
  public void deleteFile(String  fileId) {
    FileDescriptor fd=fileManager.getFile(fileId);
    String user=LoginUser.getUser().getUid();
    if(Super.getSupers().contains(user) || fd.getOwner().equalsIgnoreCase(user)){
      if(fd.getParent()==null && fd.getName().equals(FileManager.SHARE)){
        throw new RuntimeException("此目录不得删除");
      }
      recursionDelete(fd);
    }else{
      throw new RuntimeException("权限不足");
View Full Code Here

  }
 

  @Override
  public FileModel getFile(String id) {
    FileDescriptor fd=fileManager.getFile(id);
    return convert(fd);
  }
View Full Code Here

    return convert(fd);
  }

  @Override
  public void updateFileContent(String fileId, String content) {
    FileDescriptor fd=fileManager.getFile(fileId);
    String user=LoginUser.getUser().getUid();
    if(Super.getSupers().contains(user) || fd.getOwner().equalsIgnoreCase(user)){
      fd.setContent(content);
      fileManager.update(fd);
    }else{
      throw new RuntimeException("权限不足");
    }
  }
View Full Code Here

TOP

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

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.