Skip to content

Commit

Permalink
Merge branch 'feature/GEODE-584' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
metatype committed Nov 28, 2015
2 parents 6e25230 + 91536e6 commit b8fb18a
Show file tree
Hide file tree
Showing 15 changed files with 40 additions and 733 deletions.
1 change: 1 addition & 0 deletions gemfire-assembly/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ def cp = {
// depedencies from gemfire-core
it.contains('antlr') ||
it.contains('commons-io') ||
it.contains('commons-lang') ||
it.contains('commons-logging') ||
it.contains('fastutil') ||
it.contains('jackson-annotations') ||
Expand Down
2 changes: 1 addition & 1 deletion gemfire-core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ dependencies {
compile 'com.google.code.findbugs:annotations:' + project.'annotations.version'
provided 'com.google.guava:guava:' + project.'guava.version'
compile 'commons-io:commons-io:' + project.'commons-io.version'
provided 'commons-lang:commons-lang:' + project.'commons-lang.version'
compile 'commons-lang:commons-lang:' + project.'commons-lang.version'
compile 'commons-logging:commons-logging:' + project.'commons-logging.version'
compile 'commons-modeler:commons-modeler:' + project.'commons-modeler.version'
compile 'io.netty:netty-all:' + project.'netty-all.version'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
import java.util.logging.Logger;
import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;
import org.springframework.shell.core.AbstractShell;
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.Converter;
Expand All @@ -40,7 +41,6 @@
import com.gemstone.gemfire.management.cli.CommandProcessingException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandMultiModeOptionException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionHasMultipleValuesException;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliException;
import com.gemstone.gemfire.management.internal.cli.exceptions.ExceptionHandler;
import com.gemstone.gemfire.management.internal.cli.help.format.NewHelp;
Expand All @@ -62,7 +62,6 @@
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedInput;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
import com.gemstone.gemfire.management.internal.cli.util.CLIConsoleBufferUtil;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;

/**
* Implementation of the {@link Parser} interface for GemFire SHell (gfsh)
Expand Down Expand Up @@ -354,10 +353,10 @@ private int completeParameters(CommandTarget commandTarget, int cursorStart,
for (String string : userOptionSet.getSplit()) {
if (string.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Remove option prefix
string = StringUtils.removePrefix(string,
string = StringUtils.removeStart(string,
SyntaxConstants.LONG_OPTION_SPECIFIER);
// Remove value specifier
string = StringUtils.removeSuffix(string,
string = StringUtils.removeEnd(string,
SyntaxConstants.OPTION_VALUE_SPECIFIER);
if (!string.equals("")) {
if (option.getLongOption().equals(string)) {
Expand Down Expand Up @@ -546,7 +545,7 @@ && getAllPossibleValuesForParameter(completionCandidates,
// with an option specifier
if (userOptString.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Now remove the option specifier part
userOptString = StringUtils.removePrefix(userOptString,
userOptString = StringUtils.removeStart(userOptString,
SyntaxConstants.LONG_OPTION_SPECIFIER);
if (option.getLongOption().startsWith(userOptString)
&& !userOptString.equals("")
Expand Down Expand Up @@ -910,10 +909,10 @@ private boolean getAllPossibleValuesForParameter(
public ParseResult parse(String userInput) {
GfshParseResult parseResult = null;
// First remove the trailing white spaces
userInput = StringUtils.trimTrailingWhitespace(userInput);
userInput = StringUtils.stripEnd(userInput, null);
if ((ParserUtils.contains(userInput, SyntaxConstants.COMMAND_DELIMITER) && StringUtils.endsWithIgnoreCase(
userInput, SyntaxConstants.COMMAND_DELIMITER))) {
userInput = StringUtils.removeSuffix(userInput, SyntaxConstants.COMMAND_DELIMITER);
userInput = StringUtils.removeEnd(userInput, SyntaxConstants.COMMAND_DELIMITER);
}

try {
Expand Down Expand Up @@ -1205,7 +1204,7 @@ private List<CommandTarget> locateTargets(String userInput, boolean matchIncompl
// This means that the user has entered the command
CommandTarget commandTarget = commands.get(commandName);
if (isAvailable(commandTarget, commandName)) {
String remainingBuffer = StringUtils.removePrefix(userInput, commandName);
String remainingBuffer = StringUtils.removeStart(userInput, commandName);
if (remainingBuffer.length() == 0
|| remainingBuffer.startsWith(" ")
|| remainingBuffer.startsWith(GfshParser.LINE_SEPARATOR)) {
Expand Down Expand Up @@ -1257,7 +1256,7 @@ private CommandTarget locateExactMatchingTarget(final String userInput)//exact m
// This means that the user has entered the command & name matches exactly
commandTarget = commandTargetsMap.get(commandName);
if (commandTarget != null) {
String remainingBuffer = StringUtils.removePrefix(userInput, commandName);
String remainingBuffer = StringUtils.removeStart(userInput, commandName);
commandTarget = commandTarget.duplicate(commandName, remainingBuffer);
break;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import org.springframework.shell.core.Completion;
import org.springframework.shell.core.MethodTarget;
import org.springframework.shell.support.util.FileUtils;
import org.springframework.util.Assert;

import com.gemstone.gemfire.management.cli.ConverterHint;
import com.gemstone.gemfire.management.internal.cli.MultipleValueAdapter;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;

/**
* @author Nikhil Jadhav
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
import java.util.List;
import java.util.Map;

import org.springframework.shell.event.ParseResult;
import org.springframework.util.ReflectionUtils;

import com.gemstone.gemfire.LogWriter;
import com.gemstone.gemfire.cache.CacheFactory;
import com.gemstone.gemfire.management.cli.Result;
Expand All @@ -38,9 +41,6 @@
import com.gemstone.gemfire.management.internal.cli.result.ResultData;
import com.gemstone.gemfire.management.internal.cli.result.TabularResultData;
import com.gemstone.gemfire.management.internal.cli.shell.Gfsh;
import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;

import org.springframework.shell.event.ParseResult;

/**
* Utility class to abstract CompositeResultData for Multi-step commands
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@

import java.lang.reflect.Method;

import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import com.gemstone.gemfire.management.internal.cli.util.spring.ObjectUtils;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
import org.apache.commons.lang.StringUtils;
import org.springframework.util.Assert;
import org.springframework.util.ObjectUtils;

/**
* A method that can be executed via a shell command.
Expand Down Expand Up @@ -101,7 +101,7 @@ public boolean equals(Object other) {

@Override
public int hashCode() {
return ObjectUtils.nullSafeHashCode(method, target);
return ObjectUtils.nullSafeHashCode(new Object[] { method, target });
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
import java.util.LinkedList;
import java.util.List;

import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.MultipleArgumentsForOptionException;
import joptsimple.OptionException;
import joptsimple.OptionParser;
import joptsimple.OptionSpecBuilder;

import org.apache.commons.lang.StringUtils;

import com.gemstone.gemfire.management.internal.cli.MultipleValueConverter;
import com.gemstone.gemfire.management.internal.cli.exceptions.CliCommandOptionException;
import com.gemstone.gemfire.management.internal.cli.exceptions.ExceptionGenerator;
Expand All @@ -32,16 +40,10 @@
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.Preprocessor;
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.PreprocessorUtils;
import com.gemstone.gemfire.management.internal.cli.parser.preprocessor.TrimmedInput;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
import joptsimple.ArgumentAcceptingOptionSpec;
import joptsimple.MultipleArgumentsForOptionException;
import joptsimple.OptionException;
import joptsimple.OptionParser;
import joptsimple.OptionSpecBuilder;

/**
* Implementation of {@link GfshOptionParser} which internally makes use of
* {@link com.gemstone.joptsimple.OptionParser}
* {@link joptsimple.OptionParser}
*
* @author Nikhil Jadhav
* @since 7.0
Expand Down Expand Up @@ -172,10 +174,10 @@ public OptionSet parse(String userInput) throws CliCommandOptionException {
outer: for (String inputSplit : preProcessedInput) {
if (inputSplit.startsWith(SyntaxConstants.LONG_OPTION_SPECIFIER)) {
// Remove option prefix
inputSplit = StringUtils.removePrefix(inputSplit,
inputSplit = StringUtils.removeStart(inputSplit,
SyntaxConstants.LONG_OPTION_SPECIFIER);
// Remove value specifier
inputSplit = StringUtils.removeSuffix(inputSplit,
inputSplit = StringUtils.removeEnd(inputSplit,
SyntaxConstants.OPTION_VALUE_SPECIFIER);
if (!inputSplit.equals("")) {
if (option.getLongOption().equals(inputSplit)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,10 @@

import java.util.regex.Pattern;

import org.apache.commons.lang.StringUtils;

import com.gemstone.gemfire.internal.lang.SystemUtils;
import com.gemstone.gemfire.management.internal.cli.parser.SyntaxConstants;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;

/**
* The methods in this class will be used by the {@link Preprocessor} class to
Expand All @@ -36,7 +37,7 @@ public static TrimmedInput simpleTrim(String input) {
if (input != null) {
// First remove the trailing white spaces, we do not need those
if (!containsOnlyWhiteSpaces(input)) {
input = StringUtils.trimTrailingWhitespace(input);
input = StringUtils.stripEnd(input, null);
}
String output = input.trim();
return new TrimmedInput(output, input.length() - output.length());
Expand Down Expand Up @@ -77,19 +78,19 @@ public static TrimmedInput trim(final String input, final boolean retainLineSepa
String inputCopy = input;
StringBuffer output = new StringBuffer();
// First remove the trailing white spaces, we do not need those
inputCopy = StringUtils.trimTrailingWhitespace(inputCopy);
inputCopy = StringUtils.stripEnd(inputCopy, null);
// As this parser is for optionParsing, we also need to remove
// the trailing optionSpecifiers provided it has previous
// options. Remove the trailing LONG_OPTION_SPECIFIERs
// in a loop. It is necessary to check for previous options for
// the case of non-mandatory arguments.
// "^(.*)(\\s-+)$" - something that ends with a space followed by a series of hyphens.
while (Pattern.matches("^(.*)(\\s-+)$", inputCopy)) {
inputCopy = StringUtils.removeSuffix(inputCopy, SyntaxConstants.SHORT_OPTION_SPECIFIER);
inputCopy = StringUtils.removeEnd(inputCopy, SyntaxConstants.SHORT_OPTION_SPECIFIER);

// Again we need to trim the trailing white spaces
// As we are in a loop
inputCopy = StringUtils.trimTrailingWhitespace(inputCopy);
inputCopy = StringUtils.stripEnd(inputCopy, null);
}
// Here we made use of the String class function trim to remove the
// space and tabs if any at the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import java.lang.reflect.Method;

import org.springframework.shell.event.ParseResult;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;

import com.gemstone.gemfire.distributed.DistributedLockService;
import com.gemstone.gemfire.distributed.internal.InternalDistributedSystem;
Expand All @@ -34,8 +36,6 @@
import com.gemstone.gemfire.management.internal.cli.LogWrapper;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;

/**
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
import org.springframework.shell.core.ExecutionStrategy;
import org.springframework.shell.core.Shell;
import org.springframework.shell.event.ParseResult;
import org.springframework.util.Assert;
import org.springframework.util.ReflectionUtils;

import com.gemstone.gemfire.internal.ClassPathLoader;
import com.gemstone.gemfire.management.cli.CliMetaData;
Expand All @@ -40,8 +42,6 @@
import com.gemstone.gemfire.management.internal.cli.multistep.MultiStepCommand;
import com.gemstone.gemfire.management.internal.cli.result.FileResult;
import com.gemstone.gemfire.management.internal.cli.result.ResultBuilder;
import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import com.gemstone.gemfire.management.internal.cli.util.spring.ReflectionUtils;

/**
* Defines the {@link ExecutionStrategy} for commands that are executed in
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
*/
package com.gemstone.gemfire.management.internal.cli.util;

import com.gemstone.gemfire.management.internal.cli.util.spring.Assert;
import org.springframework.util.Assert;

/**
* Utility based on code extracted from
Expand Down

This file was deleted.

Loading

0 comments on commit b8fb18a

Please sign in to comment.