org.jvoicexml.jndi.client
Class CharacterInputStub

java.lang.Object
  extended by org.jvoicexml.jndi.client.CharacterInputStub
All Implemented Interfaces:
Serializable, Referenceable, CharacterInput, InputDevice, Stub, RemoteConnectable

public final class CharacterInputStub
extends Object
implements CharacterInput, Stub, Serializable

Stub for the CharacterInput.

Since:
0.5
Version:
$Revision: 216 $

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

Author:
Dirk Schnelle
See Also:
CharacterInput, Serialized Form

Constructor Summary
CharacterInputStub()
          Constructs a new object.
CharacterInputStub(String id)
          Constructs a new object.
 
Method Summary
 void addCharacter(char dtmf)
          The user entered a DTMF.
protected  void clearSkeleton()
          Clears a known remote reference to the skeleton.
 void connect(RemoteClient client)
          Establishes a connection from the given RemoteClient to this object.
 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<RemoteCharacterInput> getRemoteClass()
          Retrieves the type of the remote interface.
protected  T getSkeleton(String... suffix)
          Lazy instantiation of the skeleton.
 String getStubName()
          Retrieves the name to which the stub is bound.
 void setContext(Context ctx)
          Sets the JNDI context.
 void startRecognition()
          Detects and reports character and/or spoken input simultaneously.
 void stopRecognition()
          Stops a previously started recognition.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface javax.naming.Referenceable
getReference
 

Constructor Detail

CharacterInputStub

public CharacterInputStub()
Constructs a new object.


CharacterInputStub

public CharacterInputStub(String id)
Constructs a new object.

Parameters:
id - The session ID.
Method Detail

getLocalClass

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

Returns:
Type of the local interface.

getRemoteClass

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

Returns:
Type of the remote interface.

getStubName

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

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

addCharacter

public void addCharacter(char dtmf)
The user entered a DTMF.

Specified by:
addCharacter in interface CharacterInput
Parameters:
dtmf - Entered DTMF.

startRecognition

public void startRecognition()
                      throws NoresourceError,
                             BadFetchError
Detects and reports character and/or spoken input simultaneously.

Specified by:
startRecognition in interface CharacterInput
Specified by:
startRecognition in interface InputDevice
Throws:
NoresourceError - The input resource is not available.
BadFetchError - The active grammar contains some errors.

stopRecognition

public void stopRecognition()
Stops a previously started recognition.

Specified by:
stopRecognition in interface CharacterInput
Specified by:
stopRecognition in interface InputDevice
See Also:
CharacterInput.startRecognition()

connect

public void connect(RemoteClient client)
             throws IOException
Establishes a connection from the given RemoteClient to this object.

Specified by:
connect in interface RemoteConnectable
Parameters:
client - data container with connection relevant data.
Throws:
IOException - error establishing the connection.
Stuff to complete
implement this method.

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.