Class WorkspaceManager
- java.lang.Object
-
- org.uberfire.backend.server.cdi.workspace.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 Summary
Constructors Constructor Description WorkspaceManager()WorkspaceManager(WorkspaceManagerPreferences workspaceManagerPreferences)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected com.google.common.cache.Cache<String,Object>createCache()voiddelete(org.uberfire.backend.cdi.workspace.Workspace workspace)Deletes a workspace and its beans<T> TgetBean(org.uberfire.backend.cdi.workspace.Workspace workspace, String beanName)Returns a bean based on a workspace and a bean name.longgetBeansCount(org.uberfire.backend.cdi.workspace.Workspace workspace)Return the beans count for a workspaceorg.uberfire.backend.cdi.workspace.WorkspacegetOrCreateWorkspace(String name)Returns a workspace, but if it does not exists, it creates a new one.org.uberfire.backend.cdi.workspace.WorkspacegetWorkspace(String name)Returns a workspace.intgetWorkspaceCount()Returns the workspace countvoidinitialize()<T> voidputBean(org.uberfire.backend.cdi.workspace.Workspace workspace, String beanName, T instance)Put a bean instance into a Workspace.
-
-
-
Constructor Detail
-
WorkspaceManager
public WorkspaceManager()
-
WorkspaceManager
@Inject public WorkspaceManager(WorkspaceManagerPreferences workspaceManagerPreferences)
-
-
Method Detail
-
initialize
@PostConstruct public void initialize()
-
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.
-
getWorkspace
public org.uberfire.backend.cdi.workspace.Workspace getWorkspace(String name)
Returns a workspace. If the workspace does ont exists it throwsNoSuchElementException- 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 beansbeanName- The bean nameinstance- 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
-
-