|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
|
+--org.mmbase.module.builders.vwms.Vwm
|
+--org.mmbase.module.builders.vwms.EncodeCop
The EncodeCop vwm observes changes on a certain type of nodes and activates services by starting EncodeHandlers for that particular node. If a certain audio file has to be ripped, then the EncodeCop is programmed to check for newly AudioPart changes of ctype 'n' where the audiopart.source is equal to the CD audiosource. If this is true then it reacts by starting the EncodeHandler for ripping CD's. The same goes for the encoding of ripped audio. For this, the EncodeCop checks for RawAudio changes of type 'c' or 'n' where the rawaudio.state is equals to 1 and where the RawAudio represents encoded audio (eg. type=Real G2). The last type of node thats being checked is the g2encoder service. Here we check if the state is waiting and its info field is empty. If this is true, we make this g2encoder available for usage by adding it to a free services list. When an EncodeHandler is created, it is added to the EncoderHandlers list. The EncodeHandlers are removed from this list when they finish or when an error occurs during handling. Recovery : When the mmbase running this EncodeCop is being reset recovery is needed. Why?, cause there could be services that are still busy or services that just signalled that they're finished. In both cases, after mmbase reboot there are no more EncodeHandlers active for those services, thus the related rawaudios representing ripped/encoded audio won't be updated anymore. Thus, after mmbase reset recovery is written for the followin 2 cases: 1) Service was busy (eg. ripping or encoding) In this case the servicebuilder state is still 'busy' and the info field should contain the 'id' tag, where the value represents the audiopart being encoded. 2) Service just finished (eg. file ripped or encoded) In this case the servicebuilder state is 'waiting' and the info field should contain the 'result' tag and the 'id' tag. When all can be found an EncodeHandler is started that will actually handle the type of recovery needed for that particular service. Finally, another recovery routine is implemented for the case that EncodeHandlers are waiting for a g2encoder to come free again, sothat it can be used for encoding. In other words, the case that audioparts still need to be encoded. If mmbase is being reset while g2encode EncodeHandlers are queued up then we lose the queue (well, actually queue=threads that are waiting to be notified). When rebooted, we look for audioparts created from a CD source whose rawaudio state is 'verzoek' (request) and format is g2. The following node changed types exist in mmbase (stored in ctype variable: passed ctype: d: node deleted c: node changed n: new node f: node field changed r: node relation changed x: some xml notify? g: ? anyone...anyone... s: ? anyone...anyone...
| Fields inherited from class org.mmbase.module.builders.vwms.Vwm |
name, probe, sleeptime, Vwms, wvmnode |
| Constructor Summary | |
EncodeCop()
|
|
| Method Summary | |
void |
addService(int servicenumber)
Adds service to the list of free services. |
boolean |
audiopartChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
Checks the audiopart ctype and source value and when ok, it creates an EncodeHandler with task 'cdrip' to rip for this new audiopart. |
boolean |
g2encoderChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
Checks if the g2encoder state is waiting and has an empty info field. |
java.lang.String |
getContentsOfFreeServicesList()
Returns contents of freeservices list as a String. |
java.lang.String |
getRelatedMMServerName()
Gets the first mmserver connected to this Vwm. |
boolean |
nodeChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Checks node changetype and buildertype to decide which type of Changed method should be called. |
boolean |
nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when node was changed on local mmbase, inturn this method calls nodeChanged method. |
boolean |
nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
Called when node was changed by remote mmbase, inturn this method calls nodeChanged method. |
boolean |
probeCall()
Adds observers to audiopart, rawaudio and g2encoder changes. |
boolean |
rawaudioChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
Checks the rawaudio ctype and state & format value and when ok, it creates an an EncodeHandler with task 'g2encode' to encode for this rawaudio. |
boolean |
removeEncodeHandler(EncodeHandler eh)
Removes EncodeHandler reference from the EncoderHandlers vector. |
boolean |
removeService(int servicenumber)
Removes the first occurence of this services from the list of free services. |
int |
retrieveService()
Retrieves a service from a list of free services. |
| Methods inherited from class org.mmbase.module.builders.vwms.Vwm |
addClient, claim, debug, failed, getName, getVwmNode, init, parseProperties, performed, performTask, putTask, releaseClient, rollback, run, start, stop |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public EncodeCop()
| Method Detail |
public boolean probeCall()
probeCall in class Vwm
public boolean nodeRemoteChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
nodeRemoteChanged in interface MMBaseObservernodeRemoteChanged in class Vwmmachine - Name of the machine that changed the node.number - object number of node who's state has been changed remotely.builder - a String with the buildername of the node that was changed remotely.ctype - a String with the node change type.
public boolean nodeLocalChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
nodeLocalChanged in interface MMBaseObservernodeLocalChanged in class Vwmmachine - Name of the machine that changed the node.number - object number of node who's state has been changed.builder - a String with the buildername of the node that was changed.ctype - a String with the node change type.
public boolean nodeChanged(java.lang.String machine,
java.lang.String number,
java.lang.String builder,
java.lang.String ctype)
machine - Name of the machine that changed the node.number - object number of node who's state has been changed.builder - a String with the buildername of the node that was changed.ctype - a String with the node change type.
public boolean audiopartChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
machine - Name of the machine that changed the node.number - - a String containing the object nr of this audioparts node.ctype - - a String with the node changed type.number -
public boolean rawaudioChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
machine - Name of the machine that changed the node.number - - a String containing the object nr of this rawaudios node.ctype - - a String with the node changed type.
public boolean g2encoderChanged(java.lang.String machine,
java.lang.String number,
java.lang.String ctype)
machine - Name of the machine that changed the node.number - - a String containing the object nr of this g2encoders node.ctype - - a String with the node changed type.public boolean removeEncodeHandler(EncodeHandler eh)
h - EncodeHandlers reference.public java.lang.String getRelatedMMServerName()
public int retrieveService()
public void addService(int servicenumber)
servicenumber - that is added.public boolean removeService(int servicenumber)
servicenumber - that has to be removed.public java.lang.String getContentsOfFreeServicesList()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||