org.eclipse.emf.emfstore.internal.client.model.impl.api
Class ESWorkspaceImpl

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.common.api.AbstractAPIImpl<ESWorkspaceImpl,Workspace>
      extended by org.eclipse.emf.emfstore.internal.client.model.impl.api.ESWorkspaceImpl
All Implemented Interfaces:
ESWorkspace, InternalAPIDelegator<ESWorkspaceImpl,Workspace>

public class ESWorkspaceImpl
extends AbstractAPIImpl<ESWorkspaceImpl,Workspace>
implements ESWorkspace

Mapping between ESWorkspace and Workspace.

Author:
emueller

Constructor Summary
ESWorkspaceImpl(Workspace workspace)
          Constructor.
 
Method Summary
 ESServerImpl addServer(ESServer server)
          Adds a server to the workspace.
 ESLocalProjectImpl createLocalProject(String projectName)
          Creates a new local project that is not shared with the server yet.
 ESLocalProject getLocalProject(org.eclipse.emf.ecore.EObject modelElement)
          Returns the ESLocalProject the given model element is contained in.
 Set<ESLocalProject> getLocalProjectByName(String projectName)
          Returns all projects whose name matches the supplied project name ignoring any case.
 List<ESLocalProject> getLocalProjects()
          Returns all local projects.
 List<ESServer> getServers()
          Returns all available servers.
 void removeServer(ESServer server)
          Removes a server from the workspace.
 boolean serverExists(ESServer server)
          Whether a server with the same name, URL and port as the given one, exists.
 
Methods inherited from class org.eclipse.emf.emfstore.internal.common.api.AbstractAPIImpl
equals, hashCode, toInternalAPI
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ESWorkspaceImpl

public ESWorkspaceImpl(Workspace workspace)
Constructor.

Parameters:
workspace - the internal delegate
Method Detail

getLocalProjects

public List<ESLocalProject> getLocalProjects()
Returns all local projects.

Specified by:
getLocalProjects in interface ESWorkspace
Returns:
list of local projects
See Also:
ESWorkspace.getLocalProjects()

createLocalProject

public ESLocalProjectImpl createLocalProject(String projectName)
Creates a new local project that is not shared with the server yet.

Specified by:
createLocalProject in interface ESWorkspace
Parameters:
projectName - the project's name
Returns:
the unshared local project
See Also:
ESWorkspace.createLocalProject(java.lang.String)

getServers

public List<ESServer> getServers()
Returns all available servers.

Specified by:
getServers in interface ESWorkspace
Returns:
a list of servers
See Also:
ESWorkspace.getServers()

addServer

public ESServerImpl addServer(ESServer server)
Adds a server to the workspace. If the server is already contained in the workspace, i.e. a server with the given URL and port exists, the latter will be returned instead of the passed one.

Specified by:
addServer in interface ESWorkspace
Parameters:
server - the server to be added to the workspace
Returns:
the added server instance, or, if a server with the given URL and port already exists in the workspace, the existing server instance
See Also:
ESWorkspace.addServer(org.eclipse.emf.emfstore.client.ESServer)

serverExists

public boolean serverExists(ESServer server)
Whether a server with the same name, URL and port as the given one, exists.

Parameters:
server - the server instance containing the name, URL and port to be checked for
Returns:
true, if a server with the same name, URL and port already exists, false otherwise

removeServer

public void removeServer(ESServer server)
                  throws ESServerNotFoundException
Removes a server from the workspace.

Specified by:
removeServer in interface ESWorkspace
Parameters:
server - the server to be removed from the workspace
Throws:
ESServerNotFoundException - in case the server couldn't be found in the workspace
See Also:
ESWorkspace.removeServer(org.eclipse.emf.emfstore.client.ESServer)

getLocalProject

public ESLocalProject getLocalProject(org.eclipse.emf.ecore.EObject modelElement)
Returns the ESLocalProject the given model element is contained in.

Specified by:
getLocalProject in interface ESWorkspace
Parameters:
modelElement - the model element whose project should be returned
Returns:
the local project the given model element is contained in
See Also:
ESWorkspace.getLocalProject(org.eclipse.emf.ecore.EObject)

getLocalProjectByName

public Set<ESLocalProject> getLocalProjectByName(String projectName)
Returns all projects whose name matches the supplied project name ignoring any case. This method returns a set since project names do not have to be unique in EMFStore. Furthermore, a project may have been checked-out multiple times, possibly in different versions.

Parameters:
projectName - the project name
Returns:
a set of ESLocalProjects that match the given name. If no such project has been found, an empty set is returned
Since:
1.5


Copyright © 2015. All Rights Reserved.