rave-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfrank...@apache.org
Subject svn commit: r1095807 - in /incubator/rave/trunk/rave-portal/src: main/java/org/apache/rave/jdbc/util/ main/java/org/apache/rave/orm/jpa/ test/java/org/apache/rave/portal/repository/ test/resources/
Date Thu, 21 Apr 2011 20:28:42 GMT
Author: mfranklin
Date: Thu Apr 21 20:28:42 2011
New Revision: 1095807

URL: http://svn.apache.org/viewvc?rev=1095807&view=rev
Log:
Added missing license headers and fixed potential NPE in PopulatedLocalContainerEntityManagerFactory

Removed:
    incubator/rave/trunk/rave-portal/src/test/resources/test-data.sql
Modified:
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
    incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
    incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java?rev=1095807&r1=1095806&r2=1095807&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/DataSourcePopulator.java
Thu Apr 21 20:28:42 2011
@@ -1,10 +1,28 @@
+/*
+ * 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.
+ */
+
 package org.apache.rave.jdbc.util;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.core.io.Resource;
 
-import javax.annotation.PostConstruct;
 import javax.persistence.EntityManager;
 import javax.sql.DataSource;
 import java.io.IOException;

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java?rev=1095807&r1=1095806&r2=1095807&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/jdbc/util/SqlFileParser.java
Thu Apr 21 20:28:42 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.rave.jdbc.util;
 
 import org.springframework.core.io.Resource;

Modified: incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java?rev=1095807&r1=1095806&r2=1095807&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
(original)
+++ incubator/rave/trunk/rave-portal/src/main/java/org/apache/rave/orm/jpa/PopulatedLocalContainerEntityManagerFactory.java
Thu Apr 21 20:28:42 2011
@@ -1,3 +1,22 @@
+/*
+ * 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.
+ */
+
 package org.apache.rave.orm.jpa;
 
 import org.apache.rave.jdbc.util.DataSourcePopulator;
@@ -6,10 +25,10 @@ import org.springframework.orm.jpa.Local
 import javax.persistence.EntityManagerFactory;
 import javax.persistence.spi.PersistenceUnitInfo;
 
+
 /**
- * @author mfranklin
- *         Date: 4/21/11
- *         Time: 2:57 PM
+ * Creates a LocalContainerEntityManagerFactoryBean that calls a DataSourcePopulator bean
to insert data into the
+ * datasource immediately after the factory is initialized
  */
 public class PopulatedLocalContainerEntityManagerFactory extends LocalContainerEntityManagerFactoryBean{
     private DataSourcePopulator populator;
@@ -24,9 +43,11 @@ public class PopulatedLocalContainerEnti
 
     @Override
     protected void postProcessEntityManagerFactory(EntityManagerFactory emf, PersistenceUnitInfo
pui) {
-        //Create an entity manager to force initialization of the context and then populate
-        emf.createEntityManager().close();
-        populator.initialize(this.getDataSource());
+        if(populator != null) {
+            //Create an entity manager to force initialization of the context and then populate
+            emf.createEntityManager().close();
+            populator.initialize(this.getDataSource());
+        }
         super.postProcessEntityManagerFactory(emf, pui);
     }
 }

Modified: incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
URL: http://svn.apache.org/viewvc/incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java?rev=1095807&r1=1095806&r2=1095807&view=diff
==============================================================================
--- incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
(original)
+++ incubator/rave/trunk/rave-portal/src/test/java/org/apache/rave/portal/repository/JpaPageRepositoryTest.java
Thu Apr 21 20:28:42 2011
@@ -30,11 +30,6 @@ import org.springframework.test.context.
 import java.util.List;
 import static org.junit.Assert.assertThat;
 
-/**
- * @author mfranklin
- *         Date: 4/19/11
- *         Time: 9:13 AM
- */
 @RunWith(SpringJUnit4ClassRunner.class)
 @ContextConfiguration(locations={"file:src/main/webapp/WEB-INF/dataContext.xml", "file:src/main/webapp/WEB-INF/applicationContext.xml"})
 public class JpaPageRepositoryTest {



Mime
View raw message