org.eaglei.datatools.jena
Class RepositorySecurityProvider

java.lang.Object
  extended by org.eaglei.datatools.jena.AbstractRepositoryProvider
      extended by org.eaglei.datatools.jena.RepositorySecurityProvider
All Implemented Interfaces:
DatatoolsSecurityProvider

public class RepositorySecurityProvider
extends AbstractRepositoryProvider
implements DatatoolsSecurityProvider

Class for handling authentication and login calls to the repository.

Author:
Jason Barreto

Nested Class Summary
 
Nested classes/interfaces inherited from class org.eaglei.datatools.jena.AbstractRepositoryProvider
AbstractRepositoryProvider.RestCommands
 
Field Summary
 
Fields inherited from class org.eaglei.datatools.jena.AbstractRepositoryProvider
DEFAULT_REPOSITORY, FORMAT_VALUE, isDebugEnabled, LABEL_QUERY_FAILED
 
Method Summary
 DatatoolsConfiguration getConfiguration(java.lang.String propFile)
          Loads the DataTools configuration from a property file and returns it as a DatatoolsConfiguration object.
 org.apache.commons.httpclient.HttpClient getHttpClient(org.eaglei.security.Session session)
          Retrieves the HttpClient associated with the passed in Session object (if one exists).
static RepositorySecurityProvider getInstance()
          Retrieves the singleton instance of this class.
 RepositorySession getRepositorySession(org.eaglei.security.Session session)
          Gets the RepositorySession object associated with this session from the session map.
protected  User getUserInformation(org.eaglei.security.Session session, org.apache.commons.httpclient.HttpClient client)
           
 java.util.List<Workspace> getWorkspaces(org.eaglei.security.Session session)
           
 boolean isOnline()
           
 boolean isValid(org.eaglei.security.Session session, boolean shouldThrow)
          Checks the validity of the passed in session object and the associated RepositorySession object.
 java.util.List<WorkFlowTransition> listWorkFlowTransitions(org.eaglei.security.Session session, org.eaglei.model.EIEntity workspaceEntity)
           
 User login(java.lang.String userName, java.lang.String password)
           
 void logout(org.eaglei.security.Session session)
           
 void setDefaultRepository(java.lang.String repo)
          Sets the base URL used to define URLs going to the repository.
 User whoami(org.eaglei.security.Session session)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInstance

public static RepositorySecurityProvider getInstance()
Retrieves the singleton instance of this class.

Returns:

isValid

public boolean isValid(org.eaglei.security.Session session,
                       boolean shouldThrow)
                throws InvalidSessionException
Checks the validity of the passed in session object and the associated RepositorySession object. Optionally throws an exception for invalid sessions if the boolean flag shouldThrow is set to true.

Parameters:
session - The Session object being validated.
shouldThrow - If true then an invalid session will result in an exception, if false then an invalid session will result in a log message and a return of false.
Returns:
True if the session and the associated RepositorySession are valid. False otherwise.
Throws:
InvalidSessionException - If the boolean shouldThrow flag is set to true and the passed in session is invalid.

login

public User login(java.lang.String userName,
                  java.lang.String password)
           throws RepositoryProviderException
Specified by:
login in interface DatatoolsSecurityProvider
Throws:
RepositoryProviderException

logout

public void logout(org.eaglei.security.Session session)
            throws RepositoryProviderException
Specified by:
logout in interface DatatoolsSecurityProvider
Throws:
RepositoryProviderException

whoami

public User whoami(org.eaglei.security.Session session)
            throws RepositoryProviderException
Specified by:
whoami in interface DatatoolsSecurityProvider
Throws:
RepositoryProviderException

isOnline

public boolean isOnline()
Specified by:
isOnline in interface DatatoolsSecurityProvider

getWorkspaces

public java.util.List<Workspace> getWorkspaces(org.eaglei.security.Session session)
                                        throws RepositoryProviderException
Specified by:
getWorkspaces in interface DatatoolsSecurityProvider
Throws:
RepositoryProviderException

getConfiguration

public DatatoolsConfiguration getConfiguration(java.lang.String propFile)
                                        throws RepositoryProviderException
Loads the DataTools configuration from a property file and returns it as a DatatoolsConfiguration object. The property file location can either be passed in or is determined by querying for a system property. If the property does not exist then a default configuration is used.

Parameters:
propFile - The path to the desired property file. If null is passed in then the system properties are queried.
Returns:
A DatatoolsConfiguration object representing the configuration present in the property file.
Throws:
RepositoryProviderException - If loading of the configuration file fails.

getRepositorySession

public RepositorySession getRepositorySession(org.eaglei.security.Session session)
Gets the RepositorySession object associated with this session from the session map.

Parameters:
session - The Session object associated with the RepositorySession object sought.
Returns:
Null if session is null or if the id of the session does not correspond to a key in the session map, otherwise the associated RepositorySession object is returned.

getUserInformation

protected User getUserInformation(org.eaglei.security.Session session,
                                  org.apache.commons.httpclient.HttpClient client)
                           throws RepositoryProviderException
Throws:
RepositoryProviderException

setDefaultRepository

public void setDefaultRepository(java.lang.String repo)
Sets the base URL used to define URLs going to the repository.

Parameters:
repo - A string repsenting the url for the repository.

listWorkFlowTransitions

public java.util.List<WorkFlowTransition> listWorkFlowTransitions(org.eaglei.security.Session session,
                                                                  org.eaglei.model.EIEntity workspaceEntity)
                                                           throws RepositoryProviderException
Throws:
RepositoryProviderException

getHttpClient

public org.apache.commons.httpclient.HttpClient getHttpClient(org.eaglei.security.Session session)
Retrieves the HttpClient associated with the passed in Session object (if one exists).

Parameters:
session - The session whose HttpClient is sought.
Returns:
The HttpClient associated with the Session object or null if none exists.


Copyright © 2009-2011 Eagle-I. All Rights Reserved.