gov.nih.nci.caarray.services
Class AbstractCaArrayServer

java.lang.Object
  extended by gov.nih.nci.caarray.services.AbstractCaArrayServer
Direct Known Subclasses:
CaArrayServer, CaArrayServer

public abstract class AbstractCaArrayServer
extends java.lang.Object

Author:
dkokotov

Constructor Summary
AbstractCaArrayServer(java.lang.String jndiUrl)
          Creates a new instance configured to attach to the provided JNDI url.
AbstractCaArrayServer(java.lang.String hostname, int jndiPort)
          Creates a new instance configured to attach to the provided hostname and port.
 
Method Summary
 void connect()
          Starts a new session with this server for an anonymous (unauthenticated) user.
 void connect(java.lang.String username, java.lang.String password)
          Starts a new session with this server.
protected abstract  void executeServiceForCredentialCheck()
          Execute some method in a remote EJB service that forces the authentication credentials to be checked.
protected abstract  void lookupServices(javax.naming.Context ctx)
          Method called after obtaining a JNDI context from the remote EJB server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractCaArrayServer

public AbstractCaArrayServer(java.lang.String hostname,
                             int jndiPort)
Creates a new instance configured to attach to the provided hostname and port.

Parameters:
hostname - hostname (or IP address) of the caArray server.
jndiPort - JNDI port of the caArray server.

AbstractCaArrayServer

public AbstractCaArrayServer(java.lang.String jndiUrl)
Creates a new instance configured to attach to the provided JNDI url.

Parameters:
jndiUrl - the JNDI url, should be in the format jnp://hostname:port
Method Detail

connect

public void connect()
             throws ServerConnectionException
Starts a new session with this server for an anonymous (unauthenticated) user.

Throws:
ServerConnectionException - thrown when the connection is dropped/missing

connect

public void connect(java.lang.String username,
                    java.lang.String password)
             throws ServerConnectionException,
                    javax.security.auth.login.FailedLoginException
Starts a new session with this server.

Parameters:
username - username to use to authenticate
password - password to use to authenticate
Throws:
ServerConnectionException - thrown when the connection is dropped/missing
javax.security.auth.login.FailedLoginException - thrown when there is a problem with the login credentials

executeServiceForCredentialCheck

protected abstract void executeServiceForCredentialCheck()
Execute some method in a remote EJB service that forces the authentication credentials to be checked. This method must be side effect free, and should ideally be simple and fast, as the only purpose of executing it is to force the credential check. Subclasses should override this to invoke the appropriate API method.


lookupServices

protected abstract void lookupServices(javax.naming.Context ctx)
                                throws javax.naming.NamingException
Method called after obtaining a JNDI context from the remote EJB server. Subclasses should override this method and lookup remote EJB references in this context.

Parameters:
ctx - the JNDI context where remote EJB service references can be looked up
Throws:
javax.naming.NamingException - if there is an error looking up a remote EJB in the context