You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@geode.apache.org by ud...@apache.org on 2016/06/16 22:07:18 UTC
[04/17] incubator-geode git commit: GEODE-835: replace
geode-joptsimple with jopt-simple dependency
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/921bec11/geode-joptsimple/src/main/java/joptsimple/util/DateConverter.java
----------------------------------------------------------------------
diff --git a/geode-joptsimple/src/main/java/joptsimple/util/DateConverter.java b/geode-joptsimple/src/main/java/joptsimple/util/DateConverter.java
deleted file mode 100644
index 9b4c7b1..0000000
--- a/geode-joptsimple/src/main/java/joptsimple/util/DateConverter.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2004-2011 Paul R. Holser, Jr.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package joptsimple.util;
-
-import java.text.DateFormat;
-import java.text.ParsePosition;
-import java.text.SimpleDateFormat;
-import java.util.Date;
-
-import joptsimple.ValueConversionException;
-import joptsimple.ValueConverter;
-
-
-/**
- * Converts values to {@link Date}s using a {@link DateFormat} object.
- *
- * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- */
-public class DateConverter implements ValueConverter<Date> {
- private final DateFormat formatter;
-
- /**
- * Creates a converter that uses the given date formatter/parser.
- *
- * @param formatter the formatter/parser to use
- * @throws NullPointerException if {@code formatter} is {@code null}
- */
- public DateConverter( DateFormat formatter ) {
- if ( formatter == null )
- throw new NullPointerException( "illegal null formatter" );
-
- this.formatter = formatter;
- }
-
- /**
- * Creates a converter that uses a {@link SimpleDateFormat} with the given date/time pattern. The date formatter
- * created is not {@link SimpleDateFormat#setLenient(boolean) lenient}.
- *
- * @param pattern expected date/time pattern
- * @return the new converter
- * @throws NullPointerException if {@code pattern} is {@code null}
- * @throws IllegalArgumentException if {@code pattern} is invalid
- */
- public static DateConverter datePattern( String pattern ) {
- SimpleDateFormat formatter = new SimpleDateFormat( pattern );
- formatter.setLenient( false );
-
- return new DateConverter( formatter );
- }
-
- /** {@inheritDoc} */
- public Date convert( String value ) {
- ParsePosition position = new ParsePosition( 0 );
-
- Date date = formatter.parse( value, position );
- if ( position.getIndex() != value.length() )
- throw new ValueConversionException( message( value ) );
-
- return date;
- }
-
- /** {@inheritDoc} */
- public Class<Date> valueType() {
- return Date.class;
- }
-
- /** {@inheritDoc} */
- public String valuePattern() {
- return formatter instanceof SimpleDateFormat
- ? ( (SimpleDateFormat) formatter ).toPattern()
- : "";
- }
-
- private String message( String value ) {
- String message = "Value [" + value + "] does not match date/time pattern";
- if ( formatter instanceof SimpleDateFormat )
- message += " [" + ( (SimpleDateFormat) formatter ).toPattern() + ']';
-
- return message;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/921bec11/geode-joptsimple/src/main/java/joptsimple/util/KeyValuePair.java
----------------------------------------------------------------------
diff --git a/geode-joptsimple/src/main/java/joptsimple/util/KeyValuePair.java b/geode-joptsimple/src/main/java/joptsimple/util/KeyValuePair.java
deleted file mode 100644
index 499a841..0000000
--- a/geode-joptsimple/src/main/java/joptsimple/util/KeyValuePair.java
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2004-2011 Paul R. Holser, Jr.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package joptsimple.util;
-
-import static joptsimple.internal.Strings.*;
-
-/**
- * A simple string key/string value pair.
- *
- * <p>This is useful as an argument type for options whose values take on the form <kbd>key=value</kbd>, such as JVM
- * command line system properties.</p>
- *
- * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- */
-public final class KeyValuePair {
- public final String key;
- public final String value;
-
- private KeyValuePair( String key, String value ) {
- this.key = key;
- this.value = value;
- }
-
- /**
- * Parses a string assumed to be of the form <kbd>key=value</kbd> into its parts.
- *
- * @param asString key-value string
- * @return a key-value pair
- * @throws NullPointerException if {@code stringRepresentation} is {@code null}
- */
- public static KeyValuePair valueOf( String asString ) {
- int equalsIndex = asString.indexOf( '=' );
- if ( equalsIndex == -1 )
- return new KeyValuePair( asString, EMPTY );
-
- String aKey = asString.substring( 0, equalsIndex );
- String aValue = equalsIndex == asString.length() - 1 ? EMPTY : asString.substring( equalsIndex + 1 );
-
- return new KeyValuePair( aKey, aValue );
- }
-
- @Override
- public boolean equals( Object that ) {
- if ( !( that instanceof KeyValuePair ) )
- return false;
-
- KeyValuePair other = (KeyValuePair) that;
- return key.equals( other.key ) && value.equals( other.value );
- }
-
- @Override
- public int hashCode() {
- return key.hashCode() ^ value.hashCode();
- }
-
- @Override
- public String toString() {
- return key + '=' + value;
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/921bec11/geode-joptsimple/src/main/java/joptsimple/util/RegexMatcher.java
----------------------------------------------------------------------
diff --git a/geode-joptsimple/src/main/java/joptsimple/util/RegexMatcher.java b/geode-joptsimple/src/main/java/joptsimple/util/RegexMatcher.java
deleted file mode 100644
index 3ce159c..0000000
--- a/geode-joptsimple/src/main/java/joptsimple/util/RegexMatcher.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- The MIT License
-
- Copyright (c) 2004-2011 Paul R. Holser, Jr.
-
- Permission is hereby granted, free of charge, to any person obtaining
- a copy of this software and associated documentation files (the
- "Software"), to deal in the Software without restriction, including
- without limitation the rights to use, copy, modify, merge, publish,
- distribute, sublicense, and/or sell copies of the Software, and to
- permit persons to whom the Software is furnished to do so, subject to
- the following conditions:
-
- The above copyright notice and this permission notice shall be
- included in all copies or substantial portions of the Software.
-
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
- LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
- OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
- WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-*/
-
-package joptsimple.util;
-
-import java.util.regex.Pattern;
-
-import joptsimple.ValueConversionException;
-import joptsimple.ValueConverter;
-
-import static java.util.regex.Pattern.*;
-
-
-
-/**
- * Ensures that values entirely match a regular expression.
- *
- * @author <a href="mailto:pholser@alumni.rice.edu">Paul Holser</a>
- */
-public class RegexMatcher implements ValueConverter<String> {
- private final Pattern pattern;
-
- /**
- * Creates a matcher that uses the given regular expression, modified by the given flags.
- *
- * @param pattern the regular expression pattern
- * @param flags modifying regex flags
- * @throws IllegalArgumentException if bit values other than those corresponding to the defined match flags are
- * set in {@code flags}
- * @throws java.util.regex.PatternSyntaxException if the expression's syntax is invalid
- */
- public RegexMatcher( String pattern, int flags ) {
- this.pattern = compile( pattern, flags );
- }
-
- /**
- * Gives a matcher that uses the given regular expression.
- *
- * @param pattern the regular expression pattern
- * @return the new converter
- * @throws java.util.regex.PatternSyntaxException if the expression's syntax is invalid
- */
- public static ValueConverter<String> regex( String pattern ) {
- return new RegexMatcher( pattern, 0 );
- }
-
- /** {@inheritDoc} */
- public String convert( String value ) {
- if ( !pattern.matcher( value ).matches() ) {
- throw new ValueConversionException(
- "Value [" + value + "] did not match regex [" + pattern.pattern() + ']' );
- }
-
- return value;
- }
-
- /** {@inheritDoc} */
- public Class<String> valueType() {
- return String.class;
- }
-
- /** {@inheritDoc} */
- public String valuePattern() {
- return pattern.pattern();
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/921bec11/gradle/dependency-versions.properties
----------------------------------------------------------------------
diff --git a/gradle/dependency-versions.properties b/gradle/dependency-versions.properties
index d324cd1..9de665c 100644
--- a/gradle/dependency-versions.properties
+++ b/gradle/dependency-versions.properties
@@ -67,6 +67,7 @@ jgroups.version = 3.6.8.Final
jline.version = 2.12
jmock.version = 2.8.2
jna.version = 4.0.0
+jopt-simple.version = 5.0.1
json-path.version = 1.2.0
json4s.version = 3.2.4
jsr305.version = 3.0.1
http://git-wip-us.apache.org/repos/asf/incubator-geode/blob/921bec11/settings.gradle
----------------------------------------------------------------------
diff --git a/settings.gradle b/settings.gradle
index 0af744e..ca34692 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -17,7 +17,6 @@
rootProject.name = 'geode'
include 'geode-common'
-include 'geode-joptsimple'
include 'geode-json'
include 'geode-junit'
include 'geode-core'