Skip to content

Commit eb5bbe4

Browse files
author
Thomas Risberg
committed
added new cross-store module
1 parent 068780c commit eb5bbe4

File tree

12 files changed

+451
-1
lines changed

12 files changed

+451
-1
lines changed

spring-data-document-parent/pom.xml

+17
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@
1616
<org.mockito.version>1.8.4</org.mockito.version>
1717
<org.slf4j.version>1.5.10</org.slf4j.version>
1818
<org.springframework.version>3.0.5.RELEASE</org.springframework.version>
19+
<data.commons.version>1.0.0.BUILD-SNAPSHOT</data.commons.version>
20+
<aspectj.version>1.6.11.M2</aspectj.version>
1921
</properties>
2022
<profiles>
2123
<profile>
@@ -111,6 +113,11 @@
111113
<artifactId>spring-tx</artifactId>
112114
<version>${org.springframework.version}</version>
113115
</dependency>
116+
<dependency>
117+
<groupId>org.springframework</groupId>
118+
<artifactId>spring-orm</artifactId>
119+
<version>${org.springframework.version}</version>
120+
</dependency>
114121
<dependency>
115122
<groupId>org.springframework</groupId>
116123
<artifactId>spring-test</artifactId>
@@ -119,6 +126,16 @@
119126
</dependency>
120127

121128
<!-- Spring Data -->
129+
<dependency>
130+
<groupId>org.springframework.data</groupId>
131+
<artifactId>spring-data-commons-core</artifactId>
132+
<version>${data.commons.version}</version>
133+
</dependency>
134+
<dependency>
135+
<groupId>org.springframework.data</groupId>
136+
<artifactId>spring-data-commons-aspects</artifactId>
137+
<version>${data.commons.version}</version>
138+
</dependency>
122139
<dependency>
123140
<groupId>org.springframework.data</groupId>
124141
<artifactId>spring-data-document-core</artifactId>
+10
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry including="**/*.java" kind="src" output="target/classes" path="src/main/java"/>
4+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources"/>
5+
<classpathentry including="**/*.java" kind="src" output="target/test-classes" path="src/test/java"/>
6+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources"/>
7+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
8+
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
9+
<classpathentry kind="output" path="target/classes"/>
10+
</classpath>
+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>spring-data-mongodb-cross-store</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.ajdt.core.ajbuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.maven.ide.eclipse.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.ajdt.ui.ajnature</nature>
21+
<nature>org.eclipse.jdt.core.javanature</nature>
22+
<nature>org.maven.ide.eclipse.maven2Nature</nature>
23+
</natures>
24+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Mon Feb 28 16:26:01 EST 2011
2+
eclipse.preferences.version=1
3+
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5
4+
org.eclipse.jdt.core.compiler.compliance=1.5
5+
org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning
6+
org.eclipse.jdt.core.compiler.source=1.5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#Mon Feb 28 16:25:59 EST 2011
2+
activeProfiles=
3+
eclipse.preferences.version=1
4+
fullBuildGoals=process-test-resources
5+
resolveWorkspaceProjects=true
6+
resourceFilterGoals=process-resources resources\:testResources
7+
skipCompilerPlugin=true
8+
version=1
+203
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,203 @@
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
4+
<parent>
5+
<groupId>org.springframework.data</groupId>
6+
<artifactId>spring-data-document-parent</artifactId>
7+
<version>1.0.0.BUILD-SNAPSHOT</version>
8+
<relativePath>../spring-data-document-parent/pom.xml</relativePath>
9+
</parent>
10+
<artifactId>spring-data-mongodb-cross-store</artifactId>
11+
<packaging>jar</packaging>
12+
<name>Spring Data MongoDB Cross-store Persistence Support</name>
13+
<dependencies>
14+
15+
<!-- Spring -->
16+
<dependency>
17+
<groupId>org.springframework</groupId>
18+
<artifactId>spring-beans</artifactId>
19+
</dependency>
20+
<dependency>
21+
<groupId>org.springframework</groupId>
22+
<artifactId>spring-tx</artifactId>
23+
</dependency>
24+
<dependency>
25+
<groupId>org.springframework</groupId>
26+
<artifactId>spring-orm</artifactId>
27+
</dependency>
28+
29+
<!-- Spring Data -->
30+
<dependency>
31+
<groupId>org.springframework.data</groupId>
32+
<artifactId>spring-data-commons-core</artifactId>
33+
</dependency>
34+
<dependency>
35+
<groupId>org.springframework.data</groupId>
36+
<artifactId>spring-data-commons-aspects</artifactId>
37+
</dependency>
38+
<dependency>
39+
<groupId>org.springframework.data</groupId>
40+
<artifactId>spring-data-mongodb</artifactId>
41+
</dependency>
42+
43+
44+
<!-- Logging -->
45+
<dependency>
46+
<groupId>org.slf4j</groupId>
47+
<artifactId>slf4j-api</artifactId>
48+
</dependency>
49+
<dependency>
50+
<groupId>org.slf4j</groupId>
51+
<artifactId>jcl-over-slf4j</artifactId>
52+
<scope>compile</scope>
53+
</dependency>
54+
<dependency>
55+
<groupId>org.slf4j</groupId>
56+
<artifactId>slf4j-log4j12</artifactId>
57+
<scope>runtime</scope>
58+
</dependency>
59+
<dependency>
60+
<groupId>log4j</groupId>
61+
<artifactId>log4j</artifactId>
62+
<exclusions>
63+
<exclusion>
64+
<groupId>javax.mail</groupId>
65+
<artifactId>mail</artifactId>
66+
</exclusion>
67+
<exclusion>
68+
<groupId>javax.jms</groupId>
69+
<artifactId>jms</artifactId>
70+
</exclusion>
71+
<exclusion>
72+
<groupId>com.sun.jdmk</groupId>
73+
<artifactId>jmxtools</artifactId>
74+
</exclusion>
75+
<exclusion>
76+
<groupId>com.sun.jmx</groupId>
77+
<artifactId>jmxri</artifactId>
78+
</exclusion>
79+
</exclusions>
80+
<scope>runtime</scope>
81+
</dependency>
82+
83+
<dependency>
84+
<groupId>javax.annotation</groupId>
85+
<artifactId>jsr250-api</artifactId>
86+
<optional>true</optional>
87+
</dependency>
88+
89+
<dependency>
90+
<groupId>org.mockito</groupId>
91+
<artifactId>mockito-all</artifactId>
92+
<scope>test</scope>
93+
</dependency>
94+
95+
<dependency>
96+
<groupId>junit</groupId>
97+
<artifactId>junit</artifactId>
98+
</dependency>
99+
100+
<dependency>
101+
<groupId>org.aspectj</groupId>
102+
<artifactId>aspectjrt</artifactId>
103+
<version>${aspectj.version}</version>
104+
</dependency>
105+
<dependency>
106+
<groupId>cglib</groupId>
107+
<artifactId>cglib</artifactId>
108+
<version>2.2</version>
109+
</dependency>
110+
111+
<!-- JPA -->
112+
<dependency>
113+
<groupId>org.hibernate.javax.persistence</groupId>
114+
<artifactId>hibernate-jpa-2.0-api</artifactId>
115+
<version>1.0.0.Final</version>
116+
</dependency>
117+
118+
<!-- For Tests -->
119+
<dependency>
120+
<groupId>org.hibernate</groupId>
121+
<artifactId>hibernate-entitymanager</artifactId>
122+
<version>3.5.5-Final</version>
123+
<scope>test</scope>
124+
</dependency>
125+
<dependency>
126+
<groupId>hsqldb</groupId>
127+
<artifactId>hsqldb</artifactId>
128+
<version>1.8.0.10</version>
129+
<scope>test</scope>
130+
</dependency>
131+
<dependency>
132+
<groupId>javax.validation</groupId>
133+
<artifactId>validation-api</artifactId>
134+
<version>1.0.0.GA</version>
135+
</dependency>
136+
<dependency>
137+
<groupId>org.hibernate</groupId>
138+
<artifactId>hibernate-validator</artifactId>
139+
<version>4.0.2.GA</version>
140+
<scope>test</scope>
141+
</dependency>
142+
143+
</dependencies>
144+
<repositories>
145+
<repository>
146+
<id>jboss-repository</id>
147+
<name>JBoss Public Repository</name>
148+
<url>http://repository.jboss.org/nexus/content/groups/public-jboss</url>
149+
</repository>
150+
<repository>
151+
<id>spring-maven-snapshot</id>
152+
<snapshots>
153+
<enabled>true</enabled>
154+
</snapshots>
155+
<name>Springframework Maven SNAPSHOT Repository</name>
156+
<url>http://maven.springframework.org/snapshot</url>
157+
</repository>
158+
</repositories>
159+
<build>
160+
<plugins>
161+
<plugin>
162+
<groupId>org.codehaus.mojo</groupId>
163+
<artifactId>aspectj-maven-plugin</artifactId>
164+
<version>1.2</version>
165+
<dependencies>
166+
<dependency>
167+
<groupId>org.aspectj</groupId>
168+
<artifactId>aspectjrt</artifactId>
169+
<version>${aspectj.version}</version>
170+
</dependency>
171+
<dependency>
172+
<groupId>org.aspectj</groupId>
173+
<artifactId>aspectjtools</artifactId>
174+
<version>${aspectj.version}</version>
175+
</dependency>
176+
</dependencies>
177+
<executions>
178+
<execution>
179+
<goals>
180+
<goal>compile</goal>
181+
<goal>test-compile</goal>
182+
</goals>
183+
</execution>
184+
</executions>
185+
<configuration>
186+
<outxml>true</outxml>
187+
<aspectLibraries>
188+
<aspectLibrary>
189+
<groupId>org.springframework</groupId>
190+
<artifactId>spring-aspects</artifactId>
191+
</aspectLibrary>
192+
<!--aspectLibrary>
193+
<groupId>org.springframework.data</groupId>
194+
<artifactId>spring-data-commons-aspects</artifactId>
195+
</aspectLibrary-->
196+
</aspectLibraries>
197+
<source>1.6</source>
198+
<target>1.6</target>
199+
</configuration>
200+
</plugin>
201+
</plugins>
202+
</build>
203+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
package org.springframework.persistence.document;
2+
3+
import java.lang.annotation.ElementType;
4+
import java.lang.annotation.Retention;
5+
import java.lang.annotation.RetentionPolicy;
6+
import java.lang.annotation.Target;
7+
8+
/**
9+
* Annotation to denote an object that should be transparently persisted
10+
* using MongoDB
11+
*
12+
* @author Thomas Risberg
13+
*/
14+
15+
@Retention(RetentionPolicy.RUNTIME)
16+
@Target(ElementType.TYPE)
17+
public @interface DocumentEntity {
18+
19+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
package org.springframework.data.document.persistence;
2+
3+
import javax.persistence.Entity;
4+
5+
@Entity
6+
public class Account {
7+
8+
private String name;
9+
10+
private float balance;
11+
12+
private String friendlyName;
13+
14+
private String whatever;
15+
16+
public String getName() {
17+
return name;
18+
}
19+
20+
public void setName(String name) {
21+
this.name = name;
22+
}
23+
24+
public float getBalance() {
25+
return balance;
26+
}
27+
28+
public void setBalance(float balance) {
29+
this.balance = balance;
30+
}
31+
32+
public String getFriendlyName() {
33+
return friendlyName;
34+
}
35+
36+
public void setFriendlyName(String friendlyName) {
37+
this.friendlyName = friendlyName;
38+
}
39+
40+
public String getWhatever() {
41+
return whatever;
42+
}
43+
44+
public void setWhatever(String whatever) {
45+
this.whatever = whatever;
46+
}
47+
48+
49+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
package org.springframework.data.document.persistence;
2+
3+
import org.junit.Assert;
4+
import org.junit.Test;
5+
import org.junit.runner.RunWith;
6+
import org.springframework.beans.factory.annotation.Autowired;
7+
import org.springframework.test.annotation.Rollback;
8+
import org.springframework.test.context.ContextConfiguration;
9+
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
10+
import org.springframework.transaction.annotation.Transactional;
11+
12+
import com.mongodb.Mongo;
13+
14+
@RunWith(SpringJUnit4ClassRunner.class)
15+
@ContextConfiguration(locations = "classpath:/META-INF/spring/applicationContext.xml")
16+
public class CrossStoreMongoTests {
17+
18+
@Autowired
19+
private Mongo mongo;
20+
21+
@Test
22+
// @Transactional
23+
// @Rollback(false)
24+
public void testUserConstructor() {
25+
int age = 33;
26+
MongoPerson p = new MongoPerson("Thomas", age);
27+
//Assert.assertEquals(p.getRedisValue().getString("RedisPerson.name"), p.getName());
28+
Assert.assertEquals(age, p.getAge());
29+
p.birthday();
30+
Assert.assertEquals(1 + age, p.getAge());
31+
}
32+
33+
}

0 commit comments

Comments
 (0)