org.eclipse.emf.emfstore.internal.client.model.connectionmanager.xmlrpc
Class XmlRpcConnectionManager

java.lang.Object
  extended by org.eclipse.emf.emfstore.internal.client.model.connectionmanager.AbstractConnectionManager<XmlRpcClientManager>
      extended by org.eclipse.emf.emfstore.internal.client.model.connectionmanager.xmlrpc.XmlRpcConnectionManager
All Implemented Interfaces:
ConnectionManager, EMFStore, EMFStoreInterface

public class XmlRpcConnectionManager
extends AbstractConnectionManager<XmlRpcClientManager>
implements ConnectionManager

XML RPC based Implementation of ConnectionManager.

Author:
wesendon

Field Summary
 
Fields inherited from interface org.eclipse.emf.emfstore.internal.client.model.connectionmanager.ConnectionManager
INCOMPATIBLE_VERSION, LOGIN_FIRST, LOGIN_REFUSED, REMOTE, UNSUPPORTED_ENCODING
 
Fields inherited from interface org.eclipse.emf.emfstore.internal.server.EMFStore
CHANGEPACKAGE_URI, PROJECT_URI
 
Constructor Summary
XmlRpcConnectionManager()
           
 
Method Summary
 void addTag(SessionId sessionId, ProjectId projectId, PrimaryVersionSpec versionSpec, TagVersionSpec tag)
          Adds a tag to a version of the specified project.
 ProjectInfo createEmptyProject(SessionId sessionId, String name, String description, LogMessage logMessage)
          Create a new project on the server.
 ProjectInfo createProject(SessionId sessionId, String name, String description, LogMessage logMessage, Project project)
          Create a new project on the server.
 PrimaryVersionSpec createVersion(SessionId sessionId, ProjectId projectId, PrimaryVersionSpec baseVersionSpec, ChangePackage changePackage, BranchVersionSpec targetBranch, PrimaryVersionSpec sourceVersion, LogMessage logMessage)
          Create a new version on the server of the given project.
 void deleteProject(SessionId sessionId, ProjectId projectId, boolean deleteFiles)
          Deletes a project on the server.
 FileChunk downloadFileChunk(SessionId sessionId, ProjectId projectId, FileTransferInformation fileInformation)
          Downloads a file chunk from the server.
 ProjectHistory exportProjectHistoryFromServer(SessionId sessionId, ProjectId projectId)
          Exports a given project history from the server.
 List<BranchInfo> getBranches(SessionId sessionId, ProjectId projectId)
          Lista all branches of the given project.
 List<ChangePackage> getChanges(SessionId sessionId, ProjectId projectId, VersionSpec source, VersionSpec target)
          Get changes from the server.
 List<EMFStoreProperty> getEMFProperties(SessionId sessionId, ProjectId projectId)
          Get stored EMFStoreProperties from the server.
 List<HistoryInfo> getHistoryInfo(SessionId sessionId, ProjectId projectId, HistoryQuery<?> historyQuery)
          Get history information from the server.
 Project getProject(SessionId sessionId, ProjectId projectId, VersionSpec versionSpec)
          Gets a project in a certain revision from the server.
 List<ProjectInfo> getProjectList(SessionId sessionId)
          Get a list of projects the user of the session id can access.
 String getVersion(ServerInfo serverInfo)
          Returns the version of the EMFStore server.
 String getVersion(SessionId sessionId)
          Returns the version of the EMFStore server.
 ProjectId importProjectHistoryToServer(SessionId sessionId, ProjectHistory projectHistory)
          Imports a project history to the server.
 boolean isLoggedIn(SessionId id)
          Checks whether session id is logged in.
 AuthenticationInformation logIn(String username, String password, ServerInfo serverInfo, ClientVersionInfo clientVersionInfo)
          Log into the server given by server info.
 void logout(SessionId sessionId)
          Deletes a session on the server.
 void registerEPackage(SessionId sessionId, org.eclipse.emf.ecore.EPackage pkg)
          Register a new EPackage.
 void removeTag(SessionId sessionId, ProjectId projectId, PrimaryVersionSpec versionSpec, TagVersionSpec tag)
          Removes a tag to a version of the specified project.
 ACUser resolveUser(SessionId sessionId, ACOrgUnitId id)
          Resolves a user by id and returns an ACUser with all roles on the server.
 PrimaryVersionSpec resolveVersionSpec(SessionId sessionId, ProjectId projectId, VersionSpec versionSpec)
          Resolve a version specified to a primary version specifier.
 List<EMFStoreProperty> setEMFProperties(SessionId sessionId, List<EMFStoreProperty> properties, ProjectId projectId)
          Store EMFProperties on the server.
 void transmitProperty(SessionId sessionId, OrgUnitProperty changedProperty, ACUser tmpUser, ProjectId projectId)
          
 FileTransferInformation uploadFileChunk(SessionId sessionId, ProjectId projectId, FileChunk fileChunk)
          Uploads a file chunk to the server.
 
Methods inherited from class org.eclipse.emf.emfstore.internal.client.model.connectionmanager.AbstractConnectionManager
hasConnectionProxy
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlRpcConnectionManager

public XmlRpcConnectionManager()
Method Detail

logIn

public AuthenticationInformation logIn(String username,
                                       String password,
                                       ServerInfo serverInfo,
                                       ClientVersionInfo clientVersionInfo)
                                throws ESException
Log into the server given by server info. The connection manager will also remember the serverInfo associated with the session id.

Specified by:
logIn in interface ConnectionManager
Parameters:
username - the user name
password - the password
serverInfo - the server info for the server to log into
clientVersionInfo - the client's version
Returns:
AuthenticationInformation that can be used for later authentication
Throws:
ESException - in case of failure

logout

public void logout(SessionId sessionId)
            throws ESException
Deletes a session on the server.

Specified by:
logout in interface ConnectionManager
Parameters:
sessionId - id to be deleted.
Throws:
ESException - in case of failure on server

addTag

public void addTag(SessionId sessionId,
                   ProjectId projectId,
                   PrimaryVersionSpec versionSpec,
                   TagVersionSpec tag)
            throws ESException
Adds a tag to a version of the specified project.

Specified by:
addTag in interface EMFStore
Parameters:
sessionId - the session id
projectId - the project id
versionSpec - the version versionSpec
tag - the tag
Throws:
ESException - if any error in the EmfStore occurs

createEmptyProject

public ProjectInfo createEmptyProject(SessionId sessionId,
                                      String name,
                                      String description,
                                      LogMessage logMessage)
                               throws ESException
Create a new project on the server.

Specified by:
createEmptyProject in interface EMFStore
Parameters:
sessionId - the session id for authentication
name - the name of the server
description - the description
logMessage - the logMessage
Returns:
a ProjectInfo for the new project
Throws:
ESException - if any error in the EmfStore occurs

createProject

public ProjectInfo createProject(SessionId sessionId,
                                 String name,
                                 String description,
                                 LogMessage logMessage,
                                 Project project)
                          throws ESException
Create a new project on the server. This createProject method allows to create a project on the server with initial projectstate (share project).

Specified by:
createProject in interface EMFStore
Parameters:
sessionId - the session id for authentication
name - the name of the server
description - the description
logMessage - the logMessage
project - the initial project state
Returns:
a ProjectInfo for the new project
Throws:
ESException - if any error in the EmfStore occurs

createVersion

public PrimaryVersionSpec createVersion(SessionId sessionId,
                                        ProjectId projectId,
                                        PrimaryVersionSpec baseVersionSpec,
                                        ChangePackage changePackage,
                                        BranchVersionSpec targetBranch,
                                        PrimaryVersionSpec sourceVersion,
                                        LogMessage logMessage)
                                 throws ESException,
                                        InvalidVersionSpecException
Create a new version on the server of the given project.

Specified by:
createVersion in interface EMFStore
Parameters:
sessionId - the session id for authentication
projectId - the project id
baseVersionSpec - the version the project was last synched with the server
changePackage - the changes performed on the project since last synch
targetBranch - this should be set if a new branch shout be created with this commit. Otherwise set null
sourceVersion - if a branch was merged and the resulting merged changed are committed this should be set to the incoming branch inorder to set correct links in the version model. Can be null otherwise
logMessage - the log message for the new version
Returns:
the version specifier of the version created on the server
Throws:
InvalidVersionSpecException - if the base version is not equal to the current head revision.
ESException - if any error in the EmfStore occurs

deleteProject

public void deleteProject(SessionId sessionId,
                          ProjectId projectId,
                          boolean deleteFiles)
                   throws ESException
Deletes a project on the server. It's possible to delete the project from the containment tree and if wanted to deleted the related files too.

Specified by:
deleteProject in interface EMFStore
Parameters:
sessionId - the session id
projectId - the project id
deleteFiles - if true, the project files will be deleted too
Throws:
ESException - in case of failure

downloadFileChunk

public FileChunk downloadFileChunk(SessionId sessionId,
                                   ProjectId projectId,
                                   FileTransferInformation fileInformation)
                            throws ESException
Downloads a file chunk from the server.

Specified by:
downloadFileChunk in interface EMFStore
Parameters:
sessionId - session id
projectId - project id
fileInformation - file information
Returns:
FileChunk
Throws:
ESException - if any error occurs in the EmfStore

exportProjectHistoryFromServer

public ProjectHistory exportProjectHistoryFromServer(SessionId sessionId,
                                                     ProjectId projectId)
                                              throws ESException
Exports a given project history from the server. Caution if you try to export big projects from the server.

Specified by:
exportProjectHistoryFromServer in interface EMFStore
Parameters:
sessionId - session id
projectId - project id
Returns:
a projecthistory
Throws:
ESException - in case of failure

getChanges

public List<ChangePackage> getChanges(SessionId sessionId,
                                      ProjectId projectId,
                                      VersionSpec source,
                                      VersionSpec target)
                               throws InvalidVersionSpecException,
                                      ESException
Get changes from the server.

Specified by:
getChanges in interface EMFStore
Parameters:
sessionId - the session id for authentication
projectId - the project id
source - the source version specifier
target - the target version specifier
Returns:
a list of change packages from source to target representing the changes that happened between the two versions.
Throws:
ESException - if any error in the EmfStore occurs
InvalidVersionSpecException

getBranches

public List<BranchInfo> getBranches(SessionId sessionId,
                                    ProjectId projectId)
                             throws ESException
Lista all branches of the given project.

Specified by:
getBranches in interface EMFStore
Parameters:
sessionId - the session id for authentication
projectId - the project id
Returns:
list of BranchInfo
Throws:
ESException - in case of an error
See Also:
EMFStore.getBranches(org.eclipse.emf.emfstore.internal.server.model.SessionId, org.eclipse.emf.emfstore.internal.server.model.ProjectId)

getHistoryInfo

public List<HistoryInfo> getHistoryInfo(SessionId sessionId,
                                        ProjectId projectId,
                                        HistoryQuery<?> historyQuery)
                                 throws ESException
Get history information from the server. The list returned will describe the versions as request through HistoryQuery.

Specified by:
getHistoryInfo in interface EMFStore
Parameters:
sessionId - the session id
projectId - the project id
historyQuery - the historyQuery
Returns:
list of history information
Throws:
ESException - if any error in the EmfStore occurs

getProject

public Project getProject(SessionId sessionId,
                          ProjectId projectId,
                          VersionSpec versionSpec)
                   throws InvalidVersionSpecException,
                          ESException
Gets a project in a certain revision from the server. Depending on your persistence properties, this method can become expensive because it has to recalculate the requested project state.

Specified by:
getProject in interface EMFStore
Parameters:
sessionId - the session id for authentication
projectId - the project id of the project to get
versionSpec - the version to get
Returns:
a project in the specified revision
Throws:
ESException - if any error in the EmfStore occurs
InvalidVersionSpecException
See Also:
ServerConfiguration.PROJECTSTATE_VERSION_PERSISTENCE

getProjectList

public List<ProjectInfo> getProjectList(SessionId sessionId)
                                 throws ESException
Get a list of projects the user of the session id can access. The server should is determined by the session id.

Specified by:
getProjectList in interface EMFStore
Parameters:
sessionId - the session id for authentication
Returns:
a list of project infos for the projects the user can access
Throws:
ESException - if any error in the EmfStore occurs

importProjectHistoryToServer

public ProjectId importProjectHistoryToServer(SessionId sessionId,
                                              ProjectHistory projectHistory)
                                       throws ESException
Imports a project history to the server. The project history elements such as version, projecstate etc will be devided in several files on the server file system. The server will try to use the specified project id, if it already exists a new id is generated.

Specified by:
importProjectHistoryToServer in interface EMFStore
Parameters:
sessionId - sessionid
projectHistory - project history
Returns:
projectId
Throws:
ESException - in case of failure

removeTag

public void removeTag(SessionId sessionId,
                      ProjectId projectId,
                      PrimaryVersionSpec versionSpec,
                      TagVersionSpec tag)
               throws ESException
Removes a tag to a version of the specified project.

Specified by:
removeTag in interface EMFStore
Parameters:
sessionId - the session id
projectId - the project id
versionSpec - the version versionSpec
tag - the tag to be removed
Throws:
ESException - if any error in the EmfStore occurs

resolveUser

public ACUser resolveUser(SessionId sessionId,
                          ACOrgUnitId id)
                   throws ESException
Resolves a user by id and returns an ACUser with all roles on the server. Also roles from groups are aggregated and added to the user. To resolve other user than the requesting user himself, the user has to have admin access rights. If id is null, the requesting user will be resolved.

Specified by:
resolveUser in interface EMFStore
Parameters:
sessionId - session id
id - user id, can be null, then requesting user gets resolved
Returns:
ACuser with all roles on the server
Throws:
ESException - if any error in the EmfStore occurs

resolveVersionSpec

public PrimaryVersionSpec resolveVersionSpec(SessionId sessionId,
                                             ProjectId projectId,
                                             VersionSpec versionSpec)
                                      throws InvalidVersionSpecException,
                                             ESException
Resolve a version specified to a primary version specifier.

Specified by:
resolveVersionSpec in interface EMFStore
Parameters:
sessionId - the session id for authentication
projectId - the project id
versionSpec - the version specifier to resolve
Returns:
a primary version specifier identifing the same version
Throws:
ESException - if any error in the EmfStore occurs
InvalidVersionSpecException

transmitProperty

public void transmitProperty(SessionId sessionId,
                             OrgUnitProperty changedProperty,
                             ACUser tmpUser,
                             ProjectId projectId)
                      throws ESException

Specified by:
transmitProperty in interface EMFStore
Parameters:
sessionId - session id
changedProperty - the property that has been changed client-side
tmpUser - the respective user
projectId - the project id
Throws:
ESException - if any error occurs in the EmfStore

uploadFileChunk

public FileTransferInformation uploadFileChunk(SessionId sessionId,
                                               ProjectId projectId,
                                               FileChunk fileChunk)
                                        throws ESException
Uploads a file chunk to the server.

Specified by:
uploadFileChunk in interface EMFStore
Parameters:
sessionId - session id
projectId - project id
fileChunk - file chunk
Returns:
FileVersion denoting the current file version to be written to
Throws:
ESException - if any error occurs in the EmfStore

setEMFProperties

public List<EMFStoreProperty> setEMFProperties(SessionId sessionId,
                                               List<EMFStoreProperty> properties,
                                               ProjectId projectId)
                                        throws ESException
Store EMFProperties on the server.

Specified by:
setEMFProperties in interface EMFStore
Parameters:
sessionId - sessionId
properties - list properties which shall be shared on the server.
projectId - the project id
Returns:
a list of properties which have not been set on the server due there were more recent versions of these properties on the server
Throws:
ESException - if any error occurs in the EmfStore

getEMFProperties

public List<EMFStoreProperty> getEMFProperties(SessionId sessionId,
                                               ProjectId projectId)
                                        throws ESException
Get stored EMFStoreProperties from the server.

Specified by:
getEMFProperties in interface EMFStore
Parameters:
sessionId - sessionId
projectId - the projct id
Returns:
list of EMFStoreProperties
Throws:
ESException - if any error occurs in the EmfStore

isLoggedIn

public boolean isLoggedIn(SessionId id)
Checks whether session id is logged in.

Specified by:
isLoggedIn in interface ConnectionManager
Parameters:
id - session id
Returns:
true, if logged in
See Also:
ConnectionManager.isLoggedIn(org.eclipse.emf.emfstore.internal.server.model.SessionId)

registerEPackage

public void registerEPackage(SessionId sessionId,
                             org.eclipse.emf.ecore.EPackage pkg)
                      throws ESException
Register a new EPackage.

Specified by:
registerEPackage in interface EMFStore
Parameters:
sessionId - session id
pkg - the EPackage to be registered
Throws:
ESException - if any error occurs in the EmfStore
See Also:
EMFStore.registerEPackage(org.eclipse.emf.emfstore.internal.server.model.SessionId, org.eclipse.emf.ecore.EPackage)

getVersion

public String getVersion(ServerInfo serverInfo)
                  throws ESException
Returns the version of the EMFStore server.

Specified by:
getVersion in interface ConnectionManager
Parameters:
serverInfo - the EMFStore server whose version should be retrieved
Returns:
the version of the EMFStore server
Throws:
ESException - in case of a failure
See Also:
ConnectionManager.getVersion(org.eclipse.emf.emfstore.internal.client.model.ServerInfo)

getVersion

public String getVersion(SessionId sessionId)
                  throws ESException
Returns the version of the EMFStore server.

Specified by:
getVersion in interface EMFStore
Parameters:
sessionId - a session ID
Returns:
the version of the EMFStore server
Throws:
ESException - in case of an error
See Also:
EMFStore.getVersion(org.eclipse.emf.emfstore.internal.server.model.SessionId)


Copyright © 2015. All Rights Reserved.