pk.edu.niit.clarens
Class ClarensServer

java.lang.Object
  extended bypk.edu.niit.clarens.ClarensServer
All Implemented Interfaces:
org.apache.xmlrpc.AuthenticatedXmlRpcHandler, ConfigurableRpcHandler

public class ClarensServer
extends java.lang.Object
implements org.apache.xmlrpc.AuthenticatedXmlRpcHandler, ConfigurableRpcHandler

Handler for xmlrpc "system" methods. Methods implemented include "auth", "auth2", and "logout".


Constructor Summary
ClarensServer()
          Trivial constructor.
ClarensServer(java.lang.String certDir)
          Construct a handler.
 
Method Summary
 java.util.Vector auth(java.util.Vector params)
          Authenticate a user.
 java.util.Vector auth2(java.util.Vector params)
          Authenticate a user.
protected  java.lang.Object execute(java.lang.String methodName, java.util.Vector parameters)
          Handle a xmlrpc request with no user information.
 java.lang.Object execute(java.lang.String methodName, java.util.Vector parameters, java.lang.String username, java.lang.String password)
          Handle a xmlrpc request.
 java.lang.String getCertBaseDir()
          Get the location of the directory containing the server certificate.
 java.util.Vector logout(java.util.Vector params)
          Logout the user.
 void set(java.lang.String key, java.lang.String value)
          Set a property for a xmlrpc handler.
 void setCertBaseDir(java.lang.String certBaseDir)
          Set the location of the directory containing the server certificate.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClarensServer

public ClarensServer()
Trivial constructor.


ClarensServer

public ClarensServer(java.lang.String certDir)
Construct a handler.

Parameters:
certDir - The directory that contains the server certificates.
Method Detail

execute

public java.lang.Object execute(java.lang.String methodName,
                                java.util.Vector parameters,
                                java.lang.String username,
                                java.lang.String password)
                         throws java.lang.Exception
Handle a xmlrpc request.

Specified by:
execute in interface org.apache.xmlrpc.AuthenticatedXmlRpcHandler
Parameters:
methodName - The name of the system method being executed.
parameters - The method parameters.
username - The identity of the user performing the execution.
password - The password/key for the user performing the execution.
Returns:
A Vector containing the result.
Throws:
java.lang.Exception - A generic exception is thrown for any errors.

execute

protected java.lang.Object execute(java.lang.String methodName,
                                   java.util.Vector parameters)
                            throws java.lang.Exception
Handle a xmlrpc request with no user information.

Parameters:
methodName - The name of the system method being executed.
parameters - The method parameters.
Returns:
An object containing the result.
Throws:
java.lang.Exception - A generic exception is thrown for any errors.

auth

public java.util.Vector auth(java.util.Vector params)
Authenticate a user.

Parameters:
params - Not used.
Returns:
A vector containing the following string values: The server certificate in PEM format, The base-64 encoded encrypted server nonce. The base-64 encoded encrypted user nonce.

auth2

public java.util.Vector auth2(java.util.Vector params)
Authenticate a user. The user certificate is read from local storage.

Parameters:
params - Not used.
Returns:
A vector containing the following string values: The server certificate in PEM format, The base-64 encoded encrypted server nonce. The base-64 encoded encrypted user nonce.

logout

public java.util.Vector logout(java.util.Vector params)
Logout the user. All session information is discarded.

Parameters:
params - Not used.
Returns:
A Vector containing a single integer '0' indicating success.

setCertBaseDir

public void setCertBaseDir(java.lang.String certBaseDir)
Set the location of the directory containing the server certificate.

Parameters:
certBaseDir -

getCertBaseDir

public java.lang.String getCertBaseDir()
Get the location of the directory containing the server certificate.

Returns:
certBaseDir

set

public void set(java.lang.String key,
                java.lang.String value)
Set a property for a xmlrpc handler. This method allows all xmlrpc handlers in clarens to be configured in a common way.

Specified by:
set in interface ConfigurableRpcHandler
Parameters:
key - The name of the property to set.
value - The value of the property.