org.hackystat.projectbrowser
Class ProjectBrowserSession

java.lang.Object
  extended by org.apache.wicket.Session
      extended by org.apache.wicket.protocol.http.WebSession
          extended by org.hackystat.projectbrowser.ProjectBrowserSession
All Implemented Interfaces:
java.io.Serializable, org.apache.wicket.IClusterable

public class ProjectBrowserSession
extends org.apache.wicket.protocol.http.WebSession

Provides a session instance that holds authentication credentials.

Author:
Philip Johnson
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Session
org.apache.wicket.Session.IPageMapVisitor, org.apache.wicket.Session.PageMapAccessMetaData
 
Field Summary
 java.util.List<java.lang.String> analysisList
          The analysis list.
static java.lang.String PARAMETER_VALUE_SEPARATOR
          The separator for parameter values.
static java.lang.String PROJECT_NAME_OWNER_SEPARATR
          The separator between project name and its onwer.
 
Fields inherited from class org.apache.wicket.Session
PAGEMAP_ACCESS_MDK, SESSION_ATTRIBUTE_NAME
 
Constructor Summary
ProjectBrowserSession(org.apache.wicket.Request request)
          Provide a constructor that initializes WebSession.
 
Method Summary
 void clearProjectList()
          Clear project list.
static java.lang.String convertProjectListToString(java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> projects)
          Returns a single String represents a list of the projects, separated by comma.
static ProjectBrowserSession get()
          Obtain the current session.
 org.hackystat.dailyprojectdata.client.DailyProjectDataClient getDailyProjectDataClient()
          Returns a DailyProjectDataClient instance for this user and session.
 DailyProjectDataSession getDailyProjectDataSession()
          Returns the DailyProjectDataSession instance.
 org.hackystat.sensorbase.resource.projects.jaxb.Project getDefaultProject()
           
 java.lang.String getEmail()
           
static java.lang.String getFormattedDateString(long date)
          Returns the string that represents the given date in standard formatted.
 java.util.logging.Logger getLogger()
           
 java.lang.String getPassword()
           
 org.hackystat.sensorbase.resource.projects.jaxb.Project getProject(java.lang.String projectName, java.lang.String projectOwner)
          Returns a Project instance that available to current user and is matched to the given project name and project owner.
 java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> getProjectList()
          Returns the list of Projects associated with this user.
 ProjectPortfolioSession getProjectPortfolioSession()
           
 ProjectsSession getProjectsSession()
          Returns the ProjectsDataSession instance.
 java.lang.String getRegisterFeedback()
          Returns the string to be displayed in the registerFeedback label.
 org.hackystat.sensorbase.client.SensorBaseClient getSensorBaseClient()
          Returns a SensorBaseClient instance for this user and session.
 SensorDataSession getSensorDataSession()
          Returns the SensorDataSession instance.
 java.lang.String getSigninFeedback()
          Returns the string to be displayed in the SigninFeedback label.
 org.hackystat.telemetry.service.client.TelemetryClient getTelemetryClient()
          Returns a TelemetryClient instance for this user and session.
 TelemetrySession getTelemetrySession()
          Returns the TelemetrySession instance.
 TrajectorySession getTrajectorySession()
          Returns the TrajectorySession instance.
 java.lang.String getUserEmail()
          Gets the user's email associated with this session.
 boolean isAuthenticated()
          Returns true if the user has been authenticated in this session.
 void logUsage(java.lang.String log)
          Log the user usage to special file.
 java.lang.String printPageParameters(org.apache.wicket.PageParameters parameters)
          Print the indexed page parameters in format of /parameter0/parameter1/.../.
 void setCredentials(java.lang.String user, java.lang.String password)
          Used by the Signin form to provide the SensorBase authentication credentials to this session.
 void setRegisterFeedback(java.lang.String registerFeedback)
          Allows other components to set the feedback string for the register form.
 void setSigninFeedback(java.lang.String signinFeedback)
          Allows other components to set the feedback string for the signin form.
 boolean signin(java.lang.String email, java.lang.String password)
          Returns true if this email/password combination is valid for this sensorbase.
 
Methods inherited from class org.apache.wicket.protocol.http.WebSession
cleanupFeedbackMessages, isCurrentRequestValid
 
Methods inherited from class org.apache.wicket.Session
attach, bind, clear, createAutoPageMap, createAutoPageMapName, currentCreateAutoPageMapCounter, detach, dirty, error, exists, findOrCreate, findOrCreate, getApplication, getAttribute, getAttributeNames, getAuthorizationStrategy, getAutoPageMapNamePrefix, getAutoPageMapNameSuffix, getClassResolver, getClientInfo, getDefaultPageMap, getFeedbackMessages, getId, getLocale, getMetaData, getPage, getPage, getPageFactory, getPageFactory, getPageMaps, getSessionStore, getSizeInBytes, getStyle, incrementCreateAutoPageMapCounter, info, invalidate, invalidateNow, isSessionInvalidated, isTemporary, newPageMap, nextPageId, nextSequenceValue, pageMapForName, removeAttribute, removePageMap, set, setApplication, setAttribute, setClientInfo, setLocale, setMetaData, setStyle, touch, unset, untouch, update, visitPageMaps, warn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

analysisList

public java.util.List<java.lang.String> analysisList
The analysis list.


PARAMETER_VALUE_SEPARATOR

public static final java.lang.String PARAMETER_VALUE_SEPARATOR
The separator for parameter values.

See Also:
Constant Field Values

PROJECT_NAME_OWNER_SEPARATR

public static final java.lang.String PROJECT_NAME_OWNER_SEPARATR
The separator between project name and its onwer.

See Also:
Constant Field Values
Constructor Detail

ProjectBrowserSession

public ProjectBrowserSession(org.apache.wicket.Request request)
Provide a constructor that initializes WebSession.

Parameters:
request - The request object.
Method Detail

get

public static ProjectBrowserSession get()
Obtain the current session.

Returns:
The current ProjectBrowserSession.

isAuthenticated

public boolean isAuthenticated()
Returns true if the user has been authenticated in this session.

Returns:
True if the user has supplied a valid email and password for this sensorbase.

setCredentials

public void setCredentials(java.lang.String user,
                           java.lang.String password)
Used by the Signin form to provide the SensorBase authentication credentials to this session.

Parameters:
user - The user.
password - The password.

getSigninFeedback

public java.lang.String getSigninFeedback()
Returns the string to be displayed in the SigninFeedback label.

Returns:
A signin feedback string.

setSigninFeedback

public void setSigninFeedback(java.lang.String signinFeedback)
Allows other components to set the feedback string for the signin form.

Parameters:
signinFeedback - The message to be displayed.

setRegisterFeedback

public void setRegisterFeedback(java.lang.String registerFeedback)
Allows other components to set the feedback string for the register form.

Parameters:
registerFeedback - The message to be displayed.

getRegisterFeedback

public java.lang.String getRegisterFeedback()
Returns the string to be displayed in the registerFeedback label.

Returns:
A register feedback string.

signin

public boolean signin(java.lang.String email,
                      java.lang.String password)
Returns true if this email/password combination is valid for this sensorbase.

Parameters:
email - The email.
password - The password.
Returns:
True if valid for this sensorbase.

getSensorBaseClient

public org.hackystat.sensorbase.client.SensorBaseClient getSensorBaseClient()
Returns a SensorBaseClient instance for this user and session.

Returns:
The SensorBaseClient instance.

getTelemetryClient

public org.hackystat.telemetry.service.client.TelemetryClient getTelemetryClient()
Returns a TelemetryClient instance for this user and session.

Returns:
The TelemetryClient instance.

getDailyProjectDataClient

public org.hackystat.dailyprojectdata.client.DailyProjectDataClient getDailyProjectDataClient()
Returns a DailyProjectDataClient instance for this user and session.

Returns:
The DailyProjectDataClient instance.

getUserEmail

public java.lang.String getUserEmail()
Gets the user's email associated with this session.

Returns:
The user.

getProject

public org.hackystat.sensorbase.resource.projects.jaxb.Project getProject(java.lang.String projectName,
                                                                          java.lang.String projectOwner)
Returns a Project instance that available to current user and is matched to the given project name and project owner.

Parameters:
projectName - the given project name.
projectOwner - the given project owner.
Returns:
the Project instance. null if no matching project is found, which may means either the project name or project owner is null or there is no Project for this user with the same project name and owner as the given ones.

convertProjectListToString

public static java.lang.String convertProjectListToString(java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> projects)
Returns a single String represents a list of the projects, separated by comma.

Parameters:
projects - a list of selected projects.
Returns:
a String.

getFormattedDateString

public static java.lang.String getFormattedDateString(long date)
Returns the string that represents the given date in standard formatted. e.g. 2008-08-08T08:08:08+08:00, the +08:00 in the end means the time zone of this time stamp is +08:00

Parameters:
date - the given date
Returns:
a String

clearProjectList

public void clearProjectList()
Clear project list.


getProjectList

public java.util.List<org.hackystat.sensorbase.resource.projects.jaxb.Project> getProjectList()
Returns the list of Projects associated with this user.

Returns:
The list of Projects.

getDefaultProject

public org.hackystat.sensorbase.resource.projects.jaxb.Project getDefaultProject()
Returns:
the Default project.

getSensorDataSession

public SensorDataSession getSensorDataSession()
Returns the SensorDataSession instance.

Returns:
The session state for the sensor data page.

getDailyProjectDataSession

public DailyProjectDataSession getDailyProjectDataSession()
Returns the DailyProjectDataSession instance.

Returns:
The session state for the daily project data page.

getTelemetrySession

public TelemetrySession getTelemetrySession()
Returns the TelemetrySession instance.

Returns:
The session state for the telemetry page.

getProjectsSession

public ProjectsSession getProjectsSession()
Returns the ProjectsDataSession instance.

Returns:
The session state for the projects data page.

getPassword

public java.lang.String getPassword()
Returns:
the password

getEmail

public java.lang.String getEmail()
Returns:
the email

getProjectPortfolioSession

public ProjectPortfolioSession getProjectPortfolioSession()
Returns:
the projectPortfolioSession

logUsage

public void logUsage(java.lang.String log)
Log the user usage to special file.

Parameters:
log - the log message

printPageParameters

public java.lang.String printPageParameters(org.apache.wicket.PageParameters parameters)
Print the indexed page parameters in format of /parameter0/parameter1/.../.

Parameters:
parameters - the indexed page parameter
Returns:
the result string.

getLogger

public java.util.logging.Logger getLogger()
Returns:
the logger that associated to this web application.

getTrajectorySession

public TrajectorySession getTrajectorySession()
Returns the TrajectorySession instance.

Returns:
The session state for the trajectory page.