protected void showLSHelp() { say("lists the current store or lists details about an entry. Each entry is given a number of calls to other"); say("tools will use the most numbers from the most recent call to this."); say("Synatx:\n"); say("ls [number]\n"); say("If no number is supplied, then a complete list of all elements with numbering will be displayed."); say("If a number has been supplied, a detailed report on that item is shown."); }
protected void showDeserializeHelp() { say("Deserializes an object into the currnet store overwriting the contents. Cf. serialize."); say("deserialize [-new] -file path"); say("Deserializes the object in the given file. This replaces the object with the given index in the store."); say("The response will give the identifier of the object created."); say("If the -new flag is used, it is assumed that the object should be new. This means that if there is an existing object"); say("with that identifier the operation will fail. If there is no identifier, one will be created."); say("Omitting the -new flag means that any object will be overwritten and if needed, a new identifier will be created"); }
protected void showSerializeHelp() { say("serializes an object and either shows it on the command line or put it in a file. Cf. deserialize."); say("serialize [-file path] index"); say("Serializes the object with the given index. (Note that the index must be the last argument!) " + "It will print it to the command line or save it to the given file,"); say("overwriting the contents of the file."); }
protected void showCreateHelp() { say("Create a new entry in the currently active store."); say("Syntax is\n"); say("create [id]\n"); say("where the id is a unique uri which will identify the object. (Note that there is not a lead slash! "); say("Just enter the identifier if you want to set it. Be sure it is a valid uri.) If you do not specify an"); say("identifier, you will be prompted for one. You may also elect to have a new, random one created and assigned."); }
protected void showRMHelp() { say("Remove an item from the store. "); say("Syntax:\n"); say("rm [index|uid]\n"); say("where index is the index number from the list (ls) command or the unique identifier for the item, preceeded"); say("by a forward slash\n"); say("Examples\n"); say("rm 12\n"); say("This removes item 12 on the list\n"); say("rm /http://cilogon.org/serverT/uid/123\n"); say("This removes the item with the given unique identifier from the current store, regardless of its position in the list command"); }
protected List<Identifiable> listAll(boolean useLongFormat, String otherFlags) { loadAllEntries(); if (allEntries.isEmpty()) { say("(no entries found)"); return allEntries; } int i = 0; getSortable().setState(otherFlags); allEntries = getSortable().sort(allEntries); for (Identifiable x : allEntries) { if (useLongFormat) { longFormat(x); } else { say((i++) + ". " + format(x)); } } return allEntries; }
public void rm(InputLine inputLine) { if (showHelp(inputLine)) { showRMHelp(); return; } Identifiable x = findItem(inputLine); getStore().remove(x.getIdentifier()); say("Done. object with id = " + x.getIdentifierString() + " has been removed from the store"); info("Removed object " + x.getClass().getSimpleName() + " with id " + x.getIdentifierString()); clearEntries(); }
public void update(InputLine inputLine) { if (showHelp(inputLine)) { showUpdateHelp(); return; } if (inputLine.size() == 1) { say("You must supply the index or id of the item to update"); return; } Identifiable identifiable = findItem(inputLine); if (identifiable != null) { // Note that the contract should be that a clone is passed in and that is saved if the user // decides to. Identifiable identifiable1 = identifiable.clone(); if (update(identifiable1)) { getStore().save(identifiable1); clearEntries(); // CIL-240: Remove entries so the updated item is displayed. } return; } say("no object with that index or id found. Please try again"); }
Identifiable identifiable = findItem(inputLine); if (identifiable == null) { say("Sorry, object not found."); return;