org.mftech.dawn.runtime.client.communication.impl
Class DawnWatcherImpl

java.lang.Object
  extended by java.lang.Thread
      extended by org.mftech.dawn.runtime.client.communication.impl.DawnWatcherImpl
All Implemented Interfaces:
java.lang.Runnable, Watcher
Direct Known Subclasses:
WatcherImpl

public class DawnWatcherImpl
extends java.lang.Thread
implements Watcher

Who When What MF 08.11.2008 now only the watcher is connected to the editor. Send resourcesToServer is done by the watching Thread

Author:
killa

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
DawnWatcherImpl(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor dawnDiagramEditor, java.lang.String projectname, java.lang.String pluginId)
           
 
Method Summary
 void addToIgnoreList(org.eclipse.emf.ecore.EObject obj)
          marks an object as ignored
 boolean changeObjectOnServer(org.eclipse.gef.EditPart selectedElement)
          changes object on server
 boolean deleteObjectOnServer(org.eclipse.gmf.runtime.notation.View view)
          removes the View from the server resource
 org.eclipse.emf.ecore.resource.Resource getGmfResource()
           
 ResourceSynchronizer getResourceSynchronizer()
           
 int getUserId()
           
 boolean isConfilcted()
           
 boolean isLoggedIn()
           
 boolean publish(org.eclipse.gmf.runtime.emf.core.resources.GMFResource gmfResource)
          This method normally is called by the Editor if a save is performed It sends the current data to the server
 boolean publishChange(org.eclipse.gef.EditPart selectedElement)
           
 boolean publishDeletion(org.eclipse.gef.EditPart selectedElement)
           
 boolean publishDeletion(org.eclipse.gmf.runtime.notation.View view)
           
 boolean publishRestore(org.eclipse.gef.EditPart selectedElement)
          tries to restore an object on the server
 boolean restoreObjectOnServer(org.eclipse.gef.EditPart selectedElement)
           
 void run()
           
 void saveLastResource()
          save the last resource in local file System
 void setResourceSynchronizer(ResourceSynchronizer resourceSynchronizer)
           
 void setUserId(int userId)
           
 void updateOfflineServer()
          just basic updating.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, 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, yield
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

DawnWatcherImpl

public DawnWatcherImpl(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor dawnDiagramEditor,
                       java.lang.String projectname,
                       java.lang.String pluginId)
Parameters:
dawnDiagramEditor -
editpartProvider -
projectname -
pluginId -
Method Detail

getUserId

public int getUserId()
Specified by:
getUserId in interface Watcher
Returns:

setUserId

public void setUserId(int userId)
Specified by:
setUserId in interface Watcher
Parameters:
userId -

getResourceSynchronizer

public ResourceSynchronizer getResourceSynchronizer()
Specified by:
getResourceSynchronizer in interface Watcher
Returns:

setResourceSynchronizer

public void setResourceSynchronizer(ResourceSynchronizer resourceSynchronizer)
Specified by:
setResourceSynchronizer in interface Watcher
Parameters:
resourceSynchronizer -

run

public void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

getGmfResource

public org.eclipse.emf.ecore.resource.Resource getGmfResource()
Specified by:
getGmfResource in interface Watcher
Returns:

publish

public boolean publish(org.eclipse.gmf.runtime.emf.core.resources.GMFResource gmfResource)
                throws ServerNotAvailableException,
                       DawnRemoteConnectorNotInitializedException
This method normally is called by the Editor if a save is performed It sends the current data to the server

Specified by:
publish in interface Watcher
Parameters:
gmfResource -
Throws:
ServerNotAvailableException
DawnRemoteConnectorNotInitializedException

isConfilcted

public boolean isConfilcted()
Specified by:
isConfilcted in interface Watcher
Returns:

addToIgnoreList

public void addToIgnoreList(org.eclipse.emf.ecore.EObject obj)
marks an object as ignored

Specified by:
addToIgnoreList in interface Watcher
Parameters:
obj -

publishRestore

public boolean publishRestore(org.eclipse.gef.EditPart selectedElement)
tries to restore an object on the server

Specified by:
publishRestore in interface Watcher
Parameters:
selectedElement -
lastObject -
Returns:
ture if the restore succeeded, false if the object was restored meanwhile by another client and changed

publishChange

public boolean publishChange(org.eclipse.gef.EditPart selectedElement)
Specified by:
publishChange in interface Watcher
Parameters:
selectedElement -
Returns:

publishDeletion

public boolean publishDeletion(org.eclipse.gef.EditPart selectedElement)
Specified by:
publishDeletion in interface Watcher
Parameters:
selectedElement -
Returns:

publishDeletion

public boolean publishDeletion(org.eclipse.gmf.runtime.notation.View view)
Specified by:
publishDeletion in interface Watcher
Parameters:
view -
Returns:

changeObjectOnServer

public boolean changeObjectOnServer(org.eclipse.gef.EditPart selectedElement)
changes object on server

Specified by:
changeObjectOnServer in interface Watcher
Parameters:
selectedElement -
lastObject -
Returns:
true if the change was successfull, false if the object had been deleted meanwhile

restoreObjectOnServer

public boolean restoreObjectOnServer(org.eclipse.gef.EditPart selectedElement)
Specified by:
restoreObjectOnServer in interface Watcher
Parameters:
selectedElement -
Returns:

deleteObjectOnServer

public boolean deleteObjectOnServer(org.eclipse.gmf.runtime.notation.View view)
removes the View from the server resource

Specified by:
deleteObjectOnServer in interface Watcher
Parameters:
view -
Returns:

saveLastResource

public void saveLastResource()
save the last resource in local file System

Specified by:
saveLastResource in interface Watcher

isLoggedIn

public boolean isLoggedIn()
Specified by:
isLoggedIn in interface Watcher
Returns:

updateOfflineServer

public void updateOfflineServer()
just basic updating. Should be improved later Should this not be moved to DawnRemoteConnector????

Specified by:
updateOfflineServer in interface Watcher