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
Modifier and TypeFieldDescriptionprotected ConcurrentHashMap<ID,
Entity> protected ClientFactory
protected ServerConfig
protected com.fasterxml.jackson.databind.ObjectMapper
protected SceneProperties
protected SessionTracker
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionAdd objects to client's current positionAdd an object to client's current positionvoid
Find some objects, in-memory operation on cache.<T extends VRObject>
TGet a cached VRObjectgetClientByName
(String name) <T extends Client>
TgetClientByName
(String name, Class<T> cls) getOrCreateWorld
(String name) getPermanents
(Client client) CHECKME Commands need access to StreamManagervoid
init()
boolean
login
(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.void
Stage 2 of login, executed once client has been identified.void
void
<T extends VRObject>
Tsave
(T obj) serverLogin
(org.springframework.web.socket.handler.ConcurrentWebSocketSessionDecorator session) Login for remote serversvoid
startSession
(Client client)
-
Field Details
-
config
-
sceneProperties
-
jackson
@Autowired protected com.fasterxml.jackson.databind.ObjectMapper jackson -
clientFactory
-
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
-
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
-
dispatch
- Throws:
Exception
-
getStreamManager
CHECKME Commands need access to StreamManager- Returns:
- StreamManager
-