Author: ate
Date: Mon Aug 27 13:53:39 2012
New Revision: 1377683
URL: http://svn.apache.org/viewvc?rev=1377683&view=rev
Log:
RAVE-698
- check repository available and configuration loaded from -ByConfig mapper
- drop no longer needed/used repository available filter
Removed:
rave/sandbox/content-services/rave-jcr-service/src/main/java/org/apache/rave/jcr/servlet/ContextRepositoryAvailableFilter.java
Modified:
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/web.xml
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfig.java
Modified:
rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/web.xml
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/web.xml?rev=1377683&r1=1377682&r2=1377683&view=diff
==============================================================================
--- rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/web.xml
(original)
+++ rave/sandbox/content-services/demo-portal/src/main/webapp/WEB-INF/web.xml
Mon Aug 27 13:53:39 2012
@@ -40,22 +40,11 @@
<listener-class>org.apache.rave.portal.web.context.RaveContextLoaderListener</listener-class>
</listener>
- <!-- Filter to ensure Content Repository is loaded
- <filter>
- <filter-name>contentRepositoryAvailableFilter</filter-name>
-
<filter-class>org.apache.rave.jcr.servlet.ContextRepositoryAvailableFilter</filter-class>
- </filter>
--->
<filter>
<filter-name>springSecurityFilterChain</filter-name>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
</filter>
-<!--
- <filter-mapping>
- <filter-name>contentRepositoryAvailableFilter</filter-name>
- <url-pattern>/jcr/*</url-pattern>
- </filter-mapping>
--->
+
<filter-mapping>
<filter-name>springSecurityFilterChain</filter-name>
<url-pattern>/*</url-pattern>
Modified:
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfig.java
URL:
http://svn.apache.org/viewvc/rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfig.java?rev=1377683&r1=1377682&r2=1377683&view=diff
==============================================================================
---
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfig.java
(original)
+++
rave/sandbox/content-services/rave-web-hmvc/src/main/java/org/apache/rave/portal/web/hmvc/HmvcHandlerMethodMappingByConfig.java
Mon Aug 27 13:53:39 2012
@@ -28,7 +28,7 @@ import javax.jcr.Credentials;
import javax.jcr.Repository;
import javax.jcr.RepositoryException;
import javax.jcr.Session;
-import javax.servlet.ServletContext;
+import javax.servlet.http.HttpServletRequest;
import org.apache.rave.jcr.LazyRepositoryFactory;
import org.apache.rave.jcr.LazyRepositoryFactoryListener;
@@ -69,6 +69,8 @@ public class HmvcHandlerMethodMappingByC
private String urlMappingsPath;
+ private boolean configured;
+
/**
* Used only when JCR config manager is used
*/
@@ -86,6 +88,7 @@ public class HmvcHandlerMethodMappingByC
}
} else {
+ configured = true;
final PageConfiguration configuration =
configManager.loadConfiguration(configurationPath);
final UrlConfiguration urlConfig =
configManager.loadUrlConfig(urlMappingsPath, configuration);
// TODO use urlConfig
@@ -94,9 +97,10 @@ public class HmvcHandlerMethodMappingByC
}
@Override
- public void repositoryAvailable(final Object factoryKey, final Repository
repository) {
+ public synchronized void repositoryAvailable(final Object factoryKey,
final Repository repository) {
Session session = null;
try {
+ configured = true;
session = repository.login(credentials);
configManager = new JcrConfigManager(session, configurationPath);
final PageConfiguration configuration =
configManager.loadConfiguration(configurationName);
@@ -114,7 +118,8 @@ public class HmvcHandlerMethodMappingByC
}
@Override
- public void repositoryNotAvailable(final Object factoryKey) {
+ public synchronized void repositoryNotAvailable(final Object factoryKey) {
+ configured = false;
// TODO
}
@@ -246,4 +251,11 @@ public class HmvcHandlerMethodMappingByC
public void setLazyRepositoryFactory(LazyRepositoryFactory
repositoryFactory) {
this.repositoryFactory = repositoryFactory;
}
+
+ @Override
+ protected HandlerMethod getHandlerInternal(HttpServletRequest request)
throws Exception {
+ // force check repository available
+ repositoryFactory.getRepository();
+ return super.getHandlerInternal(request);
+ }
}
\ No newline at end of file