You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@myfaces.apache.org by bo...@apache.org on 2007/02/18 21:59:28 UTC

svn commit: r508997 - in /myfaces/tobago/trunk/example: ./ addressbook/ addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/ addressbook/src/main/resources/ addressbook/src/main/resources/META-INF/ addressbook/src/main/webapp/ addre...

Author: bommel
Date: Sun Feb 18 12:59:27 2007
New Revision: 508997

URL: http://svn.apache.org/viewvc?view=rev&rev=508997
Log:
added persistence to addressbook demo
some cleanups

Added:
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/JpaAddressDAO.java
    myfaces/tobago/trunk/example/addressbook/src/main/resources/
    myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/
    myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/persistence.xml
Modified:
    myfaces/tobago/trunk/example/addressbook/pom.xml
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java
    myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/EmailAddress.java
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/applicationContext.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp
    myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp
    myfaces/tobago/trunk/example/demo/pom.xml
    myfaces/tobago/trunk/example/pom.xml

Modified: myfaces/tobago/trunk/example/addressbook/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/pom.xml?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/pom.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/pom.xml Sun Feb 18 12:59:27 2007
@@ -15,7 +15,8 @@
  * 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">
+<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.myfaces.tobago</groupId>
@@ -39,39 +40,90 @@
         </configuration>
       </plugin>
       <plugin>
-         <groupId>org.apache.maven.plugins</groupId>
-         <artifactId>maven-dependency-plugin</artifactId>
-         <executions>
-           <execution>
-             <id>unpack</id>
-             <phase>package</phase>
-             <goals>
-               <goal>unpack</goal>
-             </goals>
-             <configuration>
-               <artifactItems>
-                 <artifactItem>
-                   <groupId>org.tango-project</groupId>
-                   <artifactId>tango-icon-theme</artifactId>
-                   <version>0.7.2</version>
-                 </artifactItem>
-               </artifactItems>
-               <outputDirectory>${project.build.directory}/${project.build.finalName}/tobago-resource/html/standard/standard/image</outputDirectory>
-             </configuration>
-           </execution>
-         </executions>
-       </plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-dependency-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>unpack</id>
+            <phase>package</phase>
+            <goals>
+              <goal>unpack</goal>
+            </goals>
+            <configuration>
+              <artifactItems>
+                <artifactItem>
+                  <groupId>org.tango-project</groupId>
+                  <artifactId>tango-icon-theme</artifactId>
+                  <version>0.7.2</version>
+                </artifactItem>
+              </artifactItems>
+              <outputDirectory>
+                ${project.build.directory}/${project.build.finalName}/tobago-resource/html/standard/standard/image
+              </outputDirectory>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+      <plugin>
+        <artifactId>maven-antrun-plugin</artifactId>
+        <executions>
+          <execution>
+            <phase>process-classes</phase>
+            <configuration>
+              <tasks>
+                <java classname="org.apache.openjpa.enhance.PCEnhancer"
+                      classpathref="maven.runtime.classpath"
+                      dir="target/classes" fork="true"/>
+              </tasks>
+            </configuration>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
 
   <scm>
     <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/addressbook</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/addressbook</developerConnection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/addressbook
+    </developerConnection>
     <url>http://svn.apache.org/viewcvs.cgi/myfaces/tobago/trunk/example/addressbook</url>
   </scm>
-
+  <repositories>
+    <repository>
+      <id>apache-incubating</id>
+      <url>http://people.apache.org/repo/m2-incubating-repository</url>
+    </repository>
+  </repositories>
   <dependencies>
     <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-persistence</artifactId>
+      <version>0.9.6-incubating</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-persistence-jdbc</artifactId>
+      <version>0.9.6-incubating</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.openjpa</groupId>
+      <artifactId>openjpa-xmlstore</artifactId>
+      <version>0.9.6-incubating</version>
+    </dependency>
+    <!--<dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>toplink-essentials</artifactId>
+      <version>1.0</version>
+    </dependency>-->
+    <!--<dependency>
+      <groupId>org.hibernate</groupId>
+      <artifactId>hibernate-entitymanager</artifactId>
+      <version>3.2.1.ga</version>
+    </dependency>-->
+    <dependency>
       <groupId>org.apache.myfaces.tobago</groupId>
       <artifactId>tobago-theme-richmond</artifactId>
       <version>${project.version}</version>
@@ -107,60 +159,29 @@
       <scope>provided</scope>
     </dependency>
     <dependency>
-      <groupId>org.springframework</groupId>
-      <artifactId>spring-core</artifactId>
-      <version>1.2.7</version>
-      <scope>compile</scope>
+      <groupId>org.apache.derby</groupId>
+      <artifactId>derby</artifactId>
+      <version>10.2.2.0</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
-      <artifactId>spring-context</artifactId>
-      <version>1.2.7</version>
-      <scope>compile</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>xerces</groupId>
-          <artifactId>xerces</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>xml-apis</groupId>
-          <artifactId>xml-apis</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>java</groupId>
-          <artifactId>tools</artifactId>
-        </exclusion>
-      </exclusions>
+      <artifactId>spring-jpa</artifactId>
+      <version>2.0.2</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
-      <artifactId>spring-beans</artifactId>
-      <version>1.2.7</version>
-      <scope>compile</scope>
+      <artifactId>spring-aop</artifactId>
+      <version>2.0.2</version>
+    </dependency>
+    <dependency>
+      <groupId>javax.persistence</groupId>
+      <artifactId>persistence-api</artifactId>
+      <version>1.0</version>
     </dependency>
     <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-web</artifactId>
-      <version>1.2.7</version>
-      <scope>compile</scope>
-      <exclusions>
-        <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>servlet-api</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>servletapi</groupId>
-          <artifactId>servletapi</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>javax.servlet</groupId>
-          <artifactId>jsp-api</artifactId>
-        </exclusion>
-        <exclusion>
-          <groupId>myfaces</groupId>
-          <artifactId>myfaces-jsf-api</artifactId>
-        </exclusion>
-      </exclusions>
+      <version>2.0.2</version>
     </dependency>
     <dependency>
       <groupId>xstream</groupId>

Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Address.java Sun Feb 18 12:59:27 2007
@@ -26,35 +26,56 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Embedded;
+import javax.persistence.AttributeOverrides;
+import javax.persistence.AttributeOverride;
+import javax.persistence.Column;
+import javax.persistence.Temporal;
+import javax.persistence.TemporalType;
+import javax.persistence.Transient;
+import javax.persistence.PrePersist;
+import javax.persistence.PreUpdate;
+import javax.persistence.PostLoad;
 import java.io.File;
 import java.util.Date;
 import java.util.Locale;
 
+@Entity
 public class Address {
 
   private static final Log LOG = LogFactory.getLog(Address.class);
-
-  private int id;
+  @Id
+  @GeneratedValue(strategy = GenerationType.IDENTITY)
+  private Integer id;
   private String firstName;
   private String lastName;
   private String street;
   private String houseNumber;
   private String city;
   private String zipCode;
+  @Transient
   private Locale country;
+  private String countryCode;
   private String phone;
   private String mobile;
   private String fax;
+  @Embedded
   private EmailAddress email;
   private String icq;
   private String homePage;
+  @Temporal(TemporalType.DATE)
   private Date dayOfBirth;
   private String note;
-
   private String company;
   private String jobTitle;
   private String jobPhone;
-  private String jobEmail;
+  @Embedded
+  @AttributeOverrides(@AttributeOverride(name="email", column = @Column(name = "jobEmail")))
+  private EmailAddress jobEmail;
   private String jobHomePage;
   private static final String EMPTY_PORTRAIT = "image/empty_portrait.png";
 
@@ -77,9 +98,7 @@
     email = fromAddress.getEmail();
     dayOfBirth = fromAddress.getDayOfBirth();
     homePage = fromAddress.getHomePage();
-
     note = fromAddress.getNote();
-
     company = fromAddress.getCompany();
     jobTitle = fromAddress.getJobTitle();
     jobPhone = fromAddress.getJobPhone();
@@ -87,11 +106,25 @@
     jobHomePage = fromAddress.getJobHomePage();
   }
 
-  public int getId() {
+  @PrePersist
+  @PreUpdate
+  private void store() {
+    if (country != null) {
+      countryCode = country.getCountry();
+    }
+  }
+  @PostLoad
+  private void load() {
+    if (countryCode != null) {
+      country = new Locale("", countryCode);
+    }
+  }
+
+  public Integer getId() {
     return id;
   }
 
-  public void setId(int id) {
+  public void setId(Integer id) {
     this.id = id;
   }
 
@@ -239,11 +272,11 @@
     this.jobPhone = jobPhone;
   }
 
-  public String getJobEmail() {
+  public EmailAddress getJobEmail() {
     return jobEmail;
   }
 
-  public void setJobEmail(String jobEmail) {
+  public void setJobEmail(EmailAddress jobEmail) {
     this.jobEmail = jobEmail;
   }
 

Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/Controller.java Sun Feb 18 12:59:27 2007
@@ -157,6 +157,17 @@
     return OUTCOME_LIST;
   }
 
+  public String okFileUpload() {
+    setRenderFileUploadPopup(false);
+    return null;
+  }
+
+  public String cancelFileUpload() {
+    setRenderFileUploadPopup(false);
+    return null;
+  }
+
+
   public String cancelPopup() {
     setRenderPopup(false);
     return OUTCOME_LIST;

Modified: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/EmailAddress.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/EmailAddress.java?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/EmailAddress.java (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/EmailAddress.java Sun Feb 18 12:59:27 2007
@@ -17,9 +17,15 @@
  * limitations under the License.
  */
 
+import javax.persistence.Embeddable;
+
+@Embeddable
 public class EmailAddress {
 
   private String email;
+
+  public EmailAddress() {
+  }
 
   public EmailAddress(String email) {
     this.email = email;

Added: myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/JpaAddressDAO.java
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/JpaAddressDAO.java?view=auto&rev=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/JpaAddressDAO.java (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/java/org/apache/myfaces/tobago/example/addressbook/JpaAddressDAO.java Sun Feb 18 12:59:27 2007
@@ -0,0 +1,58 @@
+package org.apache.myfaces.tobago.example.addressbook;
+
+/*
+ * 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.
+ */
+
+import org.springframework.orm.jpa.support.JpaDaoSupport;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.stereotype.Repository;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.List;
+
+/*
+ * Created by IntelliJ IDEA.
+ * User: bommel
+ * Date: Feb 18, 2007
+ * Time: 1:14:29 PM
+ */
+@Repository
+@Transactional()
+public class JpaAddressDAO extends JpaDaoSupport implements AddressDAO {
+
+  private static final Log LOG = LogFactory.getLog(JpaAddressDAO.class);
+
+  public Address updateAddress(Address address) throws AddressDAOException {
+    if (address.getId() == null) { 
+      getJpaTemplate().persist(address);
+    } else {
+      getJpaTemplate().merge(address);
+    }
+    return address;
+  }
+
+  public List<Address> findAddresses() throws AddressDAOException{
+    return getJpaTemplate().find("select a from Address a");
+  }
+
+  public  void removeAddress(Address address) throws AddressDAOException {
+    address = getJpaTemplate().find(Address.class, address.getId());
+    getJpaTemplate().remove(address);
+  }
+
+}

Added: myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/persistence.xml?view=auto&rev=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/persistence.xml (added)
+++ myfaces/tobago/trunk/example/addressbook/src/main/resources/META-INF/persistence.xml Sun Feb 18 12:59:27 2007
@@ -0,0 +1,27 @@
+<?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.
+-->
+<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="addressBook" transaction-type="RESOURCE_LOCAL">
+      <class>org.apache.myfaces.tobago.example.addressbook.Address</class>
+      <class>org.apache.myfaces.tobago.example.addressbook.EmailAddress</class>
+    </persistence-unit>
+</persistence>
+

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/applicationContext.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/applicationContext.xml?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/applicationContext.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/applicationContext.xml Sun Feb 18 12:59:27 2007
@@ -1,5 +1,4 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
 
 <!--
  * Licensed to the Apache Software Foundation (ASF) under one or more
@@ -18,12 +17,76 @@
  * limitations under the License.
 -->
 
-<beans>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:tx="http://www.springframework.org/schema/tx"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+                           http://www.springframework.org/schema/beans/spring-beans.xsd
+                           http://www.springframework.org/schema/tx
+                           http://www.springframework.org/schema/tx/spring-tx-2.0.xsd">
 
-  <bean id="addressDAO"
-        class="org.apache.myfaces.tobago.example.addressbook.XStreamAddressDAO"
-        singleton="true">
-    <property name="storageFileName" value="addresses.xml"/>
+  <bean class="org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor"/>
+  
+  <bean class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor"/>
+
+  <!--<bean id="entityManagerFactory"
+          class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
+    <property name="jpaProperties">
+      <props>
+        <prop key="toplink.logging.level">FINE</prop>
+        <prop key="toplink.jdbc.driver">org.apache.derby.jdbc.EmbeddedDriver</prop>
+        <prop key="toplink.jdbc.url">jdbc:derby:target/addressDB;create=true</prop>
+        <prop key="toplink.target-database">oracle.toplink.essentials.platform.database.DerbyPlatform</prop>
+        <prop key="toplink.ddl-generation">create-tables</prop>
+      </props>
+    </property>
+    <property name="persistenceUnitName" value="addressBook"/>
+  </bean>-->
+
+  <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+    <property name="dataSource" ref="dataSource"/>
+    <!--<property name="jpaVendorAdapter">
+      <bean class="org.springframework.orm.jpa.vendor.TopLinkJpaVendorAdapter">
+        <property name="showSql" value="true"/>
+        <property name="generateDdl" value="true"/>
+        <property name="databasePlatform" value="oracle.toplink.essentials.platform.database.DerbyPlatform"/>
+      </bean>
+    </property>-->
+    <!--<property name="jpaVendorAdapter">
+      <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+        <property name="databasePlatform" value="org.hibernate.dialect.DerbyDialect"/>
+        <property name="showSql" value="true"/>
+        <property name="generateDdl" value="true"/>
+      </bean>
+    </property>-->
+    <property name="jpaVendorAdapter">
+      <bean class="org.springframework.orm.jpa.vendor.OpenJpaVendorAdapter">
+        <property name="showSql" value="true"/>
+        <property name="generateDdl" value="true"/>
+      </bean>
+    </property>
+    <property name="persistenceUnitName" value="addressBook"/>
+    <property name="loadTimeWeaver">
+      <!--<bean class="org.springframework.instrument.classloading.ReflectiveLoadTimeWeaver"/>-->
+      <!--<bean class="org.springframework.instrument.classloading.InstrumentationLoadTimeWeaver"/>-->
+      <bean class="org.springframework.instrument.classloading.SimpleLoadTimeWeaver"/>
+    </property>
   </bean>
+
+  <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
+    <property name="driverClassName" value="org.apache.derby.jdbc.EmbeddedDriver"/>
+    <property name="url" value="jdbc:derby:target/addressDB;create=true"/>
+  </bean>
+
+  <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+    <property name="entityManagerFactory" ref="entityManagerFactory"/>
+    <property name="dataSource" ref="dataSource"/>
+  </bean>
+
+  <bean id="addressDAO" class="org.apache.myfaces.tobago.example.addressbook.JpaAddressDAO">
+    <property name="entityManagerFactory" ref="entityManagerFactory"/>
+  </bean>
+
+  <tx:annotation-driven />  
 
 </beans>

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/WEB-INF/faces-config.xml Sun Feb 18 12:59:27 2007
@@ -60,12 +60,12 @@
     <managed-property>
       <property-name>width</property-name>
       <property-class>int</property-class>
-      <value>400</value>
+      <value>600</value>
     </managed-property>
     <managed-property>
       <property-name>height</property-name>
       <property-class>int</property-class>
-      <value>480</value>
+      <value>500</value>
     </managed-property>
     <managed-property>
       <property-name>minimumWidth</property-name>
@@ -75,7 +75,7 @@
     <managed-property>
       <property-name>minimumHeight</property-name>
       <property-class>int</property-class>
-      <value>480</value>
+      <value>500</value>
     </managed-property>
      <managed-property>
       <property-name>maximumWidth</property-name>
@@ -85,7 +85,7 @@
     <managed-property>
       <property-name>maximumHeight</property-name>
       <property-class>int</property-class>
-      <value>480</value>
+      <value>500</value>
     </managed-property>
 
   </managed-bean>

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/editor.jsp Sun Feb 18 12:59:27 2007
@@ -86,18 +86,34 @@
                 <f:facet name="layout">
                   <tc:gridLayout rows="160px" columns="120px"/>
                 </f:facet>
-                <tc:button image="#{controller.currentAddress.imageFileName}"
-                    action="#{controller.popupFileUpload}">
-                  <%--<f:facet name="popup">--%>
-                    <%--<tc:popup width="300px" height="200px" left="200px"--%>
-                              <%--top="200px" rendered="#{controller.renderFileUploadPopup}"--%>
-                              <%--id="popup-fileUpload">--%>
-                      <%--<tc:file value="#{controller.uploadedFile}"/>--%>
-                      <%--<%--<tc:button action="#{controller.cancelPopup}" label="OK" defaultCommand="true"/>--%>--%>
-                      <%--<%--<tc:button action="#{controller.cancelPopup}" label="Cancel"/>--%>--%>
-                    <%--</tc:popup>--%>
-                  <%--</f:facet>--%>
-                </tc:button>
+                <tc:form>
+                  <tc:button image="#{controller.currentAddress.imageFileName}"
+                      action="#{controller.popupFileUpload}">
+                    <f:facet name="popup">
+                      <tc:popup width="300px" height="170px" left="200px"
+                                top="200px" rendered="#{controller.renderFileUploadPopup}"
+                                id="popup-fileUpload">
+                        <tc:box label="FileUpload">
+                          <f:facet name="layout">
+                            <tc:gridLayout rows="fixed;1*;fixed" margin="10" />
+                          </f:facet>
+                          <tc:file value="#{controller.uploadedFile}" required="true">
+                            <tc:validateFileItem contentType="image/*" />
+                          </tc:file>
+                          <tc:messages/>
+                          <tc:panel>
+                            <f:facet name="layout">
+                               <tc:gridLayout columns="1*;100px;100px" />
+                            </f:facet>
+                            <tc:cell/>
+                            <tc:button action="#{controller.okFileUpload}" label="OK" />
+                            <tc:button action="#{controller.cancelFileUpload}" label="Cancel" immediate="true"/>
+                          </tc:panel>
+                        </tc:box>
+                      </tc:popup>
+                    </f:facet>
+                  </tc:button>
+                </tc:form>
               </tc:panel>
             </tc:panel>
               <tc:panel>

Modified: myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp (original)
+++ myfaces/tobago/trunk/example/addressbook/src/main/webapp/list.jsp Sun Feb 18 12:59:27 2007
@@ -45,23 +45,24 @@
               <f:facet name="popup">
                 <tc:popup width="300px" height="200px" left="200px" top="200px"
                     rendered="#{controller.renderPopup}" id="popup">
-                  <f:facet name="layout">
-                    <tc:gridLayout rows="fixed;fixed;fixed;1*;fixed" />
-                  </f:facet>
-
-                  <tc:selectBooleanCheckbox label="First Name" value="#{controller.renderFirstName}"/>
-                  <tc:selectBooleanCheckbox label="Last Name" value="#{controller.renderLastName}"/>
-                  <tc:selectBooleanCheckbox label="Birthday" value="#{controller.renderDayOfBirth}"/>
-                  <tc:cell/>
-                  <tc:panel>
+                  <tc:box label="Select Columns">
                     <f:facet name="layout">
-                      <tc:gridLayout columns="1*;100px;100px" />
+                      <tc:gridLayout rows="fixed;fixed;fixed;1*;fixed" margin="10" />
                     </f:facet>
-                    <tc:cell/>
-                    <tc:button action="#{controller.cancelPopup}" label="OK" defaultCommand="true"/>
-                    <tc:button action="#{controller.cancelPopup}" label="Cancel" immediate="true"/>
-                  </tc:panel>
 
+                    <tc:selectBooleanCheckbox label="First Name" value="#{controller.renderFirstName}"/>
+                    <tc:selectBooleanCheckbox label="Last Name" value="#{controller.renderLastName}"/>
+                    <tc:selectBooleanCheckbox label="Birthday" value="#{controller.renderDayOfBirth}"/>
+                    <tc:cell/>
+                    <tc:panel>
+                      <f:facet name="layout">
+                        <tc:gridLayout columns="1*;100px;100px" />
+                      </f:facet>
+                      <tc:cell/>
+                      <tc:button action="#{controller.cancelPopup}" label="OK" defaultCommand="true"/>
+                      <tc:button action="#{controller.cancelPopup}" label="Cancel" immediate="true"/>
+                    </tc:panel>
+                  </tc:box>
                 </tc:popup>
               </f:facet>
             </tc:button>
@@ -70,7 +71,7 @@
 
         <tc:messages />
 
-        <tc:sheet columns="1*;1*" value="#{controller.currentAddressList}"
+        <tc:sheet columns="1*;1*;1*" value="#{controller.currentAddressList}"
             var="address" state="#{controller.selectedAddresses}">
           <tc:column label="#{bundle.listFirstName}" sortable="true"
                      rendered="#{controller.renderFirstName}">

Modified: myfaces/tobago/trunk/example/demo/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/demo/pom.xml?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/demo/pom.xml (original)
+++ myfaces/tobago/trunk/example/demo/pom.xml Sun Feb 18 12:59:27 2007
@@ -68,7 +68,8 @@
   </build>
   <scm>
     <connection>scm:svn:http://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/demo</connection>
-    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/demo</developerConnection>
+    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/myfaces/tobago/trunk/example/demo
+    </developerConnection>
     <url>http://svn.apache.org/viewcvs.cgi/myfaces/tobago/trunk/example/demo</url>
   </scm>
 
@@ -139,14 +140,14 @@
       <scope>provided</scope>
     </dependency>
     <!--<dependency>-->
-      <!--<groupId>myfaces</groupId>-->
-      <!--<artifactId>tomahawk</artifactId>-->
-      <!--<version>1.1.0</version>-->
-      <!--<purpose>jar</purpose>-->
+    <!--<groupId>myfaces</groupId>-->
+    <!--<artifactId>tomahawk</artifactId>-->
+    <!--<version>1.1.0</version>-->
+    <!--<purpose>jar</purpose>-->
     <!--</dependency>-->
 
   </dependencies>
-    <profiles>
+  <profiles>
     <profile>
       <id>myfaces</id>
       <activation>
@@ -211,28 +212,31 @@
       </dependencies>
     </profile>
     <profile>
-			<id>tomcat5x</id>
-			<build>
-				<plugins>
-					<plugin>
-						<groupId>org.codehaus.cargo</groupId>
-						<artifactId>cargo-maven2-plugin</artifactId>
-						<version>0.2</version>
-						<configuration>
-							<container>
-								<containerId>tomcat5x</containerId>
-								<zipUrlInstaller>
-									<url>http://apache.easy-webs.de/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.zip</url>
-									<installDir>${project.build.directory}/tomcat5</installDir>
-								</zipUrlInstaller>
-							</container>
-							<configuration>
-								<home>${project.build.directory}/tomcat5/container</home>
-							</configuration>
-						</configuration>
-					</plugin>
-				</plugins>
-			</build>
-		</profile>
+      <!--
+       mvn cargo:start -Ptomcat5x
+      -->
+      <id>tomcat5x</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.codehaus.cargo</groupId>
+            <artifactId>cargo-maven2-plugin</artifactId>
+            <version>0.2</version>
+            <configuration>
+              <container>
+                <containerId>tomcat5x</containerId>
+                <zipUrlInstaller>
+                  <url>http://apache.easy-webs.de/tomcat/tomcat-5/v5.5.20/bin/apache-tomcat-5.5.20.zip</url>
+                  <installDir>${project.build.directory}/tomcat5</installDir>
+                </zipUrlInstaller>
+              </container>
+              <configuration>
+                <home>${project.build.directory}/tomcat5/container</home>
+              </configuration>
+            </configuration>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
   </profiles>
 </project>

Modified: myfaces/tobago/trunk/example/pom.xml
URL: http://svn.apache.org/viewvc/myfaces/tobago/trunk/example/pom.xml?view=diff&rev=508997&r1=508996&r2=508997
==============================================================================
--- myfaces/tobago/trunk/example/pom.xml (original)
+++ myfaces/tobago/trunk/example/pom.xml Sun Feb 18 12:59:27 2007
@@ -35,8 +35,11 @@
   <build>
     <plugins>
       <plugin>
-        <!-- NOTE The demo run only with mvn jetty:run-exploded.
-         For the other examples mvn jetty:run should work.-->
+        <!-- NOTE The demo and addressbook run only with mvn jetty:run-exploded.
+         For the other examples mvn jetty:run should work.
+         For Debugging with jetty set following options
+            MAVEN_OPTS="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,address=8000"
+         -->
         <groupId>org.mortbay.jetty</groupId>
         <artifactId>maven-jetty-plugin</artifactId>
         <version>6.1.1</version>