public class DataManager extends java.lang.Thread implements DataManagerInterface
Geht eine Anfrage über die Methoden addProtocolRequest(ResultData[]) oder addScriptRequest(ResultData[]) ein, so wird diese Anfrage in
einem Ringpuffer abgelegt. Ist der Thread unbeschäftigt, werden sie der Reihe nach (FIFO) abgearbeitet.
| Modifier and Type | Field and Description |
|---|---|
private boolean |
_abort
Abbrechen des DatenManagers.
|
private DataManagerRequest |
_currentRequest
Auftrag der momentan abgearbeitet wird.
|
private ClientDavInterface |
_dav
Verbindung zum Datenverteiler
|
private static Debug |
_debug
Debug - Ausgaben
|
private DataModel |
_model
Datenmodell
|
private java.lang.String |
_path
Pfad unter dem die Dateien Verwaltet werden.
|
private boolean |
_prettyPrinter
Steuert ob der Pretty Printer verwendet werden soll.
|
private int |
_quota
Minimaler verbleibender Speicherplatz auf dem Datenträgern (in MB)
|
private RingBuffer<DataManagerRequest> |
_requests
Ringpuffer in dem die Aufträge abgelegt werden, die bereit zur Abarbeitung sind
|
private static int |
INITIAL_RINGBUFFER_SIZE
Initiale Ringbuffer Größe.
|
private static java.lang.String |
META_FILENAME_EXTENSION
Dateieindung Skript-Metainformationen
|
private static java.lang.String |
SOURCE_FILENAME_EXTENSION
Dateiendung Skript-Quelltext
|
| Constructor and Description |
|---|
DataManager(ClientDavInterface dav,
java.lang.String path,
int quota,
boolean prettyPrinter)
Erzeugen des Data Managers.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addProtocolRequest(ResultData[] resultData)
Übergeben einer Protokoll-bezogenen Anfrage.
|
void |
addScriptRequest(ResultData[] resultData)
Übergeben einer Skript-bezogenen Anfrage.
|
void |
addScriptRequest(ScriptRequest request)
Übergeben einer Skript-bezogenen Anfrage
|
ProtocolOutputStream |
createProtocolStream(long protocolId,
ProcessingParameter pp)
Erzeugt einen Ausgabestream für ein Protokoll.
|
void |
deleteProtocol(long protocolId)
Löscht ein gespeichertes Protokoll.
|
java.lang.String |
getAbsolutFileNameMeta(SystemObject script)
Liefert Pfad und Dateiname der Metainformation
|
java.lang.String |
getAbsolutFileNameSource(SystemObject script)
Liefert Pfad und Dateiname des Skriptquelltextes
|
java.lang.String |
getFileNameMeta(SystemObject script)
Liefert den Dateinamen der Metainformationen.
|
java.lang.String |
getFileNameSource(SystemObject script)
Liefert den Dateinamen des Skriptquelltexts.
|
AtlMeta |
getMetaInformation(SystemObject script)
Liefert die zum Skript gehörenden Metainformationen.
|
java.lang.String |
getPath()
Gibt den Pfad der Protokoll- und Skriptdateien zurück.
|
ProtocolInputStream |
getSavedProtocol(long protocolId)
Liefert ein Objekt zum Zugriff auf ein gespeichertes Protokoll zurück.
|
ProtocolInputStream |
getUnreadProtocol(long protocolId)
Liefert ein Objekt zum Zugriff auf ein gespeichertes Protokoll zurück.
|
DataManagerRequest[] |
getUpcomingOps(DataManagerRequest[] dmr)
Liefert eine Liste mit anstehenden Aufgaben.
|
boolean |
isUnique(long protocolId)
Überprüft ob es zu der gegebenen Protokoll-Id bereits ein gespeichertes Protokoll gibt.
|
private java.io.DataInputStream |
loadScriptSource(java.lang.String fileName)
Öffnet Stream mit Skript Quelltext.
|
ProcessingInformation |
process(ProcessingParameter parameter)
Startet die Interpretation eines Skriptes:
1. |
ProcessingInformation |
process(java.lang.String source)
Startet die Interpretation eines Skriptes.
|
private java.lang.String |
readSource(SystemObject script)
Liest den Quelltext eines Skripts ein.
|
void |
run()
Arbeitet die Aufträge ab.
|
void |
shutdown()
Fährt den Data-Manager herunter.
|
activeCount, checkAccess, clone, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yieldprivate static final java.lang.String SOURCE_FILENAME_EXTENSION
private static final java.lang.String META_FILENAME_EXTENSION
private static final int INITIAL_RINGBUFFER_SIZE
private RingBuffer<DataManagerRequest> _requests
private DataModel _model
private ClientDavInterface _dav
private static final Debug _debug
private java.lang.String _path
File.separator.private int _quota
private boolean _abort
private DataManagerRequest _currentRequest
private boolean _prettyPrinter
public DataManager(ClientDavInterface dav, java.lang.String path, int quota, boolean prettyPrinter) throws FailureException
Thread.start() gestartet werden.dav - Verbindung zum Datenverteilerpath - Pfad unter dem die Dateien (Skriptquelltexte und Protokolldateien) verwaltet werden.quota - Minimaler verbleibender Speicherplatz auf dem Datenträgern (in MB)prettyPrinter - Steuert ob der Pretty Printer verwendet werden soll.FailureException - Falls ein ungültiger Pfad übergeben wird.public ProcessingInformation process(ProcessingParameter parameter) throws FailureException
process in interface DataManagerInterfaceparameter - AuftragsparameterFailureException - Fehler beim Interpretieren des Skripts.private java.io.DataInputStream loadScriptSource(java.lang.String fileName)
throws FailureException
fileName - DateinamefileName zeigt.FailureException - Fehler beim Öffnen.public AtlMeta getMetaInformation(SystemObject script) throws FailureException
DataManagerInterfacegetMetaInformation in interface DataManagerInterfacescript - Skriptobjekt.null falls keine Metainformation existiert.FailureException - Korrupte Metainformation.DataManagerInterface.getMetaInformation(SystemObject)private java.lang.String readSource(SystemObject script) throws FailureException
FailureExceptionpublic void run()
run in interface java.lang.Runnablerun in class java.lang.Threadpublic boolean isUnique(long protocolId)
isUnique in interface DataManagerInterfaceprotocolId - Protokoll-Idpublic void addScriptRequest(ResultData[] resultData)
addScriptRequest in interface DataManagerInterfaceresultData - Objekt mit den Anfrageparameternpublic java.lang.String getPath()
DataManagerInterfaceFile.separatorgetPath in interface DataManagerInterfaceDataManagerInterface.getPath()public ProcessingInformation process(java.lang.String source) throws CriticalParserException
DataManagerInterfaceprocess in interface DataManagerInterfacesource - Source des SkriptobjektsCriticalParserException - FehlermeldungDataManagerInterface.process(java.lang.String)public void addProtocolRequest(ResultData[] resultData)
addProtocolRequest in interface DataManagerInterfaceresultData - Objekt mit den Anfrageparameternpublic java.lang.String getFileNameSource(SystemObject script)
DataManagerInterfacegetFileNameSource in interface DataManagerInterfacescript - SkriptobjektDataManagerInterface.getFileNameSource(SystemObject)public java.lang.String getFileNameMeta(SystemObject script)
DataManagerInterfacegetFileNameMeta in interface DataManagerInterfacescript - SkriptobjektDataManagerInterface.getFileNameMeta(SystemObject)public java.lang.String getAbsolutFileNameMeta(SystemObject script)
DataManagerInterfacegetAbsolutFileNameMeta in interface DataManagerInterfacescript - SkriptobjektDataManagerInterface.getAbsolutFileNameMeta(SystemObject)public java.lang.String getAbsolutFileNameSource(SystemObject script)
DataManagerInterfacegetAbsolutFileNameSource in interface DataManagerInterfacescript - SkriptobjektDataManagerInterface.getAbsolutFileNameSource(SystemObject)public void addScriptRequest(ScriptRequest request)
DataManagerInterfaceaddScriptRequest in interface DataManagerInterfacerequest - AnfrageDataManagerInterface.addScriptRequest(de.bsvrz.pua.prot.manager.requests.ScriptRequest)public void shutdown()
DataManagerInterfaceshutdown in interface DataManagerInterfaceDataManagerInterface.shutdown()public void deleteProtocol(long protocolId)
throws NoncriticalException
DataManagerInterfacedeleteProtocol in interface DataManagerInterfaceNoncriticalException - Fehler beim Löschen.DataManagerInterface.deleteProtocol(long)public ProtocolInputStream getSavedProtocol(long protocolId) throws FailureException
DataManagerInterfacegetSavedProtocol in interface DataManagerInterfaceprotocolId - Id des Protokolls, das gelesen werden soll.FailureException - Fehler.DataManagerInterface.getSavedProtocol(long)public ProtocolInputStream getUnreadProtocol(long protocolId) throws FailureException
DataManagerInterfacegetUnreadProtocol in interface DataManagerInterfaceprotocolId - Id des Protokolls, das gelesen werden soll.FailureException - Fehler.DataManagerInterface.getUnreadProtocol(long)public ProtocolOutputStream createProtocolStream(long protocolId, ProcessingParameter pp) throws NoncriticalException
DataManagerInterfacecreateProtocolStream in interface DataManagerInterfaceprotocolId - Protokoll-Id.pp - Auftragsparameter.NoncriticalException - Die Datei kann nicht angelegt werden; Fehler beim Schreiben der Protokollinformationen.DataManagerInterface.createProtocolStream(long,de.bsvrz.pua.prot.util.ProcessingParameter)public DataManagerRequest[] getUpcomingOps(DataManagerRequest[] dmr)
DataManagerInterfacegetUpcomingOps in interface DataManagerInterfacedmr - Array, in den das Ergebnis kopiert wird. Ist der Array zu klein, so wird ein neuer Array angelegt.DataManagerInterface.getUpcomingOps(DataManagerRequest[])