--- a/server/pom.xml Fri Mar 22 05:32:19 2013 +0100
+++ b/server/pom.xml Mon Mar 25 05:55:28 2013 +0100
@@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.iri_research.renkan</groupId>
<artifactId>renkan</artifactId>
- <version>0.4</version>
+ <version>0.5</version>
<packaging>war</packaging>
<properties>
--- a/server/src/main/java/org/iri_research/renkan/Constants.java Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/java/org/iri_research/renkan/Constants.java Mon Mar 25 05:55:28 2013 +0100
@@ -5,12 +5,18 @@
import java.util.List;
public class Constants {
-
+
+ //private final static Properties properties;
+
+ static {
+ //Resource res = new ServletContextResource(, path)
+ }
+
public final static List<String> VERSION = Collections.unmodifiableList(new ArrayList<String>() {
private static final long serialVersionUID = -6935554100028328149L;
{
add("0");
- add("4");
+ add("5");
add("0");
add("final");
add("0");
@@ -38,6 +44,8 @@
public final static String KEYHEX = "f2338d2299ac28ef64f82956fde37337b87a2b9e8fc03e28fa0768cac37d838113c7d0fc78c60fce1e23b1b3e03ac7db4676b3189c267f26baaab10f72544441";
public final static int SALT_LENGTH = 24;
public final static int PAGINATION_SIZE = 10;
+ public final static String PROPERTIES_SERVLET_CONTEXT_NAME = "renkan.properties";
+ public final static String PROPERTIES_CLASSPATH_NAME = "renkan_run.properties";
public enum EditMode {
READ_ONLY(1),
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/server/src/main/java/org/iri_research/renkan/RenkanProperties.java Mon Mar 25 05:55:28 2013 +0100
@@ -0,0 +1,45 @@
+package org.iri_research.renkan;
+
+import java.util.Properties;
+
+import javax.annotation.Resource;
+import javax.inject.Named;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@Named
+public class RenkanProperties {
+
+ @Resource(name="renkanProperties")
+ private Properties properties;
+
+ private final Logger logger = LoggerFactory.getLogger(RenkanProperties.class);
+
+ private static volatile RenkanProperties instance = null;
+
+ private RenkanProperties()
+ {
+ this.logger.debug("Building RenkanProperties");
+ }
+
+ public static RenkanProperties getInstance() {
+ if (instance == null) {
+ synchronized (RenkanProperties.class) {
+ if(instance == null) {
+ instance = new RenkanProperties();
+ }
+ }
+ }
+ return instance;
+ }
+
+ public int getPaginationSize() {
+ return Integer.parseInt(properties.getProperty("renkan.pagination.size", Integer.toString(Constants.PAGINATION_SIZE)));
+ }
+
+ public String getProperty(String name, String defaultVal) {
+ return properties.getProperty(name, defaultVal);
+ }
+
+}
--- a/server/src/main/java/org/iri_research/renkan/controller/RenkanController.java Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/java/org/iri_research/renkan/controller/RenkanController.java Mon Mar 25 05:55:28 2013 +0100
@@ -6,6 +6,7 @@
import org.iri_research.renkan.Constants;
import org.iri_research.renkan.Constants.EditMode;
import org.iri_research.renkan.RenkanException;
+import org.iri_research.renkan.RenkanProperties;
import org.iri_research.renkan.models.Project;
import org.iri_research.renkan.repositories.ProjectsRepository;
import org.iri_research.renkan.repositories.SpacesRepository;
@@ -96,6 +97,8 @@
this.checkCowebkey(cowebkey, project, EditMode.EDITION);
Map<String, Object> model = new HashMap<String, Object>();
+ model.put("coweb_debug", Boolean.parseBoolean(RenkanProperties.getInstance().getProperty("renkan.coweb.debug","false")));
+ model.put("coweb_websockets", Boolean.parseBoolean(RenkanProperties.getInstance().getProperty("renkan.coweb.websocket", "true")));
model.put("project", project);
model.put("space", spacesRepository.findOne(project.getSpaceId()));
--- a/server/src/main/java/org/iri_research/renkan/controller/RenkanRootController.java Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/java/org/iri_research/renkan/controller/RenkanRootController.java Mon Mar 25 05:55:28 2013 +0100
@@ -66,11 +66,9 @@
}
@RequestMapping(value="", method = RequestMethod.GET, produces={"text/html;charset=UTF-8"})
- public String renkanIndex(Model model, @PageableDefaults(sort={"created"}, sortDir=Direction.DESC, value=Constants.PAGINATION_SIZE) Pageable p, HttpServletRequest request) {
+ public String renkanIndex(Model model, @PageableDefaults(sort={"created"}, sortDir=Direction.DESC, pageNumber=0, value=Constants.PAGINATION_SIZE) Pageable p, HttpServletRequest request) {
Page<Space> page = this.spacesRepository.findAll(p);
- //Iterable<Space> spaces = this.spacesRepository.findAll();
-
model.addAttribute("page", page);
model.addAttribute("baseUrl", this.buildBaseUrl(request));
@@ -80,7 +78,7 @@
}
@RequestMapping(value="/s/{space_id}", method = RequestMethod.GET, produces={"text/html;charset=UTF-8"})
- public ModelAndView spaceIndex(@PathVariable("space_id") String spaceId, @PageableDefaults(sort={"created"}, sortDir=Direction.DESC, value=Constants.PAGINATION_SIZE) Pageable p, HttpServletRequest request) {
+ public ModelAndView spaceIndex(@PathVariable("space_id") String spaceId, @PageableDefaults(sort={"created"}, sortDir=Direction.DESC, pageNumber=0, value=Constants.PAGINATION_SIZE) Pageable p, HttpServletRequest request) {
logger.debug("SpaceId : " + (spaceId== null ? "null" : spaceId));
--- a/server/src/main/resources/log4j.xml Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/resources/log4j.xml Mon Mar 25 05:55:28 2013 +0100
@@ -27,24 +27,6 @@
<priority value ="WARN" />
<appender-ref ref="console" />
</root>
- <!--
-log4j.rootCategory=INFO, stdout
-
-log4j.appender.stdout=org.springframework.data.document.mongodb.log4j.MongoLog4jAppender
-log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
-log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
-log4j.appender.stdout.host = localhost
-log4j.appender.stdout.port = 27017
-log4j.appender.stdout.database = logs
-log4j.appender.stdout.collectionPattern = %X{year}%X{month}
-log4j.appender.stdout.applicationId = my.application
-log4j.appender.stdout.warnOrHigherWriteConcern = FSYNC_SAFE
-
-log4j.category.org.apache.activemq=ERROR
-log4j.category.org.springframework.batch=DEBUG
-log4j.category.org.springframework.data.document.mongodb=DEBUG
-log4j.category.org.springframework.transaction=INFO
--->
-
+
</log4j:configuration>
--- a/server/src/main/webapp/WEB-INF/applicationContext.xml Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/webapp/WEB-INF/applicationContext.xml Mon Mar 25 05:55:28 2013 +0100
@@ -2,15 +2,52 @@
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans
+ xmlns:util="http://www.springframework.org/schema/util"
+ xmlns:mvc="http://www.springframework.org/schema/mvc"
+ xsi:schemaLocation="
+ http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-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/context/spring-context-3.0.xsd
+ http://www.springframework.org/schema/util
+ http://www.springframework.org/schema/util/spring-util-3.0.xsd
+ http://www.springframework.org/schema/mvc
+ http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd"
+>
<!-- Activates various annotations to be detected in bean classes -->
<context:annotation-config />
- <context:property-placeholder order="1000" ignore-unresolvable="true" ignore-resource-not-found="false" location="WEB-INF/renkan.properties"/>
- <context:property-placeholder order="1" ignore-unresolvable="true" ignore-resource-not-found="true" location="classpath:renkan_run.properties"/>
+
+ <util:properties id="propsLocations">
+ <prop key="servletContextProps">WEB-INF/renkan.properties</prop>
+ <prop key="classpathProps">classpath:renkan_run.properties</prop>
+ </util:properties>
+
+ <!--context:property-placeholder order="1000" ignore-unresolvable="true" ignore-resource-not-found="false" location="${propsLocations.servletContextProps}"/>
+ <context:property-placeholder order="1" ignore-unresolvable="true" ignore-resource-not-found="true" location="${propsLocations.classpathProps}"/-->
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="order" value="1000"/>
+ <property name="location" value="#{propsLocations.servletContextProps}"/>
+ <property name="ignoreUnresolvablePlaceholders" value="true"/>
+ <property name="IgnoreResourceNotFound" value="false"/>
+ </bean>
+ <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+ <property name="order" value="1"/>
+ <property name="location" value="#{propsLocations.classpathProps}"/>
+ <property name="ignoreUnresolvablePlaceholders" value="true"/>
+ <property name="IgnoreResourceNotFound" value="true"/>
+ </bean>
+
+ <bean id="renkanProperties" class="org.springframework.beans.factory.config.PropertiesFactoryBean">
+ <property name="IgnoreResourceNotFound" value="true"/>
+ <property name="locations">
+ <list>
+ <value>#{propsLocations.servletContextProps}</value>
+ <value>#{propsLocations.classpathProps}</value>
+ </list>
+ </property>
+ <property name="fileEncoding" value="UTF-8"/>
+ </bean>
<!-- Configures the annotation-driven Spring MVC Controller programming model.
Note that, with Spring 3.0, this tag works in Servlet MVC only! -->
@@ -22,9 +59,26 @@
class="org.iri_research.renkan.coweb.SpringConfigurer"
factory-method="getInstance" />
+ <bean class="org.iri_research.renkan.RenkanProperties"
+ factory-method="getInstance" />
+
+
<!-- Scans the classpath for annotated components that will be auto-registered as Spring beans.
For example @Controller and @Service. Make sure to set the correct base-package-->
<context:component-scan base-package="org.iri_research.renkan.rest" />
<context:component-scan base-package="org.iri_research.renkan.coweb" />
+
+ <!--mvc:annotation-driven>
+ <mvc:argument-resolvers>
+ <bean class="org.springframework.data.web.PageableArgumentResolver">
+ <property name="fallbackPagable">
+ <bean class="org.springframework.data.domain.PageRequest">
+ <constructor-arg type="int" value="1"/>
+ <constructor-arg type="int" value="${renkan.pagination.size}"/>
+ </bean>
+ </property>
+ </bean>
+ </mvc:argument-resolvers>
+ </mvc:annotation-driven-->
</beans>
--- a/server/src/main/webapp/WEB-INF/renkan.properties Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/webapp/WEB-INF/renkan.properties Mon Mar 25 05:55:28 2013 +0100
@@ -2,4 +2,6 @@
mongodb.host.port = 27017
mongodb.db.name = renkan
-renkan.pagination.size = 10
\ No newline at end of file
+renkan.pagination.size = 2
+renkan.coweb.debug = false
+renkan.coweb.websocket = true
\ No newline at end of file
--- a/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/webapp/WEB-INF/templates/renkanProjectEdit.html Mon Mar 25 05:55:28 2013 +0100
@@ -23,6 +23,14 @@
<script src="js/list-bin.js" th:src="@{/static/js/list-bin.js}"></script>
<script src="js/paper-renderer.js" th:src="@{/static/js/paper-renderer.js}"></script>
<script type="text/javascript" src="js/config.js" th:src="@{/static/js/config.js}"></script>
+ <script type="text/javascript" th:inline="javascript">
+ var cowebConfig = {
+ baseUrl: window.location.protocol + '//' + window.location.host,
+ adminUrl : dojoConfig.baseUrl+'admin',
+ debug: /*[[${coweb_debug}]]*/false,
+ useWebSockets: /*[[${coweb_websockets}]]*/false
+ };
+ </script>
<script type="text/javascript" src="lib/dojo/dojo.js" data-dojo-config="isDebug: true, parseOnLoad: true" th:src="@{/static/lib/dojo/dojo.js}"></script>
<script type="text/javascript" th:inline="javascript">
$(function() {
--- a/server/src/main/webapp/static/js/config.js Fri Mar 22 05:32:19 2013 +0100
+++ b/server/src/main/webapp/static/js/config.js Mon Mar 25 05:55:28 2013 +0100
@@ -22,10 +22,3 @@
}],
};
-var cowebConfig = {
- baseUrl: window.location.protocol + '//' + window.location.host,
- adminUrl : dojoConfig.baseUrl+'admin',
- debug: false,
- useWebSockets: true,
-};
-