Expose more rhizome add command line arguments to the Java API

This commit is contained in:
Jeremy Lakeman 2016-02-15 15:34:29 +10:30
parent b8f10fd40d
commit 2da3f12cfa
2 changed files with 11 additions and 9 deletions

View File

@ -395,7 +395,7 @@ public class ServalDCommand
} }
} }
public static ManifestResult rhizomeAddFile(File payloadPath, File manifestPath, SubscriberId author, String pin) public static ManifestResult rhizomeAddFile(File payloadPath, File manifestPath, BundleId bid, SubscriberId author, String pin, String... fieldValues)
throws ServalDFailureException throws ServalDFailureException
{ {
List<String> args = new LinkedList<String>(); List<String> args = new LinkedList<String>();
@ -406,13 +406,16 @@ public class ServalDCommand
args.add("--entry-pin"); args.add("--entry-pin");
args.add(pin); args.add(pin);
} }
if (bid != null)
args.add("--bundle="+bid.toHex());
args.add(author == null ? null : author.toHex()); args.add(author == null ? null : author.toHex());
if (payloadPath != null)
args.add(payloadPath.getAbsolutePath()); args.add(payloadPath == null ? null : payloadPath.getAbsolutePath());
else if (manifestPath != null) args.add(manifestPath == null ? null : manifestPath.getAbsolutePath());
args.add(null); args.add(null);
if (manifestPath != null)
args.add(manifestPath.getAbsolutePath()); for(String f : fieldValues)
args.add(f);
ManifestResult result = new ManifestResult(); ManifestResult result = new ManifestResult();
result.setResult(command(result, args.toArray(new String[args.size()]))); result.setResult(command(result, args.toArray(new String[args.size()])));

View File

@ -38,8 +38,7 @@ static int create_rhizome_store_dir()
char rdpath[1024]; char rdpath[1024];
if (!formf_rhizome_store_path(rdpath, sizeof rdpath, "%s", config.rhizome.datastore_path)) if (!formf_rhizome_store_path(rdpath, sizeof rdpath, "%s", config.rhizome.datastore_path))
return -1; return -1;
INFOF("Rhizome datastore path = %s", alloca_str_toprint(rdpath)); DEBUGF(rhizome, "Rhizome datastore path = %s", alloca_str_toprint(rdpath));
DEBUGF(rhizome, "mkdirs(%s, 0700)", alloca_str_toprint(rdpath));
return emkdirs_info(rdpath, 0700); return emkdirs_info(rdpath, 0700);
} }