Spring in action - try opensource CMS in Java
This article will focus on the Riot content management system written in Java . The system is based on the Spring Framework , uses Ajax .
I will give the main features of the system and step by step tell you how to install it. The article is addressed to all those interested in Java content management systems.
What is riot
Creation of a new Riot project
Riot is an open source web application framework.
End users can consider the system as a CMS , but from the standpoint of the developer, Riot is more like a Content Management Framework ( CMF ) , since the system does not offer an out-of-the-box solution. Riot is a web application framework based on opensource technologies, the most significant of which are Spring and Hibernate .
There is not much documentation on the system. The riot developers insist that the system is based on well-known well-documented technologies and it will not be difficult to deal with riot add-ons. There is a group in Google in which the discussion of the system takes place, there is online JavaDoc and fmdoc .
We will create a new project in Eclipse (with the Web Standard Tools plugin installed ). If you do not want to use the IDE, just create a new folder for the future project.
In the created folder, place the following setup.xml ant file and run the default target
Setup.xml downloads the file www.riotfamily.org/setup/skeleton-8.0.zip and unpacks it. Executes the skeleton.xml ant script . Removes skeleton.xml, setup.xml, skeleton-8.0.zip .
Executing the skeleton.xml file.
The file checks if the project was created in Eclipse, and if so, then the script patches several config files in the IDE . (for example, the build / conf folder is added to the source folders list ). After that, the setup procedure of the build.xml file is called , which performs dependency resolution using Ivy.and builds a project. It took me about 15 minutes to build a project, for them Ivy pulled out eleven megabytes of libraries.
After the project is completed, update the project structure from Eclipse in order to see the files downloaded during project creation.
If you are not using the editor, use the ant war command to create the WAR file.
The created war-file is placed in the Tomcat webapps folder and restart the server.
The site will be available by default at localhost: 8080 // .
The admin panel will be available at localhost: 8080 // riot .
Username: admin
Password: admin
Riot uses utf8 encoding , but in order for the system to understand Cyrillic , you need to check several application settings.
By default, Riot uses HSQLDB and does not store changes to the system after a reboot. To configure work with MySQL (PostgreSQL), change the settings of the conf \ default \ application.properties file in accordance with the recommendations given in conf \ mysql \ application.properties or conf \ postgres \ application.properties .
1. After building the project, I had spring-beans-2.5.xsd validation errors in Eclipse. The solution was simple .
2. Also, an error occurred while creating the riot_dbmsgsrc_entries table .
I had to change the code:
on the
3. I couldn’t start Tomcat from the editor, so I added the server start / stop goals and the goal of placing the war file in the webapps folder in build.xml. My changes:
Riot is an interesting and flexible system built on java-technologies. Riot provides the developer with a web application framework with core CMS features already implemented.
I will give the main features of the system and step by step tell you how to install it. The article is addressed to all those interested in Java content management systems.
Content
What is riot
- Main characteristics
- System requirements
- Libraries used
- Documentation
Creation of a new Riot project
- Russification of Riot
- Setting up a connection to the database
- Errors encountered during installation
What is riot
Riot is an open source web application framework.
End users can consider the system as a CMS , but from the standpoint of the developer, Riot is more like a Content Management Framework ( CMF ) , since the system does not offer an out-of-the-box solution. Riot is a web application framework based on opensource technologies, the most significant of which are Spring and Hibernate .
Main characteristics:
- the ability to edit content directly on the page using the Ajax interface;
- the ability to manage business objects ( domain objects ) from the administrator section, regardless of their origin (Hibernate, JPA, custom DAO);
- multilingualism support both in the interface and in the content;
- module support;
- multisite support;
- customizable design templates, the ability to manage blocks of content directly on the site;
- user management;
- beautiful urls like site.com/level1/level2/../page.html ;
- the ability to integrate into existing applications.
System requirements:
- works on any platform with installed Java-machine from version 1.5;
- uses servlet containers that support specification 2.5;
- uses Hibernate to access data, which makes it possible to choose a DBMS from the set of available ;
- some features require the ImageMagick library, which is also available on most platforms.
Used libraries:
- Spring Framework - as an IoC container and web MVC framework;
- ORM framework Hibernate ;
- FreeMarker template engine ;
- Direct Web Remoting is a library that allows Javascript code in the browser to interact with Java objects on the server. The Riot Toolbar uses the DWR to create the user interface on Ajax;
- Apache Ant - java utility for automating the process of building a software product;
- Ivy is a dependency definition manager that is flexible and simple.
Documentation:
There is not much documentation on the system. The riot developers insist that the system is based on well-known well-documented technologies and it will not be difficult to deal with riot add-ons. There is a group in Google in which the discussion of the system takes place, there is online JavaDoc and fmdoc .
Creation of a new Riot project
We will create a new project in Eclipse (with the Web Standard Tools plugin installed ). If you do not want to use the IDE, just create a new folder for the future project.
In the created folder, place the following setup.xml ant file and run the default target
(wget http://riotfamily.org/setup.xml && ant -f setup.xml).
Setup.xml downloads the file www.riotfamily.org/setup/skeleton-8.0.zip and unpacks it. Executes the skeleton.xml ant script . Removes skeleton.xml, setup.xml, skeleton-8.0.zip .
Executing the skeleton.xml file.
The file checks if the project was created in Eclipse, and if so, then the script patches several config files in the IDE . (for example, the build / conf folder is added to the source folders list ). After that, the setup procedure of the build.xml file is called , which performs dependency resolution using Ivy.and builds a project. It took me about 15 minutes to build a project, for them Ivy pulled out eleven megabytes of libraries.
After the project is completed, update the project structure from Eclipse in order to see the files downloaded during project creation.
If you are not using the editor, use the ant war command to create the WAR file.
The created war-file is placed in the Tomcat webapps folder and restart the server.
The site will be available by default at localhost: 8080 /
The admin panel will be available at localhost: 8080 /
Username: admin
Password: admin
Russification of Riot
Riot uses utf8 encoding , but in order for the system to understand Cyrillic , you need to check several application settings.
- Check DBMS encoding. For MySQL, I had to write in the my.cnf (my.ini) file :
character-set-server = utf8
collation-server = utf8_general_ci - To correctly convert text to a picture ( org.riotfamily.website.txt2img package ), connect cyrillic fonts (for example this one ) in the riot-config / website-servlet.xml file ;
- To translate the admin menu into the address bar of the browser, enter the javascript: void (frameset.toggleI18n ()) command , after which a yellow [l18n] button will appear next to each inscription. Click on it and translate the menu.
Setting up a connection to the database
By default, Riot uses HSQLDB and does not store changes to the system after a reboot. To configure work with MySQL (PostgreSQL), change the settings of the conf \ default \ application.properties file in accordance with the recommendations given in conf \ mysql \ application.properties or conf \ postgres \ application.properties .
Errors encountered during installation
1. After building the project, I had spring-beans-2.5.xsd validation errors in Eclipse. The solution was simple .
2. Also, an error occurred while creating the riot_dbmsgsrc_entries table .
I had to change the code:
- CREATE TABLE `riot _ dbmsgsrc _ entries` (
- `id` bigint (20) NOT NULL auto_increment ,
- `bundle` varchar (255) collate utf8_general_ci default NULL ,
- `code` varchar (255) collate utf8_general_ci default NULL ,
- `comment` longtext collate utf8_general_ci,
- PRIMARY KEY (`id`),
- UNIQUE KEY `bundle` (` bundle`, `code`)
- ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci AUTO_INCREMENT = 1;
on the
- CREATE TABLE `riot _ dbmsgsrc _ entries` (
- `id` bigint (20) NOT NULL auto_increment ,
- `bundle` varchar (255) collate utf8_general_ci default NULL ,
- `code` varchar (255) collate utf8_general_ci default NULL ,
- `comment` longtext collate utf8_general_ci,
- PRIMARY KEY (`id`),
- UNIQUE KEY `bundle` (` bundle` (100), `code` (100))
- ) ENGINE = MyISAM DEFAULT CHARSET = utf8 COLLATE = utf8_general_ci AUTO_INCREMENT = 1;
3. I couldn’t start Tomcat from the editor, so I added the server start / stop goals and the goal of placing the war file in the webapps folder in build.xml. My changes:
name = "tomcat.dir" value = "C: / Program Files / Apache Software Foundation / Tomcat 6.0" /> name = "tomcat.webapp.dir" value = "$ {tomcat.dir} / webapps" /> name = "deploy-tomcat" depends = "war" description = "Copies war file into Tomcat" > -
target = "tomcat-stop" /> -
file = "$ {war.location}" todir = "$ {tomcat.webapp.dir}" /> -
dir = "$ {tomcat.webapp.dir} / $ {ant.project.name}" /> -
target = "tomcat-start" /> - >
name = "tomcat-start" > -
jar = "$ {tomcat.dir} /bin/bootstrap.jar" fork = "true" > -
value = "- Dcatalina.home = $ {tomcat.dir}" /> - >
- >
name = "tomcat-stop" > -
jar = "$ {tomcat.dir} /bin/bootstrap.jar" fork = "true" > -
value = "- Dcatalina.home = $ {tomcat.dir}" /> -
line = "stop" /> - >
- >
conclusions
Riot is an interesting and flexible system built on java-technologies. Riot provides the developer with a web application framework with core CMS features already implemented.