incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r923921 - in /incubator/aries/trunk/samples/blog: blog-datasource/src/main/resources/OSGI-INF/blueprint/ blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/ blog-persistence-jpa/src/main/resources/META-INF/ blog-we...
Date Tue, 16 Mar 2010 18:25:55 GMT
Author: zoe
Date: Tue Mar 16 18:25:55 2010
New Revision: 923921

URL: http://svn.apache.org/viewvc?rev=923921&view=rev
Log:
ARIES-225 modifications to use the changed transaction wrappers (see ARIES-256)

Modified:
    incubator/aries/trunk/samples/blog/blog-datasource/src/main/resources/OSGI-INF/blueprint/dataSource.xml
    incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
    incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/resources/META-INF/persistence.xml
    incubator/aries/trunk/samples/blog/blog-web/src/main/java/org/apache/aries/samples/blog/web/EditAuthorForm.java

Modified: incubator/aries/trunk/samples/blog/blog-datasource/src/main/resources/OSGI-INF/blueprint/dataSource.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-datasource/src/main/resources/OSGI-INF/blueprint/dataSource.xml?rev=923921&r1=923920&r2=923921&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-datasource/src/main/resources/OSGI-INF/blueprint/dataSource.xml
(original)
+++ incubator/aries/trunk/samples/blog/blog-datasource/src/main/resources/OSGI-INF/blueprint/dataSource.xml
Tue Mar 16 18:25:55 2010
@@ -26,7 +26,11 @@
     <property name="databaseName" value="blogDB"/>
   </bean>
   
-  <service id="xaDataSource" ref="derbyXADataSource" interface="javax.sql.XADataSource"/>
+  <service id="xaDataSource" ref="derbyXADataSource" interface="javax.sql.XADataSource">
+  <service-properties>
+    <entry key="osgi.jndi.serviceName" value="jdbc/blogdb"/>
+   </service-properties>
+  </service>
 
   
   <bean id="derbyDataSource" class="org.apache.derby.jdbc.EmbeddedDataSource">
@@ -35,7 +39,7 @@
   
   <service ref="derbyDataSource" interface="javax.sql.DataSource">
    <service-properties>
-     <entry key="xa.aware" value="false"/>
+     <entry key="osgi.jndi.serviceName" value="jdbc/blogdbnojta"/>
    </service-properties>
   </service>
   

Modified: incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java?rev=923921&r1=923920&r2=923921&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
(original)
+++ incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
Tue Mar 16 18:25:55 2010
@@ -70,7 +70,7 @@ public class BlogPersistenceServiceImpl 
 
 	public void createBlogPost(String authorEmail, String title,
 			String blogText, List<String> tags) {
-
+	
 		AuthorImpl a = em.find(AuthorImpl.class, authorEmail);
 		EntryImpl b = new EntryImpl();
 
@@ -83,8 +83,11 @@ public class BlogPersistenceServiceImpl 
 		b.setTags((tags == null) ? new ArrayList<String>() : tags);
 
 		a.updateEntries(b);
-		em.persist(b);
+		em.persist(b);		
 		em.merge(b.getAuthor());
+		//Uncomment this line to verify that datasources have been enlisted.
+		//The data base should not contain the blog post even though it has been persisted.
+		//throw new RuntimeException();
 	}
 
 	public Entry findBlogEntryByTitle(String title) {

Modified: incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/resources/META-INF/persistence.xml?rev=923921&r1=923920&r2=923921&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/resources/META-INF/persistence.xml
(original)
+++ incubator/aries/trunk/samples/blog/blog-persistence-jpa/src/main/resources/META-INF/persistence.xml
Tue Mar 16 18:25:55 2010
@@ -24,8 +24,8 @@
 
     <provider>org.apache.openjpa.persistence.PersistenceProviderImpl</provider>
 
-    <jta-data-source>aries:services/javax.sql.DataSource/(xa.aware=true)</jta-data-source>
-    <non-jta-data-source>aries:services/javax.sql.DataSource/(xa.aware=false)</non-jta-data-source>
+    <jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.serviceName=jdbc/blogdb)</jta-data-source>
+    <non-jta-data-source>aries:services/javax.sql.DataSource/(osgi.jndi.serviceName=jdbc/blogdbnojta)</non-jta-data-source>
 
     <class>org.apache.aries.samples.blog.persistence.entity.AuthorImpl</class>
     <class>org.apache.aries.samples.blog.persistence.entity.EntryImpl</class>

Modified: incubator/aries/trunk/samples/blog/blog-web/src/main/java/org/apache/aries/samples/blog/web/EditAuthorForm.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog/blog-web/src/main/java/org/apache/aries/samples/blog/web/EditAuthorForm.java?rev=923921&r1=923920&r2=923921&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog/blog-web/src/main/java/org/apache/aries/samples/blog/web/EditAuthorForm.java
(original)
+++ incubator/aries/trunk/samples/blog/blog-web/src/main/java/org/apache/aries/samples/blog/web/EditAuthorForm.java
Tue Mar 16 18:25:55 2010
@@ -126,10 +126,4 @@ public class EditAuthorForm extends Form
     
     out.println("</form>");
   }
-  
-  private String checkEmail(String parameter)
-  {
-    if (parameter != null && parameter.matches("^(?:[a-zA-Z0-9_'^&amp;/+-])+(?:\\.(?:[a-zA-Z0-9_'^&amp;/+-])+)*@(?:(?:\\[?(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?))\\.){3}(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\]?)|(?:[a-zA-Z0-9-]+\\.)+(?:[a-zA-Z]){2,}\\.?)$"))
return parameter;
-    return null;
-  }
 }
\ No newline at end of file



Mime
View raw message