Fixing stylecheck problems with storm-redis
Project: http://git-wip-us.apache.org/repos/asf/storm/repo Commit: http://git-wip-us.apache.org/repos/asf/storm/commit/e3f5b138 Tree: http://git-wip-us.apache.org/repos/asf/storm/tree/e3f5b138 Diff: http://git-wip-us.apache.org/repos/asf/storm/diff/e3f5b138 Branch: refs/heads/master Commit: e3f5b138eb33e0b67c98a3ba3d8b26d70c988537 Parents: 81ec15d Author: Kishor Patil <[email protected]> Authored: Sun Apr 22 22:41:44 2018 -0400 Committer: Kishor Patil <[email protected]> Committed: Mon Apr 23 00:22:36 2018 -0400 ---------------------------------------------------------------------- external/storm-redis/pom.xml | 2 +- .../storm/redis/bolt/AbstractRedisBolt.java | 28 +- .../storm/redis/bolt/RedisFilterBolt.java | 22 +- .../storm/redis/bolt/RedisLookupBolt.java | 30 +-- .../apache/storm/redis/bolt/RedisStoreBolt.java | 19 +- .../adapter/RedisCommandsAdapterJedis.java | 7 +- .../RedisCommandsAdapterJedisCluster.java | 7 +- .../redis/common/commands/RedisCommands.java | 9 +- .../redis/common/config/JedisClusterConfig.java | 23 +- .../redis/common/config/JedisPoolConfig.java | 44 ++-- .../common/container/JedisClusterContainer.java | 21 +- .../JedisCommandsContainerBuilder.java | 26 +- .../JedisCommandsInstanceContainer.java | 21 +- .../redis/common/container/JedisContainer.java | 23 +- .../common/container/RedisClusterContainer.java | 4 +- .../RedisCommandsContainerBuilder.java | 10 +- .../RedisCommandsInstanceContainer.java | 6 +- .../redis/common/container/RedisContainer.java | 6 +- .../common/mapper/RedisDataTypeDescription.java | 26 +- .../redis/common/mapper/RedisFilterMapper.java | 19 +- .../redis/common/mapper/RedisLookupMapper.java | 22 +- .../storm/redis/common/mapper/RedisMapper.java | 19 +- .../redis/common/mapper/RedisStoreMapper.java | 19 +- .../storm/redis/common/mapper/TupleMapper.java | 22 +- .../storm/redis/state/RedisKeyValueState.java | 62 ++--- .../redis/state/RedisKeyValueStateIterator.java | 22 +- .../redis/state/RedisKeyValueStateProvider.java | 42 ++- .../trident/state/AbstractRedisMapState.java | 37 ++- .../state/AbstractRedisStateQuerier.java | 25 +- .../state/AbstractRedisStateUpdater.java | 30 +-- .../storm/redis/trident/state/KeyFactory.java | 21 +- .../storm/redis/trident/state/Options.java | 24 +- .../trident/state/RedisClusterMapState.java | 213 ++++++++------- .../redis/trident/state/RedisClusterState.java | 99 ++++--- .../trident/state/RedisClusterStateQuerier.java | 23 +- .../trident/state/RedisClusterStateUpdater.java | 48 ++-- .../redis/trident/state/RedisMapState.java | 264 +++++++++---------- .../storm/redis/trident/state/RedisState.java | 92 +++---- .../redis/trident/state/RedisStateQuerier.java | 38 ++- .../redis/trident/state/RedisStateUpdater.java | 48 ++-- .../state/RedisKeyValueStateIteratorTest.java | 69 +++-- .../state/RedisKeyValueStateProviderTest.java | 34 +-- .../redis/state/RedisKeyValueStateTest.java | 186 +++++++------ 43 files changed, 797 insertions(+), 1015 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/pom.xml ---------------------------------------------------------------------- diff --git a/external/storm-redis/pom.xml b/external/storm-redis/pom.xml index ca70344..5943496 100644 --- a/external/storm-redis/pom.xml +++ b/external/storm-redis/pom.xml @@ -92,7 +92,7 @@ <artifactId>maven-checkstyle-plugin</artifactId> <!--Note - the version would be inherited--> <configuration> - <maxAllowedViolations>602</maxAllowedViolations> + <maxAllowedViolations>64</maxAllowedViolations> </configuration> </plugin> </plugins> http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java index f0f3fa3..06d59b6 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/AbstractRedisBolt.java @@ -1,37 +1,27 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.bolt; -import org.apache.storm.task.OutputCollector; -import org.apache.storm.task.TopologyContext; -import org.apache.storm.topology.base.BaseRichBolt; +import java.util.Map; import org.apache.storm.redis.common.config.JedisClusterConfig; import org.apache.storm.redis.common.config.JedisPoolConfig; import org.apache.storm.redis.common.container.JedisCommandsContainerBuilder; import org.apache.storm.redis.common.container.JedisCommandsInstanceContainer; +import org.apache.storm.task.OutputCollector; +import org.apache.storm.task.TopologyContext; import org.apache.storm.topology.base.BaseTickTupleAwareRichBolt; -import org.apache.storm.tuple.Tuple; -import org.apache.storm.utils.TupleUtils; import redis.clients.jedis.JedisCommands; -import java.util.Map; - /** * AbstractRedisBolt class is for users to implement custom bolts which makes interaction with Redis. * <p/> http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisFilterBolt.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisFilterBolt.java b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisFilterBolt.java index c7ba705..1b7ab20 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisFilterBolt.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisFilterBolt.java @@ -1,22 +1,18 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.bolt; +import java.util.List; import org.apache.storm.redis.common.config.JedisClusterConfig; import org.apache.storm.redis.common.config.JedisPoolConfig; import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; @@ -26,8 +22,6 @@ import org.apache.storm.tuple.Tuple; import redis.clients.jedis.GeoCoordinate; import redis.clients.jedis.JedisCommands; -import java.util.List; - /** * Basic bolt for querying from Redis and filters out if key/field doesn't exist. * If key/field exists on Redis, this bolt just forwards input tuple to default stream. http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisLookupBolt.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisLookupBolt.java b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisLookupBolt.java index 0a4fde1..5311d85 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisLookupBolt.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisLookupBolt.java @@ -1,33 +1,27 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.bolt; +import java.util.List; +import org.apache.storm.redis.common.config.JedisClusterConfig; +import org.apache.storm.redis.common.config.JedisPoolConfig; +import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; +import org.apache.storm.redis.common.mapper.RedisLookupMapper; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.tuple.Tuple; import org.apache.storm.tuple.Values; -import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; -import org.apache.storm.redis.common.mapper.RedisLookupMapper; -import org.apache.storm.redis.common.config.JedisClusterConfig; -import org.apache.storm.redis.common.config.JedisPoolConfig; import redis.clients.jedis.JedisCommands; -import java.util.List; - /** * Basic bolt for querying from Redis and emits response as tuple. * <p/> http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisStoreBolt.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisStoreBolt.java b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisStoreBolt.java index 7a910ce..8ca74e9 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisStoreBolt.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/bolt/RedisStoreBolt.java @@ -1,20 +1,15 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.bolt; import org.apache.storm.redis.common.config.JedisClusterConfig; http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java index 66ac903..89d759d 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedis.java @@ -18,15 +18,14 @@ package org.apache.storm.redis.common.adapter; +import java.io.Closeable; +import java.io.IOException; +import java.util.Map; import org.apache.storm.redis.common.commands.RedisCommands; import redis.clients.jedis.Jedis; import redis.clients.jedis.ScanParams; import redis.clients.jedis.ScanResult; -import java.io.Closeable; -import java.io.IOException; -import java.util.Map; - /** * Adapter class to make Jedis instance play with BinaryRedisCommands interface. */ http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedisCluster.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedisCluster.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedisCluster.java index be5cd64..680b3c9 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedisCluster.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/adapter/RedisCommandsAdapterJedisCluster.java @@ -18,15 +18,14 @@ package org.apache.storm.redis.common.adapter; +import java.io.Closeable; +import java.io.IOException; +import java.util.Map; import org.apache.storm.redis.common.commands.RedisCommands; import redis.clients.jedis.JedisCluster; import redis.clients.jedis.ScanParams; import redis.clients.jedis.ScanResult; -import java.io.Closeable; -import java.io.IOException; -import java.util.Map; - /** * Adapter class to make JedisCluster instance play with BinaryRedisCommands interface. */ http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/commands/RedisCommands.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/commands/RedisCommands.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/commands/RedisCommands.java index dd01f20..172d2ab 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/commands/RedisCommands.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/commands/RedisCommands.java @@ -18,16 +18,15 @@ package org.apache.storm.redis.common.commands; +import java.util.Map; import redis.clients.jedis.ScanParams; import redis.clients.jedis.ScanResult; -import java.util.Map; - /** * This interface represents Jedis methods exhaustively which are used on storm-redis. * - * This is a workaround since Jedis and JedisCluster doesn't implement same interface for binary type of methods, - * and unify binary methods and string methods into one interface. + * This is a workaround since Jedis and JedisCluster doesn't implement same interface for binary type of methods, and unify binary methods + * and string methods into one interface. */ public interface RedisCommands { // common @@ -48,7 +47,7 @@ public interface RedisCommands { Map<byte[], byte[]> hgetAll(byte[] key); - Map<String,String> hgetAll(String key); + Map<String, String> hgetAll(String key); String hmset(byte[] key, Map<byte[], byte[]> fieldValues); http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisClusterConfig.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisClusterConfig.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisClusterConfig.java index e7b444b..e9b355d 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisClusterConfig.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisClusterConfig.java @@ -1,31 +1,24 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.config; import com.google.common.base.Preconditions; -import redis.clients.jedis.HostAndPort; -import redis.clients.jedis.Protocol; - import java.io.Serializable; import java.net.InetSocketAddress; import java.util.HashSet; import java.util.Set; +import redis.clients.jedis.HostAndPort; +import redis.clients.jedis.Protocol; /** * Configuration for JedisCluster. http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisPoolConfig.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisPoolConfig.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisPoolConfig.java index ffd1244..f1025c9 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisPoolConfig.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/config/JedisPoolConfig.java @@ -1,26 +1,19 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.config; -import redis.clients.jedis.Protocol; - import java.io.Serializable; +import redis.clients.jedis.Protocol; /** * Configuration for JedisPool. @@ -36,6 +29,7 @@ public class JedisPoolConfig implements Serializable { // for serialization public JedisPoolConfig() { } + /** * Constructor. * <p/> @@ -95,6 +89,17 @@ public class JedisPoolConfig implements Serializable { return password; } + @Override + public String toString() { + return "JedisPoolConfig{" + + "host='" + host + '\'' + + ", port=" + port + + ", timeout=" + timeout + + ", database=" + database + + ", password='" + password + '\'' + + '}'; + } + /** * Builder for initializing JedisPoolConfig. */ @@ -163,15 +168,4 @@ public class JedisPoolConfig implements Serializable { return new JedisPoolConfig(host, port, timeout, password, database); } } - - @Override - public String toString() { - return "JedisPoolConfig{" + - "host='" + host + '\'' + - ", port=" + port + - ", timeout=" + timeout + - ", database=" + database + - ", password='" + password + '\'' + - '}'; - } } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java index 7d0baa7..9f1cb78 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisClusterContainer.java @@ -1,28 +1,21 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.container; +import java.io.IOException; import redis.clients.jedis.JedisCluster; import redis.clients.jedis.JedisCommands; -import java.io.IOException; - /** * Container for managing JedisCluster. * <p/> http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsContainerBuilder.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsContainerBuilder.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsContainerBuilder.java index d87553e..86f0f09 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsContainerBuilder.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsContainerBuilder.java @@ -1,19 +1,13 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.container; @@ -38,7 +32,9 @@ public class JedisCommandsContainerBuilder { * @return container for single Redis environment */ public static JedisCommandsInstanceContainer build(JedisPoolConfig config) { - JedisPool jedisPool = new JedisPool(DEFAULT_POOL_CONFIG, config.getHost(), config.getPort(), config.getTimeout(), config.getPassword(), config.getDatabase()); + JedisPool jedisPool = + new JedisPool(DEFAULT_POOL_CONFIG, config.getHost(), config.getPort(), config.getTimeout(), config.getPassword(), + config.getDatabase()); return new JedisContainer(jedisPool); } @@ -48,7 +44,9 @@ public class JedisCommandsContainerBuilder { * @return container for Redis Cluster environment */ public static JedisCommandsInstanceContainer build(JedisClusterConfig config) { - JedisCluster jedisCluster = new JedisCluster(config.getNodes(), config.getTimeout(), config.getTimeout(), config.getMaxRedirections(), config.getPassword(), DEFAULT_POOL_CONFIG); + JedisCluster jedisCluster = + new JedisCluster(config.getNodes(), config.getTimeout(), config.getTimeout(), config.getMaxRedirections(), config.getPassword(), + DEFAULT_POOL_CONFIG); return new JedisClusterContainer(jedisCluster); } } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java index 17a61d6..8ca0716 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisCommandsInstanceContainer.java @@ -1,26 +1,19 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.container; -import redis.clients.jedis.JedisCommands; - import java.io.Closeable; +import redis.clients.jedis.JedisCommands; /** * Interfaces for containers which stores instances implementing JedisCommands. http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java index 14005f1..aa78480 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/JedisContainer.java @@ -1,31 +1,24 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.common.container; +import java.io.Closeable; +import java.io.IOException; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.JedisCommands; import redis.clients.jedis.JedisPool; -import java.io.Closeable; -import java.io.IOException; - /** * Container for managing Jedis instances. */ http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisClusterContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisClusterContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisClusterContainer.java index d21ede8..512e950 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisClusterContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisClusterContainer.java @@ -18,12 +18,11 @@ package org.apache.storm.redis.common.container; +import java.io.IOException; import org.apache.storm.redis.common.adapter.RedisCommandsAdapterJedisCluster; import org.apache.storm.redis.common.commands.RedisCommands; import redis.clients.jedis.JedisCluster; -import java.io.IOException; - /** * Container for managing JedisCluster. * <p/> @@ -34,6 +33,7 @@ public class RedisClusterContainer implements RedisCommandsInstanceContainer { /** * Constructor + * * @param jedisCluster JedisCluster instance */ public RedisClusterContainer(JedisCluster jedisCluster) { http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsContainerBuilder.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsContainerBuilder.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsContainerBuilder.java index 856f88f..81201ef 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsContainerBuilder.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsContainerBuilder.java @@ -15,6 +15,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ + package org.apache.storm.redis.common.container; import org.apache.storm.redis.common.config.JedisClusterConfig; @@ -33,21 +34,26 @@ public class RedisCommandsContainerBuilder { /** * Builds container for single Redis environment. + * * @param config configuration for JedisPool * @return container for single Redis environment */ public static RedisCommandsInstanceContainer build(JedisPoolConfig config) { - JedisPool jedisPool = new JedisPool(DEFAULT_POOL_CONFIG, config.getHost(), config.getPort(), config.getTimeout(), config.getPassword(), config.getDatabase()); + JedisPool jedisPool = + new JedisPool(DEFAULT_POOL_CONFIG, config.getHost(), config.getPort(), config.getTimeout(), config.getPassword(), + config.getDatabase()); return new RedisContainer(jedisPool); } /** * Builds container for Redis Cluster environment. + * * @param config configuration for JedisCluster * @return container for Redis Cluster environment */ public static RedisCommandsInstanceContainer build(JedisClusterConfig config) { - JedisCluster jedisCluster = new JedisCluster(config.getNodes(), config.getTimeout(), config.getMaxRedirections(), DEFAULT_POOL_CONFIG); + JedisCluster jedisCluster = + new JedisCluster(config.getNodes(), config.getTimeout(), config.getMaxRedirections(), DEFAULT_POOL_CONFIG); return new RedisClusterContainer(jedisCluster); } } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsInstanceContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsInstanceContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsInstanceContainer.java index 04daf05..14b7c29 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsInstanceContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisCommandsInstanceContainer.java @@ -15,11 +15,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package org.apache.storm.redis.common.container; -import org.apache.storm.redis.common.commands.RedisCommands; +package org.apache.storm.redis.common.container; import java.io.Closeable; +import org.apache.storm.redis.common.commands.RedisCommands; /** * Interfaces for containers which stores instances implementing RedisCommands. @@ -27,12 +27,14 @@ import java.io.Closeable; public interface RedisCommandsInstanceContainer extends Closeable { /** * Borrows instance from container. + * * @return instance which implements RedisCommands */ RedisCommands getInstance(); /** * Returns instance to container. + * * @param redisCommands borrowed instance */ void returnInstance(RedisCommands redisCommands); http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisContainer.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisContainer.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisContainer.java index e151346..1753bb8 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisContainer.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/container/RedisContainer.java @@ -18,15 +18,14 @@ package org.apache.storm.redis.common.container; +import java.io.Closeable; +import java.io.IOException; import org.apache.storm.redis.common.adapter.RedisCommandsAdapterJedis; import org.apache.storm.redis.common.commands.RedisCommands; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.jedis.JedisPool; -import java.io.Closeable; -import java.io.IOException; - public class RedisContainer implements RedisCommandsInstanceContainer { private static final Logger LOG = LoggerFactory.getLogger(JedisContainer.class); @@ -34,6 +33,7 @@ public class RedisContainer implements RedisCommandsInstanceContainer { /** * Constructor + * * @param jedisPool JedisPool which actually manages Jedis instances */ public RedisContainer(JedisPool jedisPool) { http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisDataTypeDescription.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisDataTypeDescription.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisDataTypeDescription.java index 7e5c785..e3eac77 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisDataTypeDescription.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisDataTypeDescription.java @@ -1,20 +1,15 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.common.mapper; import java.io.Serializable; @@ -23,11 +18,8 @@ import java.io.Serializable; * RedisDataTypeDescription defines data type and additional key if needed for lookup / store tuples. */ public class RedisDataTypeDescription implements Serializable { - public enum RedisDataType { STRING, HASH, LIST, SET, SORTED_SET, HYPER_LOG_LOG, GEO } - private RedisDataType dataType; private String additionalKey; - /** * Constructor * @param dataType data type @@ -46,7 +38,7 @@ public class RedisDataTypeDescription implements Serializable { this.additionalKey = additionalKey; if (dataType == RedisDataType.HASH || - dataType == RedisDataType.SORTED_SET || dataType == RedisDataType.GEO) { + dataType == RedisDataType.SORTED_SET || dataType == RedisDataType.GEO) { if (additionalKey == null) { throw new IllegalArgumentException("Hash, Sorted Set and GEO should have additional key"); } @@ -68,4 +60,6 @@ public class RedisDataTypeDescription implements Serializable { public String getAdditionalKey() { return additionalKey; } + + public enum RedisDataType {STRING, HASH, LIST, SET, SORTED_SET, HYPER_LOG_LOG, GEO} } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisFilterMapper.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisFilterMapper.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisFilterMapper.java index b112046..f1d6506 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisFilterMapper.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisFilterMapper.java @@ -1,20 +1,15 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.common.mapper; import org.apache.storm.topology.OutputFieldsDeclarer; http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisLookupMapper.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisLookupMapper.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisLookupMapper.java index 8c9ebf4..0e3b1c5 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisLookupMapper.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisLookupMapper.java @@ -1,28 +1,22 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.common.mapper; +import java.util.List; import org.apache.storm.topology.OutputFieldsDeclarer; import org.apache.storm.tuple.ITuple; import org.apache.storm.tuple.Values; -import java.util.List; - /** * RedisLookupMapper is for defining spec. which is used for querying value from Redis and converting response to tuple. */ http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisMapper.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisMapper.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisMapper.java index b6a9559..b4ea07d 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisMapper.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisMapper.java @@ -1,20 +1,15 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.common.mapper; /** http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisStoreMapper.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisStoreMapper.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisStoreMapper.java index 4ab8b1f..f745d5d 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisStoreMapper.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/RedisStoreMapper.java @@ -1,20 +1,15 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.common.mapper; /** http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/TupleMapper.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/TupleMapper.java b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/TupleMapper.java index a2ab48b..ffe0d71 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/TupleMapper.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/common/mapper/TupleMapper.java @@ -1,25 +1,19 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ -package org.apache.storm.redis.common.mapper; -import org.apache.storm.tuple.ITuple; +package org.apache.storm.redis.common.mapper; import java.io.Serializable; +import org.apache.storm.tuple.ITuple; /** * TupleMapper defines how to extract key and value from tuple for Redis. http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java index 40b9ab4..95d0511 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueState.java @@ -1,60 +1,52 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.state; import com.google.common.collect.Maps; import com.google.common.primitives.UnsignedBytes; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.NavigableMap; +import java.util.TreeMap; +import java.util.concurrent.ConcurrentNavigableMap; +import java.util.concurrent.ConcurrentSkipListMap; import org.apache.storm.redis.common.commands.RedisCommands; import org.apache.storm.redis.common.config.JedisClusterConfig; +import org.apache.storm.redis.common.config.JedisPoolConfig; import org.apache.storm.redis.common.container.RedisCommandsContainerBuilder; import org.apache.storm.redis.common.container.RedisCommandsInstanceContainer; import org.apache.storm.state.DefaultStateEncoder; import org.apache.storm.state.DefaultStateSerializer; import org.apache.storm.state.KeyValueState; import org.apache.storm.state.Serializer; -import org.apache.storm.redis.common.config.JedisPoolConfig; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import redis.clients.util.SafeEncoder; -import java.util.Arrays; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.List; -import java.util.ArrayList; -import java.util.NavigableMap; -import java.util.TreeMap; -import java.util.concurrent.ConcurrentNavigableMap; -import java.util.concurrent.ConcurrentSkipListMap; - /** * A redis based implementation that persists the state in Redis. */ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { public static final int ITERATOR_CHUNK_SIZE = 100; - + public static final NavigableMap<byte[], byte[]> EMPTY_PENDING_COMMIT_MAP = Maps.unmodifiableNavigableMap( + new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator())); private static final Logger LOG = LoggerFactory.getLogger(RedisKeyValueState.class); private static final String COMMIT_TXID_KEY = "commit"; private static final String PREPARE_TXID_KEY = "prepare"; - public static final NavigableMap<byte[], byte[]> EMPTY_PENDING_COMMIT_MAP = Maps.unmodifiableNavigableMap( - new TreeMap<byte[], byte[]>(UnsignedBytes.lexicographicalComparator())); - private final byte[] namespace; private final byte[] prepareNamespace; @@ -80,7 +72,8 @@ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { this(namespace, RedisCommandsContainerBuilder.build(poolConfig), keySerializer, valueSerializer); } - public RedisKeyValueState(String namespace, JedisClusterConfig jedisClusterConfig, Serializer<K> keySerializer, Serializer<V> valueSerializer) { + public RedisKeyValueState(String namespace, JedisClusterConfig jedisClusterConfig, Serializer<K> keySerializer, + Serializer<V> valueSerializer) { this(namespace, RedisCommandsContainerBuilder.build(jedisClusterConfig), keySerializer, valueSerializer); } @@ -181,8 +174,9 @@ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { @Override public Iterator<Map.Entry<K, V>> iterator() { - return new RedisKeyValueStateIterator<K, V>(namespace, container, pendingPrepare.entrySet().iterator(), pendingCommit.entrySet().iterator(), - ITERATOR_CHUNK_SIZE, encoder.getKeySerializer(), encoder.getValueSerializer()); + return new RedisKeyValueStateIterator<K, V>(namespace, container, pendingPrepare.entrySet().iterator(), + pendingCommit.entrySet().iterator(), + ITERATOR_CHUNK_SIZE, encoder.getKeySerializer(), encoder.getValueSerializer()); } @Override @@ -196,7 +190,7 @@ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { commands = container.getInstance(); if (commands.exists(prepareNamespace)) { LOG.debug("Prepared txn already exists, will merge", txid); - for (Map.Entry<byte[], byte[]> e: pendingCommit.entrySet()) { + for (Map.Entry<byte[], byte[]> e : pendingCommit.entrySet()) { if (!currentPending.containsKey(e.getKey())) { currentPending.put(e.getKey(), e.getValue()); } @@ -226,7 +220,7 @@ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { if (!pendingCommit.isEmpty()) { List<byte[]> keysToDelete = new ArrayList<>(); Map<byte[], byte[]> keysToAdd = new HashMap<>(); - for(Map.Entry<byte[], byte[]> entry: pendingCommit.entrySet()) { + for (Map.Entry<byte[], byte[]> entry : pendingCommit.entrySet()) { byte[] key = entry.getKey(); byte[] value = entry.getValue(); if (Arrays.equals(encoder.getTombstoneValue(), value)) { @@ -306,7 +300,7 @@ public class RedisKeyValueState<K, V> implements KeyValueState<K, V> { if (committedTxid != null) { if (txid <= committedTxid) { throw new RuntimeException("Invalid txid '" + txid + "' for prepare. Txid '" + committedTxid + - "' is already committed"); + "' is already committed"); } } } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateIterator.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateIterator.java b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateIterator.java index e959483..19d2b91 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateIterator.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateIterator.java @@ -1,19 +1,13 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.state; @@ -22,13 +16,11 @@ import java.util.Arrays; import java.util.Iterator; import java.util.List; import java.util.Map; - import org.apache.storm.redis.common.commands.RedisCommands; import org.apache.storm.redis.common.container.RedisCommandsInstanceContainer; import org.apache.storm.state.BaseBinaryStateIterator; import org.apache.storm.state.DefaultStateEncoder; import org.apache.storm.state.Serializer; - import org.apache.storm.state.StateEncoder; import redis.clients.jedis.ScanParams; import redis.clients.jedis.ScanResult; @@ -79,7 +71,7 @@ public class RedisKeyValueStateIterator<K, V> extends BaseBinaryStateIterator<K, @Override protected boolean isEndOfDataFromStorage() { return (cachedResultIterator == null || !cachedResultIterator.hasNext()) - && Arrays.equals(cursor, ScanParams.SCAN_POINTER_START_BINARY); + && Arrays.equals(cursor, ScanParams.SCAN_POINTER_START_BINARY); } @Override http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateProvider.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateProvider.java b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateProvider.java index 01434ab..28201bc 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateProvider.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/state/RedisKeyValueStateProvider.java @@ -1,25 +1,22 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ + package org.apache.storm.redis.state; import com.fasterxml.jackson.annotation.JsonAutoDetect; import com.fasterxml.jackson.annotation.PropertyAccessor; import com.fasterxml.jackson.databind.ObjectMapper; +import java.util.Collections; +import java.util.Map; import org.apache.storm.Config; import org.apache.storm.redis.common.config.JedisClusterConfig; import org.apache.storm.redis.common.config.JedisPoolConfig; @@ -31,9 +28,6 @@ import org.apache.storm.task.TopologyContext; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Collections; -import java.util.Map; - /** * Provides {@link RedisKeyValueState} */ @@ -75,10 +69,10 @@ public class RedisKeyValueStateProvider implements StateProvider { if (jedisPoolConfig != null) { return new RedisKeyValueState(namespace, jedisPoolConfig, - getKeySerializer(topoConf, context, config), getValueSerializer(topoConf, context, config)); + getKeySerializer(topoConf, context, config), getValueSerializer(topoConf, context, config)); } else { return new RedisKeyValueState(namespace, jedisClusterConfig, - getKeySerializer(topoConf, context, config), getValueSerializer(topoConf, context, config)); + getKeySerializer(topoConf, context, config), getValueSerializer(topoConf, context, config)); } } @@ -131,13 +125,13 @@ public class RedisKeyValueStateProvider implements StateProvider { @Override public String toString() { return "StateConfig{" + - "keyClass='" + keyClass + '\'' + - ", valueClass='" + valueClass + '\'' + - ", keySerializerClass='" + keySerializerClass + '\'' + - ", valueSerializerClass='" + valueSerializerClass + '\'' + - ", jedisPoolConfig=" + jedisPoolConfig + - ", jedisClusterConfig=" + jedisClusterConfig + - '}'; + "keyClass='" + keyClass + '\'' + + ", valueClass='" + valueClass + '\'' + + ", keySerializerClass='" + keySerializerClass + '\'' + + ", valueSerializerClass='" + valueSerializerClass + '\'' + + ", jedisPoolConfig=" + jedisPoolConfig + + ", jedisClusterConfig=" + jedisClusterConfig + + '}'; } } http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisMapState.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisMapState.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisMapState.java index bf45fe4..6058b97 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisMapState.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisMapState.java @@ -1,38 +1,31 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.trident.state; import com.google.common.collect.ImmutableMap; import com.google.common.collect.Maps; -import org.apache.storm.trident.state.JSONNonTransactionalSerializer; -import org.apache.storm.trident.state.JSONOpaqueSerializer; -import org.apache.storm.trident.state.JSONTransactionalSerializer; -import org.apache.storm.trident.state.Serializer; -import org.apache.storm.trident.state.StateType; -import org.apache.storm.trident.state.map.IBackingMap; - import java.util.ArrayList; import java.util.Collections; import java.util.EnumMap; import java.util.HashMap; import java.util.List; import java.util.Map; +import org.apache.storm.trident.state.JSONNonTransactionalSerializer; +import org.apache.storm.trident.state.JSONOpaqueSerializer; +import org.apache.storm.trident.state.JSONTransactionalSerializer; +import org.apache.storm.trident.state.Serializer; +import org.apache.storm.trident.state.StateType; +import org.apache.storm.trident.state.map.IBackingMap; /** * AbstractRedisMapState is base class of any RedisMapState, which implements IBackingMap. @@ -48,9 +41,9 @@ import java.util.Map; */ public abstract class AbstractRedisMapState<T> implements IBackingMap<T> { public static final EnumMap<StateType, Serializer> DEFAULT_SERIALIZERS = Maps.newEnumMap(ImmutableMap.of( - StateType.NON_TRANSACTIONAL, new JSONNonTransactionalSerializer(), - StateType.TRANSACTIONAL, new JSONTransactionalSerializer(), - StateType.OPAQUE, new JSONOpaqueSerializer() + StateType.NON_TRANSACTIONAL, new JSONNonTransactionalSerializer(), + StateType.TRANSACTIONAL, new JSONTransactionalSerializer(), + StateType.OPAQUE, new JSONOpaqueSerializer() )); /** http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateQuerier.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateQuerier.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateQuerier.java index 9dbe4a8..0005989 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateQuerier.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateQuerier.java @@ -1,33 +1,26 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.trident.state; -import org.apache.storm.tuple.Values; import com.google.common.collect.Lists; +import java.util.List; import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; import org.apache.storm.redis.common.mapper.RedisLookupMapper; import org.apache.storm.trident.operation.TridentCollector; import org.apache.storm.trident.state.BaseQueryFunction; import org.apache.storm.trident.state.State; import org.apache.storm.trident.tuple.TridentTuple; - -import java.util.List; +import org.apache.storm.tuple.Values; /** * AbstractRedisStateQuerier is base class of any RedisStateQuerier, which implements BaseQueryFunction. @@ -38,9 +31,9 @@ import java.util.List; * @param <T> type of State */ public abstract class AbstractRedisStateQuerier<T extends State> extends BaseQueryFunction<T, List<Values>> { - private final RedisLookupMapper lookupMapper; protected final RedisDataTypeDescription.RedisDataType dataType; protected final String additionalKey; + private final RedisLookupMapper lookupMapper; /** * Constructor http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateUpdater.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateUpdater.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateUpdater.java index 53c7b2b..84a32f7 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateUpdater.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/AbstractRedisStateUpdater.java @@ -1,23 +1,20 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.trident.state; +import java.util.HashMap; +import java.util.List; +import java.util.Map; import org.apache.storm.redis.common.mapper.RedisDataTypeDescription; import org.apache.storm.redis.common.mapper.RedisStoreMapper; import org.apache.storm.trident.operation.TridentCollector; @@ -25,10 +22,6 @@ import org.apache.storm.trident.state.BaseStateUpdater; import org.apache.storm.trident.state.State; import org.apache.storm.trident.tuple.TridentTuple; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - /** * AbstractRedisStateUpdater is base class of any RedisStateUpdater, which implements BaseStateUpdater. * <p/> @@ -38,11 +31,10 @@ import java.util.Map; * @param <T> type of State */ public abstract class AbstractRedisStateUpdater<T extends State> extends BaseStateUpdater<T> { - private final RedisStoreMapper storeMapper; - - protected int expireIntervalSec = 0; protected final RedisDataTypeDescription.RedisDataType dataType; protected final String additionalKey; + private final RedisStoreMapper storeMapper; + protected int expireIntervalSec = 0; /** * Constructor http://git-wip-us.apache.org/repos/asf/storm/blob/e3f5b138/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/KeyFactory.java ---------------------------------------------------------------------- diff --git a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/KeyFactory.java b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/KeyFactory.java index 9d22aa5..cc8c06a 100644 --- a/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/KeyFactory.java +++ b/external/storm-redis/src/main/java/org/apache/storm/redis/trident/state/KeyFactory.java @@ -1,19 +1,13 @@ /** - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at + * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version + * 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at * <p> * http://www.apache.org/licenses/LICENSE-2.0 * <p> - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions + * and limitations under the License. */ package org.apache.storm.redis.trident.state; @@ -48,8 +42,9 @@ public interface KeyFactory extends Serializable { */ @Override public String build(List<Object> key) { - if (key.size() != 1) + if (key.size() != 1) { throw new RuntimeException("Default KeyFactory does not support compound keys"); + } return (String) key.get(0); }
