-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit e349669
Showing
33 changed files
with
2,587 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
Spring Integration JPA Adapters | ||
=============================== | ||
|
||
#Overview | ||
|
||
The the project contains the JPA adapters for the Spring integration. | ||
We currently have the | ||
|
||
* The Inbound Channel Adapter | ||
* The Outbound Channel Adapter | ||
* The Outbound Gateway for JPA in the project | ||
|
||
#Instructions | ||
|
||
* Checkout the project and execute mvn eclipse:eclipse, this will setup the project for eclipse | ||
* The three test classes for inbound channel adapter, outbound gateway and outbound channel adapter | ||
are present in the src/java/test |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>org.springframework.integration</groupId> | ||
<artifactId>spring-integration-jpa</artifactId> | ||
<version>2.1.0.BUILD-SNAPSHOT</version> | ||
<name>Spring Integration JPA Adapter Support</name> | ||
<licenses> | ||
<license> | ||
<name>The Apache Software License, Version 2.0</name> | ||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url> | ||
<distribution>repo</distribution> | ||
</license> | ||
</licenses> | ||
<build> | ||
<resources> | ||
<resource> | ||
<directory>src/main/java</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
<resource> | ||
<directory>src/main/resources</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
</resource> | ||
</resources> | ||
<testResources> | ||
<testResource> | ||
<directory>src/test/java</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</testResource> | ||
<testResource> | ||
<directory>src/test/resources</directory> | ||
<includes> | ||
<include>**/*</include> | ||
</includes> | ||
</testResource> | ||
</testResources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<configuration> | ||
<source>1.5</source> | ||
<target>1.5</target> | ||
</configuration> | ||
</plugin> | ||
<plugin> | ||
<artifactId>maven-surefire-plugin</artifactId> | ||
<configuration> | ||
<includes> | ||
<include>**/*Tests.java</include> | ||
</includes> | ||
<excludes> | ||
<exclude>**/*Abstract*.java</exclude> | ||
</excludes> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
<repositories> | ||
<repository> | ||
<id>SpringSource External Bundle Repository</id> | ||
<url>http://repository.springsource.com/maven/bundles/external/</url> | ||
</repository> | ||
<repository> | ||
<id>SpringSource Milestone Repository</id> | ||
<url>http://maven.springframework.org/milestone/</url> | ||
</repository> | ||
<repository> | ||
<id>SpringSource Release Bundle Repository</id> | ||
<url>http://repository.springsource.com/maven/bundles/release/</url> | ||
</repository> | ||
<repository> | ||
<id>SpringSource Release Repository</id> | ||
<url>http://maven.springframework.org/release/</url> | ||
</repository> | ||
</repositories> | ||
<dependencies> | ||
<dependency> | ||
<groupId>org.springframework.integration</groupId> | ||
<artifactId>spring-integration-core</artifactId> | ||
<version>2.1.0.BUILD-SNAPSHOT</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context-support</artifactId> | ||
<version>3.0.6.RELEASE</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-orm</artifactId> | ||
<version>3.0.6.RELEASE</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>3.0.6.RELEASE</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-jdbc</artifactId> | ||
<version>3.0.6.RELEASE</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>cglib</groupId> | ||
<artifactId>cglib-nodep</artifactId> | ||
<version>2.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>commons-logging</groupId> | ||
<artifactId>commons-logging</artifactId> | ||
<version>1.1.1</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.easymock</groupId> | ||
<artifactId>easymock</artifactId> | ||
<version>2.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.easymock</groupId> | ||
<artifactId>easymockclassextension</artifactId> | ||
<version>2.3</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hamcrest</groupId> | ||
<artifactId>hamcrest-all</artifactId> | ||
<version>1.1</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.mockito</groupId> | ||
<artifactId>mockito-all</artifactId> | ||
<version>1.8.4</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate.javax.persistence</groupId> | ||
<artifactId>hibernate-jpa-2.0-api</artifactId> | ||
<version>1.0.0.Final</version> | ||
<scope>compile</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.hibernate</groupId> | ||
<artifactId>hibernate-entitymanager</artifactId> | ||
<version>3.5.5-Final</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit-dep</artifactId> | ||
<version>4.8.2</version> | ||
<scope>test</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>com.h2database</groupId> | ||
<artifactId>h2</artifactId> | ||
<version>1.3.160</version> | ||
</dependency> | ||
<!-- Include the commons dependency here rather than log4j --> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-log4j12</artifactId> | ||
<version>1.5.10</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.slf4j</groupId> | ||
<artifactId>slf4j-api</artifactId> | ||
<version>1.5.10</version> | ||
<scope>runtime</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>log4j</groupId> | ||
<artifactId>log4j</artifactId> | ||
<version>1.2.16</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
<properties> | ||
<project.build.sourceEncoding>UTF8</project.build.sourceEncoding> | ||
</properties> | ||
</project> |
83 changes: 83 additions & 0 deletions
83
src/main/java/org/springframework/integration/jpa/AbstractJPAQlParameterSourceFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
/* | ||
* Copyright 2002-2011 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.springframework.integration.jpa; | ||
|
||
import java.util.ArrayList; | ||
import java.util.Collection; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
import org.springframework.integration.jpa.core.JpaQLParameterSource; | ||
|
||
|
||
/** | ||
* The abstract super class for all the {@link JPAQLParameterSourceFactory} | ||
* | ||
* @author Amol Nayak | ||
* | ||
*/ | ||
public abstract class AbstractJPAQlParameterSourceFactory implements JpaQLParameterSourceFactory { | ||
|
||
protected Map<String, Object> staticParameters = new HashMap<String, Object>(); | ||
|
||
protected AbstractJPAQlParameterSourceFactory(Map<String, Object> staticParameters) { | ||
if(staticParameters != null) | ||
this.staticParameters = staticParameters; | ||
} | ||
|
||
public Map<String, Object> getStaticParameters() { | ||
return staticParameters; | ||
} | ||
|
||
public void setStaticParameters(Map<String, Object> staticParameters) { | ||
this.staticParameters = staticParameters; | ||
} | ||
|
||
/** | ||
* Implemented for {@link JPAQLParameterSourceFactory} | ||
*/ | ||
public final JpaQLParameterSource createSource(Object obj) { | ||
return createConcreteSource(obj); | ||
} | ||
|
||
/** | ||
* Implemented for {@link JPAQLParameterSourceFactory} | ||
*/ | ||
public final Collection<String> getAllParameterNames() { | ||
Collection<String> allParams = new ArrayList<String>(); | ||
if(staticParameters != null && !staticParameters.isEmpty()) | ||
allParams.addAll(staticParameters.keySet()); | ||
|
||
Collection<String> subClassParams = getParameterNames(); | ||
if(subClassParams != null && !subClassParams.isEmpty()) | ||
allParams.addAll(subClassParams); | ||
|
||
return allParams; | ||
} | ||
|
||
/** | ||
* The implementing classes should return an instance of itself | ||
* @return | ||
*/ | ||
protected abstract JpaQLParameterSource createConcreteSource(Object obj); | ||
|
||
/** | ||
* Gets all the parameter names defined in the implementing subclass | ||
* @return | ||
*/ | ||
protected abstract Collection<String> getParameterNames(); | ||
|
||
} |
Oops, something went wrong.