org.mmbase.streams.createcaches
Class Job

java.lang.Object
  extended by org.mmbase.streams.createcaches.Job
All Implemented Interfaces:
Iterable<Result>

public class Job
extends Object
implements Iterable<Result>

A Job is associated with a 'source' node, and describes what is currently happening to create 'caches' nodes for it. Such a Job object is created everytime somebody creates a new source object, or explicitly triggers the associated 'cache' objects to be (re)created.

Version:
$Id: Job.java 42366 2010-06-01 14:55:52Z andre $
Author:
Michiel Meeuwissen

Field Summary
(package private)  Future<Integer> future
           
(package private)  boolean interrupted
           
(package private)  BufferedLogger logger
           
(package private)  Processor processor
           
(package private)  boolean ready
           
 
Constructor Summary
Job(Processor processor, Cloud cloud, ChainedLogger chain)
           
Job(Processor processor, Map<String,JobDefinition> list, Cloud cloud, ChainedLogger chain)
          A Job is defined by several JobDefinition's, the output is goes to loggers in ChainedLogger
 
Method Summary
protected  void findResults()
          Defines the several Results by reading the JobDefinitions in the list.
 int getBusy()
           
protected  Node getCacheNode(Node src, String key)
          Gets and/or creates the node representing the 'cached' stream (the result of a conversion), see the builder property 'org.mmbase.streams.cachestype'.
protected  Node getCacheNode(String key)
          Gets and/or creates the node representing the 'cached' stream, uses this (source) node as infile to create cache from.
 Result getCurrent()
           
 Logger getLogger()
           
 Node getMediafragment()
           
 Node getNode()
           
 long getNumber()
           
 String getProgress()
           
 Stage getStage()
           
 Thread getThread()
          Thread in which this Job is running.
 String getUser()
           
 void interrupt()
           
 boolean isInterrupted()
           
 Iterator<Result> iterator()
           
 boolean reached(Stage s)
           
 void ready()
           
 void setNode(Node n)
          Source Node on which this Job will run.
 void setThread(Thread t)
           
 void submit(Cloud cloud, int n, ChainedLogger chain)
          Start actually executing this Job by submitting it at JobCallable.
(package private)  void submit(JobCallable jc)
          Re-submit this job.
 String toString()
           
 void waitUntil(Stage stage)
           
 void waitUntilAfter(Stage stage)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

final BufferedLogger logger

future

Future<Integer> future

interrupted

boolean interrupted

ready

boolean ready

processor

final Processor processor
Constructor Detail

Job

public Job(Processor processor,
           Cloud cloud,
           ChainedLogger chain)

Job

public Job(Processor processor,
           Map<String,JobDefinition> list,
           Cloud cloud,
           ChainedLogger chain)
A Job is defined by several JobDefinition's, the output is goes to loggers in ChainedLogger

Parameters:
processor - reads config, is called by user etc.
list - the definitions
cloud - mmbase cloud nodes belong to
chain - loggers
Method Detail

findResults

protected void findResults()
Defines the several Results by reading the JobDefinitions in the list. Creates streamsourcescaches for Transcoders and asigns TranscoderResults to them or creates RecognizerResults for JobDefinitions of recognizers.


iterator

public Iterator<Result> iterator()
Specified by:
iterator in interface Iterable<Result>

submit

public void submit(Cloud cloud,
                   int n,
                   ChainedLogger chain)
Start actually executing this Job by submitting it at JobCallable.


submit

void submit(JobCallable jc)
Re-submit this job.


getLogger

public Logger getLogger()

getCacheNode

protected Node getCacheNode(String key)
Gets and/or creates the node representing the 'cached' stream, uses this (source) node as infile to create cache from.

Parameters:
key - representation of the way the stream was created from its source
Returns:
cached stream node

getCacheNode

protected Node getCacheNode(Node src,
                            String key)
Gets and/or creates the node representing the 'cached' stream (the result of a conversion), see the builder property 'org.mmbase.streams.cachestype'. It first looks if it already exists, if not it creates a new one.

Parameters:
src - source node to create cache stream from, can be another cache
key - representation of the way the stream was created from its source, f.e. transcoding parameters
Returns:
cache stream node, in builder specified in 'org.mmbase.streams.cachestype'.

getCurrent

public Result getCurrent()

getThread

public Thread getThread()
Thread in which this Job is running.


setThread

public void setThread(Thread t)

setNode

public void setNode(Node n)
Source Node on which this Job will run.


interrupt

public void interrupt()

isInterrupted

public boolean isInterrupted()

reached

public boolean reached(Stage s)

ready

public void ready()

waitUntil

public void waitUntil(Stage stage)
               throws InterruptedException
Throws:
InterruptedException

waitUntilAfter

public void waitUntilAfter(Stage stage)
                    throws InterruptedException
Throws:
InterruptedException

getStage

public Stage getStage()

getProgress

public String getProgress()

getBusy

public int getBusy()

getUser

public String getUser()

getNumber

public long getNumber()

getNode

public Node getNode()

getMediafragment

public Node getMediafragment()

toString

public String toString()
Overrides:
toString in class Object


MMBase 2.0-SNAPSHOT - null