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

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

public class ESUsersessionImpl
extends AbstractAPIImpl<ESUsersessionImpl,Usersession>
implements ESUsersession

Mapping between ESUsersession and Usersession.

Author:
emueller

Constructor Summary
ESUsersessionImpl(Usersession usersession)
          Constructor.
 
Method Summary
 void delete()
          Deletes this usersession.
 ESSessionId getESSessionId()
          Returns the session ID.
 String getPassword()
          Returns the password.
 ESServer getServer()
          Returns the usersession's server.
 ESSessionId getSessionId()
          Returns the session id of this session.
 String getUsername()
          Returns the name of the user this user session is associated with.
 boolean isLoggedIn()
          Checks whether the user session has a ESSessionId.
 boolean isSavePassword()
          Whether the password that is used by this session will be saved.
 void logout()
          Logs out the user session.
 void refresh()
          Relogins into the server using the same credentials in order to update the ESSessionId.
 void setPassword(String password)
          Sets the password to be used by this session when logging in.
 void setSavePassword(boolean shouldSavePassword)
          Whether the password that is used by this session should be saved.
 void setServer(ESServerImpl server)
          Sets the server.
 void setUsername(String name)
          Sets the user's name to be used by this session when logging in.
 
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

ESUsersessionImpl

public ESUsersessionImpl(Usersession usersession)
Constructor.

Parameters:
usersession - the delegate
Method Detail

getServer

public ESServer getServer()
Returns the usersession's server.

Specified by:
getServer in interface ESUsersession
Returns:
the server this user session is associated with
See Also:
ESUsersession.getServer()

getUsername

public String getUsername()
Returns the name of the user this user session is associated with.

Specified by:
getUsername in interface ESUsersession
Returns:
username the name of the user this user session is associated with
See Also:
ESUsersession.getUsername()

getPassword

public String getPassword()
Returns the password. The password is encrypted with the server's public key, so there's no access to the cleartext password.

Specified by:
getPassword in interface ESUsersession
Returns:
the encrypted password
See Also:
ESUsersession.getPassword()

isLoggedIn

public boolean isLoggedIn()
Checks whether the user session has a ESSessionId.

Specified by:
isLoggedIn in interface ESUsersession
Returns:
true, if session is logged in, false otherwise
See Also:
ESUsersession.isLoggedIn()

refresh

public void refresh()
             throws ESException
Relogins into the server using the same credentials in order to update the ESSessionId.

Specified by:
refresh in interface ESUsersession
Throws:
ESException - in case renewal of the session failed
See Also:
ESUsersession.refresh()

logout

public void logout()
            throws ESException
Logs out the user session.

Specified by:
logout in interface ESUsersession
Throws:
ESException - in case an error occurred during logout
See Also:
ESUsersession.logout()

getESSessionId

public ESSessionId getESSessionId()
Returns the session ID.

Returns:
the session ID

setUsername

public void setUsername(String name)
Sets the user's name to be used by this session when logging in.

Parameters:
name - the name of the user

setPassword

public void setPassword(String password)
Sets the password to be used by this session when logging in.

Parameters:
password - the new password

setServer

public void setServer(ESServerImpl server)
Sets the server.

Parameters:
server - the server

getSessionId

public ESSessionId getSessionId()
Returns the session id of this session.

Specified by:
getSessionId in interface ESUsersession
Returns:
the current session id
See Also:
ESUsersession.getSessionId()

setSavePassword

public void setSavePassword(boolean shouldSavePassword)
Whether the password that is used by this session should be saved.

Specified by:
setSavePassword in interface ESUsersession
Parameters:
shouldSavePassword - true if the password should be saved, false otherwise
See Also:
ESUsersession.setSavePassword(boolean)

isSavePassword

public boolean isSavePassword()
Whether the password that is used by this session will be saved.

Specified by:
isSavePassword in interface ESUsersession
Returns:
true if the password is saved, false otherwise
See Also:
ESUsersession.isSavePassword()

delete

public void delete()
            throws ESException
Deletes this usersession.

Specified by:
delete in interface ESUsersession
Throws:
ESException - in case removing the session fails
See Also:
ESUsersession.delete()


Copyright © 2015. All Rights Reserved.