Saros
Distributed Collaborative Editing and Distributed Party Programming
de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper Class Reference

List of all members.

Public Member Functions

synchronized void addProject (String id, IProject project, boolean isPartially)
synchronized void removeProject (String id)
synchronized void addResources (IProject project, Collection<?extends IResource > resources)
synchronized void removeResources (IProject project, Collection<?extends IResource > resources)
synchronized void removeAndAddResources (IProject project, Collection<?extends IResource > resourcesToRemove, Collection<?extends IResource > resourcesToAdd)
synchronized String getID (IProject project)
synchronized IProject getProject (String id)
synchronized boolean isShared (IResource resource)
synchronized Set< IProjectgetProjects ()
synchronized List< IResourcegetPartiallySharedResources ()
synchronized int size ()
synchronized Map< IProject,
List< IResource > > 
getProjectResourceMapping ()
synchronized boolean isCompletelyShared (IProject project)
synchronized boolean isPartiallyShared (IProject project)
synchronized boolean userHasProject (User user, IProject project)
synchronized void addMissingProjectsToUser (User user)
void userLeft (User user)

Package Functions

 SarosProjectMapper ()

Detailed Description

This class is responsible for mapping global project IDs to local IProject projects}.

The IDs are used to identify shared projects across the network, even when the local names of shared projects are different. The ID is determined by the project/file-host.


Constructor & Destructor Documentation

de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.SarosProjectMapper ( ) [package]

Member Function Documentation

synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.addMissingProjectsToUser ( User  user)

Adds all missing projects to the projects of the given user. This should be called once the user started queuing.

Parameters:
user
synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.addProject ( String  id,
IProject  project,
boolean  isPartially 
)

Adds a project to the currently shared projects.

It is possible to "upgrade" a partially shared project to a completely shared project by just adding the same project with the same ID again that must now marked as not partially shared.

Parameters:
idthe ID for the project
projectthe project to add
isPartiallytrue if the project should be treated as a partially shared project, false if it should be treated as completely shared
Exceptions:
NullPointerExceptionif the id or project is null
IllegalStateExceptionif the id is already in use or the project was already added
synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.addResources ( IProject  project,
Collection<?extends IResource resources 
)

Adds the given resources to a partially shared project.

Parameters:
projecta project that was added as a partially shared project
resourcesthe resources to add
synchronized String de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.getID ( IProject  project)

Returns the project ID for the shared project.

Parameters:
projectthe project to lookup the ID for
Returns:
the ID for the shared project or null if the project is not shared
synchronized List<IResource> de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.getPartiallySharedResources ( )

Returns all resources from all partially shared projects.

Returns:
synchronized IProject de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.getProject ( String  id)

Returns the shared project for the given ID.

Parameters:
id
Returns:
the shared project for the given ID or null if no shared project is registered with this ID
synchronized Map<IProject, List<IResource> > de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.getProjectResourceMapping ( )

Returns a mapping for each shared project and its containing resources. The resource list is always null for completely shared projects.

Returns:
synchronized Set<IProject> de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.getProjects ( )

Returns the currently shared projects.

Returns:
synchronized boolean de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.isCompletelyShared ( IProject  project)

Checks if a project is completely shared.

Parameters:
projectthe project to check
Returns:
true if the project is completely shared, false if the project is not or partially shared
synchronized boolean de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.isPartiallyShared ( IProject  project)

Checks if a project is partially shared.

Parameters:
projectthe project to check
Returns:
true if the project is partially shared, false if the project is not or completely shared
synchronized boolean de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.isShared ( IResource  resource)

Returns if the given resource is included in one of the currently shared projects.

Parameters:
resource
Returns:
synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.removeAndAddResources ( IProject  project,
Collection<?extends IResource resourcesToRemove,
Collection<?extends IResource resourcesToAdd 
)

Atomically removes and adds resources. The resources to remove will be removed first before the resources to add will be added.

Parameters:
projecta project that was added as a partially shared project
resourcesToRemovethe resources to remove
resourcesToAddthe resources to add
synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.removeProject ( String  id)

Removes a project from the currently shared projects. Does nothing if the project is not shared.

Parameters:
idthe id of the project to remove
synchronized void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.removeResources ( IProject  project,
Collection<?extends IResource resources 
)

Removes the given resources from a partially shared project.

Parameters:
projecta project that was added as a partially shared project
resourcesthe resources to remove
synchronized int de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.size ( )

Returns the current amount of shared projects.

Returns:
synchronized boolean de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.userHasProject ( User  user,
IProject  project 
)

Checks if the given user already has the given project.

Parameters:
userThe user to be checked
projectThe project to be checked
void de.fu_berlin.inf.dpp.project.internal.SarosProjectMapper.userLeft ( User  user)

Removes the user-project mapping of the user that left the session.

 All Classes Namespaces Files Functions Variables Enumerations