Package org.vrspace.server.obj
Class EventRecorder
- java.lang.Object
-
- org.vrspace.server.obj.Entity
-
- org.vrspace.server.obj.VRObject
-
- org.vrspace.server.obj.Client
-
- org.vrspace.server.obj.EventRecorder
-
public class EventRecorder extends Client
Records all events in the world, saves them to the database, plays them back. This is a special case of Client that has no session, but copies scene and properties from the client it impersonates. By overriding Client's sendMessage(), it maintains internal list of received events. Once recording is done, i.e. stop() is called, event list is persisted to the database.- Author:
- joe
- See Also:
PersistentEvent
,Recording
-
-
Constructor Summary
Constructors Constructor Description EventRecorder()
EventRecorder(WorldManager worldManager, Client client, String name)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(VRObject obj)
protected boolean
canEqual(Object other)
boolean
equals(Object o)
Client
getClient()
Collection<PersistentEvent>
getEvents()
Long
getLength()
ScheduledExecutorService
getRestart()
long
getStart()
int
hashCode()
void
init(WorldManager worldManager, Client client)
boolean
isLoop()
boolean
isPlaying()
boolean
isRecordClient()
boolean
isRecording()
boolean
isRecordScene()
void
play()
Play recorded client events as own events, optionally restart the loop when finished.void
play(Client viewer)
Play back to a client sends all recorded events back to a client, optionally restarts the loop when finished.void
processEvent(VREvent event)
Process an event received from other active objects, typically other users.void
sendMessage(Object obj)
void
setClient(Client client)
void
setEvents(Collection<PersistentEvent> events)
void
setLength(Long length)
void
setLoop(boolean loop)
void
setPlaying(boolean playing)
void
setRecordClient(boolean recordClient)
void
setRecording(boolean recording)
void
setRecordScene(boolean recordScene)
void
setRestart(ScheduledExecutorService restart)
void
setStart(long start)
void
start()
void
stop()
String
toString()
-
Methods inherited from class org.vrspace.server.obj.Client
clearToken, createScene, getIdentity, getMapper, getName, getPrivateMapper, getScene, getSceneProperties, getSession, getToken, getTokens, getUserHeight, getWriteBack, isGuest, setGuest, setIdentity, setMapper, setName, setPrivateMapper, setScene, setSceneProperties, setSession, setToken, setTokens, setUserHeight, setWriteBack
-
Methods inherited from class org.vrspace.server.obj.VRObject
active, addChildren, getActive, getAnimation, getChildren, getListeners, getMesh, getObjectId, getPermanent, getPosition, getProperties, getRotation, getScale, getScript, getStreamId, getTemporary, getWorld, getWorldId, isActive, isPermanent, isTemporary, notifyListeners, passive, removeListener, setActive, setAnimation, setChildren, setListeners, setMesh, setPermanent, setPosition, setProperties, setRotation, setScale, setScript, setStreamId, setTemporary, setWorld, setWorldId
-
-
-
-
Constructor Detail
-
EventRecorder
public EventRecorder()
-
EventRecorder
public EventRecorder(WorldManager worldManager, Client client, String name)
-
-
Method Detail
-
init
public void init(WorldManager worldManager, Client client)
-
start
public void start()
-
stop
public void stop()
-
processEvent
public void processEvent(VREvent event)
Description copied from class:Client
Process an event received from other active objects, typically other users. This implementation serializes the event and sends it over websocket.- Overrides:
processEvent
in classClient
- Parameters:
event
- Whatever has changed
-
sendMessage
public void sendMessage(Object obj)
- Overrides:
sendMessage
in classClient
-
play
public void play()
Play recorded client events as own events, optionally restart the loop when finished.
-
play
public void play(Client viewer)
Play back to a client sends all recorded events back to a client, optionally restarts the loop when finished.- Parameters:
viewer
- Client who's viewing the recording
-
addListener
public void addListener(VRObject obj)
- Overrides:
addListener
in classVRObject
-
getEvents
public Collection<PersistentEvent> getEvents()
-
isRecordClient
public boolean isRecordClient()
-
isRecordScene
public boolean isRecordScene()
-
isLoop
public boolean isLoop()
-
getLength
public Long getLength()
-
getClient
public Client getClient()
-
isRecording
public boolean isRecording()
-
getStart
public long getStart()
-
isPlaying
public boolean isPlaying()
-
getRestart
public ScheduledExecutorService getRestart()
-
setRecordClient
public void setRecordClient(boolean recordClient)
-
setRecordScene
public void setRecordScene(boolean recordScene)
-
setLoop
public void setLoop(boolean loop)
-
setLength
public void setLength(Long length)
-
setEvents
public void setEvents(Collection<PersistentEvent> events)
-
setClient
public void setClient(Client client)
-
setRecording
public void setRecording(boolean recording)
-
setStart
public void setStart(long start)
-
setPlaying
public void setPlaying(boolean playing)
-
setRestart
public void setRestart(ScheduledExecutorService restart)
-
-