org.mmbase.module.builders
Class ServiceBuilder

java.lang.Object
  |
  +--org.mmbase.module.core.MMTable
        |
        +--org.mmbase.module.core.MMObjectBuilder
              |
              +--org.mmbase.module.builders.ServiceBuilder
All Implemented Interfaces:
MMBaseObserver
Direct Known Subclasses:
cdplayers, dropboxes, g2encoders

public class ServiceBuilder
extends MMObjectBuilder
implements MMBaseObserver

Version:
$Revision: 1.24 $ $Date: 2001/05/09 10:08:00 $
Author:
Daniel Ockeloen

Fields inherited from class org.mmbase.module.core.MMObjectBuilder
broadcastChanges, database, DEFAULT_ALINEA, DEFAULT_EOL, description, descriptions, fields, nodeCache, obj2type, OBJ2TYPE_MAX_SIZE, oType, REPLACE_CACHE, searchAge, sortedDBLayout, TEMPNODE_DEFAULT_SIZE, TemporaryNodes, virtual
 
Fields inherited from class org.mmbase.module.core.MMTable
mmb, tableName
 
Constructor Summary
ServiceBuilder()
           
 
Method Summary
 void addService(java.lang.String name, java.lang.String localclass, MMObjectNode mmserver)
          adds a service to this builder, name is allways valid and correct the Service builder _must_ update all the mmbase admins to reflect new state.
 void addService(java.lang.String name, java.lang.String localclass, MMObjectNode mmserver, java.util.Hashtable initparams)
          adds a service to this builder.
 java.lang.String doClaim(scanpage sp, java.util.StringTokenizer tok)
          Claims (state=claimed) the service node and fills its info field with owner and selected tracknr that has to be ripped.
 MMObjectNode getClaimedService(java.lang.String owner)
          Gets the first service node (cdplayers) that was claimed by a certain user.
 boolean init()
          Initializes builder, calls setCheckService? and loads session module.
 boolean nodeLocalChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Called when an operation is done on a service node eg insert, commit, it calls method to send the node change to the remote side.
 boolean nodeRemoteChanged(java.lang.String machine, java.lang.String number, java.lang.String builder, java.lang.String ctype)
          Called when another mmbse changed the service, if so then we print service state and info contents..
 void removeService(java.lang.String name)
          remove a service.
 void removeService(java.lang.String name, java.util.Hashtable initparams)
          remove a service.
 void sendToRemoteBuilder(int number, java.lang.String builder, java.lang.String ctype)
          Sends a signal to the remote side to indicate that service has been changed.
 
Methods inherited from class org.mmbase.module.core.MMObjectBuilder
addField, addLocalObserver, addRemoteObserver, buildSet, checkAddTmpField, commit, convertMMNode2SQL, count, create, createAlias, created, deleteNodeCache, drop, equals, equals, executeFunction, executeFunction, fieldLocalChanged, getAge, getAliasedNode, getAncestors, getCacheNumbers, getCacheSize, getCacheSize, getClassName, getConfigFile, getDBByte, getDBKey, getDBState, getDBText, getDBType, getDefaultTeaser, getDefaultUrl, getDescendants, getDescription, getDescription, getDescriptions, getEditFields, getField, getFieldNames, getFields, getFields, getFullTableName, getFunctionParameters, getGUIIndicator, getGUIIndicator, getHardNode, getHardNode, getHTML, getInitParameter, getInitParameters, getList, getLocaleGUIIndicator, getLocaleGUIIndicator, getMachineName, getMaintainer, getNewNode, getNewTmpNode, getNextField, getNextField, getNode, getNode, getNode, getNode, getNodes, getNodeType, getNumberFromName, getObjectType, getObjectValue, getParentBuilder, getPluralName, getPluralName, getPluralNames, getQuery, getQuery, getQuery, getRelations_main, getSearchAge, getShort, getShortedByte, getShortedText, getSingularName, getSingularName, getSingularNames, getSmartPath, getSortedFields, getSortedListFields, getTableName, getTmpNode, getURLEncode, getValue, getVersion, getWAP, getXMLPath, hashCode, hostname_function, insert, insert, insertDone, isExtensionOf, isNodeCached, isVirtual, preCommit, preEdit, process, putTmpNode, readSearchResults, removeField, removeNode, removeRelations, removeTmpNode, replace, safeCache, safeCommit, safeInsert, search, search, search, searchIn, searchIn, searchIn, searchList, searchList, searchNumbers, searchVector, searchVector, searchVector, searchVector, searchVectorIn, searchVectorIn, searchVectorIn, searchVectorIn, searchWithWhere, sendFieldChangeSignal, setDBLayout_xml, setDefaults, setDescription, setDescriptions, setInitParameter, setMaintainer, setMMBase, setParentBuilder, setPluralNames, setSearchAge, setSingularNames, setTableName, setValue, setValue, setVersion, setXMLPath, setXMLValues, signalNewObject, testValidData, toString, toString, toXML, updateFields, waitUntilNodeChanged, wrap
 
Methods inherited from class org.mmbase.module.core.MMTable
size
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServiceBuilder

public ServiceBuilder()
Method Detail

init

public boolean init()
Initializes builder, calls setCheckService? and loads session module.
Overrides:
init in class MMObjectBuilder
Returns:
true.

doClaim

public java.lang.String doClaim(scanpage sp,
                                java.util.StringTokenizer tok)
Claims (state=claimed) the service node and fills its info field with owner and selected tracknr that has to be ripped. The tracknr is retrieved from the session var -> name='serviceobj#TRACKNR' This is done through a reference variable(either alias or objnumber) stored in tok parameter.
Parameters:
sp - the scanpage object.
tok - a StringTokenizer with a servicebuilder type objectnumber (eg. cdplayers) and a username of who used the service.
Returns:
an empty String!?

getClaimedService

public MMObjectNode getClaimedService(java.lang.String owner)
Gets the first service node (cdplayers) that was claimed by a certain user.
Parameters:
owner - a String with the name of the owner that claimed the service.
Returns:
the service node that was claimed.

addService

public void addService(java.lang.String name,
                       java.lang.String localclass,
                       MMObjectNode mmserver)
                throws java.lang.Exception
adds a service to this builder, name is allways valid and correct the Service builder _must_ update all the mmbase admins to reflect new state. Next version will support name with authentication. Currently always a service of type cdplayers is expected for insertion.

addService

public void addService(java.lang.String name,
                       java.lang.String localclass,
                       MMObjectNode mmserver,
                       java.util.Hashtable initparams)
                throws java.lang.Exception
adds a service to this builder. name is allways valid and correct the Service builder _must_ update all the mmbase admins to reflect new state. Next version will support name with authentication. adds a init hashtable for use for authentication and other startup params.

removeService

public void removeService(java.lang.String name)
                   throws java.lang.Exception
remove a service. Does not mean it will be 100% removed from mmbase but that its not running at the moment. possible model will be removed results in offline state for X hours and removed in X days.

removeService

public void removeService(java.lang.String name,
                          java.util.Hashtable initparams)
                   throws java.lang.Exception
remove a service. does not mean it will be 100% removed from mmbase but that its not running at the moment. possible model will be removed results in offline state for X hours and removed in X days.

nodeRemoteChanged

public boolean nodeRemoteChanged(java.lang.String machine,
                                 java.lang.String number,
                                 java.lang.String builder,
                                 java.lang.String ctype)
Called when another mmbse changed the service, if so then we print service state and info contents..
Specified by:
nodeRemoteChanged in interface MMBaseObserver
Overrides:
nodeRemoteChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - Object number of the changed service.
builder - The buildername of the changed service.
ctype - The node change type.
Returns:
true, always!?

nodeLocalChanged

public boolean nodeLocalChanged(java.lang.String machine,
                                java.lang.String number,
                                java.lang.String builder,
                                java.lang.String ctype)
Called when an operation is done on a service node eg insert, commit, it calls method to send the node change to the remote side. However, if change was done by the remote side (change to busy, or change to waiting with exitvalue), we don't send this change to the remote side. Also node change of type new 'n' or delete 'd' aren't sent to remote side.
Specified by:
nodeLocalChanged in interface MMBaseObserver
Overrides:
nodeLocalChanged in class MMObjectBuilder
Parameters:
machine - Name of the machine that changed the node.
number - a String with the object number of the node that was operated on.
builder - a String with the buildername of the node that was operated on.
ctype - a String with the node change type.
Returns:
true, always!?

sendToRemoteBuilder

public void sendToRemoteBuilder(int number,
                                java.lang.String builder,
                                java.lang.String ctype)
Sends a signal to the remote side to indicate that service has been changed. The information sent is a service reference name, buildertype and change type. Signalling is done using the protocoldriver attached to the first mmserver that in turn is attached to the current service(builder) in progress.
Parameters:
number - Objectnumber of the changed service.
builder - The buildername of changed service.
ctype - The node change type.


MMBase build 1.6.5.20030923