incubator-aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From z..@apache.org
Subject svn commit: r918451 - in /incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/aries/ src/main/java/org/apache/aries/samples/ src/main/j...
Date Wed, 03 Mar 2010 12:52:04 GMT
Author: zoe
Date: Wed Mar  3 12:52:03 2010
New Revision: 918451

URL: http://svn.apache.org/viewvc?rev=918451&view=rev
Log:
ARIES 199 - Not complete yet as the blog-assembly pom needs updating. This is just the persistence
code which relies on JPA.

Added:
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/pom.xml
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/persistence.xml
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/blueprint.xml
    incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/target/

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/pom.xml?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/pom.xml (added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/pom.xml Wed Mar  3 12:52:03
2010
@@ -0,0 +1,77 @@
+<?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>
+        <groupId>org.apache.aries.blog-sample</groupId>
+        <artifactId>blog-sample</artifactId>
+        <version>1.0.0</version>
+    </parent>
+    
+	<groupId>org.apache.aries.samples</groupId>
+	<artifactId>blog-persistence</artifactId>
+	<version>1.1.0</version>
+	<name>Apache Aries blog sample persistence</name>
+	<packaging>bundle</packaging>
+	
+	   <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.felix</groupId>
+                <artifactId>maven-bundle-plugin</artifactId>
+                <extensions>true</extensions>
+                <configuration>
+                    <instructions>
+                        <Bundle-SymbolicName>${pom.groupId}.blog-persistence</Bundle-SymbolicName>
+                        <Export-Package>!org.apache.aries.samples.*</Export-Package>
+                        <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
+                    </instructions>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+            </plugin>
+        </plugins>
+    </build>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.aries.samples</groupId>
+            <artifactId>blog-api</artifactId>
+            <version>1.0.0</version>
+            <scope>provided</scope>
+        </dependency>
+       <dependency>
+            <groupId>org.apache.derby</groupId>
+            <artifactId>derby</artifactId>
+            <version>10.5.3.0_1</version>
+        </dependency> 
+              <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jpa_2.0_spec</artifactId>
+      <version>1.0</version>
+    </dependency>
+    </dependencies>
+       
+</project>
+	

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
(added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/BlogPersistenceServiceImpl.java
Wed Mar  3 12:52:03 2010
@@ -0,0 +1,213 @@
+
+/**
+ * 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.aries.samples.blog.persistence;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+import javax.persistence.Query;
+import javax.sql.DataSource;
+
+import org.apache.aries.samples.blog.persistence.api.BlogPersistenceService;
+import org.apache.aries.samples.blog.persistence.api.Entry;
+import org.apache.aries.samples.blog.persistence.entity.AuthorImpl;
+import org.apache.aries.samples.blog.persistence.entity.EntryImpl;
+
+/**
+ * This class is the implementation of the blogPersistenceService
+ */
+public class BlogPersistenceServiceImpl implements BlogPersistenceService {
+
+	private EntityManager em;
+	private DataSource dataSource;
+	
+	public BlogPersistenceServiceImpl() {
+	}
+
+	
+	//@PersistenceContext(unitName = "blogExample")
+	public void setEntityManager(EntityManager e) {
+		em = e;
+	}
+	
+	public void setDataSource(DataSource dataSource) {
+		this.dataSource = dataSource;
+	}
+
+
+	public void createAuthor(String email, Date dob, String name,
+			String displayName, String bio) {
+		AuthorImpl a = new AuthorImpl();
+		a.setEmail(email);
+		a.setName(name);
+		a.setDisplayName(displayName);
+		a.setBio(bio);
+		a.setDob(dob);
+		em.persist(a);
+		
+	}
+
+	public void createBlogPost(String authorEmail, String title,
+			String blogText, List<String> tags) {
+
+		AuthorImpl a = em.find(AuthorImpl.class, authorEmail);
+		EntryImpl b = new EntryImpl();
+
+		Date publishDate = new Date(System.currentTimeMillis());
+
+		b.setBlogText(blogText);
+		b.setAuthor(a);
+		b.setTitle((title == null) ? "" : title);
+		b.setPublishDate(publishDate);
+		b.setTags((tags == null) ? new ArrayList<String>() : tags);
+
+		a.updateEntries(b);
+		em.persist(b);
+		em.merge(b.getAuthor());
+	}
+
+	public Entry findBlogEntryByTitle(String title) {
+		Query q = em
+				.createQuery("SELECT e FROM BLOGENTRY e WHERE e.title = ?1");
+		q.setParameter(1, title);
+		Entry b = (Entry) q.getSingleResult();
+		return b;
+	}
+
+	public List<AuthorImpl> getAllAuthors() {
+		@SuppressWarnings("unchecked")
+		List<AuthorImpl> list = em.createQuery("SELECT a FROM AUTHOR a")
+				.getResultList();
+
+		return list;
+	}
+
+	public List<EntryImpl> getAllBlogEntries() {
+		@SuppressWarnings("unchecked")
+		List<EntryImpl> list = em.createQuery(
+				"SELECT b FROM BLOGENTRY b ORDER BY b.publishDate DESC")
+				.getResultList();
+		return list;
+		
+	}
+
+	public int getNoOfBlogEntries() {
+		Number n = (Number) em.createQuery(
+				"SELECT COUNT(b) FROM BLOGENTRY b").getSingleResult();
+		return n.intValue();
+	}
+
+	public List<EntryImpl> getBlogEntries(int firstPostIndex, int noOfPosts) {
+		Query q = em
+				.createQuery("SELECT b FROM BLOGENTRY b ORDER BY b.publishDate DESC");
+		q.setFirstResult(firstPostIndex);
+		q.setMaxResults(noOfPosts);
+
+		@SuppressWarnings("unchecked")
+		List<EntryImpl> list = q.getResultList();
+
+		return list;
+	}
+
+	public AuthorImpl getAuthor(String emailAddress) {
+		AuthorImpl a = em.find(AuthorImpl.class, emailAddress);
+		return a;
+	}
+
+	public List<EntryImpl> getBlogEntriesModifiedBetween(Date start, Date end) {
+		Query q = em
+				.createQuery("SELECT b FROM BLOGENTRY b WHERE (b.updatedDate >= :start AND b.updatedDate
<= :end) OR (b.publishDate >= :start AND b.publishDate <= :end) ORDER BY b.publishDate
ASC");
+		q.setParameter("start", start);
+		q.setParameter("end", end);
+
+		@SuppressWarnings("unchecked")
+		List<EntryImpl> list = q.getResultList();
+
+		return list;
+	}
+	
+	public List<EntryImpl> getBlogsForAuthor(String emailAddress) {
+
+		List<EntryImpl> list = em.find(AuthorImpl.class, emailAddress)
+				.getEntries();
+		
+		return list;
+
+	}
+
+	public void updateAuthor(String email, Date dob, String name,
+			String displayName, String bio) {
+		AuthorImpl a = em.find(AuthorImpl.class, email);
+		a.setEmail(email);
+		a.setName(name);
+		a.setDisplayName(displayName);
+		a.setBio(bio);
+		a.setDob(dob);
+		em.merge(a);
+	}
+	
+	public void updateBlogEntry(long id, String email, String title,
+			String blogText, List<String> tags, Date updatedDate) {
+		EntryImpl b = em.find(EntryImpl.class, id);
+		b.setTitle(title);
+		b.setBlogText(blogText);
+		b.setTags(tags);
+		b.setUpdatedDate(updatedDate);
+
+		em.merge(b);
+	}
+
+	public void removeAuthor(String emailAddress) {
+		em.remove(em.find(AuthorImpl.class, emailAddress));
+	}
+
+	public void removeBlogEntry(long id) {
+		EntryImpl b = em.find(EntryImpl.class, id);
+		b = em.merge(b);
+		b.getAuthor().getEntries().remove(b);
+
+		em.remove(em.merge(b));
+		em.merge(b.getAuthor());
+
+	}
+
+	public EntryImpl getBlogEntryById(long postId) {
+		EntryImpl b =  em.find(EntryImpl.class, postId);
+		return b;
+	}
+
+	public void setPublishDate (long postId, Date date) {
+		//Added for testing
+		EntryImpl b = em.find(EntryImpl.class, postId);
+		b.setPublishDate(date);	
+		em.merge(b);
+	}
+	
+	public void setUpdatedDate (long postId, Date date) {
+		//Added for testing
+		EntryImpl b = em.find(EntryImpl.class, postId);
+		b.setUpdatedDate(date);	
+		em.merge(b);
+	}
+}

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java
(added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java
Wed Mar  3 12:52:03 2010
@@ -0,0 +1,143 @@
+/**
+ * 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.aries.samples.blog.persistence.entity;
+
+
+import java.util.Date;
+import java.util.List;
+
+import javax.persistence.CascadeType;
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.FetchType;
+import javax.persistence.Id;
+import javax.persistence.OneToMany;
+import javax.persistence.OrderBy;
+import javax.persistence.Table;
+
+import org.apache.aries.samples.blog.persistence.api.Author;
+
+/**
+ * This class represents a blog post Author
+ */
+
+@Entity(name = "AUTHOR")
+@Table(name = "AUTHOR")
+public class AuthorImpl implements Author
+{
+  /** The author's email address */
+  @Id
+  @Column(nullable = false, unique = true)
+  private String email;
+  
+  /** The author's full name */
+  private String name;
+  /** The display name for this author */
+  private String displayName;
+  /** A short bio for this author */
+  private String bio;  
+  /** The Author's date of birth */
+  private Date dob;
+
+  /** The blog entries posted by this user */
+  @OneToMany(cascade = {CascadeType.REMOVE}, fetch = FetchType.EAGER)
+  @OrderBy("publishDate DESC")
+  private List<EntryImpl> posts;
+
+  /** Get the author's email address */
+  public String getEmail()
+  {
+    return email;
+  }
+
+  /** Get the author's full name */
+  public String getName()
+  {
+    return name;
+  } 
+  
+  /** Get the author's displayed name */
+  public String getDisplayName()
+  {
+    return displayName;
+  }
+
+  /** Get the author's biographical information */
+  public String getBio()
+  {
+    return bio;
+  }
+
+  /** Get the author's date of birth */
+  public Date getDob()
+  {
+    return dob;
+  } 
+
+  /** Get the author's blog posts */
+  public List<EntryImpl> getEntries()
+  {
+    return posts;
+  }
+  
+  // Set methods are not defined in the interface
+  
+  /** Set the author's email address */
+  public void setEmail(String email)
+  {
+    this.email = email;
+  }
+  
+  /** Set the author's full name */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+  
+  /** Set the author's displayed name */
+  public void setDisplayName(String displayName)
+  {
+    this.displayName = displayName;
+  }
+  
+  /** Set the author's biographical information */
+  public void setBio(String bio)
+  {
+    this.bio = bio;
+  }
+  
+  /** Set the author's date of birth */
+  public void setDob(Date dob)
+  {
+    this.dob = dob;
+  }
+
+  /** Update  the author's blog posts */
+  public void updateEntries(EntryImpl b)
+  {
+    this.posts.add(b);
+  }
+  
+  /** set  the author's blog posts */
+  public void setEntries(List<EntryImpl> lb)
+  {
+    this.posts = lb;
+  }
+  
+}

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java
(added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java
Wed Mar  3 12:52:03 2010
@@ -0,0 +1,148 @@
+/**
+ * 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.aries.samples.blog.persistence.entity;
+
+import java.util.Date;
+import java.util.List;
+
+import org.apache.aries.samples.blog.persistence.api.Entry;
+
+
+
+/**
+ * This class represents a blog entry
+ */
+
+public class EntryImpl implements Entry
+{
+  /** An auto-generated primary key */
+
+  private Long id;
+
+  /** The author of the blog post */
+
+  private AuthorImpl author;
+
+  /** The date the post was published */
+  private Date publishDate;
+  /** The date the post was last updated */
+  private Date updatedDate;
+  /** The title of the post */
+  private String title;
+  /** Tags associated with the post */
+  private List<String> tags;
+  /** The text of the blog */
+
+  private String blogText;
+
+  /** Get the author of this blog post */
+  public AuthorImpl getAuthor()
+  {
+    return author;
+  }
+
+  /** Set the author of this blog post */
+  public void setAuthor(AuthorImpl author)
+  {
+    this.author = author;
+  }
+
+  /** Get the publish date of this blog post */
+  public Date getPublishDate()
+  {
+    return publishDate;
+  }
+
+  /** Set the publish date of this blog post */
+  public void setPublishDate(Date publishDate)
+  {
+    this.publishDate = publishDate;
+  }
+
+  /** Get the title of this blog post */
+  public String getTitle()
+  {
+    return title;
+  }
+
+  /** Set the title of this blog post */ 
+  public void setTitle(String title)
+  {
+    this.title = title;
+  }
+
+
+  /** Get the tags for this blog post */
+  public List<String> getTags()
+  {
+    return tags;
+  }
+
+  /** Set the tags for this blog post */
+  public void setTags(List<String> tags)
+  {
+    this.tags = tags;
+  }
+
+  /** Get the text for this blog post */
+  public String getBlogText()
+  {
+    return blogText;
+  }
+
+  /** Set the text for this blog post */
+  public void setBlogText(String blogText)
+  {
+    this.blogText = blogText;
+  }
+
+  /** get the Blog post id */
+  public long getId()
+  {
+    return id;
+  }
+
+  /** Set the id */
+  public void setId(Long id)
+  {
+    this.id = id;
+  }
+
+  /**
+   * @return The date of the last update to this blog
+   *         or null if it has never been modified
+   */
+  public Date getUpdatedDate()
+  {
+    return updatedDate;
+  }
+
+  /**
+   * Set the date that the blog post was last updated
+   * 
+   * @param updatedDate
+   */
+  public void setUpdatedDate(Date updatedDate)
+  {
+    this.updatedDate = updatedDate;
+  }
+
+
+}
+

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/persistence.xml?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/persistence.xml
(added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/META-INF/persistence.xml
Wed Mar  3 12:52:03 2010
@@ -0,0 +1,41 @@
+<!--
+    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.
+-->
+<persistence xmlns="http://java.sun.com/xml/ns/persistence"
+   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+   xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
+   version="1.0">
+
+  <persistence-unit name="blogExample" transaction-type="JTA">
+    <description>Persistence unit for the example blogging application</description>
+
+    <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>
+
+    <class>org.apache.aries.samples.blog.persistence.entity.AuthorImpl</class>
+    <class>org.apache.aries.samples.blog.persistence.entity.EntryImpl</class>
+    <exclude-unlisted-classes/>
+    
+    
+     <properties>
+      <property name="openjpa.ManagedRuntime" 
+        value="org.apache.openjpa.ee.JNDIManagedRuntime(TransactionManagerName=aries:services/javax.transaction.TransactionManager)"/>
+    </properties>
+   
+  </persistence-unit>
+</persistence>

Added: incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=918451&view=auto
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/blueprint.xml
(added)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence_1.1.0/src/main/resources/OSGI-INF/blueprint/blueprint.xml
Wed Mar  3 12:52:03 2010
@@ -0,0 +1,38 @@
+<?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.
+	-->
+
+<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0"
+	xmlns:tx="http://aries.apache.org/xmlns/transactions/v1.0.0" xmlns:jpa="http://aries.apache.org/xmlns/jpa/v1.0.0"
+	default-activation="lazy">
+
+	<bean id="datasource" class="org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource">
+		<property name="databaseName" value="blogDB" />
+	</bean>
+
+	<bean id="persistenceImpl"
+		class="org.apache.aries.samples.blog.persistence.BlogPersistenceServiceImpl">
+		<tx:transaction method="*" value="Required" />
+		<jpa:context property="entityManager" unitname="blogExample" />
+	</bean>
+
+	<service ref="persistenceImpl"
+		interface="org.apache.aries.samples.blog.persistence.api.BlogPersistenceService">
+	</service>
+
+</blueprint>



Mime
View raw message