Overview
Maxscape is web server framework, that provides the key features to develop, manage and operate sophisticated web sites and services. Various programs, components and modules are integrated to implement the generic functionality of a web application server platform and framework, a run time system, content management components and a development and integration environment.
Besides on the file system, content and also application code can be stored in a relational database, called the Content Database. The run time system then generates requested answers out of that Content Database. The Maxscape run time objects allow an object oriented view on the Content Database to server side applications.
Hierarchical Content Database and Object Oriented View
Unique with Maxscape is that content, templates and embedded software can consistently be stored in a Content Database. The concept of storing content and software in a database instead of on the file system has more consequences than one might think at the first glance. Unlike a directory, a database category may have elements that can be inherited to sub trees or imported into pages and templates. Page resp. template elements can arbitrarily be nested. Defining a content type, a text language, a version number, any parameter becomes a column/row in a database table.
A content database has many advantages compared to a file system approach. It eases the data storage greatly and combines the advantages of rational databases and the power of the SQL language with object oriented server and application programming.
Imagine a data model with categories, pages, templates and elements, instead of a file system with folders and files. Now, you can quite easily define run time objects that allow an object relational view on content and applications stored in the content database. In addition to the file system approach, categories may contain code and content elements. Pages are composed of template and page elements.
File System Page Tree: ====================== +--Root Folder +--Sub Folders +--Files ... Content Database Page Tree: =========================== +--Root Category +--Root Category Elements +--Sub Categories +--Sub Category Elements +--Templates +--Template Elements +--Pages +--Page Elements ...
The implementation of a Content Database model with a rational database is much easier than on a file system. Accessing an element in a database melts down to a SQL query pointing to the related storage place. Such queries are then hidden within the Maxscape classes.
The peace of code shown below is stored in a database template element, of course. $Page is the object containing the page data and page elements of the current page. The $Page->ElementContent() method fetches the content of the page elements by their name. Note, that the CSS code is inherited from the page category and imported from the page template.
Database template element with embedded Maxscape Objects
<!doctype html> <html> <head> <title> @{[ $Page->ElementContent (Name => 'Title') ]} </title> <style type="text/css"> @{[ $Page->ElementContent (Name => 'Category.CSS') ]} @{[ $Page->ElementContent (Name => 'Template.CSS') ]} @{[ $Page->ElementContent (Name => 'Page.CSS') ]} </style> </head> <body> @{[ $Page->ElementContent (Name => 'Category.PageHead') ]} @{[ $Page->UserElementLoop() ]} @{[ $Page->ElementContent (Name => 'Category.PageTrailor') ]} </body> </html>
There are a few things to be mentioned about the above example. Firstly, the code is stored in the content database instead of a file. Secondly, HTML tags and embedded Maxscape method calls are intermixed in the same element content.
Thirdly, the @{[ <function call> ]} notation might be unusual even for Perl programmers. It is a Perl closure embedded in a string variable. This construct allows to execute Perl code within text strings opposed to embedded text strings printed within Perl code. Therefor, it is used as an embedded Perl interpreter for code snippets within text strings stored in the database. The run time system then fetches the string and executes the code on the fly. Consequently, no additional embedded code interpreter is needed, at least as long as coding possibilities don't need to be restricted to application programmers.
Fourthly, it has to be emphasized that the code is stored in the content database instead of a file. The location is denoted by the template's page and category names. A template has a type and consists of one or more template elements just like pages do. All templates and pages consist of elements and have describing data attached. An element consist of a name, an attribute and the content. The type of the content is given by the 'Type' attribute, which can be whatever you have defined beforehand. Defaults are plain text, HTML, embedded Perl, Perl code and Maxscript.
Content Database Categories, Pages, Templates and Elements
Content Database Categories are similar to folders and pages to files in that they are pointed to by their path and name. Such a location is a node in the hierarchical page tree. The page tree is implemented by the NODE database table and the $Page object's methods. The SQL statements to locate page data and elements are encapsulated within the $Page and the $Context classes and provided by their member functions, so that applications normally don't need to deal with SQL database queries. See, the 'ElementContent' method in the above example. The NODE's main key is the unique NODE_NUMBER.
Templates are pages with the Node Type 'Template' and are used to implement a special design, thus separating HTML from real content. Each of them consists of elements, which can arbitrarily be nested. There are several database tables, namely DATABASE_FILE, ELEMENTS and TEMPATES, to store the elements of the node. The elements are connected to the NODE table via the NODE's NODE_NUMBER.
Application Programming Interface
Application software can be stored in files on the file system or in the content database. On the file system they live in a standardized directory structure and there are many places to insert callbacks in the page generation loops. Applications in the database are located in the content of the elements. From the programmer's point of view it doesn't make a big difference concerning the code.
An application lives in an application process that communicates with the HTTP daemon via the chosen CGI interfaces, whereas the actual CGI interface is hidden, so that programming is transparent. You only need to change the main process script.
Example Main FCGI Script of an Application Process
$Process->initialise(); my $Request; my $Response; my $FCGI_Request = FCGI::Request(); while ($FCGI_Request->Accept >= 0) { $Request = Maxscape::HTTP::Request->new; $Response = $Process->execute ($Request); print $Response->HeaderAsString, $Response->Content; $Process->postProcess; $Process->cleanup; }
The Maxscape run time system provides a lot of objects that can be used by applications. The $Page objects contains the data derived from the web sites configuration, the content database, the HTTP request (CGI) data, etc.
Application Code using Maxscape Objects
my ($Header, $Trailor) = ('foo', 'bar'); my $PageName = $Page->PageName(); my $CategoryName = $Page->CategoryName(); my $CGI = $Page->{Context}->{CGI}; my $searchString = $CGI->Query('searchString'); my $Form = Maxscape::Form->new(); my $FormText = $Form->start_form (name => 'searchInputForm') . $Form->input_text (name => 'searchString', size => '50', maxlength => '80', value => $searchString) . $Form->submit (name => 'searchSubmitAction', value => 'find') . $Form->end_form; my $Answer = "$CategoryName/$PageName: " . $::BR . $Page->simpleSearch ( QueryString => $searchString, Category => $CGI->Query ('search.Category'), Page => $CGI->Query ('search.Page'), searchCategories => $CGI->Query ('search.Categories'}, ); return $Header . $FormText . $Answer . $Trailor;
Note, that the code does not directly print to whatever STDOUT is connected to, instead the resulting text is simply returned to the calling function. $CategoryName and $PageName are the two CGI query string variables to point to the node location in the page tree hierarchy. There are several possibilities to point to node locations within HTML text Hyperlink tags. You can directly write HTML or you can use the $Page->mxsLink () method,
Pointing to Page Locations in HTML Hyperlinks
HTML: <a target="_blank" href="?Category=/myCategory&Page=Index">Link Text</a> API method yields the above hyperlink: my $Hyperlink = $Page->mxsLink (Text => 'Link Text', Category => '/myCategory', Page => $::WebServer->{'Page.defaultName'}, Target => '_blank',);
Web Site, Page and Template Design
Maxscape comes with web surfaces to work with the content database and the file system. You only need a web browser, best firefox, because the surfaces are optimized for this browser.
Now, it is best to create an account on Maxscape.com to see how the surfaces are working. Don't be surprised that the programming feature described above is disables, because you will have an anonymous account, at first. You might want to use Maxscript instead, which is a small beta state document language that provides restricted access to the run time objects.
Create a test web site and see if you like the work flow. Expect that you'll need some time to master the process. Once set up well, management of your site is greatly reduced, if you apply category elements inheritance. The templates technique will be added latter to the surfaces for anonymous members, if there is time to do just that.
Part Systems
To actually execute the above code examples the following part systems have been identified and appropriated.
- Development and Integration Environment
-
Maxscape has been developed on UNIX the best Operating System for network servers.
UNIX comes with a whole world of useful tools on its own. Decent command line shells,
vi, grep, diff, locate, find, make, etc. Additional tools namely CVS, GIT and
RPM are used for development, integration build and the distribution chain.
A central makefile and several shell scripts adapts and facilitates the UNIX tool chain to set the appropriate environments, to manage the various versions of programs, components, modules and the server's file system and last but not least to find text strings and code pieces on the file system and in the database. - Generic Web Server Platform
-
The web server platform comprises the HTTP(S) daemons, a specially compiled Perl
interpreter with many useful CPAN modules, as well as a rational database.
Apache is compiled with Openssl, Fast-CGI and Mod-Perl. Maxdaemon comprises a fast, lightweight HTTP(S) daemon written in Perl with three kinds of CGI interfaces, a web browser surface to manage the server's and the host's file system, and an application server run time system.
The build of a own, specially compiled Perl Interpreter is recommended, to adapt Perl to the needs of an application server, for example to encrypt the software sources on production systems.
The Content Database can be implemented with any rational database, as long as a DBD/DBI driver exists. Anyway a pre-compiled MySql database is part of the distribution.
To build the platform an RPM repository with spec files is used, what eases the build process greatly and makes it reproducible. - Standardized Directory Structure
- The standardized directory structure is introduced to ease the management of software components and web sites and to make applications of different servers directly compatible. Each application server lives in its own directory sub tree, structured according to UNIX conventions. Process, server and site specific components are separated in distinct directories.
- Application Server and Run Time System
- The runtime system connects all components and implements the interface between server and applications. It generates content from the content databases resp. the file system within the main loops of the application processes. It provides variables, functions and objects to applications to access configuration, server, client request, a.s.o. data and for easy work with the content database. At many states of the content generation functions applications can insert callbacks.
- Class Library and API
-
The Maxscape class library implements the main features of a generic application server,
to work with the content database, the web surfaces and the HTTP(S) daemon.
She offers an hierarchical, object oriented view on content and software stored in the content database and on the file system. Applications communicate with the server software via variables, functions and objects provided by the run time system.
At the moment she comprises 88 packages with 1420 methods, 65295 Lines of Perl Code with rudimentary documentation, whereas code in the database that is candidate to be part of the library is not counted. The number of all source lines is 507215. - Content Database and Data Model
-
The idea of the Content Database arose in 1996 from the experience, that the effort
to store a complex web site's content, design, applications and meta data on
a file system is much bigger than using a database for that task.
Instead of innumerable files and the related administration ramifications,
a database offers a regular, standardized structure, that can be managed
relatively easy.
It is also an experience that the implementation of a data model, the user interfaces to the database and the run time system to dynamically generate content is quite a big project on its own. Once set up, the possibilities are simply amazing. Thus content and design can be separated by storing them in different elements, content and design elements can be reused easily and to implement a sophisticated template technique, for example.
Another key feature of the Content Database is that besides document languages like HTML, client side scripts like Javascript, and also server side Perl scripts can be stored in the database and be evaluated or executed at run time on-the-fly. Storing server side software in a rational database offers many advantages, as you will see later.
Each virtual web site has its own content database to store configuration data, categories, pages, templates, elements, user data, etc., as well as application software.
The data model maps the hierarchical structure of a web site to the rational database. Directories become categories and files become pages. Pages consists of the page data and elements, which are inserted into templates. Categories may contain elements, which can be inherited to sub trees. Templates allow to separate content and design and to generalize page layouts.
Database pages are subdivided into page elements, which contain the content and application software. Element content can be whatever database tables can store. A particular feature of Maxscape is, that even Perl code can be stored in page elements, which is then evaluated and executed by the run time system. Thank you Perl! - Database and File System Surfaces
- Maxscape provides several web browser surfaces to the Content Database and the file system of the web site's servers. Though functionality and look & feel could definitely be improved, most of the important functions to manage web sites are implemented.
- History and Customers
- Maxscape 1.0 (1997) was the first platform integrating an HTTP daemon (first NSCA, CERN, then Apache), FastCGI/ModPerl, SSL, a database (first Msql, then Mysql, Oracle), a programming language (Perl) and an application server, that was delivered and sold, as a relatively easy to install distribution to customers like Vereinsbank, T-Data, Phase 4, GHM.
- Example Web Sites with Maxscape
-
An application server without applications is like a community site without members. Quite useless. Well, here are some sites running on Maxscape.
∙ Maxscape.com - Maxscape communication server ∙ Maxdaemon.org - Maxdaemon HTTPD and application server ∙ Internet-Profile.com - Publish a profile and web site ∙ Profile-Community.com - Simple community solution ∙ Sound-Basement.com - Sound-Basement studio/community ∙ Strinx.com - Showcase community site ∙ Rainer Jacob - Works of art by Rainer Jacob ∙ Delilah und Freunde - Delilah's profile at Sound-Basement.com ∙ The Sky Across Berlin - Photos of Berlin's sky