Saros
Distributed Collaborative Editing and Distributed Party Programming
|
Classes | |
class | ResourceInfo |
class | UpdatableValue< E > |
Public Member Functions | |
SharedProject (IProject project, ISarosSession sarosSession) | |
boolean | updateVcs (VCSProvider newValue) |
boolean | updateVcsUrl (String newValue) |
boolean | updateVcsUrl (IResource resource, String newValue) |
boolean | updateRevision (String newValue) |
boolean | updateRevision (IResource resource, String newValue) |
boolean | updateProjectIsOpen (boolean newValue) |
void | remove (IResource resource) |
void | add (IResource resource) |
void | move (IResource resource, IPath oldFullPath) |
VCSProvider | getVCSProvider () |
boolean | belongsTo (IProject project) |
boolean | contains (IResource resource) |
String | getName () |
void | delete () |
Protected Member Functions | |
void | initializeResources () |
void | checkResource (IResource resource) |
void | addAll (IResource resource) throws Exception |
Protected Attributes | |
final ISarosSession | sarosSession |
final IProject | project |
UpdatableValue< Boolean > | projectIsOpen |
UpdatableValue< VCSProvider > | vcs |
Map< IPath, ResourceInfo > | resourceMap |
UpdatableValue< Boolean > | hasWriteAccess |
ISharedProjectListener | sharedProjectListener |
A SharedProject stores the state of a project (and its resources) shared in a Saros session.
Saros replicates a shared project, i.e. keeps copies of the project on the peers in sync with the local project. A SharedProject represents the state that these remote copies are supposed to be in. Whenever a user with Permission#WRITE_ACCESS detects a mismatch between the IProject and the corresponding SharedProject, we know that we need to send activities.
Currently, the SharedProject is only accessed (updated) when the client has Permission#WRITE_ACCESS.
de.fu_berlin.inf.dpp.core.project.SharedProject.SharedProject | ( | IProject | project, |
ISarosSession | sarosSession | ||
) |
void de.fu_berlin.inf.dpp.core.project.SharedProject.add | ( | IResource | resource | ) |
Adds the resource to the SharedProject.
void de.fu_berlin.inf.dpp.core.project.SharedProject.addAll | ( | IResource | resource | ) | throws Exception [protected] |
Adds the resource, and recursively adds its decendants if it's a IContainer.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.belongsTo | ( | IProject | project | ) |
Returns true if this SharedProject tracks the state of the project.
void de.fu_berlin.inf.dpp.core.project.SharedProject.checkResource | ( | IResource | resource | ) | [protected] |
IllegalArgumentException | if the resource is null or if this shared project doesn't contain it. |
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.contains | ( | IResource | resource | ) |
Returns true if this SharedProject contains the resource.
void de.fu_berlin.inf.dpp.core.project.SharedProject.delete | ( | ) |
String de.fu_berlin.inf.dpp.core.project.SharedProject.getName | ( | ) |
VCSProvider de.fu_berlin.inf.dpp.core.project.SharedProject.getVCSProvider | ( | ) |
Returns the current VCSProvider
void de.fu_berlin.inf.dpp.core.project.SharedProject.initializeResources | ( | ) | [protected] |
Initialize the ResourceInfo for every resource in the SharedProject.
Moves the resource within the shared project. Does not change the resource information associated with the resource.
void de.fu_berlin.inf.dpp.core.project.SharedProject.remove | ( | IResource | resource | ) |
Removes the resource from the SharedProject.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateProjectIsOpen | ( | boolean | newValue | ) |
Updates if the SharedProject is currently open, and returns true if the value changed.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateRevision | ( | String | newValue | ) |
Updates the current VCS revision, and returns true if the value changed.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateRevision | ( | IResource | resource, |
String | newValue | ||
) |
Updates the current VCS revision, and returns true if the value changed.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateVcs | ( | VCSProvider | newValue | ) |
Updates the current VCSProvider, and returns true if the value changed.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateVcsUrl | ( | String | newValue | ) |
Updates the current VCS URL, and returns true if the value changed.
boolean de.fu_berlin.inf.dpp.core.project.SharedProject.updateVcsUrl | ( | IResource | resource, |
String | newValue | ||
) |
Updates the current VCS URL, and returns true if the value changed.
UpdatableValue<Boolean> de.fu_berlin.inf.dpp.core.project.SharedProject.hasWriteAccess [protected] |
new UpdatableValue<Boolean>( false)
final IProject de.fu_berlin.inf.dpp.core.project.SharedProject.project [protected] |
UpdatableValue<Boolean> de.fu_berlin.inf.dpp.core.project.SharedProject.projectIsOpen [protected] |
new UpdatableValue<Boolean>( false)
Map<IPath, ResourceInfo> de.fu_berlin.inf.dpp.core.project.SharedProject.resourceMap [protected] |
new HashMap<IPath, ResourceInfo>() { @Override public String toString() { Map<String, String> sortedMap = new TreeMap<String, String>(); for (Map.Entry<IPath, ResourceInfo> entry : this.entrySet()) sortedMap.put(entry.getKey().toString(), entry.getValue().toString()); StringBuilder result = new StringBuilder(512); String fullPath = project.getFullPath().toString() + "/"; for (Map.Entry<?, ?> entry : sortedMap.entrySet()) result.append(fullPath).append(entry.getKey()).append( " -> ") .append(entry.getValue()).append('\n'); result.setLength(result.length() - 1); return result.toString(); } }
Maps the project relative path of a resource.
final ISarosSession de.fu_berlin.inf.dpp.core.project.SharedProject.sarosSession [protected] |
ISharedProjectListener de.fu_berlin.inf.dpp.core.project.SharedProject.sharedProjectListener [protected] |
new AbstractSharedProjectListener() { @Override public void permissionChanged(User user) { boolean writeAccess = sarosSession.hasWriteAccess(); if (!hasWriteAccess.update(writeAccess)) return; if (writeAccess) { resourceMap.clear(); initializeResources(); } } }
Note that this listener is only registered if VCS support is enabled for the session.
UpdatableValue<VCSProvider> de.fu_berlin.inf.dpp.core.project.SharedProject.vcs [protected] |
new UpdatableValue<VCSProvider>(
null)