Tutorial

Introduction

SmartSites is an HTML page generator written in Java using the BEEing Platform.
The SmartSites job is to produce HTML pages.
The page producer is the “SmartSites Template Engine” and is based upon  Apache Velocity.

The flow of page production is:

  1. SmartSites check all declared site and take a loop on each one
  2. For each site, start looping on page templates assigned at the site
  3. Each template page is evaluated and some actions are taken based upon a customized behaviour expression
    • if expression is empty, a single page is produced
    • if expression is of kind “FIND” (items.FIND:class1=SPIRAL.uid), many pages are produced (one for each item in expression’s data result)
    • if expression is of kind “GROUP” (tems.GROUP:class1=SPIRAL.uid), a single page is produced and expression’s data result are added to “SmartSite Template Engine” context.
  4. Output is “post-processed”

SmartSites Run options

SmartSites can be executed as a Console application.
Run command is:

java -jar "SmartSiteLib.jar"

When you run SmartSites with no additional options, you obtain default help response that inform you about SmartSites Options:

  • –help:  Open this page
  • –editor: Open JSON editor (useful for database editing)
  • –generate: Generate all outputs and open the output folder
  • –import: Import all CSV files from “/import” folder (see “Importing Data” for more details)

SmartSites Output and Database Folders

SmartSites work directory is <UserFolder>/beeingstore/smartsiteclient.
<UserFolder> depends on your working O.S. (Linux, Windows, Mac or other).
The “beeingstore” path is default BEEing folder for all files and resources.
The “smartsiteclient” is SmartSites working directory.

Directory structure

DATA: Here is stored the smartdata database. The database is a JSON schema-less database written upon BEEing JSDB library.

SITES: This is main output folder. All generated sites are first stored in this folder. For each site is created a sub-folder.

TEMPLATES: The template repository. All templates must be hosted here. Subfolders are collections of different templates. For example, “sample” is a template and the sample folder contains all template pages and resorces like images, css, javascripts, etc..

UTILS: Utility folder. Contains some useful tools like the JSON editor.

IMPORT: Put here CSV files you want import into database. (see “Importing Data” for further details)

EXPORT: Output directory for exported data (see “Exporting Data” for further details).

The JSON editor

SmartSites database is stored in JSON native format. JSON is less verbouse than XML, but also less structured and more difficult to edit manually. Usually you should not need to edit the database.

Once you launched the editor in you browser, you have also to open the database file “db.json” with a text editor and copy the content to past into the “Value” field of the editor.
The editor is a very simple, but useful, editor written by Thomas Frank.

With this editor you can view and change database values. Remember that “Save” button in the editor does not overwrite “db.json” file, so you have to do it manually copying text from JSON editor and pasting it into your Text Editor.