Added some more CLTs: AVMRm, removes nodes, AVMSnapshot, takes a snapshot of a store,

AVMCopyIn, copies a file or a directory recursively local filesystem to a store, AVMMkDir,
creates a directory.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@4478 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-11-30 21:03:19 +00:00
parent f87f1508a1
commit bbd8db7b69
5 changed files with 365 additions and 0 deletions

View File

@@ -75,6 +75,10 @@ public abstract class AVMCltBase
int pos = 0;
while (pos < args.length)
{
if (args[pos].equals("-h"))
{
usage(usageMessage);
}
// If the argument is one of the accepted flags then it's
// a flag.
if (flagArgs.containsKey(args[pos]))
@@ -123,5 +127,40 @@ public abstract class AVMCltBase
System.exit(1);
}
/**
* Utility to split an AVM path into a parent path and a
* base name.
* @param path The path to split.
* @return An array of 1 or 2 Strings representing the parent path
* and the base name, or just the path if the path given is a root path.
*/
protected String[] splitPath(String path)
{
if (path.endsWith(":/"))
{
String [] ret = { path };
return ret;
}
int lastSlash = path.lastIndexOf("/");
if (lastSlash == -1)
{
System.err.println("Malformed path: " + path);
fContext.close();
System.exit(1);
}
String name = path.substring(lastSlash + 1);
String parent = path.substring(0, lastSlash);
if (parent.endsWith(":"))
{
parent = parent + "/";
}
while (parent.endsWith("/") && !parent.endsWith(":/"))
{
parent = parent.substring(0, parent.length() - 1);
}
String [] ret = { parent, name };
return ret;
}
protected abstract void run(Map<String, List<String>> flags, List<String> args);
}