looking like modules are now separated & mavenized

This commit is contained in:
Matthew Adams
2013-11-26 09:04:09 -06:00
parent 62042e361e
commit 7385f77705
11 changed files with 166 additions and 41 deletions

60
pom.xml
View File

@@ -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>
@@ -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>
@@ -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>

View File

@@ -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>

View File

@@ -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>
@@ -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>

View File

@@ -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>
@@ -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>
@@ -45,7 +46,7 @@
<version>1.0</version>
<optional>true</optional>
</dependency>
<!-- CDI -->
<dependency>
<groupId>javax.enterprise</groupId>
@@ -53,13 +54,43 @@
<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>
@@ -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>

View File

@@ -22,7 +22,7 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
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;
@@ -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()
@@ -93,7 +93,7 @@ public abstract class AbstractCassandraConfiguration implements BeanClassLoaderA
}
/**
* 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()
@@ -102,8 +102,8 @@ public abstract class AbstractCassandraConfiguration implements BeanClassLoaderA
* @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());
}
/**

View File

@@ -5,7 +5,7 @@ import java.util.Map;
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;
@@ -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;
@@ -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());

View File

@@ -24,7 +24,7 @@ import org.springframework.beans.factory.BeanClassLoaderAware;
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;
@@ -55,7 +55,7 @@ import com.datastax.driver.core.exceptions.NoHostAvailableException;
* @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);
@@ -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;
@@ -82,7 +82,7 @@ public class CassandraKeyspaceFactoryBean implements FactoryBean<Keyspace>, Init
this.beanClassLoader = classLoader;
}
public Keyspace getObject() {
public SpringDataKeyspace getObject() {
return keyspaceBean;
}
@@ -245,7 +245,7 @@ public class CassandraKeyspaceFactoryBean implements FactoryBean<Keyspace>, Init
// 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)

View File

@@ -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;
}
}

View File

@@ -77,9 +77,6 @@ public class CassandraMappingContext extends
*/
@Override
public void setApplicationContext(ApplicationContext applicationContext) throws BeansException {
this.context = applicationContext;
super.setApplicationContext(applicationContext);
}
}

View File

@@ -11,7 +11,7 @@ import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cassandra.core.Keyspace;
import org.springframework.data.cassandra.core.SpringDataKeyspace;
import org.springframework.context.ApplicationContext;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@@ -39,10 +39,9 @@ public class CassandraNamespaceTests {
Assert.isInstanceOf(Cluster.class, cluster);
Object ks = ctx.getBean("cassandra-keyspace");
Assert.notNull(ks);
Assert.isInstanceOf(Keyspace.class, ks);
Assert.isInstanceOf(SpringDataKeyspace.class, ks);
Cluster c = (Cluster) cluster;
System.out.println(org.apache.commons.beanutils.BeanUtils.describe(c.getConfiguration()));
}
@After

View File

@@ -1,6 +1,6 @@
Bundle-SymbolicName: org.springframework.data.cassandra
Bundle-Name: Spring Data Cassandra
Bundle-Vendor: Mirantis
Bundle-Vendor: Spring Data Cassandra Community
Bundle-ManifestVersion: 2
Import-Package:
sun.reflect;version="0";resolution:=optional
@@ -16,6 +16,7 @@ Import-Template:
org.springframework.transaction.support.*;version="[3.1.0, 4.0.0)",
org.springframework.data.*;version="[1.5.0, 2.0.0)",
org.springframework.expression.*;version="[3.1.0, 4.0.0)",
org.springframework.cassandra.*;version="[1.0.0,2.0.0)",
org.aopalliance.*;version="[1.0.0, 2.0.0)";resolution:=optional,
org.apache.commons.logging.*;version="[1.1.1, 2.0.0)",
org.w3c.dom.*;version="0",