+ rename package from o.s.datastore to o.s.data

+ add redis as subpackage of data.keyvalue
This commit is contained in:
Costin Leau
2010-11-24 19:04:31 +02:00
parent 9636887b54
commit 74d4f73b45
66 changed files with 378 additions and 382 deletions

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis;
package org.springframework.data.keyvalue.redis;
import org.springframework.dao.DataAccessResourceFailureException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis;
package org.springframework.data.keyvalue.redis;
import org.springframework.datastore.keyvalue.UncategorizedKeyvalueStoreException;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.EnumSet;
import java.util.Map;

View File

@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import org.springframework.datastore.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.keyvalue.redis.connection.RedisZSetCommands.Tuple;
/**
* Default implementation for {@link Tuple} interface.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.Collection;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import org.springframework.datastore.redis.UncategorizedRedisException;
import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
/**
* A connection (session) to a Redis server.

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import org.springframework.dao.support.PersistenceExceptionTranslator;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.List;
import java.util.Map;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.Set;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.List;
import java.util.Map;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import java.util.Set;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jedis;
package org.springframework.data.keyvalue.redis.connection.jedis;
import java.io.IOException;
import java.lang.reflect.Field;
@@ -24,10 +24,10 @@ import java.util.Map;
import java.util.Set;
import org.springframework.dao.DataAccessException;
import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
import org.springframework.data.keyvalue.redis.connection.DataType;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.datastore.keyvalue.UncategorizedKeyvalueStoreException;
import org.springframework.datastore.redis.UncategorizedRedisException;
import org.springframework.datastore.redis.connection.DataType;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.util.ReflectionUtils;
import redis.clients.jedis.BinaryJedis;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jedis;
package org.springframework.data.keyvalue.redis.connection.jedis;
import java.util.concurrent.TimeoutException;
@@ -23,8 +23,8 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jedis;
package org.springframework.data.keyvalue.redis.connection.jedis;
import java.io.IOException;
import java.net.UnknownHostException;
@@ -26,10 +26,10 @@ import java.util.concurrent.TimeoutException;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.datastore.redis.RedisConnectionFailureException;
import org.springframework.datastore.redis.UncategorizedRedisException;
import org.springframework.datastore.redis.connection.DefaultTuple;
import org.springframework.datastore.redis.connection.RedisZSetCommands.Tuple;
import org.springframework.data.keyvalue.redis.RedisConnectionFailureException;
import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
import org.springframework.data.keyvalue.redis.connection.DefaultTuple;
import org.springframework.data.keyvalue.redis.connection.RedisZSetCommands.Tuple;
import redis.clients.jedis.JedisException;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jredis;
package org.springframework.data.keyvalue.redis.connection.jredis;
import java.nio.charset.Charset;
import java.util.Arrays;
@@ -26,10 +26,10 @@ import java.util.Set;
import org.jredis.JRedis;
import org.jredis.RedisException;
import org.springframework.dao.DataAccessException;
import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
import org.springframework.data.keyvalue.redis.connection.DataType;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.datastore.keyvalue.UncategorizedKeyvalueStoreException;
import org.springframework.datastore.redis.UncategorizedRedisException;
import org.springframework.datastore.redis.connection.DataType;
import org.springframework.datastore.redis.connection.RedisConnection;
/**
* JRedis based implementation.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jredis;
package org.springframework.data.keyvalue.redis.connection.jredis;
import java.nio.charset.Charset;
@@ -26,8 +26,8 @@ import org.jredis.ri.alphazero.connection.DefaultConnectionSpec;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.dao.DataAccessException;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jredis;
package org.springframework.data.keyvalue.redis.connection.jredis;
import java.nio.charset.Charset;
import java.util.ArrayList;
@@ -27,7 +27,7 @@ import org.jredis.RedisException;
import org.jredis.RedisType;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.datastore.redis.connection.DataType;
import org.springframework.data.keyvalue.redis.connection.DataType;
/**
* Helper class featuring methods for JRedis connection handling, providing support for exception translation.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.List;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
/**
* Redis store for a certain key. Useful for creating views into Redis 'collection' types.

View File

@@ -1,126 +1,126 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.datastore.redis.core;
import java.util.List;
import java.util.Map;
/**
* Key value operations with 'friendly' names instead of using command names for methods.
* Additional helper methods for working with keys and values
*
* @author Mark Pollack
*
*/
public interface KeyValueOperations {
// Set and Set with expiry operations
void set(String key, String value);
void set(String key, String value, long expiryInMillis);
void setAsBytes(String key, byte[] value);
void setAsBytes(String key, byte[] value, long expiryInMillis);
void convertAndSet(String key, Object value);
void convertAndSet(String key, Object value, long expiryInMillis);
// Get operations
String get(String key);
byte[] getAsBytes(String key);
<T> T getAndConvert(String key, Class<T> requiredType);
// Get and Set operations
String getAndSet(String key, String value);
byte[] getAndSetBytes(String key, byte[] value);
<T> T getAndSetObject(String key, T value, Class<T> requiredType);
// Multi-get operations
List<String> getValues(List<String> keys);
<T> List<T> getAndConvertValues(List<String> keys, Class<T> requiredType);
// Set if non-existent operations
void setIfKeyNonExistent(String key, String value);
void setIfKeyNonExistent(String key, byte[] value);
void convertAndSetIfKeyNonExistent(String key, Object value);
// Multiple key-value set
void setMultiple(Map<String, String> keysAndValues);
void setMultipleAsBytes(Map<String, byte[]> keysAndValues);
<T> void convertAndSetMultiple(Map<String, T> keysAndValues);
// Multiple key-value set if non-existent
void setMultipleIfKeysNonExistent(Map<String, String> keysAndValues);
void setMultipleAsBytesIfKeysNonExistent(Map<String, byte[]> keysAndValues);
<T> void convertAndSetMultipleIfKeysNonExistent(Map<String, T> keysAndValues);
// Append
int append(String key, String value);
// Increment
int increment(String key);
int incrementBy(String key, int value);
// Decrement
int decrement(String key);
int decrementBy(String key, int value);
// Substring
String getSubString(String key, int fromIndex, int toIndex);
boolean containsKey(String key);
boolean deleteKeys(String... keys);
}
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.data.keyvalue.redis.core;
import java.util.List;
import java.util.Map;
/**
* Key value operations with 'friendly' names instead of using command names for methods.
* Additional helper methods for working with keys and values
*
* @author Mark Pollack
*
*/
public interface KeyValueOperations {
// Set and Set with expiry operations
void set(String key, String value);
void set(String key, String value, long expiryInMillis);
void setAsBytes(String key, byte[] value);
void setAsBytes(String key, byte[] value, long expiryInMillis);
void convertAndSet(String key, Object value);
void convertAndSet(String key, Object value, long expiryInMillis);
// Get operations
String get(String key);
byte[] getAsBytes(String key);
<T> T getAndConvert(String key, Class<T> requiredType);
// Get and Set operations
String getAndSet(String key, String value);
byte[] getAndSetBytes(String key, byte[] value);
<T> T getAndSetObject(String key, T value, Class<T> requiredType);
// Multi-get operations
List<String> getValues(List<String> keys);
<T> List<T> getAndConvertValues(List<String> keys, Class<T> requiredType);
// Set if non-existent operations
void setIfKeyNonExistent(String key, String value);
void setIfKeyNonExistent(String key, byte[] value);
void convertAndSetIfKeyNonExistent(String key, Object value);
// Multiple key-value set
void setMultiple(Map<String, String> keysAndValues);
void setMultipleAsBytes(Map<String, byte[]> keysAndValues);
<T> void convertAndSetMultiple(Map<String, T> keysAndValues);
// Multiple key-value set if non-existent
void setMultipleIfKeysNonExistent(Map<String, String> keysAndValues);
void setMultipleAsBytesIfKeysNonExistent(Map<String, byte[]> keysAndValues);
<T> void convertAndSetMultipleIfKeysNonExistent(Map<String, T> keysAndValues);
// Append
int append(String key, String value);
// Increment
int increment(String key);
int incrementBy(String key, int value);
// Decrement
int decrement(String key);
int decrementBy(String key, int value);
// Substring
String getSubString(String key, int fromIndex, int toIndex);
boolean containsKey(String key);
boolean deleteKeys(String... keys);
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.List;

View File

@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.util.Assert;
/**

View File

@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
/**
* Callback interface for Redis code. To be used with {@link RedisTemplate} execution methods, often as anonymous

View File

@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.transaction.support.ResourceHolder;
import org.springframework.transaction.support.ResourceHolderSynchronization;
import org.springframework.transaction.support.TransactionSynchronizationManager;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.InvocationTargetException;
@@ -25,11 +25,11 @@ import java.util.LinkedHashSet;
import java.util.List;
import java.util.Set;
import org.springframework.datastore.redis.connection.RedisConnection;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.datastore.redis.serializer.RedisSerializer;
import org.springframework.datastore.redis.serializer.SimpleRedisSerializer;
import org.springframework.datastore.redis.serializer.StringRedisSerializer;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.serializer.RedisSerializer;
import org.springframework.data.keyvalue.redis.serializer.SimpleRedisSerializer;
import org.springframework.data.keyvalue.redis.serializer.StringRedisSerializer;
import org.springframework.transaction.support.TransactionSynchronizationManager;
import org.springframework.util.Assert;
import org.springframework.util.ClassUtils;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import java.util.Set;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.serializer;
package org.springframework.data.keyvalue.redis.serializer;
/**
* Basic interface serialization and deserialization of Objects to byte arrays.

View File

@@ -13,12 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.serializer;
package org.springframework.data.keyvalue.redis.serializer;
import org.springframework.core.convert.converter.Converter;
import org.springframework.core.serializer.support.DeserializingConverter;
import org.springframework.core.serializer.support.SerializingConverter;
import org.springframework.datastore.redis.UncategorizedRedisException;
import org.springframework.data.keyvalue.redis.UncategorizedRedisException;
/**
* Simple Redis serializer delegating to the default serializer in Spring 3.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.serializer;
package org.springframework.data.keyvalue.redis.serializer;
import java.nio.charset.Charset;

View File

@@ -1,118 +1,118 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.datastore.redis.util;
import java.util.AbstractCollection;
import java.util.Collection;
import org.springframework.datastore.redis.core.RedisOperations;
/**
* Base implementation for Redis collections.
*
* @author Costin Leau
*/
public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> implements RedisStore<String> {
public static final String ENCODING = "UTF-8";
protected final String key;
protected final RedisOperations<String, E> operations;
public <K> AbstractRedisCollection(String key, RedisOperations<String, E> operations) {
this.key = key;
this.operations = operations;
}
@Override
public String getKey() {
return key;
}
@Override
public RedisOperations<String, E> getOperations() {
return operations;
}
@Override
public boolean addAll(Collection<? extends E> c) {
boolean modified = false;
for (E e : c) {
modified |= add(e);
}
return modified;
}
public abstract boolean add(E e);
public abstract void clear();
@Override
public boolean containsAll(Collection<?> c) {
boolean contains = true;
for (Object object : c) {
contains &= contains(object);
}
return contains;
}
public abstract boolean remove(Object o);
@Override
public boolean removeAll(Collection<?> c) {
boolean modified = false;
for (Object object : c) {
modified |= remove(object);
}
return modified;
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof RedisStore) {
return key.equals(((RedisStore) o).getKey());
}
if (o instanceof AbstractRedisCollection) {
return o.hashCode() == hashCode();
}
return false;
}
@Override
public int hashCode() {
int result = 17 + getClass().hashCode();
result = result * 31 + key.hashCode();
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("RedisStore for key:");
sb.append(getKey());
return sb.toString();
}
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.data.keyvalue.redis.util;
import java.util.AbstractCollection;
import java.util.Collection;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Base implementation for Redis collections.
*
* @author Costin Leau
*/
public abstract class AbstractRedisCollection<E> extends AbstractCollection<E> implements RedisStore<String> {
public static final String ENCODING = "UTF-8";
protected final String key;
protected final RedisOperations<String, E> operations;
public <K> AbstractRedisCollection(String key, RedisOperations<String, E> operations) {
this.key = key;
this.operations = operations;
}
@Override
public String getKey() {
return key;
}
@Override
public RedisOperations<String, E> getOperations() {
return operations;
}
@Override
public boolean addAll(Collection<? extends E> c) {
boolean modified = false;
for (E e : c) {
modified |= add(e);
}
return modified;
}
public abstract boolean add(E e);
public abstract void clear();
@Override
public boolean containsAll(Collection<?> c) {
boolean contains = true;
for (Object object : c) {
contains &= contains(object);
}
return contains;
}
public abstract boolean remove(Object o);
@Override
public boolean removeAll(Collection<?> c) {
boolean modified = false;
for (Object object : c) {
modified |= remove(object);
}
return modified;
}
public boolean retainAll(Collection<?> c) {
throw new UnsupportedOperationException();
}
@Override
public boolean equals(Object o) {
if (o == this)
return true;
if (o instanceof RedisStore) {
return key.equals(((RedisStore) o).getKey());
}
if (o instanceof AbstractRedisCollection) {
return o.hashCode() == hashCode();
}
return false;
}
@Override
public int hashCode() {
int result = 17 + getClass().hashCode();
result = result * 31 + key.hashCode();
return result;
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("RedisStore for key:");
sb.append(getKey());
return sb.toString();
}
}

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Arrays;
import java.util.Collection;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Collection;
import java.util.Iterator;
@@ -21,8 +21,8 @@ import java.util.List;
import java.util.ListIterator;
import java.util.NoSuchElementException;
import org.springframework.datastore.redis.core.ListOperations;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.ListOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Default implementation for {@link RedisList}.

View File

@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Set;
import org.springframework.datastore.redis.connection.RedisCommands;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.connection.RedisCommands;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Default {@link RedisMap} implementation.
@@ -39,7 +39,7 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
*
* @param entry
*/
public DefaultRedisMapEntry(org.springframework.datastore.redis.connection.RedisHashCommands.Entry entry) {
public DefaultRedisMapEntry(org.springframework.data.keyvalue.redis.connection.RedisHashCommands.Entry entry) {
this.key = entry.getField();
this.value = entry.getValue();
}
@@ -122,11 +122,11 @@ public class DefaultRedisMap<K, V> implements RedisMap<K, V> {
return createEntrySet(commands.hGetAll(redisKey));
}
private Set<java.util.Map.Entry<String, String>> createEntrySet(Set<org.springframework.datastore.redis.connection.RedisHashCommands.Entry> entries) {
private Set<java.util.Map.Entry<String, String>> createEntrySet(Set<org.springframework.data.keyvalue.redis.connection.RedisHashCommands.Entry> entries) {
Set<java.util.Map.Entry<String, String>> result = new LinkedHashSet<java.util.Map.Entry<String, String>>(
entries.size());
for (org.springframework.datastore.redis.connection.RedisHashCommands.Entry entry : entries) {
for (org.springframework.data.keyvalue.redis.connection.RedisHashCommands.Entry entry : entries) {
result.add(new DefaultRedisMapEntry(entry));
}
return result;

View File

@@ -13,13 +13,13 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Iterator;
import java.util.Set;
import org.springframework.datastore.redis.core.BoundSetOperations;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.BoundSetOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Default implementation for {@link RedisSet}.

View File

@@ -13,15 +13,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Comparator;
import java.util.Iterator;
import java.util.Set;
import java.util.SortedSet;
import org.springframework.datastore.redis.core.BoundZSetOperations;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.BoundZSetOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Default implementation for {@link RedisSortedSet}.

View File

@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.io.Serializable;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Atomic integer backed by Redis.

View File

@@ -13,11 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.io.Serializable;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**
* Atomic long backed by Redis.

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Iterator;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.List;
import java.util.Queue;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Map;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Set;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.Set;
import java.util.SortedSet;

View File

@@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
/**

View File

@@ -1,20 +0,0 @@
/*
* Copyright 2010 the original author or authors.
*
* Licensed 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.
*/
package org.springframework.datastore.keyvalue.redis;
public class PlaceHolder {
}

View File

@@ -5,6 +5,6 @@
<description>Example configuration to get you started.</description>
<bean id="service" class="org.springframework.datastore.ExampleService" />
<bean id="service" class="org.springframework.data.ExampleService" />
</beans>

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis;
package org.springframework.data.keyvalue.redis;
import java.io.Serializable;

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis;
package org.springframework.data.keyvalue.redis;
import java.io.Serializable;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection;
package org.springframework.data.keyvalue.redis.connection;
import static org.junit.Assert.*;
import static org.junit.Assume.*;
@@ -22,7 +22,9 @@ import static org.junit.Assume.*;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.datastore.redis.Person;
import org.springframework.data.keyvalue.redis.Person;
import org.springframework.data.keyvalue.redis.connection.RedisConnection;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
public abstract class AbstractConnectionIntegrationTests {

View File

@@ -14,10 +14,11 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jedis;
package org.springframework.data.keyvalue.redis.connection.jedis;
import org.springframework.datastore.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.jedis.JedisConnectionFactory;
public class JedisConnectionIntegrationTests extends AbstractConnectionIntegrationTests {

View File

@@ -14,10 +14,11 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.connection.jredis;
package org.springframework.data.keyvalue.redis.connection.jredis;
import org.springframework.datastore.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.datastore.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.AbstractConnectionIntegrationTests;
import org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory;
import org.springframework.data.keyvalue.redis.connection.jredis.JredisConnectionFactory;
public class JRedisConnectionIntegrationTests extends AbstractConnectionIntegrationTests {

View File

@@ -14,11 +14,12 @@
* limitations under the License.
*/
package org.springframework.datastore.redis.core;
package org.springframework.data.keyvalue.redis.core;
import org.junit.Before;
import org.junit.Test;
import org.springframework.datastore.redis.Person;
import org.springframework.data.keyvalue.redis.Person;
import org.springframework.data.keyvalue.redis.core.RedisTemplate;
public class RedisTemplateIntegrationTests {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.serializer;
package org.springframework.data.keyvalue.redis.serializer;
import static org.junit.Assert.*;
@@ -23,8 +23,10 @@ import java.util.UUID;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.datastore.redis.Address;
import org.springframework.datastore.redis.Person;
import org.springframework.data.keyvalue.redis.Address;
import org.springframework.data.keyvalue.redis.Person;
import org.springframework.data.keyvalue.redis.serializer.RedisSerializer;
import org.springframework.data.keyvalue.redis.serializer.SimpleRedisSerializer;
public class SimpleRedisSerializerTests {

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import static org.hamcrest.CoreMatchers.equalTo;
@@ -34,6 +34,8 @@ import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.keyvalue.redis.util.AbstractRedisCollection;
import org.springframework.data.keyvalue.redis.util.RedisStore;
/**

View File

@@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import static org.junit.Assert.*;
@@ -23,6 +23,7 @@ import java.util.NoSuchElementException;
import org.junit.Before;
import org.junit.Test;
import org.springframework.data.keyvalue.redis.util.RedisList;
/**
* Integration test for RedisList

View File

@@ -13,14 +13,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.UUID;
import org.springframework.datastore.redis.Address;
import org.springframework.datastore.redis.Person;
import org.springframework.datastore.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.datastore.redis.core.RedisTemplate;
import org.springframework.data.keyvalue.redis.Address;
import org.springframework.data.keyvalue.redis.Person;
import org.springframework.data.keyvalue.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.keyvalue.redis.core.RedisTemplate;
import org.springframework.data.keyvalue.redis.util.AbstractRedisCollection;
import org.springframework.data.keyvalue.redis.util.DefaultRedisList;
import org.springframework.data.keyvalue.redis.util.RedisStore;
/**

View File

@@ -13,13 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.datastore.redis.util;
package org.springframework.data.keyvalue.redis.util;
import java.util.UUID;
import org.springframework.datastore.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.datastore.redis.core.RedisOperations;
import org.springframework.datastore.redis.core.RedisTemplate;
import org.springframework.data.keyvalue.redis.connection.jedis.JedisConnectionFactory;
import org.springframework.data.keyvalue.redis.core.RedisOperations;
import org.springframework.data.keyvalue.redis.core.RedisTemplate;
import org.springframework.data.keyvalue.redis.util.AbstractRedisCollection;
import org.springframework.data.keyvalue.redis.util.DefaultRedisList;
import org.springframework.data.keyvalue.redis.util.RedisStore;
/**