org.granite.client.tide.javafx
Class BaseIdentity

java.lang.Object
  extended by org.granite.client.tide.impl.ComponentImpl
      extended by org.granite.client.tide.javafx.BaseIdentity
All Implemented Interfaces:
InvocationHandler, ContextAware, Identity, NameAware, Component, ExceptionHandler
Direct Known Subclasses:
Identity, Identity

public abstract class BaseIdentity
extends ComponentImpl
implements Identity, ExceptionHandler

Author:
William DRAI

Constructor Summary
protected BaseIdentity()
           
  BaseIdentity(ServerSession serverSession)
           
 
Method Summary
 boolean accepts(FaultMessage emsg)
          Should return true if this handler is able to manage the specified ErrorMessage
 Future<String> checkLoggedIn(TideResponder<String> tideResponder)
          Triggers a remote call to check is user is currently logged in Can be used at application startup to handle browser refresh cases
abstract  void clearSecurityCache()
          Clear the security cache
 String getUsername()
           
 void handle(Context context, FaultMessage emsg, TideFaultEvent faultEvent)
          Handle the error
abstract  ObservableRole hasRole(String roleName)
           
protected abstract  void initSecurityCache()
           
 boolean isLoggedIn()
           
 javafx.beans.property.BooleanProperty loggedInProperty()
           
 void login(String username, String password, TideResponder<String> tideResponder)
           
 void logout(TideResponder<Void> tideResponder)
           
 void setLoggedIn(boolean loggedIn)
           
 javafx.beans.property.StringProperty usernameProperty()
           
 
Methods inherited from class org.granite.client.tide.impl.ComponentImpl
call, callComponent, getContext, getName, getServerSession, invoke, invoke, setContext, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BaseIdentity

protected BaseIdentity()

BaseIdentity

public BaseIdentity(ServerSession serverSession)
Method Detail

loggedInProperty

public javafx.beans.property.BooleanProperty loggedInProperty()

isLoggedIn

public boolean isLoggedIn()
Specified by:
isLoggedIn in interface Identity

setLoggedIn

public void setLoggedIn(boolean loggedIn)

usernameProperty

public javafx.beans.property.StringProperty usernameProperty()

getUsername

public String getUsername()
Specified by:
getUsername in interface Identity

checkLoggedIn

public Future<String> checkLoggedIn(TideResponder<String> tideResponder)
Triggers a remote call to check is user is currently logged in Can be used at application startup to handle browser refresh cases

Specified by:
checkLoggedIn in interface Identity
Parameters:
resultHandler - optional result handler
faultHandler - optional fault handler

login

public void login(String username,
                  String password,
                  TideResponder<String> tideResponder)
Specified by:
login in interface Identity

logout

public void logout(TideResponder<Void> tideResponder)
Specified by:
logout in interface Identity

hasRole

public abstract ObservableRole hasRole(String roleName)

initSecurityCache

protected abstract void initSecurityCache()

clearSecurityCache

public abstract void clearSecurityCache()
Clear the security cache


accepts

public boolean accepts(FaultMessage emsg)
Description copied from interface: ExceptionHandler
Should return true if this handler is able to manage the specified ErrorMessage

Specified by:
accepts in interface ExceptionHandler
Parameters:
emsg - an error message
Returns:
true if ErrorMessage accepted

handle

public void handle(Context context,
                   FaultMessage emsg,
                   TideFaultEvent faultEvent)
Description copied from interface: ExceptionHandler
Handle the error

Specified by:
handle in interface ExceptionHandler
Parameters:
context - the context in which the error occured
emsg - the error message