public StringList getAll(LensSessionHandle sessionid) throws LensException { checkSessionId(sessionid); return new StringList(doGetAll(sessionid)); }
/** * Lists resources from the session for a given resource type. * * @param sessionid session handle object * @param type resource type. It can be jar, file or null * @return Lists all resources for a given resource type * Lists all resources if the resource type is not specified */ @GET @Path("resources/list") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) public StringList listResources(@QueryParam("sessionid") LensSessionHandle sessionid, @QueryParam("type") String type) { List<String> resources = sessionService.listAllResources(sessionid, type); return new StringList(resources); }
/** * Get a list of algos available * * @return */ @GET @Path("algos") public StringList getAlgoNames() { List<String> algos = getMlService().getAlgorithms(); StringList result = new StringList(algos); return result; }
/** * Get a list of key=value parameters set for this session. * * @param sessionid session handle object * @param verbose If true, all the parameters will be returned. If false, configuration parameters will be returned * @param key if this is empty, output will contain all parameters and their values, * if it is non empty parameters will be filtered by key * @return List of Strings, one entry per key-value pair */ @GET @Path("params") @Produces({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN}) public StringList getParams(@QueryParam("sessionid") LensSessionHandle sessionid, @DefaultValue("false") @QueryParam("verbose") boolean verbose, @DefaultValue("") @QueryParam("key") String key) { try { List<String> result = sessionService.getAllSessionParameters(sessionid, verbose, key); return new StringList(result); } catch (LensException e) { throw new WebApplicationException(e); } }
/** * Get all dimtables that belong to a dimension in the metastore * * @param sessionid The sessionid in which user is working * @param dimensionName name of the dimension * @return List of {@link XDimensionTable} objects */ @GET @Path("/dimensions/{dimName}/dimtables") public StringList getAllDimensionTablesOfDimension( @QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimName") String dimensionName) throws LensException { checkSessionId(sessionid); return new StringList(getSvc().getAllDimTableNames(sessionid, dimensionName)); }
/** * Get all storages of the fact table in the metastore * * @param sessionid The sessionid in which user is working * @param factName The fact table name * @return {@link StringList} consisting of all the storage names * @throws LensException */ @GET @Path("/facts/{factName}/storages") public StringList getStoragesOfFact(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("factName") String factName) throws LensException { checkSessionId(sessionid); return new StringList(getSvc().getStoragesOfFact(sessionid, factName)); }
/** * Gets the human readable param description of an algorithm * * @param algorithm the algorithm * @return the param description */ @GET @Path("algos/{algorithm}") public StringList getParamDescription(@PathParam("algorithm") String algorithm) { Map<String, String> paramDesc = getMlService().getAlgoParamDescription(algorithm); if (paramDesc == null) { throw new NotFoundException("Param description not found for " + algorithm); } List<String> descriptions = new ArrayList<String>(); for (String key : paramDesc.keySet()) { descriptions.add(key + " : " + paramDesc.get(key)); } return new StringList(descriptions); }
/** * Get model ID list for a given algorithm. * * @param algorithm algorithm name * @return the models for algo * @throws LensException the lens exception */ @GET @Path("models/{algorithm}") public StringList getModelsForAlgo(@PathParam("algorithm") String algorithm) throws LensException { List<String> models = getMlService().getModels(algorithm); if (models == null || models.isEmpty()) { throw new NotFoundException("No models found for algorithm " + algorithm); } return new StringList(models); }
/** * Get all storages of the dimension table in the metastore * * @param sessionid The sessionid in which user is working * @param dimension The dimension table name * @return StringList consisting of all the storage names * @throws LensException */ @GET @Path("/dimtables/{dimTableName}/storages") public StringList getDimensionStorages(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimension) throws LensException { checkSessionId(sessionid); return new StringList(getSvc().getDimTableStorages(sessionid, dimension)); }
/** * Get all facts that belong to a cube in the metastore * * @param sessionid The sessionid in which user is working * @param cubeName name of the base cube or derived cube * @return StringList consisting of all the fact names in the given cube */ @GET @Path("/cubes/{cubeName}/facts") public StringList getAllFactsOfCube( @QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("cubeName") String cubeName) throws LensException { checkSessionId(sessionid); return new StringList(getSvc().getAllFactNames(sessionid, cubeName)); }
/** * Get all segmentations that belong to a cube in the metastore * * @param sessionid The sessionid in which user is working * @param cubeName name of the base cube or derived cube * @return List of {@link XSegmentation} objects */ @GET @Path("/cubes/{cubeName}/segmentations") public StringList getAllSegmentationsOfCube( @QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("cubeName") String cubeName) throws LensException { checkSessionId(sessionid); return new StringList(getSvc().getAllSegmentations(sessionid, cubeName)); }
/** * Get list of reports for a given algorithm. * * @param algoritm the algoritm * @return the reports for algorithm * @throws LensException the lens exception */ @GET @Path("reports/{algorithm}") public StringList getReportsForAlgorithm(@PathParam("algorithm") String algoritm) throws LensException { List<String> reports = getMlService().getTestReports(algoritm); if (reports == null || reports.isEmpty()) { throw new NotFoundException("No test reports found for " + algoritm); } return new StringList(reports); }
/** * Get the partition timelines. * * @param sessionid The sessionid in which user is working * @param factName name of the fact * @param storage storage Name * @param updatePeriod update period * @param timeDimension time dimension name * @return List os partition timelines. */ @GET @Path("/facts/{factName}/timelines") public StringList getPartitionTimelines(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("factName") String factName, @QueryParam("storage") String storage, @QueryParam("updatePeriod") String updatePeriod, @QueryParam("timeDimension") String timeDimension) throws LensException, HiveException { checkSessionId(sessionid); return new StringList(getSvc().getPartitionTimelines(sessionid, factName, storage, updatePeriod, timeDimension)); }
/** * Get all native tables. * * @param sessionid The sessionid in which user is working * @param dbOption The options available are 'current' and 'all'. If option is current, gives all tables from current * db. If option is all, gives all tables from all databases. If dbname is passed, dbOption is * ignored. If no dbOption or dbname are passed, then default is to get tables from current db. * @param dbName The db name. If not empty, the tables in the db will be returned * @return StringList consisting of all table names. * @throws WebApplicationException */ @GET @Path("nativetables") public StringList getAllNativeTables(@QueryParam("sessionid") LensSessionHandle sessionid, @QueryParam("dbOption") String dbOption, @QueryParam("dbName") String dbName) throws LensException { checkSessionId(sessionid); if (StringUtils.isBlank(dbName) && !StringUtils.isBlank(dbOption)) { if (!dbOption.equalsIgnoreCase("current") && !dbOption.equalsIgnoreCase("all")) { throw new BadRequestException("Invalid dbOption param:" + dbOption + " Allowed values are 'current' and 'all'"); } } return new StringList(getSvc().getAllNativeTableNames(sessionid, dbOption, dbName)); }
/** * Get all cubes in the metastores, of the specified type * * @param sessionid The sessionid in which user is working * @param cubeTypes The type of cubes. Accepted values are 'all' or 'base' or 'derived' or 'queryable' * @return StringList consisting of all cubes names */ @GET @Path("cubes") public StringList getAllCubes(@QueryParam("sessionid") LensSessionHandle sessionid, @QueryParam("type") @DefaultValue("all") String cubeTypes) throws LensException { checkSessionId(sessionid); switch (cubeTypes) { case "all": return new StringList(getSvc().getAllCubeNames(sessionid)); case "base": return new StringList(getSvc().getAllBaseCubeNames(sessionid)); case "derived": return new StringList(getSvc().getAllDerivedCubeNames(sessionid)); case "queryable": return new StringList(getSvc().getAllQueryableCubeNames(sessionid)); default: throw new BadRequestException("Invalid type " + cubeTypes + " Accepted" + " values are 'all' or 'base' or 'derived' or 'queryable'"); } }