org.jvoicexml.jndi.client
Class SessionStub

java.lang.Object
  extended by org.jvoicexml.jndi.client.SessionStub
All Implemented Interfaces:
Serializable, Referenceable, Stub, Session

public final class SessionStub
extends Object
implements Session, Serializable

Stub for the Session.

Since:
0.4
Version:
$Revision: 216 $

Copyright © 2006-2007 JVoiceXML group - http://jvoicexml.sourceforge.net/

Author:
Dirk Schnelle
See Also:
Session, Serialized Form

Constructor Summary
SessionStub()
          Constructs a new object.
SessionStub(Context context)
          Constructs a new object.
SessionStub(String id)
          Constructs a new object.
 
Method Summary
 void call(URI uri)
          Handles a call request.
protected  void clearSkeleton()
          Clears a known remote reference to the skeleton.
 void close()
          Closes this session.
 CharacterInput getCharacterInput()
          Retrieves the DTMF input device.
 Context getContext()
          Retrieves the context to use.
protected  ErrorEvent getErrorEvent(Throwable throwable)
          Digs into the throwable and tries to find an ErrorEvent in the root cause hierarchy.
protected  Class getLocalClass()
          Retrieves the type of the local interface.
 Reference getReference()
          
protected  Class<RemoteSession> getRemoteClass()
          Retrieves the type of the remote interface.
 String getSessionID()
          Retrieves the universal unique identifier for this session.
protected  T getSkeleton(String... suffix)
          Lazy instantiation of the skeleton.
 String getStubName()
          Retrieves the name to which the stub is bound.
 void hangup()
          Handles a hangup request.
 void setContext(Context ctx)
          Sets the JNDI context.
 void waitSessionEnd()
          Delays until the session ends.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SessionStub

public SessionStub()
Constructs a new object.


SessionStub

public SessionStub(Context context)
Constructs a new object.

Parameters:
context - The context to use.
Since:
0.6

SessionStub

public SessionStub(String id)
Constructs a new object.

Parameters:
id - The session id.
Method Detail

getStubName

public String getStubName()
Retrieves the name to which the stub is bound.

Specified by:
getStubName in interface Stub
Returns:
Name of the stub.

getRemoteClass

protected Class<RemoteSession> getRemoteClass()
Retrieves the type of the remote interface.

Returns:
Type of the remote interface.

getLocalClass

protected Class getLocalClass()
Retrieves the type of the local interface.

Returns:
Type of the local interface.

call

public void call(URI uri)
          throws ErrorEvent
Handles a call request.

Starts processing of the given application and returns immediately.

Specified by:
call in interface Session
Parameters:
uri - URI of the first document to load.
Throws:
ErrorEvent - Error initiating the call.

hangup

public void hangup()
Handles a hangup request.

Specified by:
hangup in interface Session

getCharacterInput

public CharacterInput getCharacterInput()
                                 throws NoresourceError
Retrieves the DTMF input device.

Specified by:
getCharacterInput in interface Session
Returns:
DTMF input device.
Throws:
NoresourceError - Input device is not available.

waitSessionEnd

public void waitSessionEnd()
                    throws ErrorEvent
Delays until the session ends.

Specified by:
waitSessionEnd in interface Session
Throws:
ErrorEvent - Error processing the call.

close

public void close()
Closes this session. After a session is closed, it can not be reopened i.e., to call another application.

If no hangup call was initiated, the session is aborted.

Specified by:
close in interface Session

getSessionID

public String getSessionID()
Retrieves the universal unique identifier for this session.

Specified by:
getSessionID in interface Session
Returns:
Universal unique identifier for this session.

setContext

public final void setContext(Context ctx)
Sets the JNDI context.

Parameters:
ctx - The context to use.
Since:
0.6

getContext

public Context getContext()
Retrieves the context to use.

Returns:
The context to use.

getReference

public final Reference getReference()
                             throws NamingException

Specified by:
getReference in interface Referenceable
Throws:
NamingException

getSkeleton

protected final T getSkeleton(String... suffix)
Lazy instantiation of the skeleton.

This method tries to lookup the skeleton with the following name
getRemoteClass().getSimpleName().suffix[0].suffix[1]...
If no suffixes are given the simple class name is used instead.

Parameters:
suffix - List of suffixes to be appended.
Returns:
The skeleton to use for remote method calls, null in case of an error.

clearSkeleton

protected final void clearSkeleton()
Clears a known remote reference to the skeleton.

This method must be called in case of a remote exception. As a consequence a following method call will try to retreive a new fresh reference to the skeleton.


getErrorEvent

protected final ErrorEvent getErrorEvent(Throwable throwable)
Digs into the throwable and tries to find an ErrorEvent in the root cause hierarchy.

Parameters:
throwable - The throwable to examine.
Returns:
Detected ErrorEvent or null if there is none.


Copyright © 2005-2007 JVoiceXML group.