/** Takes current into account */ public EventContext getEventContext(final Ice.Current current) { return (EventContext) executor.execute(current.ctx, this.principal, new Executor.SimpleWork(this, "getEventContext") { @Transactional(readOnly=true) public Object doWork(Session session, ServiceFactory sf) { return ((LocalAdmin) sf.getAdminService()).getEventContextQuiet(); } }); }
@SuppressWarnings("unchecked") public List<Long> idsInDb() { return (List<Long>) ex .executeSql(new Executor.SimpleSqlWork(this, "idsInDb") { @Transactional(readOnly = true) public Object doWork(SqlAction sql) { return idsInDb(sql); } }); }
@SuppressWarnings("unchecked") public List<Fileset> loadFilesets(final List<Long> ids, final Ice.Current current) throws ServerError { if (ids == null || ids.size() == 0) { return new ArrayList<Fileset>(); // EARLY EXIT } final IceMapper mapper = new IceMapper(); try { return (List<Fileset>) mapper.map((List<ome.model.fs.Fileset>) executor.execute(current.ctx, currentUser(current), new Executor.SimpleWork( this, "loadFilesets", ids) { @Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { return sf.getQueryService().findAllByQuery( "select fs from Fileset fs where fs.id in (:ids)", new Parameters().addIds(ids)); }})); } catch (Exception e) { throw (ServerError) mapper.handleException(e, executor.getContext()); } }
@RolesAllowed("system") public void indexObject(IObject row) { if (row == null || row.getId() == null) { throw new ValidationException( "Non-managed object cannot be indexed."); } CreationLogLoader logs = new CreationLogLoader(localQuery, row); FullTextIndexer fti = new FullTextIndexer(logs); fti.setApplicationContext(this.executor.getContext()); final FullTextThread ftt = new FullTextThread(sessionManager, executor, fti, this.fullTextBridge, true); Future<Object> future = executor.submit(Executors.callable(ftt)); executor.get(future); }
public ParamsHelper(Acquirer acq, Executor ex, Principal p) { this.acq = acq; this.ex = ex; this.p = p; this.secSys = // FIXME REFACTOR (SecuritySystem) ex.getContext().getBean("securitySystem"); }
new ExecutorCompletionService<Object>(executor.getService(), new ArrayBlockingQueue<Future<Object>>(numThreads)); executor.execute(getPrincipal(), work);
executor.submit(priority, current.ctx, Executors.callable(handle)); __cb.ice_response(prx); } catch (Throwable e) {
realCtx.put(omero.constants.GROUP.value, realGroupName); effectiveEventContext = (EventContext) executor.execute(realCtx, realPrincipal, new Executor.SimpleWork(this, "makeDirs", dirs) { @Transactional(readOnly = true) executor.execute(__current.ctx, currentUser(__current), new Executor.SimpleWork(this, "makeDirs", dirs) { @Transactional(readOnly = false) throw (ServerError) rt.t; } catch (Exception e) { throw (ServerError) mapper.handleException(e, executor.getContext());
/** * Called in the main server (Blitz-0) in order to create a PIXELDATA * {@link EventLog} which will get processed by PixelData-0. */ public void onApplicationEvent(final MissingPyramidMessage mpm) { if (readOnly.isReadOnlyDb()) { log.debug("Ignored: " + mpm); return; } log.info("Received: " + mpm); // #5232. If this is called without an active event, then throw // an exception since a call to Executor should wrap whatever the // invoker is doing. final CurrentDetails cd = executor.getContext().getBean(CurrentDetails.class); if (cd.size() <= 0) { throw new InternalException("Not logged in."); } final EventContext ec = cd.getCurrentEventContext(); if (null == ec.getCurrentUserId()) { throw new InternalException("No user! Must be wrapped by call to Executor?"); } Future<EventLog> future = this.executor.submit(cd.getContext(), new Callable<EventLog>(){ public EventLog call() throws Exception { return makeEvent(ec, mpm); }}); this.executor.get(future); }
/** * Calculates {@link #performProcessing} based on the existence of the * "pixelDataTrigger" and passes all parameters to * {@link #PixelDataThread(boolean, SessionManager, Executor, PixelDataHandler, Principal, String, int) the main ctor}. */ @Deprecated public PixelDataThread( SessionManager manager, Executor executor, PixelDataHandler handler, String uuid, int numThreads, Metrics metrics) { this(executor.getContext().containsBean("pixelDataTrigger"), manager, executor, handler, DEFAULT_PRINCIPAL, uuid, numThreads, metrics); }
private PixelBuffer getPixelBuffer() { return (PixelBuffer) ex.execute(null, new Executor.SimpleWork(this, "getPixelBuffer") { @Transactional(readOnly = true) // ticket:5232 public Object doWork(Session session, ServiceFactory sf) { return pixDataSrv.getPixelBuffer(pixelsObj, false); } }); }
return (ome.model.core.OriginalFile) executor.execute(ctx, principal, new Executor.SimpleWork(this, "persistLogFile", id) { @Transactional(readOnly = false) throw (ServerError) new IceMapper().handleException(e, executor.getContext());
@RolesAllowed("user") @Transactional(readOnly = false) public void closeShare(long shareId) { final String uuid = idToUuid(shareId); Future<Object> future = executor.submit(new Callable<Object>() { public Object call() throws Exception { sessionManager.close(uuid); return null; } }); executor.get(future); }
public boolean isInRepo(final long id) { return (Boolean) ex.executeSql(new Executor.SimpleSqlWork( this, "isInRepo", id) { @Transactional(readOnly = true) public Object doWork(SqlAction sql) { return isInRepo(sql, id); } }); }
/** * Calculates {@link #performProcessing} based on the existence of the * "pixelDataTrigger" and passes all parameters to * {@link #PixelDataThread(boolean, SessionManager, Executor, PixelDataHandler, Principal, String, int) the main ctor}. */ public PixelDataThread( SessionManager manager, Executor executor, PixelDataHandler handler, String uuid, int numThreads, Metrics metrics, ReadOnlyStatus readOnly) { this(executor.getContext().containsBean("pixelDataTrigger"), manager, executor, handler, DEFAULT_PRINCIPAL, uuid, numThreads, metrics, readOnly); }
public void setManagerDown(final String managerUuid) { executor.execute(principal, new Executor.SimpleWork(this, "setManagerDown") { @Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { return getSqlAction().closeNode(managerUuid); } }); }
executor.execute(ctx, principal, new Executor.SimpleWork(this, "setOriginalFileHasherToSHA1", id) { @Transactional public Object doWork(Session session, ServiceFactory sf) { throw (ServerError) new IceMapper().handleException(e, executor.getContext());
@RolesAllowed("user") public java.util.List<Session> getMyOpenSessions() { final String uuid = currentContext().getCurrentSessionUuid(); Future<List<Session>> future = ex.submit(new Callable<List<Session>>(){ public List<Session> call() throws Exception { return mgr.findSameUser(uuid); }}); return ex.get(future); }