Class WorldManager


  • @Component("world")
    @DependsOn("database")
    public class WorldManager
    extends Object
    Main component that manages all interactions with virtual worlds.
    Author:
    joe
    • Constructor Detail

      • WorldManager

        public WorldManager()
    • Method Detail

      • init

        @PostConstruct
        public void init()
      • find

        public List<Entity> find​(Predicate<? super Entity> filter)
        Find some objects, in-memory operation on cache.
        Parameters:
        filter - Predicate to select objects, e.g. o->o.isActive()
        Returns:
      • listClasses

        public List<Class<?>> listClasses()
      • saveWorld

        public World saveWorld​(World world)
      • getOrCreateWorld

        public World getOrCreateWorld​(String name)
      • getClientByName

        public Client getClientByName​(String name)
      • getClientByName

        public <T extends Client> T getClientByName​(String name,
                                                    Class<T> cls)
      • save

        public <T extends VRObject> T save​(T obj)
      • add

        public List<VRObject> add​(Client client,
                                  List<VRObject> objects)
        Add objects to client's current position
        Parameters:
        client - client adding objects
        objects - objects to add
        Returns:
        list of added objects
      • 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
      • 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 session
        clientClass - either User or RemoteServer
        clientFactory - either userFactory or serverFactory
        Returns:
        See Also:
        login(ConcurrentWebSocketSessionDecorator)
      • login

        public void login​(Client client)
        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

        public World defaultWorld()
      • logout

        @Transactional
        public void logout​(Client client)