{"id":5801,"date":"2018-12-15T02:08:35","date_gmt":"2018-12-15T02:08:35","guid":{"rendered":"https:\/\/www.appservgrid.com\/paw92\/?p=5801"},"modified":"2018-12-28T21:04:45","modified_gmt":"2018-12-28T21:04:45","slug":"foss-project-spotlight-appaserver-linux-journal","status":"publish","type":"post","link":"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/15\/foss-project-spotlight-appaserver-linux-journal\/","title":{"rendered":"FOSS Project Spotlight: Appaserver | Linux Journal"},"content":{"rendered":"<p><em>An introduction to an application server that allows you to build MySQL user interfaces<br \/>\nwithout<br \/>\nprogramming.<\/em><\/p>\n<p>Assume you are tasked to write a browser-based, MySQL user interface for the table called CITY.<br \/>\nCITY has two columns. The column names are city_name and state_code\u2014each combined are the<br \/>\nprimary key.<\/p>\n<p>Your user interface must enable users to execute the four main SQL operations: select, insert,<br \/>\nupdate and delete. The main characteristics for each operation are:<\/p>\n<ul>\n<li>The select operation needs an HTML prompt form to request a query. It also needs a where<br \/>\nclause generator to select from CITY. After forking MySQL and retrieving the raw rows, it needs to<br \/>\ntranslate them into an HTML table form.<\/li>\n<li>The HTML table form needs to be editable, and user edits need to be translated into update<br \/>\nstatements.<\/li>\n<li>Each resulting row following the execution of a query is a candidate for deletion.<\/li>\n<li>The insert operation needs a blank form. It also needs to translate Apache&#8217;s common gateway<br \/>\ninterface (CGI) into insert statements.<\/li>\n<\/ul>\n<p>So, you might create the source file called city.c and type in all the required code. Of course,<br \/>\nrelational databases have relations. One city has many persons residing in it. Assume the PERSON<br \/>\ntable has the column names of full_name, street_address,<br \/>\ncity_name and state_code. full_name and<br \/>\nstreet_address combined are the primary key (Figure 1).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linuxjournal.com\/sites\/default\/files\/styles\/max_1300x1300\/public\/u%5Buid%5D\/12399f1.jpg\" alt=\"&quot;&quot;\" width=\"350\" height=\"350\" \/><\/p>\n<p><em><br \/>\nFigure 1. Database Schema of Many Persons Residing in One City<\/em><\/p>\n<p>Are you going to create the source file called person.c too? What about customer.c, inventory.c,<br \/>\norder.c, &#8230;?<\/p>\n<p>Alternatively, you might create the source files called select.c, insert.c, update.c and<br \/>\ndelete.c. Then each of these modules would need as input:<\/p>\n<ul>\n<li>A single table name.<\/li>\n<li>The table&#8217;s additional attributes.<\/li>\n<li>The table&#8217;s column names and additional attributes.<\/li>\n<li>A recursive list of related tables.<\/li>\n<li>Apache&#8217;s CGI dictionary output.<\/li>\n<\/ul>\n<p>The principle behind Appaserver is this multi-module approach. Appaserver stores table names in a<br \/>\ntable. Each table&#8217;s column names and relations are also stored in tables. Taking the table-driven<br \/>\nconcept to the nth degree forms a database of a database. You can glean a detailed understanding<br \/>\nof how the Appaserver database is modeled from <a href=\"https:\/\/appahost.com\/appaserver_database_schema.pdf\">https:\/\/appahost.com\/appaserver_database_schema.pdf<\/a>.<\/p>\n<h3>Create Appaserver Applications<\/h3>\n<p>To create Appaserver applications, you first need Appaserver. Because Appaserver communicates with<br \/>\nboth Apache and MySQL, installation has multiple steps. The installation steps are available at<br \/>\n<a href=\"https:\/\/github.com\/timhriley\/appaserver\/blob\/master\/INSTALL\">https:\/\/github.com\/timhriley\/appaserver\/blob\/master\/INSTALL<\/a>. You will install a database called &#8220;template&#8221;<br \/>\nfrom which all your applications are spawned. Alternatively, you can create an Appaserver<br \/>\napplication securely at <a href=\"https:\/\/cloudacus.com\/\">Cloudacus<\/a>.<\/p>\n<h3>Appaserver Roles<\/h3>\n<p>After you create your first application from the template database, you are ready to build it.<br \/>\nAfter you log in, you are presented with three preinstalled roles (Figure 2).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linuxjournal.com\/sites\/default\/files\/styles\/max_1300x1300\/public\/u%5Buid%5D\/12399f2.jpg\" alt=\"&quot;&quot;\" width=\"705\" height=\"417\" \/><\/p>\n<p><em>Figure 2. Appaserver Supports Multiple Roles<\/em><\/p>\n<p>Appaserver&#8217;s security centers around roles. You grant permissions to roles, and you assign users<br \/>\nto roles. The &#8220;System&#8221; role is used to build your database. Users interact with the database in<br \/>\nall the other roles.<\/p>\n<p>The highest user role is &#8220;Supervisor&#8221;. The &#8220;Supervisor&#8221; role has permission to select, insert,<br \/>\nupdate and delete every column in every row in every application table. Two important<br \/>\nconsiderations are:<\/p>\n<ol>\n<li>The &#8220;Supervisor&#8221; role cannot access any of the system tables, only application tables. (Well,<br \/>\nexcept the APPLICATION_CONSTANTS table.)<\/li>\n<li>The &#8220;Supervisor&#8221; role has permission to delete too much.<\/li>\n<\/ol>\n<p>The lowest subordinate role is &#8220;Public&#8221;. The &#8220;Public&#8221; role has select permission only. It is used<br \/>\nin publicly funded research applications. Cloudacus hosts a research application called <a href=\"https:\/\/cloudacus.com\/index.php?set_application_key=benthic\">&#8220;Benthic&#8221;<\/a>.<br \/>\n&#8220;Public&#8221; also may be used in commercial applications to display<br \/>\ninventories.<\/p>\n<p>The next lowest subordinate role is &#8220;Dataentry&#8221;. The &#8220;Dataentry&#8221; role receives insert and lookup<br \/>\npermissions but not update nor delete. If someone in the &#8220;Dataentry&#8221; role comes across a mistake,<br \/>\na supervisor needs to be interrupted to make the fix.<\/p>\n<p>You may create many subordinate roles above these two. Assign yourself to all of them. Then you can easily test the security.<\/p>\n<h3>Build Your Database<\/h3>\n<p>Users will interact with your database using Appaserver. Likewise, you will build your database<br \/>\nusing Appaserver. You will first use Appaserver&#8217;s insert operations. If you make a mistake,<br \/>\nyou will use Appaserver&#8217;s update and delete operations. After your user interface vision is<br \/>\ncomplete, execute the &#8220;Create Application&#8221; process. You then can change to a user role and start<br \/>\nproducing.<\/p>\n<h3>How Appaserver Works<\/h3>\n<p>Take a look at Figure 3. The cycle begins by first choosing a table to insert into or lookup from.<br \/>\nAppaserver generates and sends a &#8220;select&#8221; SQL statement to MySQL, requesting the column names of<br \/>\nyour table. MySQL returns data containing the table&#8217;s column names and other metadata to<br \/>\nAppaserver.<\/p>\n<p>Appaserver then generates HTML tags and sends them to your browser. The HTML tags will be blank<br \/>\nwidgets if you are inserting and query widgets if you are selecting.<\/p>\n<p>Your browser displays a dialog-box (form) that contains a CGI &#8220;Submit&#8221;<br \/>\nbutton. After you submit your form, the browser sends its contents to Appaserver. Appaserver<br \/>\ngenerates and sends the next appropriate SQL statement to MySQL. The cycle then repeats.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.linuxjournal.com\/sites\/default\/files\/styles\/max_1300x1300\/public\/u%5Buid%5D\/12399f3.jpg\" alt=\"&quot;&quot;\" width=\"850\" height=\"500\" \/><\/p>\n<p><em><br \/>\nFigure 3. Appaserver Data Flow Diagram<\/em><\/p>\n<h3>Conclusion<\/h3>\n<p>The <a href=\"https:\/\/appahost.com\/helloworld.html\">Hello World Tutorial<\/a> will step you through the entire database build.<\/p>\n<p>Appaserver is a MySQL user interface. The interface is consistent throughout your<br \/>\napplication\u2014both at the system level and the user level. Once you discover Appaserver&#8217;s look and feel, new<br \/>\ntables and columns can become new features simply by filling out a few forms.<\/p>\n<p><a href=\"https:\/\/www.linuxjournal.com\/content\/foss-project-spotlight-appaserver\" target=\"_blank\" rel=\"noopener\">Source<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>An introduction to an application server that allows you to build MySQL user interfaces without programming. Assume you are tasked to write a browser-based, MySQL user interface for the table called CITY. CITY has two columns. The column names are city_name and state_code\u2014each combined are the primary key. Your user interface must enable users to &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/www.appservgrid.com\/paw92\/index.php\/2018\/12\/15\/foss-project-spotlight-appaserver-linux-journal\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;FOSS Project Spotlight: Appaserver | Linux Journal&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5801","post","type-post","status-publish","format-standard","hentry","category-linux"],"_links":{"self":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5801","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/comments?post=5801"}],"version-history":[{"count":1,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5801\/revisions"}],"predecessor-version":[{"id":6425,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/posts\/5801\/revisions\/6425"}],"wp:attachment":[{"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/media?parent=5801"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/categories?post=5801"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.appservgrid.com\/paw92\/index.php\/wp-json\/wp\/v2\/tags?post=5801"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}