Skip to content

Commit 7696f5a

Browse files
schauderodrotbohm
authored andcommitted
Initial setup of infrastructure.
Created a maven project based on Spring Data JPA. Created JdbcRepositoryFactory, which actually creates Repositories. Wired the construction of meta data. Implemented a dummy version of saving an entity to demonstrate availability of meta data. Included a simple test for exercising the JdbcRepositoryFactory and the resulting JdbcRepository. Related pull request: #5.
1 parent 74b4d64 commit 7696f5a

File tree

9 files changed

+605
-0
lines changed

9 files changed

+605
-0
lines changed

pom.xml

Lines changed: 208 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,208 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
5+
<modelVersion>4.0.0</modelVersion>
6+
7+
<groupId>org.springframework.data</groupId>
8+
<artifactId>spring-data-jdbc</artifactId>
9+
<version>1.0.0.BUILD-SNAPSHOT</version>
10+
11+
<name>Spring Data JDBC</name>
12+
<description>Spring Data module for JDBC repositories.</description>
13+
<url>http://projects.spring.io/spring-data-jdbc</url>
14+
15+
<parent>
16+
<groupId>org.springframework.data.build</groupId>
17+
<artifactId>spring-data-parent</artifactId>
18+
<version>2.0.0.BUILD-SNAPSHOT</version>
19+
</parent>
20+
21+
<properties>
22+
23+
<dist.key>DATAJDBC</dist.key>
24+
25+
<springdata.commons>2.0.0.BUILD-SNAPSHOT</springdata.commons>
26+
27+
<sonar.dynamicAnalysis>reuseReports</sonar.dynamicAnalysis>
28+
<hsqldb1>1.8.0.10</hsqldb1>
29+
30+
</properties>
31+
32+
<profiles>
33+
<profile>
34+
<id>release</id>
35+
<build>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.jfrog.buildinfo</groupId>
39+
<artifactId>artifactory-maven-plugin</artifactId>
40+
<inherited>false</inherited>
41+
</plugin>
42+
</plugins>
43+
</build>
44+
</profile>
45+
</profiles>
46+
47+
<dependencies>
48+
49+
<dependency>
50+
<groupId>${project.groupId}</groupId>
51+
<artifactId>spring-data-commons</artifactId>
52+
<version>${springdata.commons}</version>
53+
</dependency>
54+
55+
<dependency>
56+
<groupId>org.springframework</groupId>
57+
<artifactId>spring-tx</artifactId>
58+
</dependency>
59+
60+
<dependency>
61+
<groupId>org.springframework</groupId>
62+
<artifactId>spring-context</artifactId>
63+
</dependency>
64+
65+
<dependency>
66+
<groupId>org.springframework</groupId>
67+
<artifactId>spring-beans</artifactId>
68+
</dependency>
69+
70+
<dependency>
71+
<groupId>org.springframework</groupId>
72+
<artifactId>spring-core</artifactId>
73+
<exclusions>
74+
<exclusion>
75+
<groupId>commons-logging</groupId>
76+
<artifactId>commons-logging</artifactId>
77+
</exclusion>
78+
</exclusions>
79+
</dependency>
80+
81+
<dependency>
82+
<groupId>org.hsqldb</groupId>
83+
<artifactId>hsqldb</artifactId>
84+
<version>2.2.8</version>
85+
<scope>test</scope>
86+
</dependency>
87+
<dependency>
88+
<groupId>org.springframework</groupId>
89+
<artifactId>spring-jdbc</artifactId>
90+
</dependency>
91+
92+
93+
</dependencies>
94+
95+
<build>
96+
<plugins>
97+
98+
<!--
99+
Jacoco plugin redeclared to make sure it's downloaded and
100+
the agents can be explicitly added to the test executions.
101+
-->
102+
<plugin>
103+
<groupId>org.jacoco</groupId>
104+
<artifactId>jacoco-maven-plugin</artifactId>
105+
<version>${jacoco}</version>
106+
<configuration>
107+
<destFile>${jacoco.destfile}</destFile>
108+
</configuration>
109+
<executions>
110+
<execution>
111+
<id>jacoco-initialize</id>
112+
<goals>
113+
<goal>prepare-agent</goal>
114+
</goals>
115+
</execution>
116+
</executions>
117+
</plugin>
118+
119+
<plugin>
120+
<groupId>org.apache.maven.plugins</groupId>
121+
<artifactId>maven-surefire-plugin</artifactId>
122+
<version>2.12</version>
123+
<dependencies>
124+
<dependency>
125+
<groupId>org.springframework</groupId>
126+
<artifactId>spring-instrument</artifactId>
127+
<version>${spring}</version>
128+
<scope>runtime</scope>
129+
</dependency>
130+
<dependency>
131+
<groupId>org.hsqldb</groupId>
132+
<artifactId>hsqldb</artifactId>
133+
<version>${hsqldb1}</version>
134+
<scope>runtime</scope>
135+
</dependency>
136+
</dependencies>
137+
<executions>
138+
<execution>
139+
<id>default-test</id>
140+
<configuration>
141+
<excludes>
142+
<exclude>**/*</exclude>
143+
</excludes>
144+
</configuration>
145+
</execution>
146+
<execution>
147+
<id>unit-tests</id>
148+
<goals>
149+
<goal>test</goal>
150+
</goals>
151+
<phase>test</phase>
152+
<configuration>
153+
<includes>
154+
<include>**/*UnitTests.java</include>
155+
</includes>
156+
</configuration>
157+
</execution>
158+
<execution>
159+
<id>integration-tests</id>
160+
<goals>
161+
<goal>test</goal>
162+
</goals>
163+
<phase>test</phase>
164+
<configuration>
165+
<includes>
166+
<include>**/*IntegrationTests.java</include>
167+
<include>**/*Tests.java</include>
168+
</includes>
169+
<excludes>
170+
<exclude>**/*UnitTests.java</exclude>
171+
\ </excludes>
172+
<argLine>
173+
-javaagent:${settings.localRepository}/org/jacoco/org.jacoco.agent/${jacoco}/org.jacoco.agent-${jacoco}-runtime.jar=destfile=${jacoco.destfile}
174+
</argLine>
175+
</configuration>
176+
</execution>
177+
</executions>
178+
</plugin>
179+
<plugin>
180+
<groupId>org.apache.maven.plugins</groupId>
181+
<artifactId>maven-assembly-plugin</artifactId>
182+
</plugin>
183+
<plugin>
184+
<groupId>org.codehaus.mojo</groupId>
185+
<artifactId>wagon-maven-plugin</artifactId>
186+
</plugin>
187+
<plugin>
188+
<groupId>org.asciidoctor</groupId>
189+
<artifactId>asciidoctor-maven-plugin</artifactId>
190+
</plugin>
191+
</plugins>
192+
</build>
193+
194+
<repositories>
195+
<repository>
196+
<id>spring-libs-snapshot</id>
197+
<url>https://repo.spring.io/libs-snapshot</url>
198+
</repository>
199+
</repositories>
200+
201+
<pluginRepositories>
202+
<pluginRepository>
203+
<id>spring-plugins-snapshot</id>
204+
<url>https://repo.spring.io/plugins-snapshot</url>
205+
</pluginRepository>
206+
</pluginRepositories>
207+
208+
</project>
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.jdbc.mapping.context;
17+
18+
import java.beans.PropertyDescriptor;
19+
import java.lang.reflect.Field;
20+
import org.springframework.data.jdbc.mapping.model.JdbcPersistentEntity;
21+
import org.springframework.data.jdbc.mapping.model.JdbcPersistentProperty;
22+
import org.springframework.data.mapping.context.AbstractMappingContext;
23+
import org.springframework.data.mapping.model.SimpleTypeHolder;
24+
import org.springframework.data.util.TypeInformation;
25+
26+
/**
27+
* @author Jens Schauder
28+
*/
29+
public class JdbcMappingContext extends AbstractMappingContext<JdbcPersistentEntity<?>, JdbcPersistentProperty> {
30+
31+
32+
@Override
33+
protected <T> JdbcPersistentEntity createPersistentEntity(TypeInformation<T> typeInformation) {
34+
return new JdbcPersistentEntity(typeInformation);
35+
}
36+
37+
@Override
38+
protected JdbcPersistentProperty createPersistentProperty(Field field, PropertyDescriptor descriptor, JdbcPersistentEntity owner, SimpleTypeHolder simpleTypeHolder) {
39+
return new JdbcPersistentProperty(field, descriptor, owner, simpleTypeHolder);
40+
}
41+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*
2+
* Copyright 2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.jdbc.mapping.model;
17+
18+
import org.springframework.data.mapping.model.BasicPersistentEntity;
19+
import org.springframework.data.util.TypeInformation;
20+
21+
/**
22+
* @author Jens Schauder
23+
*/
24+
public class JdbcPersistentEntity<T> extends BasicPersistentEntity<T, JdbcPersistentProperty> {
25+
26+
public JdbcPersistentEntity(TypeInformation<T> information) {
27+
super(information);
28+
}
29+
}
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
/*
2+
* Copyright 2017 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
package org.springframework.data.jdbc.mapping.model;
17+
18+
import java.beans.PropertyDescriptor;
19+
import java.lang.reflect.Field;
20+
import org.springframework.data.mapping.Association;
21+
import org.springframework.data.mapping.PersistentEntity;
22+
import org.springframework.data.mapping.model.AnnotationBasedPersistentProperty;
23+
import org.springframework.data.mapping.model.SimpleTypeHolder;
24+
25+
/**
26+
* @author Jens Schauder
27+
*/
28+
public class JdbcPersistentProperty extends AnnotationBasedPersistentProperty<JdbcPersistentProperty> {
29+
30+
/**
31+
* Creates a new {@link AnnotationBasedPersistentProperty}.
32+
*
33+
* @param field must not be {@literal null}.
34+
* @param propertyDescriptor can be {@literal null}.
35+
* @param owner must not be {@literal null}.
36+
* @param simpleTypeHolder
37+
*/
38+
public JdbcPersistentProperty(Field field, PropertyDescriptor propertyDescriptor, PersistentEntity<?, JdbcPersistentProperty> owner, SimpleTypeHolder simpleTypeHolder) {
39+
super(field, propertyDescriptor, owner, simpleTypeHolder);
40+
}
41+
42+
@Override
43+
protected Association<JdbcPersistentProperty> createAssociation() {
44+
return null;
45+
}
46+
}

0 commit comments

Comments
 (0)