org.eclipse.emf.emfstore.internal.client.model.impl
Class WorkspaceBase

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.BasicNotifierImpl
      extended by org.eclipse.emf.ecore.impl.BasicEObjectImpl
          extended by org.eclipse.emf.ecore.impl.EObjectImpl
              extended by org.eclipse.emf.emfstore.internal.client.model.impl.WorkspaceBase
All Implemented Interfaces:
org.eclipse.core.runtime.IAdaptable, org.eclipse.emf.common.notify.Notifier, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.InternalEObject, ESObserver, Workspace, DeleteProjectSpaceObserver, APIDelegate<ESWorkspaceImpl>, ESDisposable
Direct Known Subclasses:
WorkspaceImpl

public abstract class WorkspaceBase
extends org.eclipse.emf.ecore.impl.EObjectImpl
implements Workspace, ESDisposable, DeleteProjectSpaceObserver

Workspace space base class that contains custom user methods.

Author:
koegel, wesendon, emueller

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EAdapterList<E extends Object & org.eclipse.emf.common.notify.Adapter>, org.eclipse.emf.common.notify.impl.BasicNotifierImpl.EObservableAdapterList
 
Nested classes/interfaces inherited from interface org.eclipse.emf.ecore.InternalEObject
org.eclipse.emf.ecore.InternalEObject.EStore
 
Field Summary
 
Fields inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
ELAST_EOBJECT_FLAG
 
Fields inherited from interface org.eclipse.emf.ecore.InternalEObject
EOPPOSITE_FEATURE_BASE
 
Constructor Summary
WorkspaceBase()
           
 
Method Summary
 void addProjectSpace(ProjectSpace projectSpace)
          Adds a new ProjectSpace to the workspace.
 void addServerInfo(ServerInfo serverInfo)
          Adds an server info and saves.
 ProjectSpace cloneProject(String projectName, Project project)
          Initializes a new project space and clones the given project.
 ESWorkspaceImpl createAPI()
          Creates the API interface for this class.
 ProjectSpace createLocalProject(String projectName)
          Creates a new local project that is not shared with the server yet.
 ProjectSpace createLocalProject(String projectName, Project project, boolean cloneProject)
          Initializes a new project space.
 void dispose()
          Marker method for classes that need to perform clean-up tasks.
 void exportProjectSpace(ProjectSpace projectSpace, File file)
          Exports a project space to a file.
 void exportProjectSpace(ProjectSpace projectSpace, File file, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Exports a project space to a file.
 void exportWorkSpace(File file)
          Exports the whole workspace.
 void exportWorkSpace(File file, org.eclipse.core.runtime.IProgressMonitor progressMonitor)
          Exports the whole workspace to the given file.
 Object getAdapter(Class adapter)
          

This is to enable the workspace to be root of table views.
 AdminBroker getAdminBroker(ServerInfo serverInfo)
          Returns an AdminBroker related to the given ServerInfo.
 AdminBroker getAdminBroker(Usersession usersession)
          Returns an AdminBroker related to the given Usersession.
 org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
          Return this editing domain belonging to this workspace.
 ProjectSpace getProjectSpace(Project project)
          Retrieves the project space for the given project.
 org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
          Returns the workspace resource set.
 ProjectSpace importProject(Project project, String name, String description)
          Imports a project into a project space.
 ProjectSpace importProject(String absoluteFileName)
          Import an existing project from a given file.
 ProjectSpace importProjectSpace(String absoluteFileName)
          Import an existing project space from a file.
 void init()
          Initializes the workspace and its project spaces.
 void projectSpaceDeleted(ProjectSpace projectSpace)
          Notifies that the project space has been deleted.
 void removeServerInfo(ServerInfo serverInfo)
          Removes an server info and saves.
 void removeUsersession(Usersession session)
          Remove the given Usersession from the workspace.
 Set<ProjectSpace> resolve(ProjectUrlFragment projectUrlFragment)
          Resolves a project URL fragment to the project space the project is in.
Since a project may have been checked out multiple times, a set of project spaces is returned.
 Set<ServerInfo> resolve(ServerUrl serverUrl)
          Resolves a server URL to a server.
 void save()
          Make the current workspace state persistent.
 void setAPIImpl(ESWorkspaceImpl apiImpl)
          Set the API implementation class.
 void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
          Set the workspace resource set.
 ESWorkspaceImpl toAPI()
          Returns the API interface of this class.
 void updateACUser(ServerInfo serverInfo)
          Updates the ACUser and it roles.
 void updateACUser(Usersession usersession)
          Updates the ACUser and it roles.
 
Methods inherited from class org.eclipse.emf.ecore.impl.EObjectImpl
eAdapters, eClass, eContainerFeatureID, eDeliver, eInternalContainer, eInvoke, eIsProxy, eSetClass, eSetDeliver, eSetProxyURI
 
Methods inherited from class org.eclipse.emf.ecore.impl.BasicEObjectImpl
eAllContents, eBaseStructuralFeatureID, eBasicRemoveFromContainer, eBasicRemoveFromContainerFeature, eBasicSetContainer, eContainer, eContainingFeature, eContainmentFeature, eContains, eContents, eCrossReferences, eDerivedOperationID, eDerivedOperationID, eDerivedStructuralFeatureID, eDerivedStructuralFeatureID, eDirectResource, eDynamicBasicRemoveFromContainer, eDynamicGet, eDynamicGet, eDynamicInverseAdd, eDynamicInverseRemove, eDynamicInvoke, eDynamicIsSet, eDynamicIsSet, eDynamicSet, eDynamicSet, eDynamicUnset, eDynamicUnset, eGet, eGet, eGet, eGet, eInternalResource, eInverseAdd, eInverseAdd, eInverseRemove, eInverseRemove, eInvoke, eIsSet, eIsSet, eObjectForURIFragmentSegment, eOpenGet, eOpenIsSet, eOpenSet, eOpenUnset, eProxyURI, eResolveProxy, eResource, eSet, eSet, eSetResource, eSetStore, eSetting, eStore, eUnset, eUnset, eURIFragmentSegment, eVirtualGet, eVirtualGet, eVirtualIsSet, eVirtualSet, eVirtualUnset, toString
 
Methods inherited from class org.eclipse.emf.common.notify.impl.BasicNotifierImpl
eNotificationRequired, eNotify
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.emf.emfstore.internal.client.model.Workspace
getProjectSpaces, getServerInfos, getUsersessions
 
Methods inherited from interface org.eclipse.emf.ecore.EObject
eAllContents, eClass, eContainer, eContainingFeature, eContainmentFeature, eContents, eCrossReferences, eGet, eGet, eInvoke, eIsProxy, eIsSet, eResource, eSet, eUnset
 
Methods inherited from interface org.eclipse.emf.common.notify.Notifier
eAdapters, eDeliver, eNotify, eSetDeliver
 
Methods inherited from interface org.eclipse.emf.ecore.InternalEObject
eNotificationRequired
 

Constructor Detail

WorkspaceBase

public WorkspaceBase()
Method Detail

addProjectSpace

public void addProjectSpace(ProjectSpace projectSpace)
Adds a new ProjectSpace to the workspace.

Parameters:
projectSpace - The project space to be added

createLocalProject

public ProjectSpace createLocalProject(String projectName,
                                       Project project,
                                       boolean cloneProject)
Initializes a new project space.

Parameters:
projectName - the name of the new project
project - the project to be contained in the project space
cloneProject - whether to clone the project
Returns:
the new ProjectSpace of the cloned Project

cloneProject

public ProjectSpace cloneProject(String projectName,
                                 Project project)
Initializes a new project space and clones the given project.

Parameters:
projectName - the name of the new project
project - the project to be cloned and contained in the project space
Returns:
the new ProjectSpace of the cloned Project

createLocalProject

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

Specified by:
createLocalProject in interface Workspace
Parameters:
projectName - the project name
Returns:
the project space that the new project resides in
See Also:
ESWorkspace.createLocalProject(java.lang.String)

init

public void init()
Initializes the workspace and its project spaces.

Specified by:
init in interface Workspace
See Also:
Workspace.init()

dispose

public void dispose()
Marker method for classes that need to perform clean-up tasks.

Specified by:
dispose in interface ESDisposable
See Also:
ESDisposable.dispose()

setResourceSet

public void setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet resourceSet)
Set the workspace resource set.

Specified by:
setResourceSet in interface Workspace
Parameters:
resourceSet - The resource set to be set.
See Also:
Workspace.setResourceSet(org.eclipse.emf.ecore.resource.ResourceSet)

updateACUser

public void updateACUser(ServerInfo serverInfo)
                  throws ESException
Updates the ACUser and it roles.

Specified by:
updateACUser in interface Workspace
Parameters:
serverInfo - The ServerInfo that is used to update the ACUser.
Throws:
ESException - if an error occurs while updating the ACUser
See Also:
Workspace.updateACUser(org.eclipse.emf.emfstore.internal.client.model.ServerInfo)

updateACUser

public void updateACUser(Usersession usersession)
                  throws ESException
Updates the ACUser and it roles.

Specified by:
updateACUser in interface Workspace
Parameters:
usersession - The Usersession that should be used to update the ACUser. If null, the session manager will search for a session.
Throws:
ESException - if an error occurs while updating the ACUser
See Also:
Workspace.updateACUser(org.eclipse.emf.emfstore.internal.client.model.Usersession)

getResourceSet

public org.eclipse.emf.ecore.resource.ResourceSet getResourceSet()
Returns the workspace resource set.

Specified by:
getResourceSet in interface Workspace
Returns:
The resource set of the workspace

importProject

public ProjectSpace importProject(Project project,
                                  String name,
                                  String description)
Imports a project into a project space.

Specified by:
importProject in interface Workspace
Parameters:
project - The project to be imported
name - The name that should be assigned to the project being imported.
description - A description of the project being imported
Returns:
the newly created project space in which the imported project is contained in

importProject

public ProjectSpace importProject(String absoluteFileName)
                           throws IOException
Import an existing project from a given file. The project space containing the project will be created upon execution.

Specified by:
importProject in interface Workspace
Parameters:
absoluteFileName - The absolute path to a file to import from.
Returns:
the newly created project space in which the imported project is contained in
Throws:
IOException - If importing the project fails
See Also:
Workspace.importProject(java.lang.String)

importProjectSpace

public ProjectSpace importProjectSpace(String absoluteFileName)
                                throws IOException
Import an existing project space from a file.

Specified by:
importProjectSpace in interface Workspace
Parameters:
absoluteFileName - The absolute path to a file to import from.
Returns:
the imported project space
Throws:
IOException - If accessing the file or importing fails
See Also:
Workspace.importProjectSpace(java.lang.String)

resolve

public Set<ProjectSpace> resolve(ProjectUrlFragment projectUrlFragment)
                          throws ProjectUrlResolutionException
Resolves a project URL fragment to the project space the project is in.
Since a project may have been checked out multiple times, a set of project spaces is returned.

Specified by:
resolve in interface Workspace
Parameters:
projectUrlFragment - the project URL fragment to resolve
Returns:
a set of matching project spaces
Throws:
ProjectUrlResolutionException - if the project belonging to the given project URL fragment cannot be found in workspace
See Also:
Workspace.resolve(org.eclipse.emf.emfstore.internal.server.model.url.ProjectUrlFragment)

resolve

public Set<ServerInfo> resolve(ServerUrl serverUrl)
                        throws ServerUrlResolutionException
Resolves a server URL to a server.

Specified by:
resolve in interface Workspace
Parameters:
serverUrl - the server URL to be resolved
Returns:
the resolved ServerInfo
Throws:
ServerUrlResolutionException - if no matching server info can be found
See Also:
Workspace.resolve(org.eclipse.emf.emfstore.internal.server.model.url.ServerUrl)

save

public void save()
Make the current workspace state persistent.

Specified by:
save in interface Workspace
See Also:
Workspace.save()

exportProjectSpace

public void exportProjectSpace(ProjectSpace projectSpace,
                               File file)
                        throws IOException
Exports a project space to a file.

Specified by:
exportProjectSpace in interface Workspace
Parameters:
projectSpace - The project space that should be exported
file - The file to export to
Throws:
IOException - If creating the export file fails
See Also:
Workspace.exportProjectSpace(org.eclipse.emf.emfstore.internal.client.model.ProjectSpace, java.io.File)

exportProjectSpace

public void exportProjectSpace(ProjectSpace projectSpace,
                               File file,
                               org.eclipse.core.runtime.IProgressMonitor progressMonitor)
                        throws IOException
Exports a project space to a file.

Specified by:
exportProjectSpace in interface Workspace
Parameters:
projectSpace - The project space that should be exported
file - The file to export to
progressMonitor - The progress monitor that should be used during the xport
Throws:
IOException - If creating the export file fails
See Also:
Workspace.exportProjectSpace(org.eclipse.emf.emfstore.internal.client.model.ProjectSpace, java.io.File, org.eclipse.core.runtime.IProgressMonitor)

exportWorkSpace

public void exportWorkSpace(File file)
                     throws IOException
Exports the whole workspace.

Specified by:
exportWorkSpace in interface Workspace
Parameters:
file - The file to export to
Throws:
IOException - If creating the export file fails
See Also:
Workspace.exportWorkSpace(java.io.File)

exportWorkSpace

public void exportWorkSpace(File file,
                            org.eclipse.core.runtime.IProgressMonitor progressMonitor)
                     throws IOException
Exports the whole workspace to the given file.

Specified by:
exportWorkSpace in interface Workspace
Parameters:
file - The file to export to
progressMonitor - The progress monitor that should be used during the export
Throws:
IOException - If creating the export file fails
See Also:
Workspace.exportWorkSpace(java.io.File, org.eclipse.core.runtime.IProgressMonitor)

getAdapter

public Object getAdapter(Class adapter)


This is to enable the workspace to be root of table views.

Specified by:
getAdapter in interface org.eclipse.core.runtime.IAdaptable
See Also:
IAdaptable.getAdapter(java.lang.Class)

getAdminBroker

public AdminBroker getAdminBroker(ServerInfo serverInfo)
                           throws ESException,
                                  AccessControlException
Returns an AdminBroker related to the given ServerInfo.

Specified by:
getAdminBroker in interface Workspace
Parameters:
serverInfo - The ServerInfo that should be used to retrieve the admin broker.
Returns:
an AdminBroker related to the given server info.
Throws:
ESException - If an error occurs while retrieving the admin broker
AccessControlException - If access is denied
See Also:
Workspace.getAdminBroker(org.eclipse.emf.emfstore.internal.client.model.ServerInfo)

getAdminBroker

public AdminBroker getAdminBroker(Usersession usersession)
                           throws ESException,
                                  AccessControlException
Returns an AdminBroker related to the given Usersession.

Specified by:
getAdminBroker in interface Workspace
Parameters:
usersession - The user session that should be used to retrieve the admin broker.
If null, the session manager will search for a session.
Returns:
an AdminBroker related to the given user session.
Throws:
ESException - If an error occurs while retrieving the admin broker
AccessControlException - If access is denied
See Also:
Workspace.getAdminBroker(org.eclipse.emf.emfstore.internal.client.model.Usersession)

getEditingDomain

public org.eclipse.emf.edit.domain.EditingDomain getEditingDomain()
Return this editing domain belonging to this workspace.

Specified by:
getEditingDomain in interface Workspace
Returns:
the editing domain
See Also:
Workspace.getEditingDomain()

getProjectSpace

public ProjectSpace getProjectSpace(Project project)
                             throws UnkownProjectException
Retrieves the project space for the given project.

Specified by:
getProjectSpace in interface Workspace
Parameters:
project - The project for which to retrieve the project space.
Returns:
the project space the given project is contained in
Throws:
UnkownProjectException - If the project is not known to the workspace
See Also:
Workspace.getProjectSpace(org.eclipse.emf.emfstore.internal.common.model.Project)

projectSpaceDeleted

public void projectSpaceDeleted(ProjectSpace projectSpace)
Notifies that the project space has been deleted. This is a PRE-DELETE event.

Specified by:
projectSpaceDeleted in interface DeleteProjectSpaceObserver
Parameters:
projectSpace - the project space
See Also:
DeleteProjectSpaceObserver.projectSpaceDeleted(org.eclipse.emf.emfstore.internal.client.model.ProjectSpace)

addServerInfo

public void addServerInfo(ServerInfo serverInfo)
Adds an server info and saves.

Specified by:
addServerInfo in interface Workspace
Parameters:
serverInfo - the server info to be added
See Also:
Workspace.addServerInfo(org.eclipse.emf.emfstore.internal.client.model.ServerInfo)

removeServerInfo

public void removeServerInfo(ServerInfo serverInfo)
Removes an server info and saves.

Specified by:
removeServerInfo in interface Workspace
Parameters:
serverInfo - the server info to be removed
See Also:
Workspace.removeServerInfo(org.eclipse.emf.emfstore.internal.client.model.ServerInfo)

removeUsersession

public void removeUsersession(Usersession session)
                       throws ESException
Remove the given Usersession from the workspace.

Specified by:
removeUsersession in interface Workspace
Parameters:
session - the session to be removed
Throws:
ESException - in case removing the session fails
See Also:
Workspace.removeUsersession(org.eclipse.emf.emfstore.internal.client.model.Usersession)

toAPI

public ESWorkspaceImpl toAPI()
Returns the API interface of this class.

Specified by:
toAPI in interface APIDelegate<ESWorkspaceImpl>
Returns:
the API interface of this class
See Also:
APIDelegate.toAPI()

setAPIImpl

public void setAPIImpl(ESWorkspaceImpl apiImpl)
Set the API implementation class.

Parameters:
apiImpl - the internal workspace implementation class to be used

createAPI

public ESWorkspaceImpl createAPI()
Creates the API interface for this class.

Specified by:
createAPI in interface APIDelegate<ESWorkspaceImpl>
Returns:
the API interface of this class
See Also:
APIDelegate.createAPI()


Copyright © 2015. All Rights Reserved.