@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getType().getCategoryName(), object.getApp(), object.getName(), object.getDescription()); } }).build();
@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getApp(), object.getName(), object.getDescription()); } }).build();
@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getType().getPrettyName(), object.getName(), object.getDescription()); } }).build();
@Override public Collection<String> get() { try { List<ProgramRecord> programs = appClient.listAllPrograms(cliConfig.getCurrentNamespace(), programType); List<String> programIds = new ArrayList<>(); for (ProgramRecord programRecord : programs) { programIds.add(programRecord.getApp() + "." + programRecord.getName()); } return programIds; } catch (IOException | UnauthenticatedException | UnauthorizedException e) { return new ArrayList<>(); } } });
/** * Lists programs of a type belonging to an application. * * @param app the application * @return Map of {@link ProgramType} to list of {@link ProgramRecord}s * @throws ApplicationNotFoundException if the application with the given ID was not found * @throws IOException if a network error occurred * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server */ public Map<ProgramType, List<ProgramRecord>> listProgramsByType(ApplicationId app) throws ApplicationNotFoundException, IOException, UnauthenticatedException, UnauthorizedException { Map<ProgramType, List<ProgramRecord>> result = Maps.newHashMap(); for (ProgramType type : ProgramType.values()) { result.put(type, Lists.<ProgramRecord>newArrayList()); } for (ProgramRecord program : listPrograms(app)) { result.get(program.getType()).add(program); } return result; }
private void createProgramRecords(NamespaceId namespaceId, String appId, ProgramType type, Iterable<? extends ProgramSpecification> programSpecs, List<ProgramRecord> programRecords) throws Exception { for (ProgramSpecification programSpec : programSpecs) { if (hasAccess(namespaceId.app(appId).program(type, programSpec.getName()))) { programRecords.add(new ProgramRecord(type, appId, programSpec.getName(), programSpec.getDescription())); } } }
@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getType().getPrettyName(), object.getName(), object.getDescription()); } }).build();
@Override public Collection<String> get() { try { List<ProgramRecord> programs = appClient.listAllPrograms(cliConfig.getCurrentNamespace(), programType); List<String> programIds = new ArrayList<>(); for (ProgramRecord programRecord : programs) { programIds.add(programRecord.getApp() + "." + programRecord.getName()); } return programIds; } catch (IOException | UnauthenticatedException | UnauthorizedException e) { return new ArrayList<>(); } } });
@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getApp(), object.getName(), object.getDescription()); } }).build();
/** * Lists programs of a type belonging to an application. * * @param app the application * @param programType type of the programs to list * @return list of {@link ProgramRecord}s * @throws ApplicationNotFoundException if the application with the given ID was not found * @throws IOException if a network error occurred * @throws UnauthenticatedException if the request is not authorized successfully in the gateway server */ public List<ProgramRecord> listPrograms(ApplicationId app, ProgramType programType) throws ApplicationNotFoundException, IOException, UnauthenticatedException, UnauthorizedException { Preconditions.checkArgument(programType.isListable()); List<ProgramRecord> programs = Lists.newArrayList(); for (ProgramRecord program : listPrograms(app)) { if (programType.equals(program.getType())) { programs.add(program); } } return programs; }
private void createProgramRecords(NamespaceId namespaceId, String appId, ProgramType type, Iterable<? extends ProgramSpecification> programSpecs, List<ProgramRecord> programRecords) throws Exception { for (ProgramSpecification programSpec : programSpecs) { if (hasAccess(namespaceId.app(appId).program(type, programSpec.getName()))) { programRecords.add(new ProgramRecord(type, appId, programSpec.getName(), programSpec.getDescription())); } } }
@Override public List<?> makeRow(ProgramRecord object) { return Lists.newArrayList(object.getType().getCategoryName(), object.getApp(), object.getName(), object.getDescription()); } }).build();
List<ProgramRecord> flows = lifecycleService.list(validateAndGetNamespace(namespaceId), ProgramType.FLOW); for (ProgramRecord flow : flows) { String appId = flow.getApp(); String flowId = flow.getName(); ProgramId programId = new ProgramId(namespaceId, appId, ProgramType.FLOW, flowId); ProgramStatus status = lifecycleService.getProgramStatus(programId);
private void verifyProgramList(String namespace, String appName, final ProgramType programType, int expected) throws Exception { HttpResponse response = requestAppDetail(namespace, appName); Assert.assertEquals(200, response.getResponseCode()); ApplicationDetail appDetail = GSON.fromJson(response.getResponseBodyAsString(), ApplicationDetail.class); Collection<ProgramRecord> programs = Collections2.filter( appDetail.getPrograms(), record -> programType.getCategoryName().equals(record.getType().getCategoryName())); Assert.assertEquals(expected, programs.size()); }
List<ProgramRecord> programs = new ArrayList<>(); for (ProgramSpecification programSpec : spec.getMapReduce().values()) { programs.add(new ProgramRecord(ProgramType.MAPREDUCE, spec.getName(), programSpec.getName(), programSpec.getDescription())); programs.add(new ProgramRecord(ProgramType.SERVICE, spec.getName(), programSpec.getName(), programSpec.getDescription())); programs.add(new ProgramRecord(ProgramType.SPARK, spec.getName(), programSpec.getName(), programSpec.getDescription())); programs.add(new ProgramRecord(ProgramType.WORKER, spec.getName(), programSpec.getName(), programSpec.getDescription())); programs.add(new ProgramRecord(ProgramType.WORKFLOW, spec.getName(), programSpec.getName(), programSpec.getDescription()));