当前位置: 首页>>代码示例>>Java>>正文


Java Project类代码示例

本文整理汇总了Java中azkaban.project.Project的典型用法代码示例。如果您正苦于以下问题:Java Project类的具体用法?Java Project怎么用?Java Project使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


Project类属于azkaban.project包,在下文中一共展示了Project类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: hasPermission

import azkaban.project.Project; //导入依赖的package包/类
public static boolean hasPermission(Project project, User user,
    Permission.Type type) {
  UserManager userManager = AzkabanWebServer.getInstance().getUserManager();
  if (project.hasPermission(user, type)) {
    return true;
  }

  for (String roleName : user.getRoles()) {
    Role role = userManager.getRole(roleName);
    if (role.getPermission().isPermissionSet(type)
        || role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
      return true;
    }
  }

  return false;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:ResourceUtils.java

示例2: getProjectAjaxByPermission

import azkaban.project.Project; //导入依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret,
                                             int projectId, User user, Permission.Type type) {
    Project project = projectManager.getProject(projectId);

    if (project == null) {
        ret.put("error", "Project '" + project + "' not found.");
    } else if (!hasPermission(project, user, type)) {
        ret.put("error",
                "User '" + user.getUserId() + "' doesn't have " + type.name()
                        + " permissions on " + project.getName());
    } else {
        return project;
    }

    return null;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ScheduleServlet.java

示例3: writeHistoryData

import azkaban.project.Project; //导入依赖的package包/类
private void writeHistoryData(List<HashMap<String, Object>> output,
                              ExecutableFlow history) {
    HashMap<String, Object> data = new HashMap<String, Object>();

    data.put("scheduleid", history.getScheduleId());
    Project project = projectManager.getProject(history.getProjectId());
    data.put("flowname", history.getFlowId());
    data.put("projectname", project.getName());
    data.put("time", history.getStartTime());
    data.put("period", "0");
    long endTime = history.getEndTime();
    if (endTime == -1) {
        endTime = System.currentTimeMillis();
    }
    data.put("length", endTime - history.getStartTime());
    data.put("history", true);
    data.put("status", history.getStatus().getNumVal());

    output.add(data);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:21,代码来源:ScheduleServlet.java

示例4: hasPermission

import azkaban.project.Project; //导入依赖的package包/类
protected boolean hasPermission(Project project, User user,
                                Permission.Type type) {
    UserManager userManager = getApplication().getUserManager();
    if (project.hasPermission(user, type)) {
        return true;
    }

    for (String roleName : user.getRoles()) {
        Role role = userManager.getRole(roleName);
        if (role.getPermission().isPermissionSet(type)
                || role.getPermission().isPermissionSet(Permission.Type.ADMIN)) {
            return true;
        }
    }

    return false;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:LoginAbstractAzkabanServlet.java

示例5: getProjectPageByPermission

import azkaban.project.Project; //导入依赖的package包/类
protected Project getProjectPageByPermission(Page page, int projectId,
                                             User user, Permission.Type type) {
    Project project = projectManager.getProject(projectId);

    if (project == null) {
        page.add("errorMsg", "Project " + project + " not found.");
    } else if (!hasPermission(project, user, type)) {
        page.add("errorMsg",
                "User " + user.getUserId() + " doesn't have " + type.name()
                        + " permissions on " + project.getName());
    } else {
        return project;
    }

    return null;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例6: getProjectAjaxByPermission

import azkaban.project.Project; //导入依赖的package包/类
protected Project getProjectAjaxByPermission(Map<String, Object> ret,
                                             String projectName, User user, Permission.Type type) {
    Project project = projectManager.getProject(projectName);

    if (project == null) {
        ret.put("error", "Project '" + project + "' not found.");
    } else if (!hasPermission(project, user, type)) {
        ret.put("error",
                "User '" + user.getUserId() + "' doesn't have " + type.name()
                        + " permissions on " + project.getName());
    } else {
        return project;
    }

    return null;
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例7: ajaxRestartFailed

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxRestartFailed(HttpServletRequest req,
                               HttpServletResponse resp, HashMap<String, Object> ret, User user,
                               ExecutableFlow exFlow) throws ServletException {
    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user,
                    Type.EXECUTE);
    if (project == null) {
        ret.put("error", "Project " + exFlow.getProjectId() + " doesn't exist.");
        return;
    }

    if (exFlow.getStatus() == Status.FAILED
            || exFlow.getStatus() == Status.SUCCEEDED) {
        ret.put("error", "Flow has already finished. Please re-execute.");
        return;
    }

    try {
        executorManager.retryFailures(exFlow, user.getUserId());
    } catch (ExecutorManagerException e) {
        ret.put("error", e.getMessage());
    }
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:24,代码来源:ExecutorServlet.java

示例8: ajaxCancelFlow

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxCancelFlow(HttpServletRequest req, HttpServletResponse resp,
                            HashMap<String, Object> ret, User user, ExecutableFlow exFlow)
        throws ServletException {
    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user,
                    Type.EXECUTE);
    if (project == null) {
        ret.put("error", "Project " + exFlow.getProjectId() + " doesn't exist");
        return;
    }

    try {
        executorManager.cancelFlow(exFlow, user.getUserId());
    } catch (ExecutorManagerException e) {
        ret.put("error", e.getMessage());
    }
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:ExecutorServlet.java

示例9: ajaxGetFlowRunning

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxGetFlowRunning(HttpServletRequest req,
                                HttpServletResponse resp, HashMap<String, Object> ret, User user,
                                String projectId, String flowId) throws ServletException {
    Project project =
            getProjectAjaxByPermission(ret, projectId, user, Type.EXECUTE);
    if (project == null) {
        ret.put("error", "Project " + projectId + " doesn't exist.");
        return;
    }

    List<Integer> refs =
            executorManager.getRunningFlows(project.getId(), flowId);
    if (!refs.isEmpty()) {
        ret.put("execIds", refs);
    }
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例10: ajaxPauseFlow

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxPauseFlow(HttpServletRequest req, HttpServletResponse resp,
                           HashMap<String, Object> ret, User user, ExecutableFlow exFlow)
        throws ServletException {
    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user,
                    Type.EXECUTE);
    if (project == null) {
        ret.put("error", "Project " + exFlow.getProjectId() + " doesn't exist");
        return;
    }

    try {
        executorManager.pauseFlow(exFlow, user.getUserId());
    } catch (ExecutorManagerException e) {
        ret.put("error", e.getMessage());
    }
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:18,代码来源:ExecutorServlet.java

示例11: ajaxResumeFlow

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxResumeFlow(HttpServletRequest req, HttpServletResponse resp,
                            HashMap<String, Object> ret, User user, ExecutableFlow exFlow)
        throws ServletException {
    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user,
                    Type.EXECUTE);
    if (project == null) {
        return;
    }

    try {
        executorManager.resumeFlow(exFlow, user.getUserId());
    } catch (ExecutorManagerException e) {
        ret.put("resume", e.getMessage());
    }
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:17,代码来源:ExecutorServlet.java

示例12: ajaxFetchExecutableFlowUpdate

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxFetchExecutableFlowUpdate(HttpServletRequest req,
                                           HttpServletResponse resp, HashMap<String, Object> ret, User user,
                                           ExecutableFlow exFlow) throws ServletException {
    Long lastUpdateTime = Long.parseLong(getParam(req, "lastUpdateTime"));
    System.out.println("Fetching " + exFlow.getExecutionId());

    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user, Type.READ);
    if (project == null) {
        ret.put("error", "Project " + exFlow.getProjectId() + " doesn't exist");
        return;
    }

    Map<String, Object> map =
            getExecutableFlowUpdateInfo(exFlow, lastUpdateTime);
    map.put("status", exFlow.getStatus());
    map.put("startTime", exFlow.getStartTime());
    map.put("endTime", exFlow.getEndTime());
    map.put("updateTime", exFlow.getUpdateTime());
    ret.putAll(map);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:22,代码来源:ExecutorServlet.java

示例13: ajaxFetchExecutableFlow

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxFetchExecutableFlow(HttpServletRequest req,
                                     HttpServletResponse resp, HashMap<String, Object> ret, User user,
                                     ExecutableFlow exFlow) throws ServletException {
    System.out.println("Fetching " + exFlow.getExecutionId());

    Project project =
            getProjectAjaxByPermission(ret, exFlow.getProjectId(), user, Type.READ);
    if (project == null) {
        ret.put("error", "Project " + exFlow.getProjectId() + " doesn't exist");
        return;
    }

    ret.put("submitTime", exFlow.getSubmitTime());
    ret.put("submitUser", exFlow.getSubmitUser());
    ret.put("execid", exFlow.getExecutionId());
    ret.put("projectId", exFlow.getProjectId());
    ret.put("project", project.getName());

    Map<String, Object> flowObj = getExecutableNodeInfo(exFlow);
    ret.putAll(flowObj);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:22,代码来源:ExecutorServlet.java

示例14: ajaxAttemptExecuteFlow

import azkaban.project.Project; //导入依赖的package包/类
private void ajaxAttemptExecuteFlow(HttpServletRequest req, HttpServletResponse resp, HashMap<String, Object> ret, User user)
        throws ServletException {
    String projectName = getParam(req, "project");
    String flowId = getParam(req, "flow");

    Project project =
            getProjectAjaxByPermission(ret, projectName, user, Type.EXECUTE);
    if (project == null) {
        ret.put("error", "Project '" + projectName + "' doesn't exist.");
        return;
    }

    ret.put("flow", flowId);
    Flow flow = project.getFlow(flowId);
    if (flow == null) {
        ret.put("error", "Flow '" + flowId + "' cannot be found in project "
                + project);
        return;
    }
    if (executorManager.getMaintenanceMode()) {
        ret.put("error", "Azkaban is in maintenance mode, please submit flow latter.");
        return;
    }

    ajaxExecuteFlow(req, resp, ret, user);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:27,代码来源:ExecutorServlet.java

示例15: handleAjaxAction

import azkaban.project.Project; //导入依赖的package包/类
/**
 * ProjectServlet class now handles ajax requests. It returns a
 * @SimplifiedProject object: information regarding projects, and information
 * regarding user and project association
 * 
 * @param req
 * @param resp
 * @param session
 * @param manager
 * @throws ServletException
 * @throws IOException
 */
private void handleAjaxAction(HttpServletRequest req,
    HttpServletResponse resp, Session session, ProjectManager manager)
    throws ServletException, IOException {

  String ajaxName = getParam(req, "ajax");
  HashMap<String, Object> ret = new HashMap<String, Object>();

  if (ajaxName.equals("fetchallprojects")) {
    List<Project> projects = manager.getProjects();
    List<SimplifiedProject> simplifiedProjects =
        toSimplifiedProjects(projects);
    ret.put("projects", simplifiedProjects);
  } else if (ajaxName.equals("fetchuserprojects")) {
    handleFetchUserProjects(req, session, manager, ret);
  }

  this.writeJSON(resp, ret);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:31,代码来源:ProjectServlet.java


注:本文中的azkaban.project.Project类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。