/** * Create, initialize, and register an {@link RepoRawFileStoreI} with the proper setting (read or * write). * * @param checked The file that will be read. Can't be null, and must have ID set. * @param mode The mode for writing. If null, read-only. * @param __current The current user's session information. * @return A proxy ready to be returned to the user. * @throws ServerError * @throws InternalException */ protected RawFileStorePrx createRepoRFS(CheckedPath checked, String mode, Current __current) throws ServerError, InternalException { final Ice.Current adjustedCurr = makeAdjustedCurrent(__current); final BlitzExecutor be = context.getBean("throttlingStrategy", BlitzExecutor.class); RepoRawFileStoreI rfs; try { final RawFileStore service = repositoryDao.getRawFileStore(checked.getId(), checked, mode, __current); rfs = new RepoRawFileStoreI(be, service, adjustedCurr); rfs.setApplicationContext(this.context); } catch (Throwable t) { if (t instanceof ServerError) { throw (ServerError) t; } else { omero.InternalException ie = new omero.InternalException(); IceMapper.fillServerError(ie, t); throw ie; } } final _RawFileStoreTie tie = new _RawFileStoreTie(rfs); Ice.ObjectPrx prx = registerServant(tie, rfs, adjustedCurr); return RawFileStorePrxHelper.uncheckedCast(prx); }
/** * Set the import log file's size in the database to its current size on the filesystem. * * @throws ServerError if the import log's size could not be updated in the database */ private void setLogFileSize() throws ServerError { final OriginalFile logFile = (OriginalFile) sf.getQueryService().get(OriginalFile.class.getSimpleName(), logPath.getId()); logFile.setSize(omero.rtypes.rlong(logPath.size())); sf.getUpdateService().saveObject(logFile); }