org.robokind.impl.messaging
Class RemoteServiceFacade<Config extends org.apache.avro.generic.IndexedRecord>

java.lang.Object
  extended by org.robokind.api.common.playable.AbstractPlayable
      extended by org.robokind.impl.messaging.RemoteServiceFacade<Config>
All Implemented Interfaces:
org.robokind.api.common.playable.Playable, org.robokind.api.messaging.RemoteService<Config>

public class RemoteServiceFacade<Config extends org.apache.avro.generic.IndexedRecord>
extends org.robokind.api.common.playable.AbstractPlayable
implements org.robokind.api.messaging.RemoteService<Config>

A facade for controlling a RemoteService using Avro and JMS (Qpid). A RemoteServiceFacade has a JMS MessageProducer for sending commands to the RemoteService, and a JMS MessageConsumer for receiving error messages. (Error messages are not yet completed)

Author:
Matthew Stevenson

Field Summary
static String COMMAND_MIME_TYPE
           
static String CONFIG_MIME_TYPE
           
 
Fields inherited from class org.robokind.api.common.playable.AbstractPlayable
myElapsedPauseTime, myPauseTime, myPlayableListeners, myPlayState, myResumeTime, myStartTime, myStopTime
 
Constructor Summary
RemoteServiceFacade(Class<Config> configClass, Config reusableConfig, javax.jms.Session session, javax.jms.Destination commandDest, javax.jms.Destination errorDest)
           
RemoteServiceFacade(Class<Config> configClass, Config reusableConfig, javax.jms.Session session, javax.jms.MessageProducer commandSender, javax.jms.MessageConsumer errorReceiver)
           
 
Method Summary
 Class<Config> getConfigClass()
           
 Config getReusableConfig()
           
 void initialize(Config config)
           
 boolean onComplete(long time)
           
 boolean onPause(long time)
           
 boolean onResume(long time)
           
 boolean onStart(long time)
           
 boolean onStop(long time)
           
protected
<C extends org.apache.avro.generic.IndexedRecord>
void
send(Class<C> cls, C c, String contentType)
           
protected  boolean sendCommand(org.robokind.avrogen.messaging.ServiceCommandType command)
           
 void setReceiver(javax.jms.MessageConsumer consumer)
           
 void setSender(javax.jms.MessageProducer producer)
           
 void setSession(javax.jms.Session session)
           
 
Methods inherited from class org.robokind.api.common.playable.AbstractPlayable
addPlayableListener, afterComplete, complete, firePlayStateChanged, getElapsedPauseTime, getElapsedPlayTime, getPauseTime, getPlayState, getResumeTime, getStartTime, getStopTime, pause, removePlayableListener, resume, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.robokind.api.common.playable.Playable
addPlayableListener, complete, getElapsedPauseTime, getElapsedPlayTime, getPauseTime, getPlayState, getResumeTime, getStartTime, getStopTime, pause, removePlayableListener, resume, start, stop
 

Field Detail

CONFIG_MIME_TYPE

public static final String CONFIG_MIME_TYPE
See Also:
Constant Field Values

COMMAND_MIME_TYPE

public static final String COMMAND_MIME_TYPE
See Also:
Constant Field Values
Constructor Detail

RemoteServiceFacade

public RemoteServiceFacade(Class<Config> configClass,
                           Config reusableConfig,
                           javax.jms.Session session,
                           javax.jms.Destination commandDest,
                           javax.jms.Destination errorDest)
                    throws javax.jms.JMSException
Throws:
javax.jms.JMSException

RemoteServiceFacade

public RemoteServiceFacade(Class<Config> configClass,
                           Config reusableConfig,
                           javax.jms.Session session,
                           javax.jms.MessageProducer commandSender,
                           javax.jms.MessageConsumer errorReceiver)
Method Detail

setSession

public void setSession(javax.jms.Session session)

setSender

public void setSender(javax.jms.MessageProducer producer)

setReceiver

public void setReceiver(javax.jms.MessageConsumer consumer)

initialize

public void initialize(Config config)
                throws IOException,
                       javax.jms.JMSException,
                       Exception
Specified by:
initialize in interface org.robokind.api.messaging.RemoteService<Config extends org.apache.avro.generic.IndexedRecord>
Throws:
IOException
javax.jms.JMSException
Exception

onStart

public boolean onStart(long time)
Specified by:
onStart in class org.robokind.api.common.playable.AbstractPlayable

onPause

public boolean onPause(long time)
Specified by:
onPause in class org.robokind.api.common.playable.AbstractPlayable

onResume

public boolean onResume(long time)
Specified by:
onResume in class org.robokind.api.common.playable.AbstractPlayable

onComplete

public boolean onComplete(long time)
Specified by:
onComplete in class org.robokind.api.common.playable.AbstractPlayable

onStop

public boolean onStop(long time)
Specified by:
onStop in class org.robokind.api.common.playable.AbstractPlayable

send

protected <C extends org.apache.avro.generic.IndexedRecord> void send(Class<C> cls,
                                                                      C c,
                                                                      String contentType)
             throws IOException,
                    javax.jms.JMSException
Throws:
IOException
javax.jms.JMSException

sendCommand

protected boolean sendCommand(org.robokind.avrogen.messaging.ServiceCommandType command)

getConfigClass

public Class<Config> getConfigClass()
Specified by:
getConfigClass in interface org.robokind.api.messaging.RemoteService<Config extends org.apache.avro.generic.IndexedRecord>

getReusableConfig

public Config getReusableConfig()
Specified by:
getReusableConfig in interface org.robokind.api.messaging.RemoteService<Config extends org.apache.avro.generic.IndexedRecord>


Copyright © 2011. All Rights Reserved.