Skip to content

Commit

Permalink
looking like modules are now separated & mavenized
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewadams committed Nov 26, 2013
1 parent 62042e3 commit 7385f77
Show file tree
Hide file tree
Showing 11 changed files with 166 additions and 41 deletions.
60 changes: 54 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -82,12 +82,7 @@
<artifactId>cassandra-driver-core</artifactId>
<version>${cassandra-driver-core.version}</version>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>${cassandra-unit.version}</version>
<scope>test</scope>
</dependency>

<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
Expand Down Expand Up @@ -130,6 +125,54 @@
<optional>true</optional>
</dependency>

<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>2.2.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<version>1.1.0.1</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.9.13</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.9.13</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<version>${cassandra-unit.version}</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>cassandra-all</artifactId>
<groupId>org.apache.cassandra</groupId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit-spring</artifactId>
<version>${cassandra-unit.version}</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
Expand Down Expand Up @@ -162,6 +205,11 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
<version>2.8</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
Expand Down
10 changes: 10 additions & 0 deletions spring-cassandra/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,16 @@
<scope>provided</scope>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
Expand Down
15 changes: 12 additions & 3 deletions spring-data-cassandra-distribution/pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-cassandra-distribution</artifactId>

<packaging>pom</packaging>
Expand All @@ -16,12 +17,20 @@
<version>1.0.0.BUILD-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

<properties>
<project.root>${basedir}/..</project.root>
<dist.key>SDCASS</dist.key>
</properties>

<dependencies>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
Expand Down
53 changes: 42 additions & 11 deletions spring-data-cassandra/pom.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>

<artifactId>spring-data-cassandra</artifactId>

<name>Spring Data Cassandra - Core</name>
Expand All @@ -25,14 +26,14 @@
<groupId>${project.groupId}</groupId>
<artifactId>spring-cassandra</artifactId>
</dependency>
<!-- Spring -->

<!-- Spring -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
</dependency>

<!-- Spring Data -->
<!-- Spring Data -->
<dependency>
<groupId>${project.groupId}</groupId>
<artifactId>spring-data-commons</artifactId>
Expand All @@ -45,21 +46,51 @@
<version>1.0</version>
<optional>true</optional>
</dependency>

<!-- CDI -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<scope>provided</scope>
<optional>true</optional>
</dependency>


<dependency>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.cassandraunit</groupId>
<artifactId>cassandra-unit</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<scope>test</scope>
</dependency>

<!-- JSR 303 Validation -->
<dependency>
<groupId>javax.validation</groupId>
Expand All @@ -73,13 +104,13 @@
<artifactId>hibernate-validator</artifactId>
<scope>test</scope>
</dependency>

<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.cassandra.core.CassandraOperations;
import org.springframework.cassandra.core.CassandraTemplate;
import org.springframework.cassandra.core.Keyspace;
import org.springframework.data.cassandra.core.SpringDataKeyspace;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -74,7 +74,7 @@ public abstract class AbstractCassandraConfiguration implements BeanClassLoaderA
public abstract Cluster cluster() throws Exception;

/**
* Creates a {@link Session} to be used by the {@link Keyspace}. Will use the {@link Cluster} instance configured in
* Creates a {@link Session} to be used by the {@link SpringDataKeyspace}. Will use the {@link Cluster} instance configured in
* {@link #cluster()}.
*
* @see #cluster()
Expand All @@ -93,7 +93,7 @@ public Session session() throws Exception {
}

/**
* Creates a {@link Keyspace} to be used by the {@link CassandraTemplate}. Will use the {@link Session} instance
* Creates a {@link SpringDataKeyspace} to be used by the {@link CassandraTemplate}. Will use the {@link Session} instance
* configured in {@link #session()} and {@link CassandraConverter} configured in {@link #converter()}.
*
* @see #cluster()
Expand All @@ -102,8 +102,8 @@ public Session session() throws Exception {
* @throws Exception
*/
@Bean
public Keyspace keyspace() throws Exception {
return new Keyspace(getKeyspaceName(), session(), converter());
public SpringDataKeyspace keyspace() throws Exception {
return new SpringDataKeyspace(getKeyspaceName(), session(), converter());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cassandra.core.Keyspace;
import org.springframework.data.cassandra.core.SpringDataKeyspace;
import org.springframework.cassandra.core.SessionCallback;
import org.springframework.cassandra.support.CassandraExceptionTranslator;
import org.springframework.cassandra.support.exception.CassandraTableExistsException;
Expand All @@ -30,7 +30,7 @@ public class CassandraAdminTemplate implements CassandraAdminOperations {

private static Logger log = LoggerFactory.getLogger(CassandraAdminTemplate.class);

private Keyspace keyspace;
private SpringDataKeyspace keyspace;
private Session session;
private CassandraConverter converter;
private MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext;
Expand All @@ -42,11 +42,11 @@ public class CassandraAdminTemplate implements CassandraAdminOperations {
*
* @param keyspace must not be {@literal null}.
*/
public CassandraAdminTemplate(Keyspace keyspace) {
public CassandraAdminTemplate(SpringDataKeyspace keyspace) {
setKeyspace(keyspace);
}

protected CassandraAdminTemplate setKeyspace(Keyspace keyspace) {
protected CassandraAdminTemplate setKeyspace(SpringDataKeyspace keyspace) {
Assert.notNull(keyspace);
this.keyspace = keyspace;
return setSession(keyspace.getSession()).setCassandraConverter(keyspace.getCassandraConverter());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.cassandra.core.Keyspace;
import org.springframework.data.cassandra.core.SpringDataKeyspace;
import org.springframework.cassandra.support.CassandraExceptionTranslator;
import org.springframework.dao.DataAccessException;
import org.springframework.dao.InvalidDataAccessApiUsageException;
Expand Down Expand Up @@ -55,7 +55,7 @@
* @author Alex Shvid
*/

public class CassandraKeyspaceFactoryBean implements FactoryBean<Keyspace>, InitializingBean, DisposableBean,
public class CassandraKeyspaceFactoryBean implements FactoryBean<SpringDataKeyspace>, InitializingBean, DisposableBean,
BeanClassLoaderAware, PersistenceExceptionTranslator {

private static final Logger log = LoggerFactory.getLogger(CassandraKeyspaceFactoryBean.class);
Expand All @@ -72,7 +72,7 @@ public class CassandraKeyspaceFactoryBean implements FactoryBean<Keyspace>, Init
private CassandraConverter converter;
private MappingContext<? extends CassandraPersistentEntity<?>, CassandraPersistentProperty> mappingContext;

private Keyspace keyspaceBean;
private SpringDataKeyspace keyspaceBean;

private KeyspaceAttributes keyspaceAttributes;

Expand All @@ -82,7 +82,7 @@ public void setBeanClassLoader(ClassLoader classLoader) {
this.beanClassLoader = classLoader;
}

public Keyspace getObject() {
public SpringDataKeyspace getObject() {
return keyspaceBean;
}

Expand Down Expand Up @@ -245,7 +245,7 @@ public void afterPropertiesSet() throws Exception {
// initialize property
this.session = session;

this.keyspaceBean = new Keyspace(keyspace, session, converter);
this.keyspaceBean = new SpringDataKeyspace(keyspace, session, converter);
}

private void createNewTable(Session session, String useTableName, CassandraPersistentEntity<?> entity)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
package org.springframework.data.cassandra.core;

import org.springframework.cassandra.core.Keyspace;
import org.springframework.data.cassandra.convert.CassandraConverter;
import org.springframework.util.Assert;

import com.datastax.driver.core.Session;

/**
* @deprecated This needs more thought.
*/
@Deprecated
public class SpringDataKeyspace extends Keyspace {

private CassandraConverter converter;

public SpringDataKeyspace(String keyspace, Session session, CassandraConverter converter) {
super(keyspace, session);
setCassandraConverter(converter);
}

public CassandraConverter getCassandraConverter() {
return converter;
}

private void setCassandraConverter(CassandraConverter converter) {
Assert.notNull(converter);
this.converter = converter;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ protected <T> BasicCassandraPersistentEntity<T> createPersistentEntity(TypeInfor
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {

this.context = applicationContext;
super.setApplicationContext(applicationContext);
}

}
Loading

0 comments on commit 7385f77

Please sign in to comment.