Class WorkspaceManager


  • @ApplicationScoped
    public class WorkspaceManager
    extends Object
    Contains every workspace created in the application and the beans for those workspaces. Beans are stored into a cache, with size and time expiration.
    • Constructor Detail

      • WorkspaceManager

        public WorkspaceManager()
    • Method Detail

      • getOrCreateWorkspace

        public org.uberfire.backend.cdi.workspace.Workspace getOrCreateWorkspace​(String name)
        Returns a workspace, but if it does not exists, it creates a new one.
        Parameters:
        name - The name of the workspace.
        Returns:
        The existent or the new workspace.
      • createCache

        protected com.google.common.cache.Cache<String,​Object> createCache()
      • getWorkspace

        public org.uberfire.backend.cdi.workspace.Workspace getWorkspace​(String name)
        Returns a workspace. If the workspace does ont exists it throws NoSuchElementException
        Parameters:
        name - Workspace name
        Returns:
        The workspace object
      • getBean

        public <T> T getBean​(org.uberfire.backend.cdi.workspace.Workspace workspace,
                             String beanName)
        Returns a bean based on a workspace and a bean name. If the bean does not exist, returns null
        Parameters:
        workspace - The workspace name.
        beanName - The bean name for that workspace.
        Returns:
        the bean instance
      • putBean

        public <T> void putBean​(org.uberfire.backend.cdi.workspace.Workspace workspace,
                                String beanName,
                                T instance)
        Put a bean instance into a Workspace.
        Parameters:
        workspace - The workspace to store beans
        beanName - The bean name
        instance - The bean instance
      • delete

        public void delete​(org.uberfire.backend.cdi.workspace.Workspace workspace)
        Deletes a workspace and its beans
        Parameters:
        workspace - the workspace to delete
      • getWorkspaceCount

        public int getWorkspaceCount()
        Returns the workspace count
        Returns:
        the number of workspaces
      • getBeansCount

        public long getBeansCount​(org.uberfire.backend.cdi.workspace.Workspace workspace)
        Return the beans count for a workspace
        Parameters:
        workspace - The workspace to count beans
        Returns:
        The number of beans for a workspace