You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@isis.apache.org by da...@apache.org on 2012/01/08 14:23:53 UTC
svn commit: r1228838 - in /incubator/isis/trunk/examples/embeddedinspring:
./ ide/eclipse/launch/
src/main/java/org/apache/isis/examples/embeddedinspring/controller/
src/main/webapp/WEB-INF/spring/ src/main/webapp/WEB-INF/spring/app/
src/test/java/org/...
Author: danhaywood
Date: Sun Jan 8 13:23:52 2012
New Revision: 1228838
URL: http://svn.apache.org/viewvc?rev=1228838&view=rev
Log:
ISIS-25: more on the embedded runtime example
Added:
incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/WebServerBootstrapper.launch
incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/
incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java
incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-isis.xml
Removed:
incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/embeddedinspring.launch
Modified:
incubator/isis/trunk/examples/embeddedinspring/ (props changed)
incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java
incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/isis.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/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java
incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java
Propchange: incubator/isis/trunk/examples/embeddedinspring/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sun Jan 8 13:23:52 2012
@@ -0,0 +1,4 @@
+.settings
+.classpath
+.project
+target
Added: incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/WebServerBootstrapper.launch
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/WebServerBootstrapper.launch?rev=1228838&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/WebServerBootstrapper.launch (added)
+++ incubator/isis/trunk/examples/embeddedinspring/ide/eclipse/launch/WebServerBootstrapper.launch Sun Jan 8 13:23:52 2012
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="1"/>
+</listAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.CLASSPATH_PROVIDER" value="org.eclipse.m2e.launchconfig.classpathProvider"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.apache.isis.examples.embeddedinspring.webserver.WebServerBootstrapper"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="embeddedinspring"/>
+<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.m2e.launchconfig.sourcepathProvider"/>
+</launchConfiguration>
Modified: 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=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/java/org/apache/isis/examples/embeddedinspring/controller/PersonController.java Sun Jan 8 13:23:52 2012
@@ -1,15 +1,14 @@
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.context.ApplicationContext;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -30,7 +29,8 @@ public class PersonController {
private IsisMetaModel isisMetaModel;
@RequestMapping(method=RequestMethod.GET,value="edit")
- public ModelAndView editPerson(@RequestParam(value="id",required=false) Long id) {
+ 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");
Modified: incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/isis.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/isis.xml?rev=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/isis.xml (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/isis.xml Sun Jan 8 13:23:52 2012
@@ -9,17 +9,14 @@
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"/>
- <property name="classSubstitutor">
- <bean class="org.apache.isis.examples.embeddedinspring.isis.CglibClassSubstitutor"></bean>
- </property>
- </bean>
-
-
- <bean id="embeddedContext" class="org.apache.isis.runtimes.embedded.EmbeddedContextNoop"/>
-
+ <bean id="isisMetaModel" class="org.apache.isis.runtimes.embedded.IsisMetaModel" init-method="init" >
+ <constructor-arg ref="embeddedContext"/>
+ <constructor-arg ref="personRepo"/>
+ <property name="classSubstitutor">
+ <bean class="org.apache.isis.examples.embeddedinspring.isis.CglibClassSubstitutor"></bean>
+ </property>
+ </bean>
+
+ <bean id="embeddedContext" class="org.apache.isis.runtimes.embedded.EmbeddedContextNoop"/>
</beans>
Modified: 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=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/app/servlet-context.xml Sun Jan 8 13:23:52 2012
@@ -7,21 +7,21 @@
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 />
+ <!-- Initialize the IsisMetaModel -->
+ <beans:import resource="isis.xml" />
+
<!-- Imports user-defined @Controller beans that process client requests -->
<beans:import resource="controllers.xml" />
<!-- Scan for DAOs -->
<beans:import resource="dao.xml" />
- <!-- Initialize the IsisMetaModel -->
- <beans:import resource="isis.xml" />
-
-
<!-- Handles HTTP GET requests for /resources/** by efficiently serving up static resources in the ${webappRoot}/resources directory -->
<resources mapping="/resources/**" location="/resources/" />
Modified: 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=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/main/webapp/WEB-INF/spring/db.xml Sun Jan 8 13:23:52 2012
@@ -36,7 +36,6 @@
<bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
</bean>
-
<bean
class="org.springframework.orm.jpa.support.PersistenceAnnotationBeanPostProcessor" />
Modified: 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=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/controller/PersonControllerTest.java Sun Jan 8 13:23:52 2012
@@ -17,7 +17,7 @@ import org.springframework.test.context.
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.servlet.ModelAndView;
-@ContextConfiguration("/test-context.xml")
+@ContextConfiguration({"/test-context.xml", "/test-isis.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
public class PersonControllerTest {
Modified: 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=1228838&r1=1228837&r2=1228838&view=diff
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java (original)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/dao/PersonDaoTest.java Sun Jan 8 13:23:52 2012
@@ -13,7 +13,7 @@ import org.springframework.test.context.
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.transaction.annotation.Transactional;
-@ContextConfiguration("/test-context.xml")
+@ContextConfiguration({"/test-context.xml", "/test-isis.xml"})
@RunWith(SpringJUnit4ClassRunner.class)
@Transactional
public class PersonDaoTest {
Added: incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java?rev=1228838&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/java/org/apache/isis/examples/embeddedinspring/webserver/WebServerBootstrapper.java Sun Jan 8 13:23:52 2012
@@ -0,0 +1,56 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.isis.examples.embeddedinspring.webserver;
+
+import org.apache.isis.core.commons.exceptions.IsisException;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+/**
+ * For bootstrapping the app from the command line.
+ */
+public class WebServerBootstrapper {
+
+ private static final String SRC_MAIN_WEBAPP = "src/main/webapp";
+
+ private static final String CONTEXT_PATH = "/";
+ private static final int PORT = 8080;
+
+ private Server jettyServer;
+
+ public static void main(String[] args) {
+ new WebServerBootstrapper().run();
+ }
+
+ public void run() {
+
+ jettyServer = new Server(PORT);
+ final WebAppContext context = new WebAppContext(SRC_MAIN_WEBAPP, CONTEXT_PATH);
+
+ jettyServer.setHandler(context);
+
+ try {
+ jettyServer.start();
+ jettyServer.join();
+ } catch (final Exception ex) {
+ throw new IsisException("Unable to start Jetty server", ex);
+ }
+ }
+}
\ No newline at end of file
Added: incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-isis.xml
URL: http://svn.apache.org/viewvc/incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-isis.xml?rev=1228838&view=auto
==============================================================================
--- incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-isis.xml (added)
+++ incubator/isis/trunk/examples/embeddedinspring/src/test/resources/test-isis.xml Sun Jan 8 13:23:52 2012
@@ -0,0 +1,22 @@
+<?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"/>
+ <property name="classSubstitutor">
+ <bean class="org.apache.isis.examples.embeddedinspring.isis.CglibClassSubstitutor"></bean>
+ </property>
+ </bean>
+
+ <bean id="embeddedContext" class="org.apache.isis.runtimes.embedded.EmbeddedContextNoop"/>
+
+</beans>