Author: ate
Date: Tue Sep  4 22:24:50 2012
New Revision: 1380922

URL: http://svn.apache.org/viewvc?rev=1380922&view=rev
Log:
RAVE-694: mostly cleanup

Added:
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page-body.jsp
      - copied unchanged from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-body.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page-content.jsp
      - copied unchanged from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-content.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page-header.jsp
      - copied unchanged from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-header.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page-tabs.jsp
      - copied unchanged from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-tabs.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page.jsp
      - copied, changed from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/page-configuration.xml
      - copied, changed from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/resources/page-configuration.xml
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/url-mapping.xml
      - copied unchanged from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/resources/url-mapping.xml
Removed:
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/FooterController.java
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageBodyController.java
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageContentController.java
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageTabsController.java
    
rave/sandbox/content-services/demo-portal/src/main/resources/page-configuration.xml
    rave/sandbox/content-services/demo-portal/src/main/resources/url-mapping.xml
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/mybody.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/mycontent.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/myfooter.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/myheader.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/mymenu.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/mypage.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-body.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-content.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-header.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page-tabs.jsp
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page.jsp
    
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/ConfigUtils.java
Modified:
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageHeaderController.java
    
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/UserPageController.java
    
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/dispatcher-servlet.xml
    
rave/sandbox/content-services/rave-jcr-integration/page-configuration/pom.xml
    
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/FileConfigManager.java
    
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/FileConfigManagerTest.java

Modified: 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageHeaderController.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageHeaderController.java?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageHeaderController.java
 (original)
+++ 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/PageHeaderController.java
 Tue Sep  4 22:24:50 2012
@@ -20,6 +20,7 @@ import org.apache.rave.portal.model.Page
 import org.apache.rave.portal.model.PageUser;
 import org.apache.rave.portal.model.User;
 import org.apache.rave.portal.web.hmvc.Hmvc;
+import org.apache.rave.portal.web.hmvc.HmvcConfig;
 import org.apache.rave.portal.web.model.NavigationItem;
 import org.apache.rave.portal.web.model.NavigationMenu;
 import org.springframework.stereotype.Controller;
@@ -32,7 +33,7 @@ public class PageHeaderController {
 
     @Hmvc
     @RequestMapping
-    public String render(Model model, @ModelAttribute User user, 
@ModelAttribute Page page, @ModelAttribute PageUser pageUser) {
+    public String render(HmvcConfig config, Model model, @ModelAttribute User 
user, @ModelAttribute Page page, @ModelAttribute PageUser pageUser) {
         NavigationMenu menu = new NavigationMenu("topnav");
         NavigationItem profile = new NavigationItem("page.profile.title", 
getDisplayName(user), "/app/person/" + user.getUsername() + "?referringPageId=" 
+ page.getId());
         menu.addNavigationItem(profile);
@@ -46,7 +47,7 @@ public class PageHeaderController {
         NavigationItem logout = getLogoutItem();
         menu.addNavigationItem(logout);
         model.addAttribute(menu.getName(), menu);
-        return "hmvc/page-header";
+        return config.getViewName();
     }
 
     protected static NavigationItem getAdminItem() {

Modified: 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/UserPageController.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/UserPageController.java?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/UserPageController.java
 (original)
+++ 
rave/sandbox/content-services/demo-portal/src/main/java/org/apache/rave/portal/web/hmvc/controller/UserPageController.java
 Tue Sep  4 22:24:50 2012
@@ -30,6 +30,7 @@ import org.apache.rave.portal.service.Pa
 import org.apache.rave.portal.service.PageService;
 import org.apache.rave.portal.service.UserService;
 import org.apache.rave.portal.web.hmvc.Hmvc;
+import org.apache.rave.portal.web.hmvc.HmvcConfig;
 import org.apache.rave.portal.web.util.ModelKeys;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -55,12 +56,12 @@ public class UserPageController {
     }
 
     @Hmvc(view="defaultPage") @RequestMapping
-    public String viewDefaultPage(Model model, HttpServletRequest request) {
-        return view(null, model, request);
+    public String viewDefaultPage(HmvcConfig config, Model model, 
HttpServletRequest request) {
+        return view(null, config, model, request);
     }
 
     @Hmvc @RequestMapping
-    public String view(@PathVariable Long pageId, Model model, 
HttpServletRequest request) {
+    public String view(@PathVariable Long pageId, HmvcConfig config, Model 
model, HttpServletRequest request) {
         List<Page> pages = getAllPagesForAuthenticatedUser();
         Page page = null;
         if (pageId != null) {
@@ -87,7 +88,7 @@ public class UserPageController {
         model.addAttribute(ModelKeys.PAGES, pages);
         model.addAttribute(ModelKeys.PAGE_USER, currentPageUser);
         model.addAttribute(ModelKeys.PAGE_LAYOUTS, pageLayouts);
-        return "hmvc/page";
+        return config.getViewName();
     }
 
     private List<Page> getAllPagesForAuthenticatedUser() {

Modified: 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/dispatcher-servlet.xml
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/dispatcher-servlet.xml?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/dispatcher-servlet.xml
 (original)
+++ 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/dispatcher-servlet.xml
 Tue Sep  4 22:24:50 2012
@@ -157,8 +157,8 @@
     <property name="credentials" ref="jcrCredentials"/>
     <property name="lazyRepositoryFactory" ref="lazyRepositoryFactory"/>
 -->
-    <property name="configurationPath" 
value="classpath:page-configuration.xml"/>
-    <property name="urlMappingsPath" value="classpath:url-mapping.xml"/>
+    <property name="configurationPath" 
value="/WEB-INF/page-configuration.xml"/>
+    <property name="urlMappingsPath" value="/WEB-INF/url-mapping.xml"/>
     <property name="refreshDelay" value="10000"/>
   </bean>
 

Copied: 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page.jsp
 (from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page.jsp)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page.jsp?p2=rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page.jsp&p1=rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page.jsp&r1=1380702&r2=1380922&rev=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/page.jsp
 (original)
+++ 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/jsp/views/hmvc/userpage/page.jsp
 Tue Sep  4 22:24:50 2012
@@ -2,7 +2,6 @@
 <%@ page language="java" trimDirectiveWhitespaces="true" %>
 <%@ include file="/WEB-INF/jsp/includes/taglibs.jsp" %>
 <%@ taglib uri="http://www.apache-rave.org/jsp/core"; prefix="hmvc" %>
-
 <!DOCTYPE html>
 <html class="no-js">
 <head>

Copied: 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/page-configuration.xml
 (from r1380702, 
rave/sandbox/content-services/demo-portal/src/main/resources/page-configuration.xml)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/page-configuration.xml?p2=rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/page-configuration.xml&p1=rave/sandbox/content-services/demo-portal/src/main/resources/page-configuration.xml&r1=1380702&r2=1380922&rev=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/demo-portal/src/main/resources/page-configuration.xml
 (original)
+++ 
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/page-configuration.xml
 Tue Sep  4 22:24:50 2012
@@ -19,19 +19,13 @@
   -->
 <configuration name="default">
 
-  <page-definition name="myPage3" description="My Page" displayname="My page" 
controller="org.apache.rave.portal.web.hmvc.example.MyPageController">
-    <page-fragment name="head" 
controller="org.apache.rave.portal.web.hmvc.example.MyHeaderController"/>
-    <page-fragment name="body" 
controller="org.apache.rave.portal.web.hmvc.example.MyContentController"/>
-    <page-fragment name="footer" viewname="hmvc/footer"/>
-  </page-definition>
-
-  <page-definition name="userPage" 
controller="org.apache.rave.portal.web.hmvc.controller.UserPageController">
-    <page-fragment name="header" 
controller="org.apache.rave.portal.web.hmvc.controller.PageHeaderController"/>
-    <page-fragment name="body" 
controller="org.apache.rave.portal.web.hmvc.controller.PageBodyController">
-      <page-fragment name="tabs" 
controller="org.apache.rave.portal.web.hmvc.controller.PageTabsController"/>
-      <page-fragment name="content" 
controller="org.apache.rave.portal.web.hmvc.controller.PageContentController"/>
+  <page-definition name="userPage" viewname="hmvc/userpage/page" 
controller="org.apache.rave.portal.web.hmvc.controller.UserPageController">
+    <page-fragment name="header" viewname="hmvc/userpage/page-header" 
controller="org.apache.rave.portal.web.hmvc.controller.PageHeaderController"/>
+    <page-fragment name="body" viewname="hmvc/userpage/page-body">
+      <page-fragment name="tabs" viewname="hmvc/userpage/page-tabs"/>
+      <page-fragment name="content" viewname="hmvc/userpage/page-content"/>
     </page-fragment>
-    <page-fragment name="footer" 
controller="org.apache.rave.portal.web.hmvc.controller.FooterController"/>
+    <page-fragment name="footer" viewname="hmvc/footer"/>
   </page-definition>
 
 </configuration>

Modified: 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/pom.xml
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/page-configuration/pom.xml?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/pom.xml 
(original)
+++ 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/pom.xml 
Tue Sep  4 22:24:50 2012
@@ -47,6 +47,11 @@
       <artifactId>jackrabbit-core</artifactId>
       <version>${apache.jackrabbit.version}</version>
     </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${org.springframework.version}</version>
+    </dependency>
 
     <!-- Test -->
     <dependency>

Modified: 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/FileConfigManager.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/FileConfigManager.java?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/FileConfigManager.java
 (original)
+++ 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/main/java/org/apache/rave/jcr/config/FileConfigManager.java
 Tue Sep  4 22:24:50 2012
@@ -19,6 +19,7 @@
 
 package org.apache.rave.jcr.config;
 
+import java.io.IOException;
 import java.io.InputStream;
 
 import javax.xml.bind.JAXBContext;
@@ -34,14 +35,18 @@ import org.apache.rave.jcr.config.model.
 import org.apache.rave.jcr.config.url.FileUrlConfiguration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.Resource;
+import org.springframework.context.ResourceLoaderAware;
+import org.springframework.core.io.ResourceLoader;
 
 /**
  * @version "$Id$"
  */
-public class FileConfigManager implements ConfigManager {
+public class FileConfigManager implements ConfigManager, ResourceLoaderAware {
 
     private static Logger log = 
LoggerFactory.getLogger(FileConfigManager.class);
 
+    private ResourceLoader resourceLoader;
 
     @Override
     public UrlConfiguration loadUrlConfig(String path, PageConfiguration 
configuration) throws InvalidConfigurationException {
@@ -51,7 +56,11 @@ public class FileConfigManager implement
         log.info("Loading configuration: {}", path);
         InputStream is = null;
         try {
-            is = ConfigUtils.getResourceInputStream(path);
+            try {
+                Resource resource = resourceLoader.getResource(path);
+                is = resource.getInputStream();
+            }
+            catch (Exception ex) {}
             if (is == null) {
                 throw new InvalidConfigurationException("Configuration file 
not found for path: " + path);
             }
@@ -76,7 +85,11 @@ public class FileConfigManager implement
 
         InputStream is = null;
         try {
-            is = ConfigUtils.getResourceInputStream(path);
+            try {
+                Resource resource = resourceLoader.getResource(path);
+                is = resource.getInputStream();
+            }
+            catch (Exception ex) {}
             if (is == null) {
                 throw new InvalidConfigurationException("Configuration file 
not found for path: " + path);
             }
@@ -108,6 +121,15 @@ public class FileConfigManager implement
     }
 
     public long lastModified(String name) {
-        return ConfigUtils.lastModified(name);
+        Resource resource = resourceLoader.getResource(name);
+        try {
+            return resource != null && resource.exists() ? 
resource.getFile().lastModified() : 0;
+        } catch (IOException e) {
+            return 0;
+        }
+    }
+
+    public void setResourceLoader(final ResourceLoader resourceLoader) {
+        this.resourceLoader = resourceLoader;
     }
 }

Modified: 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/FileConfigManagerTest.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/FileConfigManagerTest.java?rev=1380922&r1=1380921&r2=1380922&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/FileConfigManagerTest.java
 (original)
+++ 
rave/sandbox/content-services/rave-jcr-integration/page-configuration/src/test/java/org/apache/rave/jcr/config/FileConfigManagerTest.java
 Tue Sep  4 22:24:50 2012
@@ -32,6 +32,7 @@ import org.apache.rave.jcr.config.model.
 import org.junit.Test;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.springframework.core.io.FileSystemResourceLoader;
 
 import static junit.framework.Assert.assertEquals;
 import static junit.framework.Assert.assertNotNull;
@@ -43,16 +44,22 @@ import static junit.framework.Assert.ass
 public class FileConfigManagerTest {
 
     private static Logger log = 
LoggerFactory.getLogger(FileConfigManagerTest.class);
+    public static final String CLASSPATH_PREFIX = "classpath:";
     public static final String EXAMPLE_CONFIGURATION_XML = 
"example_configuration.xml";
-    public static final String PAGE_CONFIG_PATH = ConfigUtils.CLASSPATH_PREFIX 
+ EXAMPLE_CONFIGURATION_XML;
+    public static final String PAGE_CONFIG_PATH = CLASSPATH_PREFIX + 
EXAMPLE_CONFIGURATION_XML;
     public static final String EXAMPLE_URL_MAPPING_XML = 
"example_url_mapping.xml";
-    public static final String URL_CONFIG_PATH = ConfigUtils.CLASSPATH_PREFIX 
+ EXAMPLE_URL_MAPPING_XML;
+    public static final String URL_CONFIG_PATH = CLASSPATH_PREFIX + 
EXAMPLE_URL_MAPPING_XML;
 
+    private ConfigManager getConfigManager() {
+        FileConfigManager dao = new FileConfigManager();
+        dao.setResourceLoader(new FileSystemResourceLoader());
+        return dao;
+    }
 
     @Test
     public void testLoadConfig() throws Exception {
-        ConfigManager dao = new FileConfigManager();
-        final PageConfiguration config = 
dao.loadConfiguration(ConfigUtils.CLASSPATH_PREFIX + 
"example_configuration.xml");
+        ConfigManager dao = getConfigManager();
+        final PageConfiguration config = 
dao.loadConfiguration(CLASSPATH_PREFIX + "example_configuration.xml");
         assertNotNull(config);
         assertEquals("default", config.getName());
         final Collection<PageDefinition> definitions = 
config.getPageDefinitions();
@@ -115,14 +122,14 @@ public class FileConfigManagerTest {
 
     @Test(expected = InvalidConfigurationException.class)
     public void testLoadConfigFail() throws Exception {
-        ConfigManager dao = new FileConfigManager();
+        ConfigManager dao = getConfigManager();
         // this should throw InvalidConfigurationException exception
-        dao.loadConfiguration(ConfigUtils.CLASSPATH_PREFIX + 
"NONE_EXISTING_example_configuration.xml");
+        dao.loadConfiguration(CLASSPATH_PREFIX + 
"NONE_EXISTING_example_configuration.xml");
     }
 
     @Test
     public void testNoParent() throws Exception {
-        ConfigManager dao = new FileConfigManager();
+        ConfigManager dao = getConfigManager();
         final PageConfiguration config = 
dao.loadConfiguration(PAGE_CONFIG_PATH);
         assertNotNull(config);
         final Collection<PageDefinition> definitions = 
config.getPageDefinitions();
@@ -135,7 +142,7 @@ public class FileConfigManagerTest {
 
     @Test
     public void testLoadUrlConfig() throws Exception {
-        FileConfigManager dao = new FileConfigManager();
+        ConfigManager dao = getConfigManager();
         final UrlConfiguration config = dao.loadUrlConfig(URL_CONFIG_PATH, 
dao.loadConfiguration(PAGE_CONFIG_PATH));
         log.info("config {}", config);
         assertTrue(config != null);
@@ -165,6 +172,4 @@ public class FileConfigManagerTest {
         }
 
     }
-
-
 }
\ No newline at end of file


Reply via email to