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"); }
/** * 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); }
/** * 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); }
/** * 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, Principal principal, String uuid, int numThreads, Metrics metrics) { this(executor.getContext().containsBean("pixelDataTrigger"), manager, executor, handler, principal, uuid, numThreads, metrics); }
/** * 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, Principal principal, String uuid, int numThreads, Metrics metrics, ReadOnlyStatus readOnly) { this(executor.getContext().containsBean("pixelDataTrigger"), manager, executor, handler, principal, uuid, numThreads, metrics, readOnly); }
/** * Previous constructor which should no longer be used. Primarily for * simplicity of testing. */ public RepositoryDaoImpl(Principal principal, Executor executor) { this(principal, new Roles(), executor, executor.getContext().getBean("statefulExecutor", Executor.class), executor.getContext().getBean("omeroInterceptor", OmeroInterceptor.class), UUID.randomUUID().toString()); }
/** * 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} * passing a {@link NullMetrics} as necessary. */ @Deprecated public PixelDataThread(SessionManager manager, Executor executor, PixelDataHandler handler, Principal principal, String uuid, int numThreads) { this(executor.getContext().containsBean("pixelDataTrigger"), manager, executor, handler, principal, uuid, numThreads, new NullMetrics()); }
@Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { try { EventContext ec = ((LocalAdmin) sf.getAdminService()) .getEventContextQuiet(); Deletion d = executor.getContext().getBean( Deletion.class.getName(), Deletion.class); final SetMultimap<String, Long> toDelete = HashMultimap.create(); toDelete.put("OriginalFile", id); d.deleteFiles(toDelete); return null; } catch (ome.conditions.ValidationException ve) { log.debug("ValidationException on delete", ve); } catch (Throwable e) { log.warn("Throwable while deleting script " + id, e); } return null; }
throw (ServerError) rt.t; } catch (Exception e) { throw (ServerError) mapper.handleException(e, executor.getContext());
throw (ServerError) new IceMapper().handleException(e, executor.getContext());
@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()); } }
throw (ServerError) new IceMapper().handleException(e, executor.getContext());
public void run(OmeroContext ctx) { try { Object retVal = null; // If the work throw an exception, we have to handle it as // IceMethodInvoker would. try { retVal = this.ex.execute(this.p, this.work); } catch (Throwable t) { Ice.UserException ue = mapper.handleException(t, ex .getContext()); exception(ue, ex.getContext()); return; // EARLY EXIT } // Any exception thrown now will be thrown as is. if (mapper != null && mapper.canMapReturnValue()) { retVal = mapper.mapReturnValue(retVal); } response(retVal, ctx); } catch (Exception e) { exception(e, ctx); } }
/** * 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); }
public OriginalFile register(final String repoUuid, final CheckedPath checked, final String mimetype, final Ice.Current current) throws ServerError { if (checked.isRoot) { throw new omero.SecurityViolation(null, null, "Can't re-register the repository"); } final CheckedPath parent = checked.parent(); final IceMapper mapper = new IceMapper(); try { final ome.model.core.OriginalFile of = (ome.model.core.OriginalFile) executor.execute(current.ctx, currentUser(current), new Executor.SimpleWork( this, "register", repoUuid, checked, mimetype) { @Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { return _internalRegister(repoUuid, Arrays.asList(checked), Arrays.asList(parent), null, mimetype, sf, getSqlAction(), session).get(0); } }); final OriginalFile rv = (OriginalFile) mapper.map(of); final String name = rv.getName().getValue(); if (name.startsWith(fileRepoSecretKey)) { rv.setName(omero.rtypes.rstring(name.substring(fileRepoSecretKey.length()))); } return rv; } catch (Exception e) { throw (ServerError) mapper.handleException(e, executor.getContext()); } }
throw (ServerError) mapper.handleException(e, executor.getContext()); } finally { outer.stop("omero.repo.save_fileset");
public RawFileStore getRawFileStore(final long fileId, final CheckedPath checked, String mode, Ice.Current current) throws SecurityViolation { final RawFileStore proxy = executor.getContext() .getBean("managed-ome.api.RawFileStore", RawFileStore.class); final RawFileBean bean = unwrapRawFileBean(proxy); final FileBuffer buffer = checked.getFileBuffer(mode); try { Map<String, String> fileContext = fileContext(fileId, current); statefulExecutor.execute(fileContext, currentUser(current), new StatefulWork(bean, this, "setFileIdWithBuffer", fileId, checked, mode) { @Transactional(readOnly = true) public Object doWork(Session session, ServiceFactory sf) { bean.setFileIdWithBuffer(fileId, buffer); return null; } }); } catch (ome.conditions.SecurityViolation sv) { throw wrapSecurityViolation(sv); } return proxy; }
public Job saveJob(final Job job, final Ice.Current current) throws ServerError { if (job == null) { throw new omero.ValidationException(null, null, "Job is null!"); } final IceMapper mapper = new IceMapper(); try { final ome.model.jobs.Job in = (ome.model.jobs.Job) mapper.reverse(job); final ome.model.jobs.Job out = (ome.model.jobs.Job) executor.execute(current.ctx, currentUser(current), new Executor.SimpleWork( this, "saveJob", in) { @Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { JobHandle jh = sf.createJobHandle(); jh.submit(in); return jh.getJob(); } }); return (Job) mapper.map(out); } catch (Exception e) { throw (ServerError) mapper.handleException(e, executor.getContext()); } }
public void updateJob(final Job job, final String message, final String status, final Ice.Current current) throws ServerError { if (job == null || job.getId() == null) { throw new omero.ValidationException(null, null, "Job is null!"); } final IceMapper mapper = new IceMapper(); try { final ome.model.jobs.Job in = (ome.model.jobs.Job) mapper.reverse(job); executor.execute(current.ctx, currentUser(current), new Executor.SimpleWork( this, "updateJob", in, message, status) { @Transactional(readOnly = false) public Object doWork(Session session, ServiceFactory sf) { JobHandle jh = sf.createJobHandle(); jh.attach(in.getId()); jh.setStatusAndMessage(status, message); return null; } }); } 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); }