Difference between revisions of "SMILA/Documentation/Workspace Handling"

From Eclipsepedia

Jump to: navigation, search
(New page: Some SMILA bundles need a workspace, i.e. a directory in the local file system where they can store temporary or persistent data. This space should be seperated from the Configuration dire...)
 
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
Some SMILA bundles need a workspace, i.e. a directory in the local file system where they can store temporary or persistent data. This space should be seperated from the Configuration directory to make clean up of the workspace (to reset the application to its initial state) as well as managing and updating the configuration easier. To support this bundle <code>org.eclipse.eilf.utils</code> contains the WorkspaceHelper that manages the creation of workspace directories for other bundles.
+
Some SMILA bundles need a workspace, i.e. a directory in the local file system where they can store temporary or persistent data to. This space should be separated from the configuration directory to make the cleaning up of the workspace (i.e. resetting the application to its initial state) as well as the managing and updating of the configuration easier. To support this bundle <code>org.eclipse.smila.utils</code> provides the class <tt>WorkspaceHelper</tt> that manages the creation of workspace directories for other bundles.
  
The complete class name of this helper is  
+
The complete class name of this helper is <code>org.eclipse.smila.utils.workspace.WorkspaceHelper</code>.
 
+
<code>org.eclipse.eilf.utils.workspace.WorkspaceHelper</code>
+
  
 
It has basically two methods:
 
It has basically two methods:
  
* <code>java.io.File createWorkingDir(String bundleName)</code>: ensures the existence of the working dir for the given bundle and creates a File object for it.
+
* <code>java.io.File createWorkingDir(String bundleName)</code>: This method ensures the existence of the working directory for the given bundle and creates a <tt>File</tt> object for it.
* <code>java.io.File createWorkingDir(String bundleName, String dirName)</code>: ensures the existence of directory <dirName> inside the working dir of the named bundle and creates a File object for it.
+
* <code>java.io.File createWorkingDir(String bundleName, String dirName)</code>: This method ensures the existence of the directory <dirName> inside the working directory of the named bundle and creates a <tt>File</tt> object for it.
  
 
The actual location of the bundle workspace is configurable as follows:
 
The actual location of the bundle workspace is configurable as follows:
  
 
# If for a given bundle there is a system property (or environment variable) <code><bundleName>.workspace</code>, its value describes the working directory for this bundle.
 
# If for a given bundle there is a system property (or environment variable) <code><bundleName>.workspace</code>, its value describes the working directory for this bundle.
# Else, if there is a system property (or environment variable) <code>org.eclipse.eilf.utils.workspace.root</code>, the working directory of a bundle will be <code><org.eclipse.eilf.utils.workspace.root>/<bundleName></code>
+
# Else, if there is a system property (or environment variable) <code>org.eclipse.smila.utils.workspace.root</code>, the working directory of a bundle will be <code><org.eclipse.smila.utils.workspace.root>/<bundleName></code>.
# Else, the working directory will be determined by <code>org.eclipse.core.runtime.Platform.getStateLocation(bundleName)</code>. In a default installation this will be <code><EILF_HOME>/workspace/.metadata/.plugins/<bundleName></code>.
+
# Else, the working directory will be determined by <code>org.eclipse.core.runtime.Platform.getStateLocation(bundleName)</code>. In a default installation this will be <code>$SMILA_HOME/workspace/.metadata/.plugins/<bundleName></code>.
  
 
If both system properties and environment variables are set, the system property takes precedence.
 
If both system properties and environment variables are set, the system property takes precedence.
  
All bundles that need a working directory should use this class, this makes it easier later to change the behaviour for all bundles at once if we find a better strategy.
+
All bundles that need a working directory should use this class, this makes it easier later to change the behavior for all bundles at once if we find a better strategy.
 +
 
 +
[[Category:SMILA]]

Latest revision as of 10:47, 16 October 2008

Some SMILA bundles need a workspace, i.e. a directory in the local file system where they can store temporary or persistent data to. This space should be separated from the configuration directory to make the cleaning up of the workspace (i.e. resetting the application to its initial state) as well as the managing and updating of the configuration easier. To support this bundle org.eclipse.smila.utils provides the class WorkspaceHelper that manages the creation of workspace directories for other bundles.

The complete class name of this helper is org.eclipse.smila.utils.workspace.WorkspaceHelper.

It has basically two methods:

  • java.io.File createWorkingDir(String bundleName): This method ensures the existence of the working directory for the given bundle and creates a File object for it.
  • java.io.File createWorkingDir(String bundleName, String dirName): This method ensures the existence of the directory <dirName> inside the working directory of the named bundle and creates a File object for it.

The actual location of the bundle workspace is configurable as follows:

  1. If for a given bundle there is a system property (or environment variable) <bundleName>.workspace, its value describes the working directory for this bundle.
  2. Else, if there is a system property (or environment variable) org.eclipse.smila.utils.workspace.root, the working directory of a bundle will be <org.eclipse.smila.utils.workspace.root>/<bundleName>.
  3. Else, the working directory will be determined by org.eclipse.core.runtime.Platform.getStateLocation(bundleName). In a default installation this will be $SMILA_HOME/workspace/.metadata/.plugins/<bundleName>.

If both system properties and environment variables are set, the system property takes precedence.

All bundles that need a working directory should use this class, this makes it easier later to change the behavior for all bundles at once if we find a better strategy.