You are viewing a plain text version of this content. The canonical link for it is here.
Posted to server-dev@james.apache.org by no...@apache.org on 2010/02/03 15:19:19 UTC
svn commit: r906060 - in /james/server/trunk: ./ jpa-store/
jpa-store/src/main/java/org/apache/james/server/jpa/
jpa-store/src/test/java/org/apache/james/server/jpa/
Author: norman
Date: Wed Feb 3 14:19:18 2010
New Revision: 906060
URL: http://svn.apache.org/viewvc?rev=906060&view=rev
Log:
Add jpa-store to maven build ( need some more love )
Added:
james/server/trunk/jpa-store/pom.xml
Modified:
james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUser.java
james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java
james/server/trunk/jpa-store/src/test/java/org/apache/james/server/jpa/JpaUsersRepositoryTest.java
james/server/trunk/pom.xml
Added: james/server/trunk/jpa-store/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa-store/pom.xml?rev=906060&view=auto
==============================================================================
--- james/server/trunk/jpa-store/pom.xml (added)
+++ james/server/trunk/jpa-store/pom.xml Wed Feb 3 14:19:18 2010
@@ -0,0 +1,79 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You 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.
+ -->
+<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/maven-v4_0_0.xsd ">
+ <modelVersion>4.0.0</modelVersion>
+ <parent>
+ <artifactId>james-server</artifactId>
+ <groupId>org.apache.james</groupId>
+ <version>3.0-M1</version>
+ </parent>
+
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-jpa-store</artifactId>
+ <name>Apache JAMES Server JPA Backend</name>
+ <version>3.0-M1</version>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-user-api</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <scope>compile</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-user-library</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-core-api</artifactId>
+ <type>jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+ <artifactId>james-server-user-library</artifactId>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.apache.openjpa</groupId>
+ <artifactId>openjpa</artifactId>
+ <version>1.2.1</version>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+
+</project>
Modified: james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUser.java
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUser.java?rev=906060&r1=906059&r2=906060&view=diff
==============================================================================
--- james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUser.java (original)
+++ james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUser.java Wed Feb 3 14:19:18 2010
@@ -24,7 +24,6 @@
import javax.persistence.Id;
import javax.persistence.Version;
-import org.apache.jackrabbit.util.Text;
import org.apache.james.api.user.User;
@Entity(name="User")
@@ -44,7 +43,7 @@
*/
public static String hashPassword(String username, String password) {
// Combine dynamic and static salt
- final String hashedSaltedPassword = Text.md5(Text.md5(username + password) + SALT);
+ final String hashedSaltedPassword = password;// = Text.md5(Text.md5(username + password) + SALT);
return hashedSaltedPassword;
}
Modified: james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java?rev=906060&r1=906059&r2=906060&view=diff
==============================================================================
--- james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java (original)
+++ james/server/trunk/jpa-store/src/main/java/org/apache/james/server/jpa/JPAUsersRepository.java Wed Feb 3 14:19:18 2010
@@ -25,7 +25,9 @@
import javax.persistence.EntityManager;
import javax.persistence.EntityTransaction;
+import javax.persistence.PersistenceContext;
import javax.persistence.PersistenceException;
+import javax.persistence.PersistenceUnit;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -45,21 +47,8 @@
private EntityManager entityManager;
- /**
- * Constructs repository with injection.
- * @param entityManager not null
- */
- public JPAUsersRepository(EntityManager entityManager) {
- super();
- this.entityManager = entityManager;
- }
-
- /**
- * Constructor for setting injection.
- */
- public JPAUsersRepository() {
- this(null);
- }
+
+
/**
* Gets current logger.
@@ -89,6 +78,7 @@
* Sets entity manager.
* @param entityManager the entityManager to set
*/
+ @PersistenceContext
public final void setEntityManager(EntityManager entityManager) {
this.entityManager = entityManager;
}
Modified: james/server/trunk/jpa-store/src/test/java/org/apache/james/server/jpa/JpaUsersRepositoryTest.java
URL: http://svn.apache.org/viewvc/james/server/trunk/jpa-store/src/test/java/org/apache/james/server/jpa/JpaUsersRepositoryTest.java?rev=906060&r1=906059&r2=906060&view=diff
==============================================================================
--- james/server/trunk/jpa-store/src/test/java/org/apache/james/server/jpa/JpaUsersRepositoryTest.java (original)
+++ james/server/trunk/jpa-store/src/test/java/org/apache/james/server/jpa/JpaUsersRepositoryTest.java Wed Feb 3 14:19:18 2010
@@ -80,6 +80,8 @@
{
factory = OpenJPAPersistence.getEntityManagerFactory(properties);
manager = factory.createEntityManager();
- return new JPAUsersRepository(manager);
+ JPAUsersRepository repos = new JPAUsersRepository();
+ repos.setEntityManager(manager);
+ return repos;
}
}
Modified: james/server/trunk/pom.xml
URL: http://svn.apache.org/viewvc/james/server/trunk/pom.xml?rev=906060&r1=906059&r2=906060&view=diff
==============================================================================
--- james/server/trunk/pom.xml (original)
+++ james/server/trunk/pom.xml Wed Feb 3 14:19:18 2010
@@ -53,6 +53,7 @@
<module>fetchmail</module>
<module>experimental-activemq</module>
<module>jcr-store</module>
+ <module>jpa-store</module>
<module>spring-deployment</module>
<module>osgi-deployment</module>
<module>mina-socket</module>
---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org