/** * Helper method for implementations of pushOwningProcess, appends the * specified local name to the current owning process identifier and returns * the new id. This doesn't change the current process identifier. If there * is a colon ':' in the specified name this is invalid and will throw * ProcessIdentifierException at you. * * @param newLocalProcess * @return * @throws ProcessIdentifierException */ protected final String pushOwner(String newLocalProcess) throws ProcessIdentifierException { if (newLocalProcess.contains(":")) { throw new ProcessIdentifierException("Can't push '" + newLocalProcess + "' as it contains a ':' character"); } if (owner.equals("")) { // If the owner was the empty string we don't need to append the // colon return newLocalProcess; } else { return owner + ":" + newLocalProcess; } }
/** * Helper method for implementations of pushOwningProcess, appends the * specified local name to the current owning process identifier and returns * the new id. This doesn't change the current process identifier. If there * is a colon ':' in the specified name this is invalid and will throw * ProcessIdentifierException at you. * * @param newLocalProcess * @return * @throws ProcessIdentifierException */ protected final String pushOwner(String newLocalProcess) throws ProcessIdentifierException { if (newLocalProcess.contains(":")) { throw new ProcessIdentifierException("Can't push '" + newLocalProcess + "' as it contains a ':' character"); } if (owner.equals("")) { // If the owner was the empty string we don't need to append the // colon return newLocalProcess; } else { return owner + ":" + newLocalProcess; } }
/** * Helper method for implementations of pushOwningProcess, appends the * specified local name to the current owning process identifier and returns * the new id. This doesn't change the current process identifier. If there * is a colon ':' in the specified name this is invalid and will throw * ProcessIdentifierException at you. * * @param newLocalProcess * @return * @throws ProcessIdentifierException */ protected final String pushOwner(String newLocalProcess) throws ProcessIdentifierException { if (newLocalProcess.contains(":")) { throw new ProcessIdentifierException("Can't push '" + newLocalProcess + "' as it contains a ':' character"); } if (owner.equals("")) { // If the owner was the empty string we don't need to append the // colon return newLocalProcess; } else { return owner + ":" + newLocalProcess; } }
/** * Helper method for implementations of popOwningProcess, this constructs * the appropriate process identifier after the leaf has been removed and * returns it. If there is no leaf to remove, i.e. the current process * identifier is the empty string, then ProcessIdentifierException is thrown * * @return * @throws ProcessIdentifierException */ protected final String popOwner() throws ProcessIdentifierException { // Empty string already, can't pop from here, throw exception if (owner.equals("")) { throw new ProcessIdentifierException( "Attempt to pop a null owning process (empty string)"); } // A single ID with no colon in, return the empty string if (owner.lastIndexOf(':') < 0) { return ""; } return owner.substring(0, owner.lastIndexOf(':')); }
/** * Helper method for implementations of popOwningProcess, this constructs * the appropriate process identifier after the leaf has been removed and * returns it. If there is no leaf to remove, i.e. the current process * identifier is the empty string, then ProcessIdentifierException is thrown * * @return * @throws ProcessIdentifierException */ protected final String popOwner() throws ProcessIdentifierException { // Empty string already, can't pop from here, throw exception if (owner.equals("")) { throw new ProcessIdentifierException( "Attempt to pop a null owning process (empty string)"); } // A single ID with no colon in, return the empty string if (owner.lastIndexOf(':') < 0) { return ""; } return owner.substring(0, owner.lastIndexOf(':')); }
/** * Helper method for implementations of popOwningProcess, this constructs * the appropriate process identifier after the leaf has been removed and * returns it. If there is no leaf to remove, i.e. the current process * identifier is the empty string, then ProcessIdentifierException is thrown * * @return * @throws ProcessIdentifierException */ protected final String popOwner() throws ProcessIdentifierException { // Empty string already, can't pop from here, throw exception if (owner.equals("")) { throw new ProcessIdentifierException( "Attempt to pop a null owning process (empty string)"); } // A single ID with no colon in, return the empty string if (owner.lastIndexOf(':') < 0) { return ""; } return owner.substring(0, owner.lastIndexOf(':')); }