Package org.vrspace.server.core
Class WorldManager
java.lang.Object
org.vrspace.server.core.WorldManager
Main component that manages all interactions with virtual worlds.
- Author:
- joe
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected ConcurrentHashMap<ID,Entity> protected ClientFactoryprotected ServerConfigprotected Dispatcherprotected com.fasterxml.jackson.databind.ObjectMapperprotected com.fasterxml.jackson.databind.ObjectMapperprotected ScenePropertiesprotected SessionTrackerprotected WorldConfig -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionAdd objects to client's current positionAdd an object to client's current positionvoidFind some objects, in-memory operation on cache.<T extends VRObject>
TGet a cached VRObjectIf the client is currently active, cached version of the client, otherwise nullgetClientByName(String name) <T extends Client>
TgetClientByName(String name, Class<T> cls) getDb()CHECKME Commands need access to databasegetOrCreateWorld(String name) getPermanents(Client client) CHECKME Commands need access to StreamManagervoidinit()booleanlogin(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session) Remote user login over websocket.login(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session, Class<? extends Client> clientClass) Common login procedure for both users and remote servers.voidStage 2 of login, executed once client has been identified.voidCalled by SessionManager after the client closes the web socketvoid<T extends VRObject>
Tsave(T obj) serverLogin(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session) Login for remote serversintstartSession(Client client)
-
Field Details
-
config
-
sceneProperties
-
jackson
@Autowired @Qualifier("objectMapper") protected com.fasterxml.jackson.databind.ObjectMapper jackson -
privateJackson
@Autowired @Qualifier("privateMapper") protected com.fasterxml.jackson.databind.ObjectMapper privateJackson -
clientFactory
-
worldConfig
-
dispatcher
-
sessionTracker
-
cache
-
-
Constructor Details
-
WorldManager
public WorldManager()
-
-
Method Details
-
init
@PostConstruct public void init() -
get
Get a cached VRObject- Parameters:
id-- Returns:
-
get
-
find
Find some objects, in-memory operation on cache.- Parameters:
filter- Predicate to select objects, e.g. o->o.isActive()- Returns:
-
listClasses
-
getWorld
-
saveWorld
-
getOrCreateWorld
-
getClient
-
getClientByName
-
getCachedClient
If the client is currently active, cached version of the client, otherwise null -
getClientByName
-
save
-
getRange
-
getPermanents
-
add
Add an object to client's current position- Parameters:
client- Client adding objectso- A VRObject- Returns:
- saved VRObject
-
isOwner
-
add
Add objects to client's current position- Parameters:
client- client adding objectsobjects- objects to add- Returns:
- list of added objects
-
remove
-
login
@Transactional public Welcome login(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session) Remote user login over websocket. Called from SessionManager, after websocket session has been established. Uses session security context (principal) to identify user and fetch/create the appropriate Client object from the ClientFactory. May create a new guest client, if guest (anonymous) connections are allowed.- Parameters:
session- websocket session- Returns:
- Welcome message
-
serverLogin
@Transactional public Welcome serverLogin(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session) Login for remote servers -
login
@Transactional public Welcome login(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session, Class<? extends Client> clientClass) Common login procedure for both users and remote servers. This may change, same for the time being.- Parameters:
session- web socket sessionclientClass- either User or RemoteServerclientFactory- either userFactory or serverFactory- Returns:
- See Also:
-
login
Stage 2 of login, executed once client has been identified. Does not depend on websocket session, can be used for internal login, e.g. bots.- Parameters:
client-
-
defaultWorld
-
enter
-
enter
-
startSession
- Throws:
SessionException
-
logout
Called by SessionManager after the client closes the web socket -
dispatch
- Throws:
Exception
-
getStreamManager
CHECKME Commands need access to StreamManager- Returns:
- StreamManager
-
getDb
CHECKME Commands need access to database- Returns:
- VRObjectRepository
-