Skip to content
Snippets Groups Projects
Commit 91f24a2b authored by felmer's avatar felmer
Browse files

LMS-103

add Javadoc

SVN: 2137
parent 897cc265
No related branches found
No related tags found
No related merge requests found
......@@ -22,12 +22,19 @@ import ch.systemsx.cisd.bds.storage.INode;
import ch.systemsx.cisd.common.exceptions.UserFailureException;
/**
*
* Storage utility methods.
*
* @author Franz-Josef Elmer
*/
public class Utilities
{
/**
* Returns a subdirectory from the specified directory.
*
* @param directory Parent directory of the requested directory.
* @param name Name of the requested directory.
* @throws UserFailureException if requested directory not found.
*/
public static IDirectory getSubDirectory(IDirectory directory, String name)
{
INode node = directory.getNode(name);
......@@ -38,11 +45,21 @@ public class Utilities
return (IDirectory) node;
}
/**
* Convenient short cut for <code>{@link #getString(IDirectory, String)}.trim()</code>.
*/
public static String getTrimmedString(IDirectory directory, String name)
{
return getString(directory, name).trim();
}
/**
* Returns the string content of a file from the specified directory.
*
* @param directory Directory of the requested file.
* @param name Name of the file.
* @throws UserFailureException if the requested file does not exist.
*/
public static String getString(IDirectory directory, String name)
{
INode node = directory.getNode(name);
......@@ -58,4 +75,8 @@ public class Utilities
return file.getStringContent();
}
private Utilities()
{
}
}
......@@ -30,6 +30,9 @@ public final class Version
private static final String MAJOR = "major";
private static final String MINOR = "minor";
/**
* Loads the version from the specified directory.
*/
public static Version loadFrom(IDirectory directory)
{
IDirectory versionFolder = Utilities.getSubDirectory(directory, VERSION);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment