You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by zo...@apache.org on 2010/02/22 21:33:33 UTC

svn commit: r915049 - in /incubator/aries/trunk/samples/blog-sample/blog-persistence: ./ src/main/java/org/apache/aries/samples/blog/persistence/entity/ src/main/resources/META-INF/ src/main/resources/OSGI-INF/blueprint/

Author: zoe
Date: Mon Feb 22 20:33:33 2010
New Revision: 915049

URL: http://svn.apache.org/viewvc?rev=915049&view=rev
Log:
ARIES-199 Reverting previous changes, did not intend to overwrite the JDBC persistence layer

Removed:
    incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/META-INF/persistence.xml
Modified:
    incubator/aries/trunk/samples/blog-sample/blog-persistence/pom.xml
    incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java
    incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java
    incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/OSGI-INF/blueprint/blueprint.xml

Modified: incubator/aries/trunk/samples/blog-sample/blog-persistence/pom.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence/pom.xml?rev=915049&r1=915048&r2=915049&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence/pom.xml (original)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence/pom.xml Mon Feb 22 20:33:33 2010
@@ -29,7 +29,7 @@
     
 	<groupId>org.apache.aries.samples</groupId>
 	<artifactId>blog-persistence</artifactId>
-	<version>1.1.0</version>
+	<version>1.0.0</version>
 	<name>Apache Aries blog sample persistence</name>
 	<packaging>bundle</packaging>
 	
@@ -43,7 +43,6 @@
                     <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>
@@ -66,11 +65,6 @@
             <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>

Modified: incubator/aries/trunk/samples/blog-sample/blog-persistence/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/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java?rev=915049&r1=915048&r2=915049&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java (original)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/AuthorImpl.java Mon Feb 22 20:33:33 2010
@@ -1,144 +1,125 @@
-/**
- * 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;
-  }
-  
-}
-
+/**
+ * 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.Author;
+
+
+
+/**
+ * This class represents a blog post Author
+ */
+
+public class AuthorImpl implements Author
+{
+  /** The author's email address */
+
+
+  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 */
+
+  private List<EntryImpl> posts;
+
+  /** Get the author's email address */
+  public String getEmail()
+  {
+    return email;
+  }
+
+  /** Set the author's email address */
+  public void setEmail(String email)
+  {
+    this.email = email;
+  }
+
+  /** Get the author's full name */
+  public String getName()
+  {
+    return name;
+  }
+
+  /** Set the author's full name */
+  public void setName(String name)
+  {
+    this.name = name;
+  }
+
+  /** Get the author's displayed name */
+  public String getDisplayName()
+  {
+    return displayName;
+  }
+
+  /** Set the author's displayed name */
+  public void setDisplayName(String displayName)
+  {
+    this.displayName = displayName;
+  }
+
+  /** Get the author's biographical information */
+  public String getBio()
+  {
+    return bio;
+  }
+
+  /** Set the author's biographical information */
+  public void setBio(String bio)
+  {
+    this.bio = bio;
+  }
+
+  /** Get the author's date of birth */
+  public Date getDob()
+  {
+    return dob;
+  }
+
+  /** Set the author's date of birth */
+  public void setDob(Date dob)
+  {
+    this.dob = dob;
+  }
+
+  /** Get the author's blog posts */
+  public List<EntryImpl> getEntries()
+  {
+    return posts;
+  }
+
+  /** Set the author's blog posts */
+  public void setEntries(List<EntryImpl> posts)
+  {
+    this.posts = posts;
+  }
+
+}

Modified: incubator/aries/trunk/samples/blog-sample/blog-persistence/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/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java?rev=915049&r1=915048&r2=915049&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java (original)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/java/org/apache/aries/samples/blog/persistence/entity/EntryImpl.java Mon Feb 22 20:33:33 2010
@@ -1,156 +1,147 @@
-/**
- * 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.Column;
-import javax.persistence.Entity;
-import javax.persistence.FetchType;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.Table;
-
-import org.apache.aries.samples.blog.persistence.api.Entry;
-
-/**
- * This class represents a blog entry
- */
-@Entity(name = "BLOGENTRY")
-@Table(name = "BLOGENTRY")
-public class EntryImpl implements Entry
-{
-  /** An auto-generated primary key */
-  @Id
-  @GeneratedValue
-  private long id;
-  
-  /** The author of the blog post */
-  @ManyToOne(fetch = FetchType.EAGER)
-  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 */
-  @Column(length=10000)
-  private String blogText;
-  
-  /** Get the author of this blog post */
-  public AuthorImpl getAuthor()
-  {
-    return author;
-  }
-  
-  /** Get the publish date of this blog post */
-  public Date getPublishDate()
-  {
-    return publishDate;
-  }
-  
-  /** Get the title of this blog post */
-  public String getTitle()
-  {
-    return title;
-  }
-  
-  /** Get the tags for this blog post */
-  public List<String> getTags()
-  {
-    return tags;
-  }
- 
-  
-  /** Get the text for this blog post */
-  public String getBlogText()
-  {
-    return blogText;
-  }
-  
-
-  /** get the Blog post id */
-  public long getId()
-  {
-    return 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 methods are only defined in implementation class. Not part of interface.
-  
-  
-  /** Set the author of this blog post */
-  public void setAuthor(AuthorImpl author)
-  {
-    this.author = author;
-  }
-  
-  
-  /** Set the publish date of this blog post */
-  public void setPublishDate(Date publishDate)
-  {
-    this.publishDate = publishDate;
-  }
-  
-  /** Set the title of this blog post */
-  public void setTitle(String title)
-  {
-    this.title = title;
-  }
-  
-  /** Set the text for this blog post */
-  public void setBlogText(String blogText)
-  {
-    this.blogText = blogText;
-  }
-  
-  
-  /** Set the tags for this blog post */
-  public void setTags(List<String> tags)
-  {
-    this.tags = tags;
-  }
-
-  /**
-   * Set the date that the blog post was last updated
-   * 
-   * @param updatedDate
-   */
-  public void setUpdatedDate(Date updatedDate)
-  {
-    this.updatedDate = updatedDate;
-  }
-  
-}
-
+/**
+ * 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;
+  }
+
+
+}

Modified: incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/OSGI-INF/blueprint/blueprint.xml
URL: http://svn.apache.org/viewvc/incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/OSGI-INF/blueprint/blueprint.xml?rev=915049&r1=915048&r2=915049&view=diff
==============================================================================
--- incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/OSGI-INF/blueprint/blueprint.xml (original)
+++ incubator/aries/trunk/samples/blog-sample/blog-persistence/src/main/resources/OSGI-INF/blueprint/blueprint.xml Mon Feb 22 20:33:33 2010
@@ -15,19 +15,20 @@
     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="persistenceImpl" class="org.apache.aries.samples.blog.persistence.BlogPersistenceServiceImpl">
-    <tx:transaction method="*" value="Required"/>
-    <jpa:context property="entityManager" unitname="blogExample"/>
+<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">
+            
+  <bean id="datasource" class="org.apache.derby.jdbc.EmbeddedConnectionPoolDataSource">
+     <property name="databaseName" value="blogDB"/>
   </bean>
 
-  <service ref="persistenceImpl" interface="org.apache.aries.samples.blog.persistence.api.BlogPersistenceService">
-  </service>
+  <bean id="persistenceImpl" class="org.apache.aries.samples.blog.persistence.BlogPersistenceServiceImpl" activation="lazy">
+   <property name="dataSource" ref="datasource" />
+  </bean>
 
-</blueprint>
+  <service ref="persistenceImpl" interface="org.apache.aries.samples.blog.persistence.api.BlogPersistenceService"/>
+ 
+ 
+</blueprint>
\ No newline at end of file