org.mftech.dawn.runtime.client.synchronization.impl
Class ResourceSynchronizerImpl

java.lang.Object
  extended by java.util.Observable
      extended by org.mftech.dawn.runtime.client.synchronization.impl.ResourceSynchronizerImpl
All Implemented Interfaces:
ResourceSynchronizer

public class ResourceSynchronizerImpl
extends java.util.Observable
implements ResourceSynchronizer

This classes handles the changes on the clientside

Author:
killa

Field Summary
 
Fields inherited from interface org.mftech.dawn.runtime.client.synchronization.ResourceSynchronizer
LOCALLY_DELTETION_CONFLICT, NO_CONFLICT, REMOTELY_AND_LOCALLY_CHANGED_CONFLICT, REMOTELY_DELTETION_CONFLICT
 
Constructor Summary
ResourceSynchronizerImpl(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor edit, java.lang.String projectname2, org.eclipse.emf.ecore.resource.Resource localResource, boolean isServerAvailable, org.eclipse.emf.ecore.resource.ResourceSet res, DawnElementTypeHelper elementTypeHelper, java.lang.String pluginId)
          constructor
 
Method Summary
 void cleanIgnoreList()
          cleans the ignore list
 java.util.Map<java.lang.String,ChangeObject> getChangedLocalyAndRemotellyConflicts()
           
 int getConflictType(java.lang.String key)
          returns the conflictlist for the object
 java.util.Map<java.lang.String,ChangeObject> getDeletedLocallyConflicts()
           
 java.util.Map<java.lang.String,ChangeObject> getDeletedRemotelyConflicts()
           
 java.util.Set<java.lang.String> getGloballyLocked()
           
 java.util.Set<java.lang.String> getIgnoreList()
           
 org.eclipse.emf.ecore.resource.Resource getLastResource()
           
 java.util.Set<java.lang.String> getLocallyLocked()
           
 java.util.Set<org.eclipse.emf.ecore.EObject> getSelectedElements()
           
 boolean isConflicted()
           
 boolean isConflicted(org.eclipse.gmf.runtime.emf.core.resources.GMFResource localResource, DawnRemoteConnection dawnRemoteConnection)
          chekcs if the resource GMFResource is in conflict with local and last resource
 void lastResourceChangeView(org.eclipse.gmf.runtime.notation.View newView)
           
 void lastResourceDeleteView(org.eclipse.gmf.runtime.notation.View newView)
           
 void loadLastResource()
           
 int lockObjectsLocally(java.util.List<org.eclipse.gef.EditPart> selectedElements, DawnRemoteConnection dawnRemoteConnection)
          locks the objects on the server in the sepcific project
 boolean publish(org.eclipse.gmf.runtime.emf.core.resources.GMFResource localResource, DawnRemoteConnection dawnRemoteConnection)
          sends the local Resources to the server.
 void resolveChangedLocalyAndRemotellyConflict(java.lang.String xmiId)
          resolve the locally and globally change conflict for the view behind the xmiid
 void resolveDeletedLocallyConflict(java.lang.String xmiId)
           
 void resolveDeletedRemotellyConflict(java.lang.String xmiId)
           
 void saveLastResource(org.eclipse.emf.ecore.resource.Resource localResource)
           
 void setChangedLocalyAndRemotellyConflicts(java.util.Map<java.lang.String,ChangeObject> changedLocalyAndRemotellyConflicts)
           
 void setDeletedLocallyConflicts(java.util.Map<java.lang.String,ChangeObject> delectConflicts)
           
 void setDeletedRemotelyConflicts(java.util.Map<java.lang.String,ChangeObject> deletedRemotelyConflicts)
           
 void setGloballyLocked(java.util.Set<java.lang.String> lockedObjects)
           
 void setIgnored(org.eclipse.emf.ecore.EObject obj)
           
 void setIgnored(java.lang.String id)
           
 void setIgnoreList(java.util.Set<java.lang.String> ignoreList)
           
 void setLastResource(org.eclipse.emf.ecore.resource.Resource lastResource)
           
 void setLocallyLocked(java.util.Set<java.lang.String> locallyLocked)
          sets the locally locked elements
 void setRemoteLocks(java.util.Map<java.lang.String,java.lang.Integer> lockedObjects)
          sets all locks from remote
 void setSelectedElements(java.util.Set<org.eclipse.emf.ecore.EObject> selectedElements)
           
static void synchronizeDiagramXMI(org.eclipse.emf.ecore.resource.Resource oldResouce, org.eclipse.emf.ecore.resource.Resource newResource)
          This messages synchronizes the XMI id of the client diagram with the server diagram.
 void unIgnored(java.lang.String id)
           
 int unlockObjects(java.util.List<org.eclipse.gef.EditPart> selectedElements, DawnRemoteConnection dawnRemoteConnection)
          unlocks all Objects from the list
 boolean update(org.eclipse.emf.ecore.resource.Resource localResouce, org.eclipse.emf.ecore.resource.Resource serverResource, boolean publish, DawnRemoteConnection dawnRemoteConnection)
          This method synchronizes the resources.
 void updateViewWithRemoteView(org.eclipse.gmf.runtime.notation.View obj)
          updates obj with the information from the serverNode
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mftech.dawn.runtime.client.synchronization.ResourceSynchronizer
addObserver
 

Constructor Detail

ResourceSynchronizerImpl

public ResourceSynchronizerImpl(org.eclipse.gmf.runtime.diagram.ui.resources.editor.parts.DiagramDocumentEditor edit,
                                java.lang.String projectname2,
                                org.eclipse.emf.ecore.resource.Resource localResource,
                                boolean isServerAvailable,
                                org.eclipse.emf.ecore.resource.ResourceSet res,
                                DawnElementTypeHelper elementTypeHelper,
                                java.lang.String pluginId)
constructor

Parameters:
edit -
projectname2 -
localResource -
Method Detail

getLocallyLocked

public java.util.Set<java.lang.String> getLocallyLocked()
Specified by:
getLocallyLocked in interface ResourceSynchronizer

setLocallyLocked

public void setLocallyLocked(java.util.Set<java.lang.String> locallyLocked)
sets the locally locked elements

Specified by:
setLocallyLocked in interface ResourceSynchronizer
Parameters:
locallyLocked -

getChangedLocalyAndRemotellyConflicts

public java.util.Map<java.lang.String,ChangeObject> getChangedLocalyAndRemotellyConflicts()
Specified by:
getChangedLocalyAndRemotellyConflicts in interface ResourceSynchronizer

setChangedLocalyAndRemotellyConflicts

public void setChangedLocalyAndRemotellyConflicts(java.util.Map<java.lang.String,ChangeObject> changedLocalyAndRemotellyConflicts)
Specified by:
setChangedLocalyAndRemotellyConflicts in interface ResourceSynchronizer
Parameters:
changedLocalyAndRemotellyConflicts -

getDeletedRemotelyConflicts

public java.util.Map<java.lang.String,ChangeObject> getDeletedRemotelyConflicts()
Specified by:
getDeletedRemotelyConflicts in interface ResourceSynchronizer
Returns:

getIgnoreList

public java.util.Set<java.lang.String> getIgnoreList()
Specified by:
getIgnoreList in interface ResourceSynchronizer

setIgnoreList

public void setIgnoreList(java.util.Set<java.lang.String> ignoreList)
Specified by:
setIgnoreList in interface ResourceSynchronizer

setDeletedRemotelyConflicts

public void setDeletedRemotelyConflicts(java.util.Map<java.lang.String,ChangeObject> deletedRemotelyConflicts)
Parameters:
deletedRemotelyConflicts -

getDeletedLocallyConflicts

public java.util.Map<java.lang.String,ChangeObject> getDeletedLocallyConflicts()
Specified by:
getDeletedLocallyConflicts in interface ResourceSynchronizer
Returns:

setDeletedLocallyConflicts

public void setDeletedLocallyConflicts(java.util.Map<java.lang.String,ChangeObject> delectConflicts)
Specified by:
setDeletedLocallyConflicts in interface ResourceSynchronizer
Parameters:
delectConflicts -

getSelectedElements

public java.util.Set<org.eclipse.emf.ecore.EObject> getSelectedElements()
Specified by:
getSelectedElements in interface ResourceSynchronizer
Returns:

setSelectedElements

public void setSelectedElements(java.util.Set<org.eclipse.emf.ecore.EObject> selectedElements)
Specified by:
setSelectedElements in interface ResourceSynchronizer
Parameters:
selectedElements -

publish

public boolean publish(org.eclipse.gmf.runtime.emf.core.resources.GMFResource localResource,
                       DawnRemoteConnection dawnRemoteConnection)
sends the local Resources to the server. The Server will merge the resources with the current resource on the server

Specified by:
publish in interface ResourceSynchronizer
Parameters:
localResource -
Returns:
true if conflicted, false otherwise

cleanIgnoreList

public void cleanIgnoreList()
cleans the ignore list

Specified by:
cleanIgnoreList in interface ResourceSynchronizer

update

public boolean update(org.eclipse.emf.ecore.resource.Resource localResouce,
                      org.eclipse.emf.ecore.resource.Resource serverResource,
                      boolean publish,
                      DawnRemoteConnection dawnRemoteConnection)
               throws java.lang.Exception
This method synchronizes the resources. It also detects conflicts and makrs the conflictes objekts • Erstelle DIff zum Alten Bestand • Identifiziere, new, changed und deleted • Hole Daten vom Server • Erkenne Konflikte • Behandle Konflikte • Merge • Sende Daten an den Server (alle Ändeurngen) • Speicher Bestand in alten Bestand

Specified by:
update in interface ResourceSynchronizer
Parameters:
resource -
Returns:
Throws:
java.lang.Exception
java.io.IOException

isConflicted

public boolean isConflicted(org.eclipse.gmf.runtime.emf.core.resources.GMFResource localResource,
                            DawnRemoteConnection dawnRemoteConnection)
                     throws java.io.IOException,
                            java.lang.Exception
chekcs if the resource GMFResource is in conflict with local and last resource

Specified by:
isConflicted in interface ResourceSynchronizer
Parameters:
localResource -
Returns:
Throws:
java.io.IOException
java.lang.Exception

isConflicted

public boolean isConflicted()
Specified by:
isConflicted in interface ResourceSynchronizer
Returns:

lastResourceChangeView

public void lastResourceChangeView(org.eclipse.gmf.runtime.notation.View newView)
Specified by:
lastResourceChangeView in interface ResourceSynchronizer
Parameters:
newView -

lastResourceDeleteView

public void lastResourceDeleteView(org.eclipse.gmf.runtime.notation.View newView)
Specified by:
lastResourceDeleteView in interface ResourceSynchronizer
Parameters:
newView -

updateViewWithRemoteView

public void updateViewWithRemoteView(org.eclipse.gmf.runtime.notation.View obj)
updates obj with the information from the serverNode

Specified by:
updateViewWithRemoteView in interface ResourceSynchronizer
Parameters:
obj -

synchronizeDiagramXMI

public static void synchronizeDiagramXMI(org.eclipse.emf.ecore.resource.Resource oldResouce,
                                         org.eclipse.emf.ecore.resource.Resource newResource)
This messages synchronizes the XMI id of the client diagram with the server diagram. This means only that the client-diagram's xmi id is overwritten by the server's one. It also sets the xmi Id for the emf root --oldXMId=newXMIid-- NOTE: This method should become @deprecated if the recursively emf compare based comparison is implemented.

Parameters:
oldResouce -
newResource -

resolveDeletedRemotellyConflict

public void resolveDeletedRemotellyConflict(java.lang.String xmiId)
Specified by:
resolveDeletedRemotellyConflict in interface ResourceSynchronizer
Parameters:
xmiId -

resolveChangedLocalyAndRemotellyConflict

public void resolveChangedLocalyAndRemotellyConflict(java.lang.String xmiId)
resolve the locally and globally change conflict for the view behind the xmiid

Specified by:
resolveChangedLocalyAndRemotellyConflict in interface ResourceSynchronizer
Parameters:
xmiId - the id which identifies the view

resolveDeletedLocallyConflict

public void resolveDeletedLocallyConflict(java.lang.String xmiId)
Specified by:
resolveDeletedLocallyConflict in interface ResourceSynchronizer
Parameters:
xmiId -

getConflictType

public int getConflictType(java.lang.String key)
returns the conflictlist for the object

Specified by:
getConflictType in interface ResourceSynchronizer
Parameters:
model -
Returns:

unIgnored

public void unIgnored(java.lang.String id)
Specified by:
unIgnored in interface ResourceSynchronizer

getLastResource

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

setLastResource

public void setLastResource(org.eclipse.emf.ecore.resource.Resource lastResource)
Specified by:
setLastResource in interface ResourceSynchronizer
Parameters:
lastResource -

setIgnored

public void setIgnored(java.lang.String id)
Specified by:
setIgnored in interface ResourceSynchronizer
Parameters:
id -

setIgnored

public void setIgnored(org.eclipse.emf.ecore.EObject obj)
Specified by:
setIgnored in interface ResourceSynchronizer
Parameters:
obj -

setRemoteLocks

public void setRemoteLocks(java.util.Map<java.lang.String,java.lang.Integer> lockedObjects)
sets all locks from remote

Specified by:
setRemoteLocks in interface ResourceSynchronizer
Parameters:
lockedObjects -

getGloballyLocked

public java.util.Set<java.lang.String> getGloballyLocked()
Specified by:
getGloballyLocked in interface ResourceSynchronizer
Returns:

setGloballyLocked

public void setGloballyLocked(java.util.Set<java.lang.String> lockedObjects)
Specified by:
setGloballyLocked in interface ResourceSynchronizer
Parameters:
lockedObjects -

lockObjectsLocally

public int lockObjectsLocally(java.util.List<org.eclipse.gef.EditPart> selectedElements,
                              DawnRemoteConnection dawnRemoteConnection)
locks the objects on the server in the sepcific project

Specified by:
lockObjectsLocally in interface ResourceSynchronizer
Parameters:
selectedElements -
Returns:

unlockObjects

public int unlockObjects(java.util.List<org.eclipse.gef.EditPart> selectedElements,
                         DawnRemoteConnection dawnRemoteConnection)
unlocks all Objects from the list

Specified by:
unlockObjects in interface ResourceSynchronizer
Parameters:
selectedElements -
Returns:

saveLastResource

public void saveLastResource(org.eclipse.emf.ecore.resource.Resource localResource)
Specified by:
saveLastResource in interface ResourceSynchronizer
Parameters:
gmfResource -

loadLastResource

public void loadLastResource()
Specified by:
loadLastResource in interface ResourceSynchronizer