org.sakaiproject.tool.assessment.shared.impl.assessment
Class SecureDeliveryServiceImpl

java.lang.Object
  extended by org.sakaiproject.tool.assessment.shared.impl.assessment.SecureDeliveryServiceImpl
All Implemented Interfaces:
SecureDeliveryServiceAPI

public class SecureDeliveryServiceImpl
extends Object
implements SecureDeliveryServiceAPI

Author:
Luis Camargo (lcamargo@respondus.com)

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI
SecureDeliveryServiceAPI.Phase, SecureDeliveryServiceAPI.PhaseStatus
 
Field Summary
 
Fields inherited from interface org.sakaiproject.tool.assessment.shared.api.assessment.SecureDeliveryServiceAPI
EXITPWD_KEY, MODULE_KEY, NONE_ID, TITLE_DECORATION
 
Constructor Summary
SecureDeliveryServiceImpl()
           
 
Method Summary
 String decryptPassword(String moduleId, String password)
          Uses the module specified to decrypt the exit password.
 String encryptPassword(String moduleId, String password)
          Uses the module specified to encrypt the exit password before storing it on the assessment settings.
 String getHTMLFragment(String moduleId, PublishedAssessmentIfc assessment, javax.servlet.http.HttpServletRequest request, SecureDeliveryServiceAPI.Phase phase, SecureDeliveryServiceAPI.PhaseStatus status, Locale locale)
          Returns an HTML appropriate for the combination of parameters.
 String getInitialHTMLFragments(javax.servlet.http.HttpServletRequest request, Locale locale)
          Returns the initial HTML fragments for all active modules.
 SecureDeliveryModuleIfc getModuleReference(String moduleId, Object context)
          Helper method to obtain a reference to the runtime instance of the module specified.
 SortedSet<RegisteredSecureDeliveryModuleIfc> getSecureDeliveryModules(Locale locale)
           
 String getTitleDecoration(String moduleId, Locale locale)
           
 void init()
          Loads the secure delivery plugins defined by the samigo.secureDeliveryPlugins setting.
 boolean isSecureDeliveryAvaliable()
           
 boolean isSecureDeliveryModuleAvailable(String moduleId)
           
 SecureDeliveryServiceAPI.PhaseStatus validatePhase(String moduleId, SecureDeliveryServiceAPI.Phase phase, PublishedAssessmentIfc assessment, javax.servlet.http.HttpServletRequest request)
          Checks with the module specified by moduleId if the current delivery phase can continue.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SecureDeliveryServiceImpl

public SecureDeliveryServiceImpl()
Method Detail

init

public void init()
Loads the secure delivery plugins defined by the samigo.secureDeliveryPlugins setting. samigo.secureDeliveryPlugins is a list of JAR files separated by ":". Each JAR file plugin can provide one or more secure module implementation(s).


isSecureDeliveryAvaliable

public boolean isSecureDeliveryAvaliable()
Specified by:
isSecureDeliveryAvaliable in interface SecureDeliveryServiceAPI

isSecureDeliveryModuleAvailable

public boolean isSecureDeliveryModuleAvailable(String moduleId)
Specified by:
isSecureDeliveryModuleAvailable in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
Returns:
true if the module with moduleId is availabe.

getSecureDeliveryModules

public SortedSet<RegisteredSecureDeliveryModuleIfc> getSecureDeliveryModules(Locale locale)
Specified by:
getSecureDeliveryModules in interface SecureDeliveryServiceAPI
Returns:
A set of RegisteredSecureDeliveryModuleIfc entries with the module name internationalized for the given locale. The list always includes NONE_ID as its first element. Others are ordered alphabetically by their name.

getTitleDecoration

public String getTitleDecoration(String moduleId,
                                 Locale locale)
Specified by:
getTitleDecoration in interface SecureDeliveryServiceAPI
Returns:
The title decoration for the given module and locale. Returns empty string if moduleId is NONE_ID, null, not available or disabled.

validatePhase

public SecureDeliveryServiceAPI.PhaseStatus validatePhase(String moduleId,
                                                          SecureDeliveryServiceAPI.Phase phase,
                                                          PublishedAssessmentIfc assessment,
                                                          javax.servlet.http.HttpServletRequest request)
Checks with the module specified by moduleId if the current delivery phase can continue. Returns SUCCESS if moduleId is null or NONE_ID or if the module is no longer available or disabled.

Specified by:
validatePhase in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
phase -
assessment -
request -
Returns:

getInitialHTMLFragments

public String getInitialHTMLFragments(javax.servlet.http.HttpServletRequest request,
                                      Locale locale)
Returns the initial HTML fragments for all active modules. The fragments are inserted into the assessment list.

Specified by:
getInitialHTMLFragments in interface SecureDeliveryServiceAPI
Parameters:
request -
locale -
Returns:

getHTMLFragment

public String getHTMLFragment(String moduleId,
                              PublishedAssessmentIfc assessment,
                              javax.servlet.http.HttpServletRequest request,
                              SecureDeliveryServiceAPI.Phase phase,
                              SecureDeliveryServiceAPI.PhaseStatus status,
                              Locale locale)
Returns an HTML appropriate for the combination of parameters. The fragment is injected during delivery. Returns empty string if module id is null or NONE_ID or if the module is no longer available or disabled.

Specified by:
getHTMLFragment in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
assessment -
request -
phase -
status -
locale -
Returns:

getModuleReference

public SecureDeliveryModuleIfc getModuleReference(String moduleId,
                                                  Object context)
Helper method to obtain a reference to the runtime instance of the module specified. The context object provided is passed to the module itself for validation and the reference is only returned if the module validation is successful. The idea is to let module developers interact with the mod How the actual context type and how it's validated is up to each module implementation.

Specified by:
getModuleReference in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
context -
Returns:
the reference. null if the module is NONE_ID, not available or if the module rejected the context

encryptPassword

public String encryptPassword(String moduleId,
                              String password)
Uses the module specified to encrypt the exit password before storing it on the assessment settings. The encryption method used is up to the module implementation. Returns the same password if module id is null or NONE_ID or if the module is no longer available.

Specified by:
encryptPassword in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
password -
Returns:
the encrypted password

decryptPassword

public String decryptPassword(String moduleId,
                              String password)
Uses the module specified to decrypt the exit password. The encryption method used is up to the module implementation. Returns the same password if module id is null or NONE_ID or if the module is no longer available.

Specified by:
decryptPassword in interface SecureDeliveryServiceAPI
Parameters:
moduleId -
password -
Returns:
the plain text password


Copyright © 2005-2012 Sakai Project. All Rights Reserved.