ome.services.scripts
Class ScriptUploader

java.lang.Object
  extended by ome.services.scripts.ScriptUploader
Direct Known Subclasses:
MakeMovieJob, PopulateRoiJob

public abstract class ScriptUploader
extends Object

Start-up task which guarantees a script is added as a script to the server. The strategy here is to not only check for name, but also for the sha1 of the file, meaning that if a new version is published, it will be used. Also provides createJob() method in order to allow simple creation of processors.

Since:
Beta4.1

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Constructor Summary
ScriptUploader(Principal principal, Executor executor, File source)
           
ScriptUploader(String uuid, Executor executor, File source)
           
 
Method Summary
 omero.model.ScriptJob createJob()
          Returns a fresh (unsaved) ScriptJob which can be passed to acquireProcessor for background processing.
protected  ome.model.core.OriginalFile createScript(byte[] buf, String sha1, ServiceFactory sf)
          Create the original file and upload the bytes we've already read into memory.
abstract  String getName()
          Subclasses should override to return the name of the file under scripts/ which should be uploaded.
 void init()
           
protected  List<ome.model.core.OriginalFile> loadScripts(ServiceFactory sf, ome.parameters.Parameters p)
          Load all scripts that match the name, sha1, and format for script
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected final org.apache.commons.logging.Log log
Constructor Detail

ScriptUploader

public ScriptUploader(String uuid,
                      Executor executor,
                      File source)

ScriptUploader

public ScriptUploader(Principal principal,
                      Executor executor,
                      File source)
Method Detail

getName

public abstract String getName()
Subclasses should override to return the name of the file under scripts/ which should be uploaded.


init

public void init()

loadScripts

protected List<ome.model.core.OriginalFile> loadScripts(ServiceFactory sf,
                                                        ome.parameters.Parameters p)
Load all scripts that match the name, sha1, and format for script


createScript

protected ome.model.core.OriginalFile createScript(byte[] buf,
                                                   String sha1,
                                                   ServiceFactory sf)
Create the original file and upload the bytes we've already read into memory.


createJob

public omero.model.ScriptJob createJob()
Returns a fresh (unsaved) ScriptJob which can be passed to acquireProcessor for background processing.



OmeroJava Api

Version: Beta-4.1.1-r5927-b91

Copyright © 2009 The University of Dundee. All Rights Reserved.