/** * Clears idle sessions. response will contain how many sessions were cleared. * @throws LensException */ @DELETE @Path("sessions") @Produces({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) public APIResult clearIdleSessions() throws LensException { int before = getSessionInfo().size(); sessionService.cleanupIdleSessions(); int after = getSessionInfo().size(); return APIResult.success("cleared " + (after - before) + " idle sessions"); } }
public APIResult delete(LensSessionHandle sessionid, String entityName, Boolean cascade) throws LensException { log.info("Drop {} {} cascade: {}", name(), entityName, cascade); checkSessionId(sessionid); doDelete(sessionid, entityName, cascade); return success(); }
/** * Drop all the storage tables of a dimension table * * @param sessionid The sessionid in which user is working * @param dimTableName The dimension table name * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if drop was successful. {@link APIResult} with state * {@link Status#FAILED}, if drop has failed */ @DELETE @Path("/dimtables/{dimTableName}/storages") public APIResult dropAllStoragesOfDim(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimTableName) throws LensException { checkSessionId(sessionid); getSvc().dropAllStoragesOfDimTable(sessionid, dimTableName); return success(); }
/** * Drop all the storage tables of a fact table * * @param sessionid The sessionid in which user is working * @param factName The fact table name * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if drop was successful. {@link APIResult} with state * {@link Status#FAILED}, if drop has failed */ @DELETE @Path("/facts/{factName}/storages") public APIResult dropAllStoragesOfFact(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("factName") String factName) throws LensException { checkSessionId(sessionid); getSvc().dropAllStoragesOfFact(sessionid, factName); return success(); }
public static APIResult successOrPartialOrFailure(int actual, int expected, Exception e) { if (actual == 0 && expected != 0) { return failure(e); } if (actual < expected) { return partial(actual, expected); } else { return success(); } }
public static APIResult successOrPartialOrFailure(int actual, int expected, Exception e) { if (actual == 0 && expected != 0) { return failure(e); } if (actual < expected) { return partial(actual, expected); } else { return success(); } }
/** * Update cube definition * * @param sessionid The sessionid in which user is working * @param cubeName The cube name * @param cube The {@link XCube} representation of the updated cube definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if update was successful. {@link APIResult} with * state {@link Status#FAILED}, if update has failed */ @PUT @Path("/cubes/{cubeName}") public APIResult updateCube(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("cubeName") String cubeName, XCube cube) throws LensException { checkSessionId(sessionid); getSvc().updateCube(sessionid, cube); return success(); }
/** * Create a new fact tabble * * @param sessionid The sessionid in which user is working * @param fact The {@link XFact} representation of the fact table definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("/facts") public APIResult createFactTable(@QueryParam("sessionid") LensSessionHandle sessionid, XFact fact) throws LensException { checkSessionId(sessionid); log.info("Create fact table"); getSvc().createFactTable(sessionid, fact); return success(); }
/** * Create new storage * * @param sessionid The sessionid in which user is working * @param storage The XStorage representation of storage * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("storages") public APIResult createNewStorage(@QueryParam("sessionid") LensSessionHandle sessionid, XStorage storage) throws LensException { checkSessionId(sessionid); getSvc().createStorage(sessionid, storage); return success(); }
/** * Set the current db * * @param sessionid The sessionid in which user is working * @param dbName The db name * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if set was successful. {@link APIResult} with state * {@link Status#FAILED}, if set has failed */ @PUT @Path("databases/current") @Consumes({MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON}) public APIResult setDatabase(@QueryParam("sessionid") LensSessionHandle sessionid, String dbName) throws LensException { checkSessionId(sessionid); log.info("Set database:{}", dbName); getSvc().setCurrentDatabase(sessionid, dbName); return success(); }
/** * Add storage to dimension table * * @param sessionid The sessionid in which user is working * @param dimTableName The dimension table name * @param storageTbl The Storage table description * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful. {@link APIResult} with state * {@link Status#FAILED}, if add has failed */ @POST @Path("/dimtables/{dimTableName}/storages") public APIResult createDimensionStorage(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimTableName, XStorageTableElement storageTbl) throws LensException { checkSessionId(sessionid); getSvc().addDimTableStorage(sessionid, dimTableName, storageTbl); return success(); }
/** * Update dimension table definition * * @param sessionid The sessionid in which user is working * @param dimensionTable The {@link XDimensionTable} representation of the updated dim table definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if update was successful. {@link APIResult} with * state {@link Status#FAILED}, if update has failed */ @PUT @Path("/dimtables/{dimTableName}") public APIResult updateCubeDimension(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimTableName") String dimTableName, XDimensionTable dimensionTable) throws LensException { checkSessionId(sessionid); getSvc().updateDimensionTable(sessionid, dimensionTable); return success(); }
/** * Create a new cube * * @param sessionid The sessionid in which user is working * @param cube The {@link XCube} representation of the cube definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("cubes") public APIResult createNewCube(@QueryParam("sessionid") LensSessionHandle sessionid, XCube cube) throws LensException { checkSessionId(sessionid); getSvc().createCube(sessionid, cube); return success(); }
/** * Add storage to fact table * * @param sessionid The sessionid in which user is working * @param factName The fact table name * @param storageTable The storage table description * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if add was successful. {@link APIResult} with state * {@link Status#FAILED}, if add has failed */ @POST @Path("/facts/{factName}/storages") public APIResult addStorageToFact( @QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("factName") String factName, XStorageTableElement storageTable) throws LensException { checkSessionId(sessionid); getSvc().addStorageToFact(sessionid, factName, storageTable); return success(); }
/** * Update storage definition * * @param sessionid The sessionid in which user is working * @param storageName The storage name * @param storage The {@link XStorage} representation of the updated storage definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if update was successful. {@link APIResult} with * state {@link Status#FAILED}, if update has failed */ @PUT @Path("/storages/{storageName}") public APIResult updateStorage(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("storageName") String storageName, XStorage storage) throws LensException { checkSessionId(sessionid); getSvc().alterStorage(sessionid, storageName, storage); return success(); }
/** * Update dimension definition * * @param sessionid The sessionid in which user is working * @param dimName The dimension name * @param dimension The {@link XDimension} representation of the updated dimension definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if update was successful. {@link APIResult} with * state {@link Status#FAILED}, if update has failed */ @PUT @Path("/dimensions/{dimName}") public APIResult updateDimension(@QueryParam("sessionid") LensSessionHandle sessionid, @PathParam("dimName") String dimName, XDimension dimension) throws LensException { checkSessionId(sessionid); getSvc().updateDimension(sessionid, dimName, dimension); return success(); }
/** * Create a new segmentation * * @param sessionid The sessionid in which user is working * @param seg The {@link XSegmentation} representation of the segmentation * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("/segmentations") public APIResult createSegmentation(@QueryParam("sessionid") LensSessionHandle sessionid, XSegmentation seg) throws LensException { checkSessionId(sessionid); log.info("Create segmentation"); getSvc().createSegmentation(sessionid, seg); return success(); }
/** * Create new dimension * * @param sessionid The sessionid in which user is working * @param dimension The XDimension representation of dimension * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("dimensions") public APIResult createDimension(@QueryParam("sessionid") LensSessionHandle sessionid, XDimension dimension) throws LensException { checkSessionId(sessionid); getSvc().createDimension(sessionid, dimension); return success(); }
/** * Create a new dimension table * * @param sessionid The sessionid in which user is working * @param dimensionTable The {@link XDimensionTable} representation of the dimension table definition * @return {@link APIResult} with state {@link Status#SUCCEEDED}, if create was successful. {@link APIResult} with * state {@link Status#FAILED}, if create has failed */ @POST @Path("/dimtables") public APIResult createDimensionTable(@QueryParam("sessionid") LensSessionHandle sessionid, XDimensionTable dimensionTable) throws LensException { checkSessionId(sessionid); getSvc().createDimensionTable(sessionid, dimensionTable); return success(); }
private APIResult checkAndUpdatePartitions(LensSessionHandle sessionid, String table, String storage, XPartition partition) throws LensException { checkSessionId(sessionid); checkNonNullArgs("Partition is null", partition); checkNonNullArgs("Partition elements are null", partition.getFactOrDimensionTableName(), partition.getUpdatePeriod()); getSvc().updatePartition(sessionid, table, storage, partition); return success(); } }