Commit Graph

1292 Commits

Author SHA1 Message Date
Christoph Strobl
f732b5f6b9 DATAREDIS-438 - Polishing.
RedisGeoCommands now take and return Spring Data domain types like Distance and GeoResults.
Updated JavaDoc and Reference documentation.
Added and updated author and license headers.
Fixed minor formatting and code style issues.

Original Pulll Request: #187
2016-05-23 07:07:50 +02:00
Ninad Divadkar
b0e20d3da8 DATAREDIS-438 - Add support for geo commands.
Original Pulll Request: #187
CLA: 169220160326121428 (Ninad Divadkar)
2016-05-18 16:04:45 +02:00
Mark Paluch
83359a9c4f DATAREDIS-469 - Polishing.
Return zero (0) in getAndSet to prevent NullPointerExceptions. Remove trailing whitespace. Add tests for existing methods. Simplify tests.

Original pull request: #182.
2016-05-13 14:35:27 +02:00
Christoph Strobl
20cfd3e76c DATAREDIS-469 - Throw DataRetrievalFailureException for atomic numbers when key is removed.
We now throw DataRetrievalFailureException in case of get() when the underlying key storing the value of an AtomicInteger, AtomicLong or AtomicDouble is removed from Redis.

Original pull request: #182.
2016-05-13 14:34:55 +02:00
Mark Paluch
d097a64bc6 DATAREDIS-423 - Polishing.
Extend documentation. Reformat JavaDoc. Adjust test method names.

Original pull request: #197.
2016-05-13 12:50:49 +02:00
Christoph Strobl
568e41f8dd DATAREDIS-423 - Add support for Jackson2 based HashMapper.
Added FasterXML Jackson `ObjectMapper` based `HashMapper` implementation that allows flattening.

```java
class Person {
  String firstname;
  String lastname;
  Address address;
}

class Address {
  String city;
  String country;
}
```

```bash
firstname:Jon
lastname:Snow
address:{ city : Castle Black, country : The North }

firstname:Jon
lastname:Snow
address.city:Castle Black
address.country:The North
```

Original pull request: #197.
2016-05-13 12:49:46 +02:00
Mark Paluch
b1a3559db1 DATAREDIS-509 - Polishing.
Update license headers. Add test for index resolver using an indexed primitive array.

Original pull request: #196.
2016-05-09 15:13:32 +02:00
Christoph Strobl
16b692c899 DATAREDIS-509 - Fix handling of primitive arrays in MappingRedisConverter.
We now correctly convert arrays of primitive values.

Original pull request: #196.
2016-05-09 14:59:39 +02:00
Christoph Strobl
f2cee266e3 DATAREDIS-507 - Polishing.
Added missing author and issue reference.

Original Pull Request: #195
2016-05-04 08:37:16 +02:00
Mark Paluch
ebbcd95c6d DATAREDIS-507 - Do not destroy RedisConnectionFactory in RedisKeyValueAdapter.destroy.
Do not destroy RedisConnectionFactory which is likely managed outside of RedisKeyValueAdapter. 
This change makes sure to retain a working connection factory while shutting down message listeners as those try to unsubscribe on shutdown.

Original Pull Request: #195
2016-05-04 08:36:31 +02:00
Mark Paluch
c1476b701b DATAREDIS-503 - Polishing.
Rename ConvertingHashMapper to ObjectHashMapper. Add fromHash with type to avoid casting. Add JavaDoc documentation to HashMapper. Add hash mapping to reference documentation.

Original pull request: #194.
2016-05-02 09:07:10 +02:00
Christoph Strobl
359c3e4533 DATAREDIS-503 - Add HashMapper implementation based on MappingRedisConverter.
We now support mapping of simple and complex types to Redis HASH structures applying the same structure as the Repository support. This allows Object to hash Mapping and its direct usage via RedisTemplate without the need of explicitly having to use the repository abstraction.

Original pull request: #194.
2016-05-02 09:06:28 +02:00
Christoph Strobl
f5ecd3a9b1 DATAREDIS-501 - Use application context ClassLoader as default for JdkSerializationRedisSerializer in RedisTemplate.
We now pick up the ClassLoader from the ApplicationContext and use the latter as default in RedisTemplate for initializing the JdkSerializationRedisSerializer. We only do this in case the default serializer has not been set explicitly.

Original pull request: #192.
2016-04-26 15:12:11 +02:00
Christoph Strobl
652b1b8354 DATAREDIS-489 - Add type hints for Object types.
We now store the type hint for simple types when the declaring bean property does not match the actual value type.
2016-04-15 11:09:36 +02:00
Christoph Strobl
14e44880c7 DATAREDIS-492 - Polishing.
Added some more tests and fix read operation.

Original Pull Request: #189
2016-04-15 11:09:13 +02:00
Greg Turnquist
2492fbe332 DATAREDIS-492 - Handle serializing arrays and collections.
Original Pull Request: #189
2016-04-15 11:09:13 +02:00
Christoph Strobl
deec98efc6 DATAREDIS-498 - Favor Collections.sort over List.sort which requires Java 8. 2016-04-15 11:08:33 +02:00
Oliver Gierke
7da2e3b2f2 DATAREDIS-486 - Updated changelog. 2016-04-06 23:14:27 +02:00
Oliver Gierke
f11bc83e46 DATAREDIS-484 - After release cleanups. 2016-04-06 16:37:03 +02:00
Oliver Gierke
6e5df14794 DATAREDIS-484 - Prepare next development iteration. 2016-04-06 16:37:00 +02:00
Oliver Gierke
59b6b93abc DATAREDIS-484 - Release version 1.7 GA (Hopper). 2016-04-06 16:35:59 +02:00
Oliver Gierke
96358c430d DATAREDIS-484 - Prepare 1.7 GA (Hopper). 2016-04-06 16:34:46 +02:00
Oliver Gierke
8c6519896f DATAREDIS-484 - Updated changelog. 2016-04-06 16:34:41 +02:00
Mark Paluch
4dc61c3744 DATAREDIS-485 - Point to the appropriate Jira project. 2016-04-05 14:18:47 +02:00
Mark Paluch
a826c3eea9 DATAREDIS-485 - Add pull request template.
Original pull request: #188.
2016-04-05 09:19:53 +02:00
Mark Paluch
bef4fbe831 DATAREDIS-444 - Polishing.
Add author name. Update license header. Reformat code. Add JavaDoc to hash operations.

Original pull request: #184.
2016-03-29 10:30:55 +02:00
Ninad Divadkar
5f9d005cb3 DATAREDIS-444 - Return result of delete in DefaultHashOperation.
Delete in DefaultHashOperation returns now the result of the HDEL command.

Original pull request: #184.
CLA: 169220160326121428 (Ninad Divadkar)
2016-03-29 09:25:57 +02:00
Christoph Strobl
1b3fe81b61 DATAREDIS-482 - Provide meaningful exception messages in MappingRedisConverter.
Original pull request: #183.
2016-03-24 14:49:58 +01:00
Mark Paluch
b3243ff328 DATAREDIS-480 - Polishing.
Add missing author tag. Minor reformatting. Explicitly set default SSL options and add test to verify default SSL options. Enhance JavaDoc.

Original pull request: #180.
2016-03-22 11:06:10 +01:00
Balazs Nemeth
8edfb2b94e DATAREDIS-480 - Add support for all lettuce SSL options.
LettuceConnectionFactory now supports verifyPeer and startTls options for Redis Standalone usage.

Original pull request: #180.
CLA: 166820160311101157 (Balázs Németh)
2016-03-22 11:00:13 +01:00
Oliver Gierke
93bad424d1 DATAREDIS-475 - After release cleanups. 2016-03-18 11:16:08 +01:00
Oliver Gierke
41b6e8a171 DATAREDIS-475 - Prepare next development iteration. 2016-03-18 11:15:51 +01:00
Oliver Gierke
6e2d2683d1 DATAREDIS-475 - Release version 1.7 RC1 (Hopper). 2016-03-18 11:15:00 +01:00
Oliver Gierke
5d5ff81cd2 DATAREDIS-475 - Prepare 1.7 RC1 (Hopper). 2016-03-18 11:06:58 +01:00
Oliver Gierke
c82351b638 DATAREDIS-475 - Updated changelog. 2016-03-18 11:06:55 +01:00
Christoph Strobl
4783a0c361 DATAREDIS-427 - Polishing.
Use ShadowingClassLoader instead of a self written one.

Original Pull Request: #179
2016-03-17 14:16:08 +01:00
Mark Paluch
77630d0820 DATAREDIS-427 - Allow construction of customized JdkSerializationRedisSerializer.
We now allow constructing JdkSerializationRedisSerializer using an own class loader and by specifying custom converters.

Using an own class-loader: new JdkSerializationRedisSerializer(classLoader)

Using own converters (Serializer/Deserializer): new JdkSerializationRedisSerializer(new SerializingConverter(), new DeserializingConverter(new DefaultDeserializer(classLoader)))

Original Pull Request: #179
2016-03-17 14:15:46 +01:00
Christoph Strobl
648e35a11a DATAREDIS-479 - Polishing.
Assert that not all values of a scan operation are captured by the first result and add tests to also run using the lettuce driver.

Original Pull Request: #178
2016-03-16 09:37:12 +01:00
Mark Paluch
77de777da8 DATAREDIS-479 - Upgrade to jedis to 2.8.1.
Update jedis driver to 2.8.1. Use binary method for SSCAN and implement ZSCAN and HSCAN methods. Move ScanOptions to ScanParams conversion to JedisConverters.

Original Pull Request: #178
2016-03-15 14:32:37 +01:00
Mark Paluch
069954ee7a DATAREDIS-476 - Polishing.
Add author and getter method for SSL property. Apply formatting. Create test to validate SSL setting is set correctly in the lettuce driver.

Original pull request: #177.
2016-03-15 09:17:37 +01:00
Balazs Nemeth
a9d8a6b388 DATAREDIS-476 - Add SSL support to LettuceConnectionFactory.
Original pull request: #177.
CLA: 166820160311101157 (Balázs Németh)
2016-03-15 09:17:37 +01:00
Mark Paluch
754639d137 DATAREDIS-478 - Upgrade to lettuce 3.4.2.Final. 2016-03-15 08:15:07 +01:00
Christoph Strobl
8f129b16f9 DATAREDIS-425 - Preserve item order in list, update documentation.
We now preserve the item order when converting list elements. This does not mean that we place elements at the exact position retrieved from the store but rather maintain their order based on the index value.

Additionally applied some documentation polishing and cluster tests.

Original Pull Request: #156
2016-03-14 10:41:58 +01:00
Christoph Strobl
9eb309c495 DATAREDIS-425 - Adapted to changes in Spring Data KeyValue APIs.
Default query initialization changed to new, so we can delete some code here. 

Original Pull Request: #156
2016-03-14 10:41:23 +01:00
Oliver Gierke
2cc30553a8 DATAREDIS-425 - Adapted to changes in Spring Data KeyValue APIs.
We now favor shadowing fields over using protected accessor methods.

Original Pull Request: #156
2016-03-14 10:40:31 +01:00
Mark Paluch
92274a8450 DATAREDIS-425 - Add JSR-310 support, CDI extension and Update reference documentation.
We ship converters for JSR-310 types (LocalDate/Time, ZonedDateTime, Period, Duration and ZoneId) to map between UTF-8-encoded byte[] and JDK 8 date/time types.

We also export Redis Repositories in a CDI environment. Repositories can be injected using @Inject. The CDI extension requires at least RedisOperations to be provided. Other beans like RedisKeyValueAdapter and RedisKeyValueTemplate can be provided by the user. If no RedisKeyValueAdapter/RedisKeyValueTemplate beans are found, the CDI extension creates own managed instances.

Original Pull Request: #156
2016-03-14 10:39:50 +01:00
Christoph Strobl
4362c58a8a DATAREDIS-425 - CRUD operation and index resolution refinements.
- Add a composite IndexResolver implementation that iterates over a given collection of delegate IndexResolver instances and collects IndexedData from those.
- Break up cycle involving ReferenceResolver and let the resolver just returns the raw hash.
- Remove IndexType and use dedicated classes for index definitions.
- Fix pagination error and follow up to changes introduced via DATAKV-123.

Original Pull Request: #156
2016-03-14 10:38:52 +01:00
Rob Winch
059ac9fabb DATAREDIS-425 - Add SpelIndexResolver
This commit adds support for adding an index using SpEL expressions.

Original PR #160
2016-03-14 10:38:20 +01:00
Rob Winch
40c2582302 DATAREDIS-425 - Support distinct indexName
This commit adds support for distinguishing between
the property path that is being indexed and the
name of the index that should be used.

This is useful when you do not want the property
path and index name to be the same. For example,
if you want to use Spel expressions, it may not be
possible to use the path as the name of the index.

Original PR #160
2016-03-14 10:38:12 +01:00
Christoph Strobl
bd7728e6ad DATAREDIS-425 - Add Support for basic CRUD and finder Operations backed by Hashes and Sets.
We now enable storing domain object as a flat Redis 'HASH' and maintain additional 'SET' structures to enable finder operations on simple properties.

  @RedisHash("persons");
  class Person {

    @id String id;
    @Indexed String firstname;
    String lastname;

    Map<String, String> attributes;

    City city;

    @Reference Person mother;
  }

The above is stored in the HASH with key 'persons:1' as

  _class = org.example.Person
  id = 1
  firstname = rand
  lastname = al’thor
  attributes.[eye-color] = grey
  attributes.[hair-color] = red
  city.name = emond's field
  city.region = two rivers
  mother = persons:2

Complex types are flattened out to their full property path for each of the values provided. If the properties actual value type does not match the declared one the '_class' type hint is added to the entry.

  city._class = CityInAndor.class
  city.name = emond's field
  city.region = two rivers
  city.country = andor

Map and Collection like structures are stored with their key/index values as part of the property path. If the map/collection value type does not match the actutal objects one the '_class' type hint is added to the entry.

  list.[0]._class = DomainType.class
  list.[0].property1 = ...

  map.[key-1]._class = DomainType.class
  map.[key-1].property1 = ...

Properties marked with '@Reference' are stored as semantic references by just storing the key to the referenced object 'HASH' instead of embedding its values.

   mother = persons:2

Please note that referenced objects are not transitively updated/saved and that lazy loading of references will be part of future development.

A 'save' operation therefore executes the following:

  # flatten domain type and add as hash
  HMSET persons:1 id 1 firstname rand …

  # add the newly inserted entry to the list of all entries of that type
  SADD persons 1

  # index the firstname for finder lookup
  SADD persons.firstname:rand 1

Simple finder operation like 'findByFirstname' use 'SINTER' to find matching

  SINTER persons.firstname:rand
  HGETALL persons:1

Besides resolving an index via the '@Index' annotation we also allow to add custom configuration via the 'indexConfiguration' attribute of '@EnableRedisRepositories'.

  @Configuration
  @EnableRedisRepositories(indexConfiguration = CustomIndexConfiguration.class)
  class Config { }

  static class CustomIndexConfiguration extends IndexConfiguration {

    @Override
    protected Iterable<RedisIndexDefinition> initialConfiguration() {
      return Arrays.asList(
        new SimpleIndexDefinition("persons", "lastname"),
      );
    }
  }

The '@TimeToLive' annotation allows to define a property or method providing an expiration time when storing the key in redis.

@RedisHash
class Person {

  @Id String id;
  @TimeToLive Long ttl;
}

Original Pull Request: #156
2016-03-14 10:37:53 +01:00