org.activemath.webapp.ws.delegation
Class DelegationGuide

java.lang.Object
  extended by org.activemath.webapp.ws.delegation.DelegationGuide
Direct Known Subclasses:
SietteDelegation

public class DelegationGuide
extends Object

A simple class to play the role of guide-server in a browser-delegation process. TODO: have a constructor "by-name" which refers to a sub-configuration where the needed URLs are encoded (seems to bring in only the activity URL...) TODO: consider: a velocity macro that expresses a link to such a named delegation... (and checks it before) TODO: probably have ways to let such guides die after some time-out...


Nested Class Summary
protected  class DelegationGuide.GuideService
           
 
Field Summary
protected  boolean activityFinished
           
protected  URL activityServerUrl
           
protected  org.apache.xmlrpc.XmlRpcClient activityServiceClient
           
protected  String currentStatus
           
protected  DelegationGuide.GuideService guideService
           
protected  URL guideServiceUrl
           
protected  long lastModified
           
protected static org.apache.commons.logging.Log log
           
protected  String pathToComeBack
           
protected  String resourceActivityId
           
protected  double score
           
protected  String userName
           
 
Constructor Summary
protected DelegationGuide()
           
  DelegationGuide(Subconfiguration config, String activityId, String userName, String pathToComeBack)
           
  DelegationGuide(URL activityServerUrl, String activityId, String userName, String pathToComeBack)
          Constructs a delegation-guide which stores params and registers itself.
 
Method Summary
protected  Map activityFinished(Hashtable args)
          Called by the activity server through xml-rpc
 URL cancelActivity()
           
 void checkAvailability()
           
protected  DelegationGuide.GuideService createGuideService()
           
 String getCurrentStatus()
           
 long getLastModified()
           
 double getScore()
           
protected  URL getUrlToComeBack()
           
 boolean isActivityFinished()
           
protected  void removeGuideService()
           
 URL sendWishToStart()
          Invokes the start for delegation and returns the URL to send the learner to as well.
 void setPathToComeBack(String path)
           
protected  void updateStatus(String status)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static org.apache.commons.logging.Log log

activityServerUrl

protected URL activityServerUrl

resourceActivityId

protected String resourceActivityId

userName

protected String userName

pathToComeBack

protected String pathToComeBack

guideServiceUrl

protected URL guideServiceUrl

guideService

protected DelegationGuide.GuideService guideService

activityServiceClient

protected org.apache.xmlrpc.XmlRpcClient activityServiceClient

currentStatus

protected String currentStatus

activityFinished

protected boolean activityFinished

score

protected double score

lastModified

protected long lastModified
Constructor Detail

DelegationGuide

protected DelegationGuide()

DelegationGuide

public DelegationGuide(Subconfiguration config,
                       String activityId,
                       String userName,
                       String pathToComeBack)
                throws Exception
Throws:
Exception

DelegationGuide

public DelegationGuide(URL activityServerUrl,
                       String activityId,
                       String userName,
                       String pathToComeBack)
Constructs a delegation-guide which stores params and registers itself.

Parameters:
activityServerUrl - the URL to the activity server
activityId - the ID of the activity to be started
userName - the user-name with which ity will happen
pathToComeBack - the relative url-to-come-back if already known (relative to the service-URL) (??)
Method Detail

createGuideService

protected DelegationGuide.GuideService createGuideService()

checkAvailability

public void checkAvailability()
                       throws org.apache.xmlrpc.XmlRpcException
Throws:
org.apache.xmlrpc.XmlRpcException

sendWishToStart

public URL sendWishToStart()
Invokes the start for delegation and returns the URL to send the learner to as well.

Returns:

cancelActivity

public URL cancelActivity()

setPathToComeBack

public void setPathToComeBack(String path)

getUrlToComeBack

protected URL getUrlToComeBack()

removeGuideService

protected void removeGuideService()

activityFinished

protected Map activityFinished(Hashtable args)
Called by the activity server through xml-rpc

Parameters:
args - should contain: user resourceId score
Returns:
a map with at least urlToComeBack (to be resolved along the URL to call the service here)

isActivityFinished

public boolean isActivityFinished()

getScore

public double getScore()

updateStatus

protected void updateStatus(String status)

getCurrentStatus

public String getCurrentStatus()

getLastModified

public long getLastModified()