Author: ate
Date: Mon Sep 10 16:25:55 2012
New Revision: 1382970

URL: http://svn.apache.org/viewvc?rev=1382970&view=rev
Log:
RAVE-694: more config Manager refactoring to provide a single model for either 
a simple Config with plain Routes or an enhanced PageConfig which also provides 
PageDefinitions

Added:
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
   (with props)
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Config.java
      - copied, changed from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Routes.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/ConfigManager.java
      - copied, changed from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/RoutesManager.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfig.java
      - copied, changed from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManager.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
   (with props)
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManagerImpl.java
      - copied, changed from r1382965, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManagerImpl.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java
      - copied, changed from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java
Removed:
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManager.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManagerImpl.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Routes.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/RoutesManager.java
Modified:
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
    
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FilePageRoutesManager.java

Added: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java?rev=1382970&view=auto
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
 (added)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
 Mon Sep 10 16:25:55 2012
@@ -0,0 +1,20 @@
+/*
+ * 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.rave.portal.web.mvc;
+
+public class NestedHandlerMethodHandlerMapping extends 
RoutedRequestMappingHandlerMapping {
+}

Propchange: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/NestedHandlerMethodHandlerMapping.java
------------------------------------------------------------------------------
    svn:keywords = Id

Modified: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java?rev=1382970&r1=1382969&r2=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/RoutedRequestMappingHandlerMapping.java
 Mon Sep 10 16:25:55 2012
@@ -28,10 +28,10 @@ import java.util.Set;
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.rave.portal.web.mvc.config.RoutesManager;
+import org.apache.rave.portal.web.mvc.config.ConfigManager;
 import org.apache.rave.portal.web.mvc.config.PageDefinition;
 import org.apache.rave.portal.web.mvc.config.PageFragment;
-import org.apache.rave.portal.web.mvc.config.Routes;
+import org.apache.rave.portal.web.mvc.config.Config;
 import org.apache.rave.portal.web.mvc.config.Route;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -61,9 +61,9 @@ public class RoutedRequestMappingHandler
 
     private static final Logger log = 
LoggerFactory.getLogger(RoutedRequestMappingHandlerMapping.class);
 
-    private RoutesManager routesManager;
+    private ConfigManager configManager;
 
-    private volatile Routes routes;
+    private volatile Config config;
 
     // temporary hacked open *references* to the real but private 
handlerMethods and urlMap maps in AbstractHandlerMethodMapping.java
     private Map<RequestMappingInfo, HandlerMethod> handlerMethods;
@@ -115,19 +115,19 @@ public class RoutedRequestMappingHandler
 
     @Override
     protected void initHandlerMethods() {
-        routes = routesManager.getRoutes();
-        processConfiguration(routes);
+        config = configManager.getConfig();
+        processRoutes(config);
     }
 
     protected void reloadConfigIfNeeded() {
 
-        Routes latestConfiguration = routesManager.getRoutes();
-        if ((routes == null && latestConfiguration != null) ||
-                (routes != null && latestConfiguration == null) ||
-                (routes != latestConfiguration)) {
-            synchronized (routesManager) {
-               routes = latestConfiguration;
-               processConfiguration(routes);
+        Config latestConfiguration = configManager.getConfig();
+        if ((config == null && latestConfiguration != null) ||
+                (config != null && latestConfiguration == null) ||
+                (config != latestConfiguration)) {
+            synchronized (configManager) {
+               config = latestConfiguration;
+               processRoutes(config);
             }
         }
     }
@@ -189,14 +189,14 @@ public class RoutedRequestMappingHandler
         return actionMethods.get("default");
     }
 
-    private void processConfiguration(Routes routes) {
+    private void processRoutes(Config config) {
 
         // reset
         getHandlerMethodsInternal().clear();
         getUrlMapInternal().clear();
 
-        if (routes != null) {
-            for (Route route : routes.getRoutes()) {
+        if (config != null) {
+            for (Route route : config.getRoutes()) {
 
                 // TODO rewrite to find the correct Router OR PageRouter
 //            PageDefinition pageDefinition = route.getPageDefinition();
@@ -221,6 +221,10 @@ public class RoutedRequestMappingHandler
         }
     }
 
+    protected void processRoute(Route route) {
+
+    }
+
     protected void registerPageHandlerMethod(PageDefinition pageDefinition, 
Object handler, Method method, RequestMappingInfo mapping, String action) {
         NestedHandlerMethod nestedHandlerMethod = 
getNestedHandlerMethodForFragment(handler, method, pageDefinition, action);
         registerHandlerMethod(handler, method, mapping);
@@ -306,8 +310,8 @@ public class RoutedRequestMappingHandler
                 null);
     }
 
-    public void setRoutesManager(RoutesManager routesManager) {
-        this.routesManager = routesManager;
+    public void setConfigManager(ConfigManager configManager) {
+        this.configManager = configManager;
     }
 
     @Override

Copied: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Config.java
 (from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Routes.java)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Config.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Config.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Routes.java&r1=1382923&r2=1382970&rev=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Routes.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/Config.java
 Mon Sep 10 16:25:55 2012
@@ -24,13 +24,7 @@ import java.util.List;
 /**
  * @version "$Id$"
  */
-public interface Routes {
-
-    String getName();
-
-    void setName(String name);
+public interface Config {
 
     List<Route> getRoutes();
-
-    void setRoutes(List<Route> routes);
 }

Copied: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/ConfigManager.java
 (from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/RoutesManager.java)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/ConfigManager.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/ConfigManager.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/RoutesManager.java&r1=1382923&r2=1382970&rev=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/RoutesManager.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/ConfigManager.java
 Mon Sep 10 16:25:55 2012
@@ -22,18 +22,18 @@ package org.apache.rave.portal.web.mvc.c
 /**
  * @version "$Id$"
  */
-public interface RoutesManager {
+public interface ConfigManager {
 
     /**
      * Gets url mappings configuration. The manager implementation is in 
control of whether it 
-     * returns a new {@link Routes} or one that it created before already. 
This method
+     * returns a new {@link Config} or one that it created before already. 
This method
      * must be implemented thread-safe and can be called concurrently.
      *
-     * @return UrlConfig instance containing url and render mappings
+     * @return Config instance containing Route mappings
      * @throws InvalidConfigurationException
      *          thrown when config cannot be loaded or parsed or configuration 
parameter was null
      */
-    Routes getRoutes() throws InvalidConfigurationException;
+    Config getConfig() throws InvalidConfigurationException;
 
     /**
      * @return the lastModified timestamp in ms since epoch.

Copied: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfig.java
 (from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManager.java)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfig.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfig.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManager.java&r1=1382923&r2=1382970&rev=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManager.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfig.java
 Mon Sep 10 16:25:55 2012
@@ -16,14 +16,11 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
 package org.apache.rave.portal.web.mvc.config;
 
-public interface PageRoutesManager extends RoutesManager {
+import java.util.List;
 
-    /**
-     * @return configuration or null if none found
-     */
-    PageDefinitions getPageDefinitions();
+public interface PagesConfig extends Config {
 
+    List<PageDefinition> getPageDefinitions();
 }

Added: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java?rev=1382970&view=auto
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
 (added)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
 Mon Sep 10 16:25:55 2012
@@ -0,0 +1,24 @@
+/*
+ * 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.rave.portal.web.mvc.config;
+
+public interface PagesConfigManager extends ConfigManager {
+    @Override
+    PagesConfig getConfig() throws InvalidConfigurationException;
+}

Propchange: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManager.java
------------------------------------------------------------------------------
    svn:keywords = Id

Copied: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManagerImpl.java
 (from r1382965, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManagerImpl.java)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManagerImpl.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManagerImpl.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManagerImpl.java&r1=1382965&r2=1382970&rev=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PageRoutesManagerImpl.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/PagesConfigManagerImpl.java
 Mon Sep 10 16:25:55 2012
@@ -1,40 +1,52 @@
+/*
+ * 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.rave.portal.web.mvc.config;
 
 /**
  * <p>
- *  This {@link PageRoutesManagerImpl} is about enhancing and validating 
{@link PageDefinitions} and {@link Routes}s.
- *  It takes a {@link RoutesManager} implementation as constructor argument. 
Typically, this delegate {@link RoutesManager}
- *  gets its {@link PageDefinitions} and {@link Routes} bootstrapped from 
either file system sources,
+ *  This {@link PagesConfigManagerImpl} is about enhancing and validating 
{@link PageDefinitions} and {@link PagesConfig}s.
+ *  It takes a {@link PagesConfigManager} implementation as constructor 
argument. Typically, this delegate {@link PagesConfigManager}
+ *  gets its {@link PageDefinitions} and {@link Config} bootstrapped from 
either file system sources,
  *  or sources stored in some repository, like {@link javax.jcr.Repository}. 
  * </p>
  * <p>
- *  This {@link PageRoutesManagerImpl} is agnostic about the backing storage, 
but is targeting the glue between the
+ *  This {@link PagesConfigManagerImpl} is agnostic about the backing storage, 
but is targeting the glue between the
  *  {@link Route} and {@link PageDefinition}s and about the enhancement like 
resolving
  *  the <code>extend</code> logic of the {@link PageDefinition}s and {@link 
PageFragment}s of the 
- *  {@link PageDefinitions}. Also, this implementation detects incorrect 
configurations, like recursive extension
- *  of {@link PageFragment}s or non-allowed same-name-siblings of {@link 
PageDefinition}s or {@link PageFragment}s.
+
  * </p>
  */
-public class PageRoutesManagerImpl implements PageRoutesManager {
+public class PagesConfigManagerImpl implements PagesConfigManager {
 
-    private PageRoutesManager delegatee;
+    private PagesConfigManager delegatee;
 
-    public PageRoutesManagerImpl(PageRoutesManager delegatee) {
+    public PagesConfigManagerImpl(PagesConfigManager delegatee) {
         this.delegatee = delegatee;
     }
 
     @Override
-    public Routes getRoutes() throws InvalidConfigurationException {
-       return delegatee.getRoutes();
-    }
-
-    @Override
-    public PageDefinitions getPageDefinitions() {
-        return delegatee.getPageDefinitions();
+    public PagesConfig getConfig() throws InvalidConfigurationException {
+        return delegatee.getConfig();
     }
 
     @Override
     public long lastModified() {
         return delegatee.lastModified();
     }
-}
+}
\ No newline at end of file

Modified: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FilePageRoutesManager.java
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FilePageRoutesManager.java?rev=1382970&r1=1382969&r2=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FilePageRoutesManager.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FilePageRoutesManager.java
 Mon Sep 10 16:25:55 2012
@@ -21,6 +21,7 @@ package org.apache.rave.portal.web.mvc.c
 
 import java.io.IOException;
 import java.io.InputStream;
+import java.util.List;
 
 import javax.xml.bind.JAXBContext;
 import javax.xml.bind.JAXBException;
@@ -29,9 +30,11 @@ import javax.xml.bind.Unmarshaller;
 import org.apache.commons.io.IOUtils;
 import org.apache.commons.lang.StringUtils;
 import org.apache.rave.portal.web.mvc.config.InvalidConfigurationException;
+import org.apache.rave.portal.web.mvc.config.PageDefinition;
 import org.apache.rave.portal.web.mvc.config.PageDefinitions;
-import org.apache.rave.portal.web.mvc.config.PageRoutesManager;
-import org.apache.rave.portal.web.mvc.config.Routes;
+import org.apache.rave.portal.web.mvc.config.PagesConfig;
+import org.apache.rave.portal.web.mvc.config.PagesConfigManager;
+import org.apache.rave.portal.web.mvc.config.Route;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.context.ResourceLoaderAware;
@@ -41,10 +44,31 @@ import org.springframework.core.io.Resou
 /**
  * @version "$Id$"
  */
-public class FilePageRoutesManager implements PageRoutesManager, 
ResourceLoaderAware {
+public class FilePageRoutesManager implements PagesConfigManager, 
ResourceLoaderAware {
 
     private static Logger log = 
LoggerFactory.getLogger(FilePageRoutesManager.class);
 
+    private static class PagesConfigImpl implements PagesConfig {
+
+        private List<Route> routes;
+        private List<PageDefinition> pageDefinitions;
+
+        public PagesConfigImpl(List<Route> routes, List<PageDefinition> 
pageDefinitions) {
+            this.routes = routes;
+            this.pageDefinitions = pageDefinitions;
+        }
+
+        @Override
+        public List<PageDefinition> getPageDefinitions() {
+            return pageDefinitions;
+        }
+
+        @Override
+        public List<Route> getRoutes() {
+            return routes;
+        }
+    }
+
     private ResourceLoader resourceLoader;
 
     private String urlMappingsPath;
@@ -55,7 +79,7 @@ public class FilePageRoutesManager imple
     private long refreshDelay;
 
 
-    private volatile Routes routes;
+    private volatile PagesConfig config;
     private volatile long lastBuildTime;
 
     public void setUrlMappingsPath(final String urlMappingsPath) {
@@ -80,18 +104,18 @@ public class FilePageRoutesManager imple
     }
     
     @Override
-    public Routes getRoutes() throws InvalidConfigurationException {
-        Routes existing = routes;
+    public PagesConfig getConfig() throws InvalidConfigurationException {
+        PagesConfig existing = config;
 
         if (existing != null && !checkBuildTime()) {
             return existing;
         }
 
         synchronized (this) {
-            // the routes can have been rebuild already. Check this by 
existing != routes
-            if (existing != routes) {
+            // the config can have been rebuild already. Check this by 
existing != config
+            if (existing != config) {
                 // another thread already rebuilt the model. Return model
-                return routes;
+                return config;
             }
             if (StringUtils.isBlank(configurationPath) || 
StringUtils.isBlank(urlMappingsPath)) {
                 throw new InvalidConfigurationException("Both 
configurationPath and urlMappingsPath should be set " +
@@ -114,10 +138,10 @@ public class FilePageRoutesManager imple
                 }
                 JAXBContext context = 
JAXBContext.newInstance(FileRoutes.class);
                 Unmarshaller unmarshaller = context.createUnmarshaller();
-                final FileRoutes config = (FileRoutes) 
unmarshaller.unmarshal(is);
-                routes = config;
+                final FileRoutes routes = (FileRoutes) 
unmarshaller.unmarshal(is);
+                this.config = new PagesConfigImpl(routes.getRoutes(), 
pageDefinitions.getPageDefinitions());
                 lastBuildTime = System.currentTimeMillis();
-                return routes;
+                return this.config;
             } catch (JAXBException e) {
                 throw new InvalidConfigurationException("Error parsing 
configuration file: " + urlMappingsPath, e);
             } finally {
@@ -126,7 +150,6 @@ public class FilePageRoutesManager imple
         }
     }
 
-    @Override
     public PageDefinitions getPageDefinitions() {
         log.info("Loading configuration: {}", configurationPath);
 

Copied: 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java
 (from r1382923, 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java)
URL: 
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java?p2=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java&p1=rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java&r1=1382923&r2=1382970&rev=1382970&view=diff
==============================================================================
--- 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java
 (original)
+++ 
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/mvc/config/file/FileRoutes.java
 Mon Sep 10 16:25:55 2012
@@ -25,46 +25,39 @@ import javax.xml.bind.annotation.XmlAttr
 import javax.xml.bind.annotation.XmlElement;
 import javax.xml.bind.annotation.XmlRootElement;
 
-import org.apache.rave.portal.web.mvc.config.PageDefinitions;
 import org.apache.rave.portal.web.mvc.config.Route;
-import org.apache.rave.portal.web.mvc.config.Routes;
 
 /**
  * @version "$Id$"
  */
 @XmlRootElement(name = "routes")
-public class FileRoutes implements Routes {
+public class FileRoutes {
 
     private String name;
     private List<Route> routes;
 
     @XmlAttribute
-    @Override
     public String getName() {
         return name;
     }
 
-    @Override
     public void setName(String name) {
         this.name = name;
     }
 
     @XmlElement(name = "route", type = FileRoute.class)
-    @Override
     public List<Route> getRoutes() {
         return routes;
     }
 
-    @Override
     public void setRoutes(List<Route> routes) {
         this.routes = routes;
     }
 
-
     @Override
     public String toString() {
         final StringBuilder sb = new StringBuilder();
-        sb.append("FileRoutes");
+        sb.append("FileConfig");
         sb.append(", name='").append(name).append('\'');
         sb.append(", routes=").append(routes);
         sb.append('}');


Reply via email to