public static HashMap<String, String> stringListToMap(StringList stringList) { HashMap<String, String> map = new HashMap<String, String>(); if (stringList == null) { return null; } List<String> list = stringList.getElements(); for (String element : list) { StringTokenizer tk = new StringTokenizer(element, "="); map.put(tk.nextToken(), tk.nextToken()); } return map; }
public StringList getAll(LensSessionHandle sessionid) throws LensException { checkSessionId(sessionid); return new StringList(doGetAll(sessionid)); }
/** * Gets the connection params. * * @param key the key * @return the connection params */ public List<String> getConnectionParams(String key) { WebTarget target = getSessionWebTarget(); StringList value = target.path("params").queryParam("sessionid", this.sessionHandle).queryParam("key", key) .request().get(StringList.class); return value.getElements(); }
/** * 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); }
/** * List resources from session * * @param type type of resource * @return List of resources */ public List<String> listResourcesFromConnection(String type) { WebTarget target = getSessionWebTarget(); StringList result = target.path("resources/list").queryParam("sessionid", this.sessionHandle) .queryParam("type", type).request().get(StringList.class); return result.getElements(); }
/** * 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; }
public List<String> getConnectionParams() { WebTarget target = getSessionWebTarget(); StringList list = target.path("params").queryParam("sessionid", this.sessionHandle).queryParam("verbose", true) .request().get(StringList.class); return list.getElements(); }
/** * 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); } }
public List<String> getConnectionParams() { WebTarget target = getSessionWebTarget(); StringList list = target.path("params").queryParam("sessionid", this.sessionHandle).queryParam("verbose", true) .request().get(StringList.class); return list.getElements(); }
/** * 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)); }
/** * Gets the connection params. * * @param key the key * @return the connection params */ public List<String> getConnectionParams(String key) { WebTarget target = getSessionWebTarget(); StringList value = target.path("params").queryParam("sessionid", this.sessionHandle).queryParam("key", key) .request().get(StringList.class); return value.getElements(); }
/** * 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)); }
/** * List resources from session * * @param type type of resource * @return List of resources */ public List<String> listResourcesFromConnection(String type) { WebTarget target = getSessionWebTarget(); StringList result = target.path("resources/list").queryParam("sessionid", this.sessionHandle) .queryParam("type", type).request().get(StringList.class); return result.getElements(); }
/** * 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); }
public List<String> getAlgoNames() { StringList algoNames = getMLWebTarget().path("algos").request().get(StringList.class); return algoNames == null ? null : algoNames.getElements(); }
/** * 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)); }
public List<String> getPartitionTimelines(String factName, String storageName, String updatePeriod, String timeDimension) { return getMetastoreWebTarget().path("facts").path(factName).path("timelines") .queryParam("storage", storageName) .queryParam("updatePeriod", updatePeriod) .queryParam("timeDimension", timeDimension) .queryParam("sessionid", this.connection.getSessionHandle()) .request(MediaType.APPLICATION_XML) .get(StringList.class).getElements(); }
/** * 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); }
/** * Gets the test reports of algorithm. * * @param algorithm the algorithm * @return the test reports of algorithm */ public List<String> getTestReportsOfAlgorithm(String algorithm) { try { StringList list = getMLWebTarget().path("reports").path(algorithm).request().get(StringList.class); return list == null ? null : list.getElements(); } catch (NotFoundException exc) { return null; } }
/** * 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)); }