org.mftech.dawn.server
Class DawnServerImpl

java.lang.Object
  extended by org.mftech.dawn.server.DawnServerImpl
All Implemented Interfaces:
DawnServer

public class DawnServerImpl
extends java.lang.Object
implements DawnServer


Field Summary
 
Fields inherited from interface org.mftech.dawn.server.DawnServer
mfINSTANCE
 
Constructor Summary
DawnServerImpl()
           
 
Method Summary
 void addUser(User u)
           
 boolean canExecute(java.lang.String projectName, int userID, int operation)
           
 boolean changeObjects(java.lang.String restoreResource, java.lang.String projectName)
          changes all objects in the given resource.
 int createProject(java.lang.String projectName, java.lang.String editorID, int UserID)
          This method creates a new project on the server.
 int createUser(java.lang.String userName, java.lang.String password)
           
 boolean deleteObjects(java.lang.String restoreResource, java.lang.String projectName)
           
 java.util.Collection<Project> getAllProjects()
           
 java.util.Collection<User> getAllUsers()
           
 java.util.Collection<User> getAllUsersFromProject(java.lang.String projectName)
           
 UserManager getGlobalUserManager()
           
 java.util.Set<Role> getGroups()
           
 int getId()
           
 java.util.Map<java.lang.String,java.lang.Integer> getLockedObjects(java.lang.String projectName)
           
 java.util.Set<java.lang.String> getMyProjectNames(int userID)
          returns only the projects the user is assgined to
 java.util.Collection<Project> getMyProjects(int userID)
           
 Project getProject(java.lang.String projectName)
           
 Project getProject(java.lang.String projectName, boolean loadResource)
          searches for a project in the Projects list if ist das not find on, it creates it.
 java.util.Set<java.lang.String> getProjectNames()
           
 java.util.Map<java.lang.String,Project> getProjects()
           
 Role getRole(int id)
           
 int getRoleInProject(java.lang.String projectName, int userId)
           
 User getUser(int userID)
           
 User getUser(java.lang.String username)
           
 java.util.Map<java.lang.Integer,User> getUsers()
           
static DawnServerImpl initialize()
           
 int initResource(java.lang.String projectName, java.lang.String initXMLString)
           
 boolean isAlive()
           
 int lockObjects(int userId, java.lang.String projectName, java.util.Set<java.lang.String> toBeLockedObjects)
           
 void merge(Project project, org.eclipse.emf.ecore.xmi.XMLResource projectResource, java.util.Set<java.lang.String> deleted, org.eclipse.emf.ecore.xmi.XMLResource clientResource)
          merges the changes in teh resource with the changes of the global resource for the project currently provides the funtionality only for my project later this should be generic
 void publish(java.lang.String notational, java.util.Set<java.lang.String> deleted, java.lang.String projectName)
          This method sets the content of one User and merges the changes to the global Registry of the Project
 void removeProject(java.lang.String projectName)
           
 void removeUser(int userId)
           
 boolean restoreObjects(java.lang.String restoreResource, java.lang.String projectName)
           
 void setGlobalUserManager(UserManager globalUserManager)
           
 void setId(int id)
           
 void setProjects(java.util.Map<java.lang.String,Project> projects)
           
 void setRoles(java.util.Set<Role> roles)
           
 void setUsers(java.util.Map<java.lang.Integer,User> users)
           
 int unlockObjects(int userId, java.lang.String projectName, java.util.Set<java.lang.String> toBeLockedObjects)
           
 java.lang.String update(java.lang.String projectName)
          returns the XML resource as string
 void updateGlobalRoles(Role newRole)
           
 int userLogin(java.lang.String userName, java.lang.String password)
           
 int userLogoff(java.lang.String userName)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DawnServerImpl

public DawnServerImpl()
Method Detail

initialize

public static DawnServerImpl initialize()

publish

public void publish(java.lang.String notational,
                    java.util.Set<java.lang.String> deleted,
                    java.lang.String projectName)
This method sets the content of one User and merges the changes to the global Registry of the Project

Specified by:
publish in interface DawnServer

merge

public void merge(Project project,
                  org.eclipse.emf.ecore.xmi.XMLResource projectResource,
                  java.util.Set<java.lang.String> deleted,
                  org.eclipse.emf.ecore.xmi.XMLResource clientResource)
merges the changes in teh resource with the changes of the global resource for the project currently provides the funtionality only for my project later this should be generic

Parameters:
project -
deleted -
resource -

update

public java.lang.String update(java.lang.String projectName)
                        throws java.io.IOException
returns the XML resource as string

Specified by:
update in interface DawnServer
Throws:
java.io.IOException

getProject

public Project getProject(java.lang.String projectName,
                          boolean loadResource)
                   throws java.io.IOException
searches for a project in the Projects list if ist das not find on, it creates it.

Specified by:
getProject in interface DawnServer
Parameters:
projectName -
Returns:
Throws:
java.io.IOException

getProject

public Project getProject(java.lang.String projectName)
                   throws java.io.IOException
Specified by:
getProject in interface DawnServer
Throws:
java.io.IOException

restoreObjects

public boolean restoreObjects(java.lang.String restoreResource,
                              java.lang.String projectName)
Specified by:
restoreObjects in interface DawnServer

changeObjects

public boolean changeObjects(java.lang.String restoreResource,
                             java.lang.String projectName)
changes all objects in the given resource.

Specified by:
changeObjects in interface DawnServer

deleteObjects

public boolean deleteObjects(java.lang.String restoreResource,
                             java.lang.String projectName)
Specified by:
deleteObjects in interface DawnServer

createProject

public int createProject(java.lang.String projectName,
                         java.lang.String editorID,
                         int UserID)
This method creates a new project on the server. If a Project with the same name exists, it retirn a specifixc returncode

Specified by:
createProject in interface DawnServer
Parameters:
projectName - the name of the new project, it will be checked for existence
editorID - the editor ID so the right resource can be created
UserID - the userid to check the rights of the user and mark him initial

getUser

public User getUser(int userID)
Specified by:
getUser in interface DawnServer

getUsers

public java.util.Map<java.lang.Integer,User> getUsers()
Specified by:
getUsers in interface DawnServer

getAllUsers

public java.util.Collection<User> getAllUsers()
Specified by:
getAllUsers in interface DawnServer

getAllUsersFromProject

public java.util.Collection<User> getAllUsersFromProject(java.lang.String projectName)
                                                  throws java.io.IOException
Specified by:
getAllUsersFromProject in interface DawnServer
Throws:
java.io.IOException

setUsers

public void setUsers(java.util.Map<java.lang.Integer,User> users)

getGroups

public java.util.Set<Role> getGroups()

setRoles

public void setRoles(java.util.Set<Role> roles)

getProjects

public java.util.Map<java.lang.String,Project> getProjects()
Specified by:
getProjects in interface DawnServer

getAllProjects

public java.util.Collection<Project> getAllProjects()
Specified by:
getAllProjects in interface DawnServer

getMyProjects

public java.util.Collection<Project> getMyProjects(int userID)
Specified by:
getMyProjects in interface DawnServer

getMyProjectNames

public java.util.Set<java.lang.String> getMyProjectNames(int userID)
returns only the projects the user is assgined to

Specified by:
getMyProjectNames in interface DawnServer

setProjects

public void setProjects(java.util.Map<java.lang.String,Project> projects)

isAlive

public boolean isAlive()
Specified by:
isAlive in interface DawnServer

userLogin

public int userLogin(java.lang.String userName,
                     java.lang.String password)
Specified by:
userLogin in interface DawnServer

userLogoff

public int userLogoff(java.lang.String userName)
Specified by:
userLogoff in interface DawnServer

initResource

public int initResource(java.lang.String projectName,
                        java.lang.String initXMLString)
Specified by:
initResource in interface DawnServer

getProjectNames

public java.util.Set<java.lang.String> getProjectNames()
Specified by:
getProjectNames in interface DawnServer

lockObjects

public int lockObjects(int userId,
                       java.lang.String projectName,
                       java.util.Set<java.lang.String> toBeLockedObjects)
Specified by:
lockObjects in interface DawnServer

unlockObjects

public int unlockObjects(int userId,
                         java.lang.String projectName,
                         java.util.Set<java.lang.String> toBeLockedObjects)
Specified by:
unlockObjects in interface DawnServer

getLockedObjects

public java.util.Map<java.lang.String,java.lang.Integer> getLockedObjects(java.lang.String projectName)
Specified by:
getLockedObjects in interface DawnServer

createUser

public int createUser(java.lang.String userName,
                      java.lang.String password)
Specified by:
createUser in interface DawnServer

getUser

public User getUser(java.lang.String username)
Specified by:
getUser in interface DawnServer

getRole

public Role getRole(int id)
Specified by:
getRole in interface DawnServer

getRoleInProject

public int getRoleInProject(java.lang.String projectName,
                            int userId)
Specified by:
getRoleInProject in interface DawnServer

setGlobalUserManager

public void setGlobalUserManager(UserManager globalUserManager)

getGlobalUserManager

public UserManager getGlobalUserManager()
Specified by:
getGlobalUserManager in interface DawnServer

setId

public void setId(int id)

getId

public int getId()

canExecute

public boolean canExecute(java.lang.String projectName,
                          int userID,
                          int operation)
Specified by:
canExecute in interface DawnServer

addUser

public void addUser(User u)
Specified by:
addUser in interface DawnServer

removeUser

public void removeUser(int userId)
Specified by:
removeUser in interface DawnServer

removeProject

public void removeProject(java.lang.String projectName)
Specified by:
removeProject in interface DawnServer

updateGlobalRoles

public void updateGlobalRoles(Role newRole)
Specified by:
updateGlobalRoles in interface DawnServer