Package org.ametys.runtime.workspace
Class WorkspaceManager
- java.lang.Object
-
- org.ametys.runtime.workspace.WorkspaceManager
-
public final class WorkspaceManager extends Object
Main entry point for access to workspaces.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
WorkspaceManager.InactivityCause
Cause of the deactivation of a workspace
-
Field Summary
Fields Modifier and Type Field Description private static WorkspaceManager
__manager
private static String
__WORKSPACE_FILENAME
private Map<String,WorkspaceManager.InactivityCause>
_inactiveWorkspaces
private org.slf4j.Logger
_logger
private Map<String,Workspace>
_workspaces
-
Constructor Summary
Constructors Modifier Constructor Description private
WorkspaceManager()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private Configuration
_getConfigurationFromStream(String workspaceName, InputStream is, String path)
private void
_initFileWorkspaces(File workspaceFile, String workspaceName, Collection<String> excludedWorkspace)
private void
_initResourceWorkspace(Collection<String> excludedWorkspace, URL workspaceResource)
String
getBaseURI(String workspaceName)
Returns the base URI associated with the given workspace, or null if the workspace does not existSet<String>
getEmbeddedWorskpacesIds()
Returns a String array containing the ids of the plugins embedded in jarsMap<String,WorkspaceManager.InactivityCause>
getInactiveWorkspaces()
Return the inactive workspacesstatic WorkspaceManager
getInstance()
Returns the shared instance of theWorkspaceManager
File
getLocation(String workspaceName)
Returns the workspace filesystem location for the given workspace or null if the workspace is loaded from the classpath.Set<String>
getWorkspaceNames()
Returns all active workspaces namesMap<String,Workspace>
getWorkspaces()
Returns active workspaces declarations.void
init(Collection<String> excludedWorkspace, String contextPath)
Initialize the WorkspaceManager.
It first looks for META-INF/runtime-workspace files in the classpath, then in the "workspaces" directory of the application.
-
-
-
Field Detail
-
__manager
private static WorkspaceManager __manager
-
__WORKSPACE_FILENAME
private static final String __WORKSPACE_FILENAME
- See Also:
- Constant Field Values
-
_workspaces
private Map<String,Workspace> _workspaces
-
_inactiveWorkspaces
private Map<String,WorkspaceManager.InactivityCause> _inactiveWorkspaces
-
_logger
private org.slf4j.Logger _logger
-
-
Constructor Detail
-
WorkspaceManager
private WorkspaceManager()
-
-
Method Detail
-
getInstance
public static WorkspaceManager getInstance()
Returns the shared instance of theWorkspaceManager
- Returns:
- the shared instance of the
WorkspaceManager
-
getWorkspaceNames
public Set<String> getWorkspaceNames()
Returns all active workspaces names- Returns:
- all active workspaces names
-
getWorkspaces
public Map<String,Workspace> getWorkspaces()
Returns active workspaces declarations.- Returns:
- active workspaces declarations.
-
getInactiveWorkspaces
public Map<String,WorkspaceManager.InactivityCause> getInactiveWorkspaces()
Return the inactive workspaces- Returns:
- All the inactive workspaces
-
getEmbeddedWorskpacesIds
public Set<String> getEmbeddedWorskpacesIds()
Returns a String array containing the ids of the plugins embedded in jars- Returns:
- a String array containing the ids of the plugins embedded in jars
-
getBaseURI
public String getBaseURI(String workspaceName)
Returns the base URI associated with the given workspace, or null if the workspace does not exist- Parameters:
workspaceName
- the name of the working workspace- Returns:
- the URI associated with the given workspace
-
getLocation
public File getLocation(String workspaceName)
Returns the workspace filesystem location for the given workspace or null if the workspace is loaded from the classpath.- Parameters:
workspaceName
- the workspace name- Returns:
- the workspace location for the given workspace
-
init
public void init(Collection<String> excludedWorkspace, String contextPath) throws IOException
Initialize the WorkspaceManager.
It first looks for META-INF/runtime-workspace files in the classpath, then in the "workspaces" directory of the application.- Parameters:
excludedWorkspace
- the excluded workspaces, as given by the RuntimeConfigcontextPath
- the servlet context path- Throws:
IOException
- if an error occurs while retrieving resources
-
_initResourceWorkspace
private void _initResourceWorkspace(Collection<String> excludedWorkspace, URL workspaceResource) throws IOException
- Throws:
IOException
-
_initFileWorkspaces
private void _initFileWorkspaces(File workspaceFile, String workspaceName, Collection<String> excludedWorkspace) throws IOException
- Throws:
IOException
-
_getConfigurationFromStream
private Configuration _getConfigurationFromStream(String workspaceName, InputStream is, String path)
-
-