incubator-isis-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danhayw...@apache.org
Subject svn commit: r1225837 - in /incubator/isis/trunk/examples/embeddedinspring: ./ src/ src/main/ src/main/java/ src/main/java/org/ src/main/java/org/apache/ src/main/java/org/apache/isis/ src/main/java/org/apache/isis/examples/ src/main/java/org/apache/isi...
Date Fri, 30 Dec 2011 14:42:56 GMT
Author: danhaywood
Date: Fri Dec 30 14:42:54 2011
New Revision: 1225837

URL: http://svn.apache.org/viewvc?rev=1225837&view=rev
Log:
ISIS-161: initial take-on of an example spring app, bootstrapping IsisMetaModel but with a no-op for EmbeddedContext impl

Added:
    incubator/isis/trunk/examples/embeddedinspring/
    incubator/isis/trunk/examples/embeddedinspring/pom.xml
    incubator/isis/trunk/examples/embeddedinspring/src/
    incubator/isis/trunk/examples/embeddedinspring/src/main/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/HomeController.java
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/PersonDao.java
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/
    incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/Person.java
    incubator/isis/trunk/examples/embeddedinspring/src/main/resources/
    incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/
    incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/persistence.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/resources/db.properties
    incubator/isis/trunk/examples/embeddedinspring/src/main/resources/log4j.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/MANIFEST.MF
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/context.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/controllers.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/isis.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/root-context.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/edit.jsp
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/home.jsp
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/list.jsp
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/web.xml
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/index.html
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/
    incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/screen.css
    incubator/isis/trunk/examples/embeddedinspring/src/test/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/DataInitializer.java
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/HomeControllerTest.java
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/
    incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java
    incubator/isis/trunk/examples/embeddedinspring/src/test/resources/
    incubator/isis/trunk/examples/embeddedinspring/src/test/resources/db.properties
    incubator/isis/trunk/examples/embeddedinspring/src/test/resources/log4j.xml
    incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-context.xml
    incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-db.xml

Added: incubator/isis/trunk/examples/embeddedinspring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/pom.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/pom.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/pom.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,242 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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>
+	<groupId>org.apache.isis.examples</groupId>
+	<artifactId>embeddedinspring</artifactId>
+	<packaging>war</packaging>
+	<version>0.2.0-incubating-SNAPSHOT</version>
+	<name>embeddedinspring</name>
+
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<jetty.version>6.1.4</jetty.version>
+		<spring.version>3.0.5.RELEASE</spring.version>
+		<slf4j.version>1.5.10</slf4j.version>
+		<java.version>1.5</java.version>
+		<junit.version>4.8.2</junit.version>
+	</properties>
+
+	<dependencies>
+
+
+		<!-- Bean Validation Dependencies -->
+
+		<dependency>
+			<groupId>javax.validation</groupId>
+			<artifactId>validation-api</artifactId>
+			<version>1.0.0.GA</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-validator</artifactId>
+			<version>4.0.0.GA</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- JPA Persistence Dependencies -->
+
+		<dependency>
+			<groupId>org.hibernate</groupId>
+			<artifactId>hibernate-entitymanager</artifactId>
+			<version>3.6.0.Final</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>hsqldb</groupId>
+			<artifactId>hsqldb</artifactId>
+			<version>1.8.0.10</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.hibernate.javax.persistence</groupId>
+			<artifactId>hibernate-jpa-2.0-api</artifactId>
+			<version>1.0.0.Final</version>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- Spring Dependencies -->
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context</artifactId>
+			<version>${spring.version}</version>
+			<exclusions>
+				<!-- Exclude Commons Logging in favor of SLF4j -->
+				<exclusion>
+					<groupId>commons-logging</groupId>
+					<artifactId>commons-logging</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-orm</artifactId>
+			<version>${spring.version}</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-test</artifactId>
+			<version>${spring.version}</version>
+			<type>jar</type>
+			<scope>test</scope>
+		</dependency>
+
+		<!-- DB Dependencies -->
+
+		<dependency>
+			<groupId>commons-dbcp</groupId>
+			<artifactId>commons-dbcp</artifactId>
+			<version>20030825.184428</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+		<dependency>
+			<groupId>commons-pool</groupId>
+			<artifactId>commons-pool</artifactId>
+			<version>20030825.183949</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- View Dependencies -->
+		<dependency>
+			<groupId>taglibs</groupId>
+			<artifactId>standard</artifactId>
+			<version>1.1.2</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+
+		<!-- Test Dependencies -->
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>${junit.version}</version>
+			<scope>test</scope>
+		</dependency>
+
+		<!-- logging -->
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>${slf4j.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>jcl-over-slf4j</artifactId>
+			<version>${slf4j.version}</version>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>${slf4j.version}</version>
+			<scope>runtime</scope>
+		</dependency>
+		<dependency>
+			<groupId>log4j</groupId>
+			<artifactId>log4j</artifactId>
+			<version>1.2.15</version>
+			<exclusions>
+				<exclusion>
+					<groupId>com.sun.jdmk</groupId>
+					<artifactId>jmxtools</artifactId>
+				</exclusion>
+				<exclusion>
+					<groupId>com.sun.jmx</groupId>
+					<artifactId>jmxri</artifactId>
+				</exclusion>
+			</exclusions>
+			<scope>runtime</scope>
+		</dependency>
+
+
+		<dependency>
+			<groupId>jstl</groupId>
+			<artifactId>jstl</artifactId>
+			<version>1.1.2</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+		<dependency>
+			<groupId>org.apache.isis.runtimes</groupId>
+			<artifactId>embedded</artifactId>
+			<version>0.2.0-incubating-SNAPSHOT</version>
+			<type>jar</type>
+			<scope>compile</scope>
+		</dependency>
+
+	</dependencies>
+
+	<repositories>
+		<!-- JBoss Repository used for Java EE 6 pieces -->
+		<repository>
+			<id>repository.jboss.org</id>
+			<name>JBoss Repository</name>
+			<url>http://repository.jboss.org/nexus/content/groups/public-jboss/</url>
+		</repository>
+
+		<repository>
+			<id>org.springframework.maven.milestone</id>
+			<name>Spring Maven Milestone Repository</name>
+			<url>http://maven.springframework.org/milestone</url>
+			<snapshots>
+				<enabled>false</enabled>
+			</snapshots>
+		</repository>
+	</repositories>
+
+	<build>
+		<finalName>embeddedinspring</finalName>
+		<plugins>
+
+			<!-- Facilitates downloading source and javadoc in Eclipse -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-eclipse-plugin</artifactId>
+				<version>2.8</version>
+				<configuration>
+					<wtpversion>2.0</wtpversion>
+					<downloadSources>true</downloadSources>
+					<downloadJavadocs>true</downloadJavadocs>
+				</configuration>
+			</plugin>
+
+			<!-- Plugin to run and test through maven -->
+			<plugin>
+				<groupId>org.mortbay.jetty</groupId>
+				<artifactId>maven-jetty-plugin</artifactId>
+				<version>6.1.25</version>
+				<configuration>
+					<scanIntervalSeconds>3</scanIntervalSeconds>
+				</configuration>
+			</plugin>
+
+			<!-- Ensures we are compiling at 1.6 level -->
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>${java.version}</source>
+					<target>${java.version}</target>
+				</configuration>
+			</plugin>
+
+		</plugins>
+	</build>
+</project>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/HomeController.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/HomeController.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/HomeController.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/HomeController.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,31 @@
+package org.apache.isis.examples.embeddedinspring.controller;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * Sample controller for going to the home page with a message
+ */
+@Controller
+public class HomeController {
+
+	private static final Logger logger = LoggerFactory
+			.getLogger(HomeController.class);
+
+	/**
+	 * Selects the home page and populates the model with a message
+	 */
+	@RequestMapping(value = "/", method = RequestMethod.GET)
+	public String home(Model model) {
+		logger.info("Welcome home!");
+		model.addAttribute("controllerMessage",
+				"This is the message from the controller!");
+		return "home";
+	}
+	
+
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,70 @@
+package org.apache.isis.examples.embeddedinspring.controller;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.isis.core.metamodel.spec.ObjectSpecification;
+import org.apache.isis.examples.embeddedinspring.dao.PersonDao;
+import org.apache.isis.examples.embeddedinspring.model.Person;
+import org.apache.isis.runtimes.embedded.IsisMetaModel;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+@RequestMapping("/person/")
+public class PersonController {
+	
+	private static final Logger logger = LoggerFactory.getLogger(PersonController.class);
+
+	@Autowired
+	private PersonDao personDao;
+
+	@Autowired
+	private IsisMetaModel isisMetaModel;
+
+	@RequestMapping(method=RequestMethod.GET,value="edit")
+	public ModelAndView editPerson(@RequestParam(value="id",required=false) Long id) {		
+		logger.debug("Received request to edit person id : "+id);				
+		ModelAndView mav = new ModelAndView();		
+ 		mav.setViewName("edit");
+ 		Person person = null;
+ 		if (id == null) {
+ 			person = new Person();
+ 		} else {
+ 			person = personDao.find(id);
+ 		}
+ 		
+ 		mav.addObject("person", person);
+		return mav;
+		
+	}
+	
+	@RequestMapping(method=RequestMethod.POST,value="edit") 
+	public String savePerson(@ModelAttribute Person person) {
+		logger.debug("Received postback on person "+person);		
+		personDao.save(person);
+		return "redirect:list";
+		
+	}
+	
+	@RequestMapping(method=RequestMethod.GET,value="list")
+	public ModelAndView listPeople() {
+		logger.debug("Received request to list persons");
+		ModelAndView mav = new ModelAndView();
+		List<Person> people = personDao.listPeople();
+		logger.debug("Person Listing count = "+people.size());
+		mav.addObject("people",people);
+		mav.setViewName("list");
+		return mav;
+		
+	}
+
+	
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/PersonDao.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/PersonDao.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/PersonDao.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/dao/PersonDao.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,37 @@
+package org.apache.isis.examples.embeddedinspring.dao;
+
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.isis.examples.embeddedinspring.model.Person;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+@Repository("personRepo")
+public class PersonDao {
+
+	@PersistenceContext
+	private EntityManager entityManager;
+	
+	public Person find(Long id) {
+		return entityManager.find(Person.class, id);
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<Person> listPeople() {
+		return entityManager.createQuery("select p from Person p").getResultList();
+	}
+	
+	@Transactional
+	public Person save(Person person) {
+		if (person.getId() == null) {
+			entityManager.persist(person);
+			return person;
+		} else {
+			return entityManager.merge(person);
+		}		
+	}	
+	
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/Person.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/Person.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/Person.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/model/Person.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,115 @@
+package org.apache.isis.examples.embeddedinspring.model;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
+import javax.persistence.Id;
+
+@Entity
+public class Person implements Serializable {
+
+	private static final long serialVersionUID = -1308795024262635690L;
+
+	@Id
+	@GeneratedValue(strategy = GenerationType.AUTO)
+	private Long id;
+
+	@Column
+	private String firstName;
+
+	@Column
+	private String lastName;
+
+	public Person() {
+	}
+
+	public Person(String firstName, String lastName) {
+		super();
+		this.firstName = firstName;
+		this.lastName = lastName;
+	}
+
+	// {{ Id (property)
+	public Long getId() {
+		return id;
+	}
+
+	public void setId(Long id) {
+		this.id = id;
+	}
+	// }}
+
+	// {{ FirstName (property)
+	public String getFirstName() {
+		return firstName;
+	}
+
+	public void setFirstName(String firstName) {
+		this.firstName = firstName;
+	}
+	// }}
+
+	// {{ LastName (property)
+	public String getLastName() {
+		return lastName;
+	}
+
+	public void setLastName(String lastName) {
+		this.lastName = lastName;
+	}
+	// }}
+
+	// {{ toString
+	@Override
+	public String toString() {
+
+		return super.toString() + " name = " + firstName + " " + lastName
+				+ " id = " + id;
+	}
+	// }}
+
+	// {{ equals, hashCode
+	// }}
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((firstName == null) ? 0 : firstName.hashCode());
+		result = prime * result + ((id == null) ? 0 : id.hashCode());
+		result = prime * result
+				+ ((lastName == null) ? 0 : lastName.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		Person other = (Person) obj;
+		if (firstName == null) {
+			if (other.firstName != null)
+				return false;
+		} else if (!firstName.equals(other.firstName))
+			return false;
+		if (id == null) {
+			if (other.id != null)
+				return false;
+		} else if (!id.equals(other.id))
+			return false;
+		if (lastName == null) {
+			if (other.lastName != null)
+				return false;
+		} else if (!lastName.equals(other.lastName))
+			return false;
+		return true;
+	}
+
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/persistence.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/persistence.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/persistence.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/resources/META-INF/persistence.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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="acme" transaction-type="RESOURCE_LOCAL">
+		<properties>
+			<property name="hibernate.hbm2ddl.auto" value="create-drop" />
+			<property name="hibernate.show_sql" value="true" />
+			<property name="hibernate.transaction.flush_before_completion"
+				value="true" />
+			<property name="hibernate.cache.provider_class" value="org.hibernate.cache.HashtableCacheProvider" />
+		</properties>
+	</persistence-unit>
+
+</persistence>
\ No newline at end of file

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/resources/db.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/resources/db.properties?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/resources/db.properties (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/resources/db.properties Fri Dec 30 14:42:54 2011
@@ -0,0 +1,16 @@
+db.username=sa
+db.password=
+db.driver=org.hsqldb.jdbcDriver
+db.url=jdbc:hsqldb:mem:app-db
+db.dialect=org.hibernate.dialect.HSQLDialect
+
+
+#MySQL Options
+#db.password=password
+#db.username=username
+#db.url=jdbc:mysql://localhost/dbname
+#db.dialect=org.hibernate.dialect.MySQL5Dialect
+#db.driver=com.mysql.jdbc.Driver
+
+ 
+

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/resources/log4j.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/resources/log4j.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/resources/log4j.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/resources/log4j.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<!-- Appenders -->
+	<appender name="console" class="org.apache.log4j.ConsoleAppender">
+		<param name="Target" value="System.out" />
+		<layout class="org.apache.log4j.PatternLayout">
+			<param name="ConversionPattern" value="%-5p: %c - %m%n" />
+		</layout>
+	</appender>
+	
+	<!-- Application Loggers -->
+	<logger name="org.application">
+		<level value="debug" />
+	</logger>
+	
+	<!-- 3rdparty Loggers -->
+	<logger name="org.springframework.core">
+		<level value="info" />
+	</logger>
+	
+	<logger name="org.springframework.beans">
+		<level value="info" />
+	</logger>
+	
+	<logger name="org.springframework.context">
+		<level value="info" />
+	</logger>
+
+	<logger name="org.springframework.web">
+		<level value="info" />
+	</logger>
+	
+	<logger name="org.hibernate">
+		<level value="warn" />
+	</logger>
+
+	
+
+	<!-- Root Logger -->
+	<root>
+		<priority value="warn" />
+		<appender-ref ref="console" />
+	</root>
+	
+</log4j:configuration>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/MANIFEST.MF?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/MANIFEST.MF (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/MANIFEST.MF Fri Dec 30 14:42:54 2011
@@ -0,0 +1,3 @@
+Manifest-Version: 1.0
+Class-Path: 
+

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/context.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/context.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/context.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/META-INF/context.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Context>
+   <!-- disable storage of sessions across restarts -->
+   <Manager pathname=""/>
+   <Resource name="BeanManager" auth="Container" type="javax.enterprise.inject.spi.BeanManager" factory="org.jboss.weld.resources.ManagerObjectFactory"/>
+   <!-- Uncomment to enable injection into Servlets, Servlet Listeners and Filters in Tomcat -->
+   <!-- <Listener className="org.jboss.weld.environment.tomcat.WeldLifecycleListener"/> -->
+</Context>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/controllers.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/controllers.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/controllers.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/controllers.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd	
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
+
+	<!-- Scans within the base package of the application for @Components to 
+		configure as beans -->
+	<context:component-scan base-package="org.apache.isis.examples.embeddedinspring.controller" />
+	
+	<tx:annotation-driven />
+	
+</beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans:beans xmlns="http://www.springframework.org/schema/mvc"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:beans="http://www.springframework.org/schema/beans"
+	
+	xsi:schemaLocation="
+        http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd">
+
+	<!-- DispatcherServlet Context: defines this servlet's request-processing infrastructure -->
+	
+	<!-- Enables the Spring MVC @Controller programming model -->
+	<annotation-driven />	
+
+	
+
+	<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
+	<resources mapping="/resources/**" location="/resources/" />
+
+	<!-- Resolves views selected for rendering by @Controllers to .jsp resources in the /WEB-INF/views directory -->
+	<beans:bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+		<beans:property name="prefix" value="/WEB-INF/views/" />
+		<beans:property name="suffix" value=".jsp" />
+	</beans:bean>
+	
+	<!-- Imports user-defined @Controller beans that process client requests -->
+	<beans:import resource="controllers.xml" />
+	
+
+	<beans:bean id="validator"
+		class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean" />
+	
+</beans:beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd	
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-autowire="byName">
+
+	<!-- Scans within the base package of the application for @Components to configure as beans -->
+	<bean id="placeholderConfig"
+		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+		<property name="location" value="classpath:db.properties" />
+	</bean>
+
+	<bean id="entityManagerFactory"
+		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+		<property name="jpaVendorAdapter">
+			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+				<property name="showSql" value="true" />
+				<property name="generateDdl" value="true" />
+				<property name="databasePlatform" value="${db.dialect}" />
+			</bean>
+		</property>		
+	</bean>
+
+	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
+		destroy-method="close">
+		<property name="driverClassName" value="${db.driver}" />
+		<property name="url" value="${db.url}" />
+		<property name="username" value="${db.username}" />
+		<property name="password" value="${db.password}" />
+	</bean>
+
+	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+	</bean>
+		
+
+	<bean
+		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
+	
+</beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/isis.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/isis.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/isis.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/isis.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd	
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-autowire="byName">
+
+
+	<bean id="isisMetaModel" class="org.apache.isis.runtimes.embedded.IsisMetaModel" init-method="init">
+		<constructor-arg ref="embeddedContext"/>
+		<constructor-arg ref="personRepo"/>
+	</bean>	
+	
+	<bean id="embeddedContext" class="org.apache.isis.runtimes.embedded.EmbeddedContextNoop"/>
+
+	
+</beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/root-context.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/root-context.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/root-context.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/root-context.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<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"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+	http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
+	http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+	<!-- Root Context: defines shared resources visible to all other web components -->
+				
+	<context:component-scan base-package="org.apache.isis.examples.embeddedinspring.dao" />
+				
+	
+	<import resource="db.xml" />
+	<import resource="isis.xml" />
+		
+	
+</beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/edit.jsp
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/edit.jsp?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/edit.jsp (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/edit.jsp Fri Dec 30 14:42:54 2011
@@ -0,0 +1,25 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ page session="false" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+<html>
+<head>
+	<title>Home</title>
+</head>
+<body>
+<h1>
+	Editing Person ${person.id} - ${person.firstName}  ${person.lastName} 
+</h1>
+<form:form commandName="person" style="padding:8px">
+    ID - ${person.id}<br/>
+    <p>
+        First Name<br/>
+        <form:input path="firstName"/>
+    </p>
+    <p>
+        Last Name<br/>
+        <form:input path="lastName"/>
+    </p>
+    <input type="submit" value="Save"/>
+</form:form>
+</body>
+</html>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/home.jsp
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/home.jsp?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/home.jsp (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/home.jsp Fri Dec 30 14:42:54 2011
@@ -0,0 +1,16 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ page session="false" %>
+<html>
+<head>
+	<title>Home</title>
+</head>
+<body>
+<h1>
+	Hello world! - 
+</h1>
+${controllerMessage}<br/>
+<br/>
+<br/>
+<a href="person/list">Go to the person list</a>
+</body>
+</html>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/list.jsp
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/list.jsp?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/list.jsp (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/views/list.jsp Fri Dec 30 14:42:54 2011
@@ -0,0 +1,16 @@
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
+<%@ page session="false"%>
+<html>
+<head>
+<title>Home</title>
+</head>
+<body>
+<h1>Listing People</h1>
+<c:forEach items="${people}" var="v_person">
+	<a href="edit?id=${v_person.id}">${v_person.id} -
+	${v_person.firstName} ${v_person.lastName}</a>
+	<br />
+</c:forEach>
+<a href="edit"> Add Person</a>
+</body>
+</html>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/web.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/web.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/web.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Use this definition if using a Java EE 6 container This also stops Eclipse 
+	from complaining that 3.0 is not a valid version <web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" 
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation=" 
+	http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> -->
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+	version="2.5">
+
+	<!-- The definition of the Root Spring Container shared by all Servlets 
+		and Filters -->
+	<context-param>
+		<param-name>contextConfigLocation</param-name>
+		<param-value>/WEB-INF/spring/root-context.xml</param-value>
+	</context-param>
+
+	<!-- Creates the Spring Container shared by all Servlets and Filters -->
+	<listener>
+		<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+	</listener>
+
+	<!-- Processes application requests -->
+	<servlet>
+		<servlet-name>appServlet</servlet-name>
+		<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+		<init-param>
+			<param-name>contextConfigLocation</param-name>
+			<param-value>/WEB-INF/spring/app/servlet-context.xml</param-value>
+		</init-param>
+		<load-on-startup>1</load-on-startup>
+	</servlet>
+
+	<servlet-mapping>
+		<servlet-name>appServlet</servlet-name>
+		<url-pattern>/spring/*</url-pattern>
+	</servlet-mapping>
+
+
+
+</web-app>
\ No newline at end of file

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/index.html
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/index.html?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/index.html (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/index.html Fri Dec 30 14:42:54 2011
@@ -0,0 +1,5 @@
+<html> 
+<head>
+  <meta http-equiv="Refresh" content="0; URL=spring/">
+</head>
+</html>

Added: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/screen.css
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/screen.css?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/screen.css (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/resources/css/screen.css Fri Dec 30 14:42:54 2011
@@ -0,0 +1,133 @@
+body {
+	margin: 0;
+	padding: 0;
+	background-color: #EAECEE;
+	font-family: Verdana, sans-serif;
+	font-size: 10px;
+}
+
+#header {
+	height: 120px;
+	border-bottom: 3px solid #c0c0c0;
+	background: #204080;
+	text-align: center;
+	color: #f0f0f0;
+	margin: 0;
+	padding: 0;
+}
+
+#header h1 {
+	padding-top: 24px;
+	font-size: 250%;
+}
+
+#header a {
+	color : #f0f0f0;
+}
+
+#page {
+	background: #ffffff;
+	width: 960px;
+	margin-left: auto;
+	margin-right: auto;
+	border-right: solid 2px #a0a0a0;
+	border-bottom: solid 2px #a0a0a0;
+}
+
+#sidebar {
+	float: right;
+	width: 200px;	
+	border: 1px solid #d0d0d0;
+	min-height: 240px;
+	padding: 4px;
+}
+
+#sidebar h1 {
+	display: block;
+	font-size: 120%;
+	border-bottom: 1px solid #d0d0d0;
+}
+
+#container {
+	padding: 8px;
+}
+
+#content {
+	min-height: 320px;
+	font-size: 120%;
+	width: 720px;
+}
+
+#footer {
+	text-align: center;
+	padding: 8px;
+	margin: 8px;
+	border-top: 1px solid #c0c0c0;
+	clear : both;
+}
+
+.panel {
+	border: 1px solid #d0d0d0;
+	padding: 8px;
+	margin: 8px 4px 16px 4px;
+	background: #fafafa;
+}
+
+.panel h1 {
+	font-size: 120%;
+	display: block;
+	background: #f0f0f0;
+	padding: 6px;
+	margin: -8px;
+	border-bottom: 1px solid #d0d0d0;
+	margin-bottom: 8px;
+}
+
+.odd {
+	background: #f0f0f0;
+}
+
+.even {
+	background: #ffffff;
+}
+
+.dataTable {
+	border-collapse: collapse;;
+	width: 100%;
+}
+
+.dataTable th {
+	background: #204080;
+	color: #f0f0f0;
+	padding: 6px;
+	border: 1px solid #f0f0f0;
+}
+
+.dataTable td {
+	border: 1px solid #d0d0d0;
+	padding: 4px;
+}
+
+.caption {
+	float: left;
+	width: 100px;
+}
+
+.formCaption {
+	float: left;
+	width: 100px;
+	padding-top: 4px;
+}
+
+.value {	
+	margin-right: 8px;
+}
+
+.errorMessage {
+	color: #ff0000;
+	font-weight: bold;
+}
+
+.property {
+	margin-bottom: 12px;
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/DataInitializer.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/DataInitializer.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/DataInitializer.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/DataInitializer.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,44 @@
+package org.apache.isis.examples.embeddedinspring.controller;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+import org.apache.isis.examples.embeddedinspring.model.Person;
+import org.springframework.context.annotation.Scope;
+import org.springframework.stereotype.Component;
+
+@Component
+@Scope("prototype")
+public class DataInitializer {
+
+	public static final int PERSON_COUNT = 3;
+
+	@PersistenceContext
+	private EntityManager entityManager;
+
+	public List<Long> people = new ArrayList<Long>();
+
+	public void initData() {
+		people.clear();// clear out the previous list of people
+		addPerson("Jim", "Smith");
+		addPerson("Tina", "Marsh");
+		addPerson("Steve", "Blair");
+		entityManager.flush();
+		entityManager.clear();
+	}
+
+	public void addPerson(String firstName, String lastName) {
+		Person p = new Person();
+		p.setFirstName(firstName);
+		p.setLastName(lastName);
+		entityManager.persist(p);
+		people.add(p.getId());
+	}
+	
+	public EntityManager getEntityManager() {
+		return entityManager;
+	}
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/HomeControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/HomeControllerTest.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/HomeControllerTest.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/HomeControllerTest.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,20 @@
+package org.apache.isis.examples.embeddedinspring.controller;
+
+import junit.framework.Assert;
+
+import org.junit.Test;
+import org.springframework.ui.ExtendedModelMap;
+import org.springframework.ui.Model;
+
+public class HomeControllerTest {
+
+	@Test
+	public void testController() {
+		HomeController controller = new HomeController();
+		Model model = new ExtendedModelMap();
+		Assert.assertEquals("home",controller.home(model));
+		
+		Object message = model.asMap().get("controllerMessage");
+		Assert.assertEquals("This is the message from the controller!",message);		
+	}
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,73 @@
+package org.apache.isis.examples.embeddedinspring.controller;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+
+import org.apache.isis.examples.embeddedinspring.model.Person;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.web.servlet.ModelAndView;
+
+@ContextConfiguration("/test-context.xml")
+@RunWith(SpringJUnit4ClassRunner.class)
+@Transactional
+public class PersonControllerTest {
+	
+	@Autowired
+	private DataInitializer dataInitializer;
+	
+	@Autowired
+	private PersonController personController;
+		
+	@Before
+	public void before() {
+		dataInitializer.initData();
+	}
+	
+	@Test
+	public void shouldReturnPersonListView() {
+		ModelAndView mav = personController.listPeople();
+		assertEquals("list",mav.getViewName());
+		
+		@SuppressWarnings("unchecked")
+		List<Person> people = (List<Person>) mav.getModelMap().get("people");
+		assertNotNull(people);		
+		assertEquals(DataInitializer.PERSON_COUNT,people.size());		
+	}
+	
+	
+
+	public void shouldReturnNewPersonWithEditMav() {
+		ModelAndView mav = personController.editPerson(null);
+		assertNotNull(mav);
+		assertEquals("edit", mav.getViewName());
+		Object object = mav.getModel().get("person");
+		assertTrue(Person.class.isAssignableFrom(object.getClass()));
+		Person person = (Person) object;
+		assertNull(person.getId());
+		assertNull(person.getFirstName());
+		assertNull(person.getLastName());		
+	}
+	
+	@Test
+	public void shouldReturnSecondPersonWithEditMav() {
+		Long template = dataInitializer.people.get(1);
+		ModelAndView mav = personController.editPerson(template);
+		assertNotNull(mav);
+		assertEquals("edit", mav.getViewName());
+		Object object = mav.getModel().get("person");
+		assertTrue(Person.class.isAssignableFrom(object.getClass()));
+		Person person = (Person) object;
+		assertEquals(template,person.getId());
+	}
+	
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java Fri Dec 30 14:42:54 2011
@@ -0,0 +1,57 @@
+package org.apache.isis.examples.embeddedinspring.dao;
+
+import java.util.List;
+
+import org.apache.isis.examples.embeddedinspring.controller.DataInitializer;
+import org.apache.isis.examples.embeddedinspring.model.Person;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.test.context.ContextConfiguration;
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
+import org.springframework.transaction.annotation.Transactional;
+
+@ContextConfiguration("/test-context.xml")
+@RunWith(SpringJUnit4ClassRunner.class)
+@Transactional
+public class PersonDaoTest {
+
+	@Autowired
+	private PersonDao personDao;
+
+	@Autowired
+	private DataInitializer dataInitializer;
+
+	@Before
+	public void prepareData() {
+		dataInitializer.initData();
+	}
+
+	@Test
+	public void shouldSaveAPerson() {
+		Person p = new Person();
+		p.setFirstName("Andy");
+		p.setLastName("Gibson");
+		personDao.save(p);
+		Long id = p.getId();
+		Assert.assertNotNull(id);
+	}
+
+	@Test
+	public void shouldLoadAPerson() {
+		Long template = dataInitializer.people.get(0);
+		Person p = personDao.find(template);
+
+		Assert.assertNotNull("Person not found!", p);
+		Assert.assertEquals(template, p.getId());
+	}
+
+	public void shouldListPeople() {
+		List<Person> people = personDao.listPeople();
+		Assert.assertEquals(DataInitializer.PERSON_COUNT, people.size());
+
+	}
+
+}

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/resources/db.properties
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/resources/db.properties?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/resources/db.properties (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/resources/db.properties Fri Dec 30 14:42:54 2011
@@ -0,0 +1,15 @@
+db.username=sa
+db.password=
+db.driver=org.hsqldb.jdbcDriver
+db.url=jdbc:hsqldb:mem:app-db
+db.dialect=org.hibernate.dialect.HSQLDialect
+
+
+#MySQL Options
+#db.password=password
+#db.username=username
+#db.url=jdbc:mysql://localhost/dbname
+#db.dialect=org.hibernate.dialect.MySQL5Dialect
+#db.driver=com.mysql.jdbc.Driver
+
+ 

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/resources/log4j.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/resources/log4j.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/resources/log4j.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/resources/log4j.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd" >
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+	<!-- Appenders -->
+	<appender name="console" class="org.apache.log4j.ConsoleAppender">
+		<param name="Target" value="System.out" />
+		<layout class="org.apache.log4j.PatternLayout">
+			<param name="ConversionPattern" value="%-5p: %c - %m%n" />
+		</layout>
+	</appender>
+	
+	<!-- Application Loggers -->
+	<logger name="org.application">
+		<level value="debug" />
+	</logger>
+	
+	<!-- 3rdparty Loggers -->
+	<logger name="org.springframework.core">
+		<level value="info" />
+	</logger>	
+	
+	<logger name="org.springframework.beans">
+		<level value="info" />
+	</logger>
+	
+	<logger name="org.springframework.context">
+		<level value="info" />
+	</logger>
+
+	<logger name="org.springframework.web">
+		<level value="info" />
+	</logger>
+
+	<!-- Root Logger -->
+	<root>
+		<priority value="info" />
+		<appender-ref ref="console" />
+	</root>
+	
+</log4j:configuration>

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-context.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-context.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-context.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-context.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd	
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd"
+	default-autowire="byName">
+
+	<!-- Scans within the base package of the application for @Components to 
+		configure as beans -->
+	<import resource="test-db.xml" />
+
+	<tx:annotation-driven />
+	<context:component-scan base-package="org.apache.isis.examples.embeddedinspring" />	
+
+</beans>

Added: incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-db.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-db.xml?rev=1225837&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-db.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-db.xml Fri Dec 30 14:42:54 2011
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xmlns:mvc="http://www.springframework.org/schema/mvc"
+	xmlns:context="http://www.springframework.org/schema/context"
+	xmlns:tx="http://www.springframework.org/schema/tx"
+	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+		http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd	
+		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
+		http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd" default-autowire="byName">
+
+	<!-- Scans within the base package of the application for @Components to configure as beans -->
+	<bean id="placeholderConfig"
+		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+		<property name="location" value="classpath:db.properties" />
+	</bean>
+
+	<bean id="entityManagerFactory"
+		class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
+		<property name="jpaVendorAdapter">
+			<bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
+				<property name="showSql" value="true" />
+				<property name="generateDdl" value="true" />
+				<property name="databasePlatform" value="${db.dialect}" />
+			</bean>
+		</property>		
+	</bean>
+
+	<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
+		destroy-method="close">
+		<property name="driverClassName" value="${db.driver}" />
+		<property name="url" value="${db.url}" />
+		<property name="username" value="${db.username}" />
+		<property name="password" value="${db.password}" />
+	</bean>
+
+	<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
+
+	</bean>
+	
+
+
+	<tx:annotation-driven />
+
+	<bean
+		class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
+	
+</beans>



Mime
View raw message