Skip to content

Commit

Permalink
Migrating java-util from Metamarkets. (apache#3585)
Browse files Browse the repository at this point in the history
* Migrating java-util from Metamarkets.

* checkstyle and updated license on java-util files.

* Removed unused imports from whole project.

* cherry pick metamx/java-util@826021f.

* Copyright changes on java-util pom, address review comments.
  • Loading branch information
akashdw authored and drcrallen committed Oct 21, 2016
1 parent 8b7ff44 commit 4b3bd8b
Show file tree
Hide file tree
Showing 994 changed files with 17,448 additions and 1,843 deletions.
8 changes: 8 additions & 0 deletions NOTICE
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,11 @@ This product contains variable length long deserialization code adapted from Apa
* https://github.com/apache/lucene-solr/blob/master/lucene/LICENSE.txt (Apache License, Version 2.0)
* HOMEPAGE:
* https://github.com/apache/lucene-solr

This product contains a modified version of Metamarkets java-util library
* LICENSE:
* https://github.com/metamx/java-util/blob/master/LICENSE (Apache License, Version 2.0)
* HOMEPAGE:
* https://github.com/metamx/java-util
* COMMIT TAG:
* https://github.com/metamx/java-util/commit/826021f
9 changes: 8 additions & 1 deletion api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,15 @@

<dependencies>
<dependency>
<groupId>com.metamx</groupId>
<groupId>io.druid</groupId>
<artifactId>java-util</artifactId>
<version>${project.parent.version}</version>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.inject</groupId>
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/data/input/FirehoseFactory.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
package io.druid.data.input;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.metamx.common.parsers.ParseException;

import io.druid.data.input.impl.InputRowParser;
import io.druid.java.util.common.parsers.ParseException;

import java.io.IOException;

Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/data/input/FirehoseFactoryV2.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
package io.druid.data.input;

import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.metamx.common.parsers.ParseException;

import io.druid.data.input.impl.InputRowParser;
import io.druid.java.util.common.parsers.ParseException;

import java.io.IOException;
/**
Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/io/druid/data/input/MapBasedRow.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.metamx.common.IAE;
import com.metamx.common.logger.Logger;
import com.metamx.common.parsers.ParseException;

import io.druid.java.util.common.logger.Logger;
import io.druid.java.util.common.parsers.ParseException;

import org.joda.time.DateTime;

import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
Expand Down
1 change: 0 additions & 1 deletion api/src/main/java/io/druid/data/input/Row.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.metamx.common.parsers.ParseException;
import org.joda.time.DateTime;

import java.util.List;
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/data/input/Rows.java
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSortedSet;
import com.google.common.collect.Maps;
import com.metamx.common.ISE;

import io.druid.java.util.common.ISE;

import java.util.List;
import java.util.Map;
Expand Down
6 changes: 3 additions & 3 deletions api/src/main/java/io/druid/data/input/impl/CSVParseSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.metamx.common.parsers.CSVParser;
import com.metamx.common.parsers.ParseException;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.CSVParser;
import io.druid.java.util.common.parsers.Parser;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import com.metamx.common.parsers.DelimitedParser;
import com.metamx.common.parsers.ParseException;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.DelimitedParser;
import io.druid.java.util.common.parsers.Parser;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,8 @@
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.annotation.JsonValue;
import com.fasterxml.jackson.databind.jsontype.NamedType;
import com.fasterxml.jackson.databind.module.SimpleModule;
import com.google.common.base.Preconditions;

import java.util.List;

/**
*/
@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = StringDimensionSchema.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.metamx.common.parsers.ParserUtils;

import io.druid.java.util.common.parsers.ParserUtils;

import javax.annotation.Nullable;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.metamx.common.parsers.ParseException;
import io.druid.data.input.InputRow;

@JsonTypeInfo(use = JsonTypeInfo.Id.NAME, property = "type", defaultImpl = StringInputRowParser.class)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.metamx.common.parsers.JSONToLowerParser;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.JSONToLowerParser;
import io.druid.java.util.common.parsers.Parser;

import java.util.List;

Expand Down
5 changes: 3 additions & 2 deletions api/src/main/java/io/druid/data/input/impl/JSONParseSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.core.JsonParser.Feature;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.metamx.common.parsers.JSONPathParser;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.JSONPathParser;
import io.druid.java.util.common.parsers.Parser;

import java.util.ArrayList;
import java.util.HashMap;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,10 @@
import com.fasterxml.jackson.annotation.JacksonInject;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.metamx.common.ISE;
import com.metamx.common.parsers.JavaScriptParser;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.ISE;
import io.druid.java.util.common.parsers.JavaScriptParser;
import io.druid.java.util.common.parsers.Parser;
import io.druid.js.JavaScriptConfig;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import com.metamx.common.logger.Logger;
import com.metamx.common.parsers.ParseException;

import io.druid.data.input.InputRow;
import io.druid.data.input.MapBasedInputRow;
import io.druid.java.util.common.parsers.ParseException;

import org.joda.time.DateTime;

import java.util.List;
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/data/input/impl/ParseSpec.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.Parser;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.metamx.common.parsers.Parser;
import com.metamx.common.parsers.RegexParser;

import io.druid.java.util.common.parsers.Parser;
import io.druid.java.util.common.parsers.RegexParser;

import java.util.List;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@
package io.druid.data.input.impl;

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,11 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Charsets;
import com.metamx.common.parsers.ParseException;
import com.metamx.common.parsers.Parser;

import io.druid.data.input.ByteBufferInputRowParser;
import io.druid.data.input.InputRow;
import io.druid.java.util.common.parsers.ParseException;
import io.druid.java.util.common.parsers.Parser;

import java.nio.ByteBuffer;
import java.nio.CharBuffer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@

import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.metamx.common.parsers.Parser;

import io.druid.java.util.common.parsers.Parser;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.base.Function;
import com.metamx.common.parsers.TimestampParser;

import io.druid.java.util.common.parsers.TimestampParser;

import org.joda.time.DateTime;

import java.util.List;
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/guice/JsonConfigurator.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
import com.google.inject.Inject;
import com.google.inject.ProvisionException;
import com.google.inject.spi.Message;
import com.metamx.common.logger.Logger;

import io.druid.java.util.common.logger.Logger;

import javax.validation.ConstraintViolation;
import javax.validation.ElementKind;
Expand Down
19 changes: 10 additions & 9 deletions api/src/main/java/io/druid/guice/LifecycleModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
import com.google.inject.TypeLiteral;
import com.google.inject.multibindings.Multibinder;
import com.google.inject.name.Names;
import com.metamx.common.lifecycle.Lifecycle;

import io.druid.java.util.common.lifecycle.Lifecycle;

import java.lang.annotation.Annotation;
import java.util.Set;
Expand All @@ -48,8 +49,8 @@ public class LifecycleModule implements Module
* scope. That is, they are generally eagerly loaded because the loading operation will produce some beneficial
* side-effect even if nothing actually directly depends on the instance.
*
* This mechanism exists to allow the {@link com.metamx.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link com.metamx.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* This mechanism exists to allow the {@link io.druid.java.util.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link io.druid.java.util.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* it is not clear which is actually the best approach. This is more explicit, but eager bindings inside of modules
* is less error-prone.
*
Expand All @@ -69,8 +70,8 @@ public static void register(Binder binder, Class<?> clazz)
* scope. That is, they are generally eagerly loaded because the loading operation will produce some beneficial
* side-effect even if nothing actually directly depends on the instance.
*
* This mechanism exists to allow the {@link com.metamx.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link com.metamx.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* This mechanism exists to allow the {@link io.druid.java.util.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link io.druid.java.util.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* it is not clear which is actually the best approach. This is more explicit, but eager bindings inside of modules
* is less error-prone.
*
Expand All @@ -91,8 +92,8 @@ public static void register(Binder binder, Class<?> clazz, Annotation annotation
* scope. That is, they are generally eagerly loaded because the loading operation will produce some beneficial
* side-effect even if nothing actually directly depends on the instance.
*
* This mechanism exists to allow the {@link com.metamx.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link com.metamx.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* This mechanism exists to allow the {@link io.druid.java.util.common.lifecycle.Lifecycle} to be the primary entry point from the injector, not to
* auto-register things with the {@link io.druid.java.util.common.lifecycle.Lifecycle}. It is also possible to just bind things eagerly with Guice,
* it is not clear which is actually the best approach. This is more explicit, but eager bindings inside of modules
* is less error-prone.
*
Expand All @@ -113,8 +114,8 @@ public static void register(Binder binder, Class<?> clazz, Class<? extends Annot
* scope. That is, they are generally eagerly loaded because the loading operation will produce some beneficial
* side-effect even if nothing actually directly depends on the instance.
*
* This mechanism exists to allow the {@link com.metamx.common.lifecycle.Lifecycle} to be the primary entry point
* from the injector, not to auto-register things with the {@link com.metamx.common.lifecycle.Lifecycle}. It is
* This mechanism exists to allow the {@link io.druid.java.util.common.lifecycle.Lifecycle} to be the primary entry point
* from the injector, not to auto-register things with the {@link io.druid.java.util.common.lifecycle.Lifecycle}. It is
* also possible to just bind things eagerly with Guice, it is not clear which is actually the best approach.
* This is more explicit, but eager bindings inside of modules is less error-prone.
*
Expand Down
5 changes: 3 additions & 2 deletions api/src/main/java/io/druid/guice/LifecycleScope.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
import com.google.inject.Key;
import com.google.inject.Provider;
import com.google.inject.Scope;
import com.metamx.common.lifecycle.Lifecycle;
import com.metamx.common.logger.Logger;

import io.druid.java.util.common.lifecycle.Lifecycle;
import io.druid.java.util.common.logger.Logger;

import java.util.List;

Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/guice/ManageLifecycle.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Marks the object to be managed by {@link com.metamx.common.lifecycle.Lifecycle}
* Marks the object to be managed by {@link io.druid.java.util.common.lifecycle.Lifecycle}
*
* This Scope gets defined by {@link io.druid.guice.LifecycleModule}
*/
Expand Down
2 changes: 1 addition & 1 deletion api/src/main/java/io/druid/guice/ManageLifecycleLast.java
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
import static java.lang.annotation.RetentionPolicy.RUNTIME;

/**
* Marks the object to be managed by {@link com.metamx.common.lifecycle.Lifecycle} and set to be on Stage.LAST
* Marks the object to be managed by {@link io.druid.java.util.common.lifecycle.Lifecycle} and set to be on Stage.LAST
*
* This Scope gets defined by {@link io.druid.guice.LifecycleModule}
*/
Expand Down
5 changes: 2 additions & 3 deletions api/src/main/java/io/druid/tasklogs/NoopTaskLogs.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,11 @@

import com.google.common.base.Optional;
import com.google.common.io.ByteSource;
import com.google.common.io.InputSupplier;
import com.metamx.common.logger.Logger;

import io.druid.java.util.common.logger.Logger;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;

public class NoopTaskLogs implements TaskLogs
{
Expand Down
2 changes: 0 additions & 2 deletions api/src/main/java/io/druid/tasklogs/TaskLogStreamer.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,8 @@

import com.google.common.base.Optional;
import com.google.common.io.ByteSource;
import com.google.common.io.InputSupplier;

import java.io.IOException;
import java.io.InputStream;

/**
* Something that knows how to stream logs for tasks.
Expand Down
3 changes: 2 additions & 1 deletion api/src/main/java/io/druid/timeline/DataSegment.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,10 @@
import com.google.common.collect.Interner;
import com.google.common.collect.Interners;
import com.google.common.collect.Iterables;
import com.metamx.common.Granularity;

import io.druid.jackson.CommaListJoinDeserializer;
import io.druid.jackson.CommaListJoinSerializer;
import io.druid.java.util.common.Granularity;
import io.druid.query.SegmentDescriptor;
import io.druid.timeline.partition.NoneShardSpec;
import io.druid.timeline.partition.ShardSpec;
Expand Down
Loading

0 comments on commit 4b3bd8b

Please sign in to comment.