jaugment2.speech
Class JavaSpeechService

java.lang.Object
  |
  +--java.rmi.server.RemoteObject
        |
        +--java.rmi.server.RemoteServer
              |
              +--java.rmi.server.UnicastRemoteObject
                    |
                    +--jaugment2.jini.simpleService.simpleService
                          |
                          +--jaugment2.speech.JavaSpeechService

public class JavaSpeechService
extends simpleService
implements java.rmi.Remote, net.jini.discovery.DiscoveryListener, speechSynthesizing, speechRecognizing

an implementation of the speechRecognizing and speechSynthesizing -interfaces using a local JavaSpeech(tm)-provider

See Also:
Serialized Form

Inner Class Summary
private  class JavaSpeechService.dictationListenerAdaptor
           
private  class JavaSpeechService.eventRegistration
           
private  class JavaSpeechService.myCookie
           
private  class JavaSpeechService.myLandLord
          This class contains all out lease-management.
private  class JavaSpeechService.storedItem
          an abstract item stored by our lease-management-code
 
Inner classes inherited from class jaugment2.jini.simpleService.simpleService
simpleService.myServiceIDListener
 
Inner classes inherited from class jaugment2.speech.speechRecognizing
speechRecognizing.GrammarResult
 
Field Summary
private  javax.speech.recognition.DictationGrammar dictgrammar
           
private  JavaSpeechService.dictationListenerAdaptor dictgrammarlistener
           
private  com.sun.jini.lease.landlord.LandlordLeaseFactory leaseFactory
           
private static int LEASETYPE_DICT
           
private static int LEASETYPE_GRAMMAR
           
private  JavaSpeechService.myLandLord myLandLordInstance
           
private  JavaSpeechServiceProxy myproxy
           
private  int nextEventID
           
private  javax.speech.recognition.Recognizer recognizer
           
private  javax.speech.EngineModeDesc recognizerDesc
           
private  boolean running
           
private  javax.speech.synthesis.Synthesizer synthesizer
           
private  javax.speech.EngineModeDesc synthesizerDesc
           
 
Fields inherited from class jaugment2.jini.simpleService.simpleService
bindings, fallback_attrSets, jmngr, ldm, lrm, persistentState, proxy, sid, simpleservicedebugMessages
 
Fields inherited from class java.rmi.server.UnicastRemoteObject
csf, port, portFactoryParamTypes, portParamTypes, serialVersionUID, ssf
 
Fields inherited from class java.rmi.server.RemoteServer
log, logname, serialVersionUID
 
Fields inherited from class java.rmi.server.RemoteObject
ref, serialVersionUID
 
Constructor Summary
JavaSpeechService()
           
JavaSpeechService(net.jini.core.discovery.LookupLocator locallocator)
           
 
Method Summary
 net.jini.core.lease.Lease addDictationListener(net.jini.core.event.RemoteEventListener listener, java.rmi.MarshalledObject handback, int subscribedFor)
           
 speechRecognizing.GrammarResult addGrammar(java.lang.String grammar, net.jini.core.event.RemoteEventListener listener, java.rmi.MarshalledObject handback, int subscribedFor)
          add a grammar to be recognized and a listener to be informed whenever it is spoken and activate the grammar
 speechRecognizing.GrammarResult addGrammar(java.lang.String grammar, net.jini.core.event.RemoteEventListener listener, java.rmi.MarshalledObject handback, int subscribedFor, boolean activate)
          add a grammar to be recognized and a listener to be informed whenever it is spoken and activate the grammar if activate is true
private  javax.speech.recognition.RuleGrammar addGrammari(java.lang.String grammar, javax.speech.recognition.ResultListener listener, boolean activate)
           
 void destroy()
          stop this service, destroy any persistent storage and exit
 void discarded(net.jini.discovery.DiscoveryEvent e)
          Called when one or more lookup service registrars has been discarded.
 void discovered(net.jini.discovery.DiscoveryEvent e)
          Called when one or more lookup service registrars has been discovered.
 javax.speech.EngineList getAvailableSynthesizers()
          return the synthesizers we can use
 javax.speech.EngineList getAvaliableRecognizers()
          return the recognizers we can use
 javax.speech.EngineModeDesc getRecognizer()
          get the recognizer we are using (or null if not yet initialized)
 javax.speech.EngineModeDesc getSynthesizer()
          get the synthesizer we are using (or null if not yet initialized)
private  void leaseCanceled(int type, java.lang.Object item, int newcount)
           
private  void loadMe()
           
 void restart()
          restart this service once it has been stopped
 void setRecognizer(javax.speech.EngineModeDesc newRecognizer)
          set the recognizer to use
 void setSynthesizer(javax.speech.EngineModeDesc newSynthesizer)
          set the synthesizer to use
 void speak(java.lang.String s)
          speaks the given text.
 void stop(boolean exit)
          stop this service.
 
Methods inherited from class jaugment2.jini.simpleService.simpleService
, deinit, deinitBindings, finalize, getProxy, getServiceItem, getStorageLocation, init, initBindings, initBindings, load, save, setStorageLocation
 
Methods inherited from class java.rmi.server.UnicastRemoteObject
clone, exportObject, exportObject, exportObject, exportObject, readObject, reexport, unexportObject
 
Methods inherited from class java.rmi.server.RemoteServer
getClientHost, getLog, setLog
 
Methods inherited from class java.rmi.server.RemoteObject
equals, getRef, hashCode, toString, toStub, writeObject
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

running

private boolean running

myLandLordInstance

private JavaSpeechService.myLandLord myLandLordInstance

leaseFactory

private com.sun.jini.lease.landlord.LandlordLeaseFactory leaseFactory

myproxy

private JavaSpeechServiceProxy myproxy

recognizerDesc

private javax.speech.EngineModeDesc recognizerDesc

recognizer

private javax.speech.recognition.Recognizer recognizer

synthesizerDesc

private javax.speech.EngineModeDesc synthesizerDesc

synthesizer

private javax.speech.synthesis.Synthesizer synthesizer

dictgrammar

private javax.speech.recognition.DictationGrammar dictgrammar

dictgrammarlistener

private JavaSpeechService.dictationListenerAdaptor dictgrammarlistener

LEASETYPE_DICT

private static int LEASETYPE_DICT

LEASETYPE_GRAMMAR

private static int LEASETYPE_GRAMMAR

nextEventID

private int nextEventID
Constructor Detail

JavaSpeechService

public JavaSpeechService()
                  throws java.rmi.RemoteException

JavaSpeechService

public JavaSpeechService(net.jini.core.discovery.LookupLocator locallocator)
                  throws java.rmi.RemoteException
Method Detail

discovered

public void discovered(net.jini.discovery.DiscoveryEvent e)
Called when one or more lookup service registrars has been discovered. The method should return quickly; e.g., it should not make remote calls.
Specified by:
discovered in interface net.jini.discovery.DiscoveryListener
Parameters:
e - the event that describes the discovered registrars

discarded

public void discarded(net.jini.discovery.DiscoveryEvent e)
Called when one or more lookup service registrars has been discarded. The method should return quickly; e.g., it should not make remote calls.
Specified by:
discarded in interface net.jini.discovery.DiscoveryListener
Parameters:
e - the event that describes the discarded registrars

loadMe

private void loadMe()

getAvaliableRecognizers

public javax.speech.EngineList getAvaliableRecognizers()
                                                throws java.rmi.RemoteException
return the recognizers we can use

getAvailableSynthesizers

public javax.speech.EngineList getAvailableSynthesizers()
                                                 throws java.rmi.RemoteException
return the synthesizers we can use

setRecognizer

public void setRecognizer(javax.speech.EngineModeDesc newRecognizer)
                   throws java.lang.IllegalArgumentException,
                          java.rmi.RemoteException
set the recognizer to use

getRecognizer

public javax.speech.EngineModeDesc getRecognizer()
                                          throws java.rmi.RemoteException
get the recognizer we are using (or null if not yet initialized)

setSynthesizer

public void setSynthesizer(javax.speech.EngineModeDesc newSynthesizer)
                    throws java.rmi.RemoteException
set the synthesizer to use

getSynthesizer

public javax.speech.EngineModeDesc getSynthesizer()
                                           throws java.rmi.RemoteException
get the synthesizer we are using (or null if not yet initialized)

restart

public void restart()
             throws java.lang.Exception
restart this service once it has been stopped
Overrides:
restart in class simpleService
See Also:
stop

stop

public void stop(boolean exit)
          throws java.lang.Exception
stop this service. If exit is false all references to this service are still valid but it has deregistered everywhere. (this includes the RMI-activation-daemon)
Overrides:
stop in class simpleService
Parameters:
exit - stop running
See Also:
restart, destroy

destroy

public void destroy()
             throws java.rmi.RemoteException
stop this service, destroy any persistent storage and exit
Overrides:
destroy in class simpleService

speak

public void speak(java.lang.String s)
           throws java.rmi.RemoteException,
                  java.lang.IllegalStateException
speaks the given text. See the Java-Speech-API-doc for special tokens.
Specified by:
speak in interface speechSynthesizing

leaseCanceled

private void leaseCanceled(int type,
                           java.lang.Object item,
                           int newcount)

addGrammar

public speechRecognizing.GrammarResult addGrammar(java.lang.String grammar,
                                                  net.jini.core.event.RemoteEventListener listener,
                                                  java.rmi.MarshalledObject handback,
                                                  int subscribedFor)
                                           throws java.rmi.RemoteException,
                                                  net.jini.core.lease.LeaseDeniedException,
                                                  java.lang.IllegalStateException
add a grammar to be recognized and a listener to be informed whenever it is spoken and activate the grammar
Specified by:
addGrammar in interface speechRecognizing

addGrammar

public speechRecognizing.GrammarResult addGrammar(java.lang.String grammar,
                                                  net.jini.core.event.RemoteEventListener listener,
                                                  java.rmi.MarshalledObject handback,
                                                  int subscribedFor,
                                                  boolean activate)
                                           throws java.rmi.RemoteException,
                                                  net.jini.core.lease.LeaseDeniedException,
                                                  java.lang.IllegalStateException
add a grammar to be recognized and a listener to be informed whenever it is spoken and activate the grammar if activate is true
Specified by:
addGrammar in interface speechRecognizing

addGrammari

private javax.speech.recognition.RuleGrammar addGrammari(java.lang.String grammar,
                                                         javax.speech.recognition.ResultListener listener,
                                                         boolean activate)
                                                  throws java.lang.IllegalStateException

addDictationListener

public net.jini.core.lease.Lease addDictationListener(net.jini.core.event.RemoteEventListener listener,
                                                      java.rmi.MarshalledObject handback,
                                                      int subscribedFor)
                                               throws java.rmi.RemoteException,
                                                      net.jini.core.lease.LeaseDeniedException,
                                                      java.lang.IllegalStateException
Specified by:
addDictationListener in interface speechRecognizing