MongoSessionConverter -> AbstractMongoSessionConverter
Using Abstract prefix follows conventions for abstract classes beginning with Abstract. This also opens up the door to introduce a MongoSessionConverter interface in the future. Issue gh-17
This commit is contained in:
@@ -19,9 +19,9 @@ import java.util.List;
|
||||
* @author Jakub Kubrynski
|
||||
* @since 1.2
|
||||
*/
|
||||
public abstract class MongoSessionConverter implements GenericConverter {
|
||||
public abstract class AbstractMongoSessionConverter implements GenericConverter {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(MongoSessionConverter.class);
|
||||
private static final Log LOG = LogFactory.getLog(AbstractMongoSessionConverter.class);
|
||||
|
||||
protected static final String EXPIRE_AT_FIELD_NAME = "expireAt";
|
||||
|
||||
@@ -38,13 +38,13 @@ import java.util.Set;
|
||||
import static org.springframework.session.FindByIndexNameSessionRepository.PRINCIPAL_NAME_INDEX_NAME;
|
||||
|
||||
/**
|
||||
* {@code MongoSessionConverter} implementation transforming {@code MongoExpiringSession} to/from a BSON object
|
||||
* {@code AbstractMongoSessionConverter} implementation transforming {@code MongoExpiringSession} to/from a BSON object
|
||||
* using standard Java serialization
|
||||
*
|
||||
* @author Jakub Kubrynski
|
||||
* @since 1.2
|
||||
*/
|
||||
class JdkMongoSessionConverter extends MongoSessionConverter {
|
||||
class JdkMongoSessionConverter extends AbstractMongoSessionConverter {
|
||||
|
||||
private static final Log LOG = LogFactory.getLog(JdkMongoSessionConverter.class);
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ import java.util.Map;
|
||||
|
||||
/**
|
||||
* Session repository implementation which stores sessions in Mongo.
|
||||
* Uses {@link MongoSessionConverter} to transform session objects from/to
|
||||
* Uses {@link AbstractMongoSessionConverter} to transform session objects from/to
|
||||
* native Mongo representation ({@code DBObject}).
|
||||
*
|
||||
* Repository is also responsible for removing expired sessions from database.
|
||||
@@ -46,7 +46,7 @@ public class MongoOperationsSessionRepository implements FindByIndexNameSessionR
|
||||
|
||||
private final MongoOperations mongoOperations;
|
||||
|
||||
private MongoSessionConverter mongoSessionConverter = new JdkMongoSessionConverter();
|
||||
private AbstractMongoSessionConverter mongoSessionConverter = new JdkMongoSessionConverter();
|
||||
private Integer maxInactiveIntervalInSeconds = DEFAULT_INACTIVE_INTERVAL;
|
||||
private String collectionName = DEFAULT_COLLECTION_NAME;
|
||||
|
||||
@@ -121,7 +121,7 @@ public class MongoOperationsSessionRepository implements FindByIndexNameSessionR
|
||||
TypeDescriptor.valueOf(MongoExpiringSession.class), TypeDescriptor.valueOf(DBObject.class));
|
||||
}
|
||||
|
||||
public void setMongoSessionConverter(MongoSessionConverter mongoSessionConverter) {
|
||||
public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter) {
|
||||
this.mongoSessionConverter = mongoSessionConverter;
|
||||
}
|
||||
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.core.type.AnnotationMetadata;
|
||||
import org.springframework.data.mongodb.core.MongoOperations;
|
||||
import org.springframework.session.config.annotation.web.http.SpringHttpSessionConfiguration;
|
||||
import org.springframework.session.data.mongo.MongoOperationsSessionRepository;
|
||||
import org.springframework.session.data.mongo.MongoSessionConverter;
|
||||
import org.springframework.session.data.mongo.AbstractMongoSessionConverter;
|
||||
|
||||
/**
|
||||
* Configuration class registering {@code MongoSessionRepository} bean
|
||||
@@ -36,7 +36,7 @@ import org.springframework.session.data.mongo.MongoSessionConverter;
|
||||
@Configuration
|
||||
class MongoHttpSessionConfiguration extends SpringHttpSessionConfiguration implements ImportAware {
|
||||
|
||||
private MongoSessionConverter mongoSessionConverter;
|
||||
private AbstractMongoSessionConverter mongoSessionConverter;
|
||||
|
||||
private Integer maxInactiveIntervalInSeconds;
|
||||
private String collectionName;
|
||||
@@ -60,7 +60,7 @@ class MongoHttpSessionConfiguration extends SpringHttpSessionConfiguration imple
|
||||
}
|
||||
|
||||
@Autowired(required = false)
|
||||
public void setMongoSessionConverter(MongoSessionConverter mongoSessionConverter) {
|
||||
public void setMongoSessionConverter(AbstractMongoSessionConverter mongoSessionConverter) {
|
||||
this.mongoSessionConverter = mongoSessionConverter;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,7 +51,7 @@ public class MongoOperationsSessionRepositoryTests {
|
||||
@Mock
|
||||
MongoOperations mongoOperations;
|
||||
@Mock
|
||||
MongoSessionConverter converter;
|
||||
AbstractMongoSessionConverter converter;
|
||||
|
||||
MongoOperationsSessionRepository sut;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user