{"id":4153,"date":"2014-01-23T11:53:45","date_gmt":"2014-01-23T16:53:45","guid":{"rendered":"http:\/\/www.lordandrei.com\/blog\/?p=4153"},"modified":"2014-01-23T11:53:45","modified_gmt":"2014-01-23T16:53:45","slug":"the-project-a-peek-under-the-hood","status":"publish","type":"post","link":"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/","title":{"rendered":"The Project: A Peek Under the Hood"},"content":{"rendered":"<p><img loading=\"lazy\" class=\"alignright size-medium wp-image-4156\" alt=\"coding\" src=\"http:\/\/www.lordandrei.com\/blog\/wp-content\/uploads\/2014\/01\/coding-300x225.jpg\" width=\"300\" height=\"225\" srcset=\"http:\/\/www.lordandrei.com\/blog\/wp-content\/uploads\/2014\/01\/coding-300x225.jpg 300w, http:\/\/www.lordandrei.com\/blog\/wp-content\/uploads\/2014\/01\/coding-150x112.jpg 150w, http:\/\/www.lordandrei.com\/blog\/wp-content\/uploads\/2014\/01\/coding.jpg 400w\" sizes=\"(max-width: 300px) 100vw, 300px\" \/>I&#8217;ve been fairly quiet on the blog the past two weeks. This has been because I have been head down in code catching up from the holidays and being sick. I know all to well how abstract and vague I&#8217;ve been on what The Project is. I&#8217;m still shooting for a grand unveiling upon the ides of March. (March 15 for those who read not the Shakespeare)<\/p>\n<p>I however do not want to be without any information. So I decided to play the magnifier game. This is the game where you show someone a picture of a common object through a magnifying glass and let them guess what it is they are looking at. Granted, that&#8217;s not my intent. I know what I&#8217;m showing is intentionally obfuscated to hide The Project&#8217;s intent.<\/p>\n<p>However, I want to show a checkin from one of the classes that I did today to talk about what&#8217;s going on.<\/p>\n<p>I&#8217;ve make no secret that this project uses a database to manage the content and Java and Tomcat to serve as a buffer to clients. Today, I am working on the database upload abstract class. In revamping my Java Servlets this past week, I have managed to completely abstract the query command class to the point that I can create any pre-packaged SQL query on the database into a 4 line subclass. This subclass can handle variant queries, compares, subqueries, and most importantly documentation on the return. This work made me very happy.<\/p>\n<p>In pushing data up to the database there is more work needed. I have to verify that the call is including the correct information. I have to make sure that the subclasses have defined the necessary info to check. (So subclasses will be closer to 10 lines instead of 4)<\/p>\n<p>Effectively, a push command should identify the table in the database, the usable column names, the required column names. And of course error check and return the response in a consumable way.<\/p>\n<p>Below is my checkin comments from today&#8217;s abstract Class work. (Note there are redactions)<\/p>\n<p>(Ah, the fun of Java)<\/p>\n<pre>imports java.util.List\r\nadds ivars\r\n\tMUST BE OVERRIDDEN List requiredHeaders\r\n\tMUST BE OVERRIDDEN List usableHeaders\r\n\tString sqlQueryHeaders (for building sql update)\r\n\tString sqlQueryValues (for building sql update)\r\ndoSQLQuery() now doSQL()\r\n\tsetRC not setRS with executeUpdate instead of executeQuery\r\ngoGet()\r\n\tSends a formatted json error response (put, not get)\r\nvalidateSubClass() (new)\r\n\tChecks to see that there is at least 1 usableHeaders\r\n\tChecks to see that there are no more required headers than usable headers\r\n\tChecks that all required Headers are in usable Headers\r\n\tChecks that there is a table conversion equiv in getDbaseTable() {below}\r\n\tThrows Exception (Programming error) if any of these cases fail.\r\nvalidateRequest() (new)\r\n\tVerifies that required headers are in the request http Header\r\n\tReturns first missing required header if failure\r\nprocessHeaderPair() (new)\r\n\texamines each HTTP header pair\r\n\tsearches for headers that are: Package.Command.usableHeader\r\n\tconverts them into caseCorrected usableHeader and Value\r\n\tAppends them into Strings for use in SQL Update request\r\ngetDbaseTable() (new)\r\n\tconverts servlet full DNS name into table in Database\r\n\treturns null if not set.\r\ndoPost() now doPut()\r\n\tAdds failNote as a return from validateRequest()\r\n\tCalls validateSubclass()\r\n\tCalls and evaluates validateRequest()\r\n\tRuns ProcessHeader() while iteration headers\r\n\tBuilds SQLQuery (Should be update)\r\n\tCalls doSQL() and evaluates\r\n\tre-Enables SqlResult display in output\r\n\tErrorIn -&gt; ErrorLoc\r\n\tShows failNote<\/pre>\n<p>On top of this, since you can&#8217;t test a PUT command in a browser; I&#8217;ve had to write a mini Putter app on my Mac. Let me assure you, hopping back and forth between Cocoa for OS X in Xcode and Java for Servlets in Eclipse can be a bit of a mind scramble.<\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-4153\" class=\"share-facebook sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Facebook (Opens in new window)<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-4153\" class=\"share-twitter sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Twitter (Opens in new window)<\/span><\/a><\/li><li class=\"share-pinterest\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-pinterest-4153\" class=\"share-pinterest sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=pinterest\" target=\"_blank\" title=\"Click to share on Pinterest\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Pinterest (Opens in new window)<\/span><\/a><\/li><li class=\"share-tumblr\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-tumblr sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=tumblr\" target=\"_blank\" title=\"Click to share on Tumblr\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Tumblr (Opens in new window)<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been fairly quiet on the blog the past two weeks. This has been because I have been head down in code catching up from the holidays and being sick. I know all to well how abstract and vague I&#8217;ve been on what The Project is. I&#8217;m still shooting for a grand unveiling upon the [&hellip;]<\/p>\n<div class=\"sharedaddy sd-sharing-enabled\"><div class=\"robots-nocontent sd-block sd-social sd-social-icon sd-sharing\"><h3 class=\"sd-title\">Share this:<\/h3><div class=\"sd-content\"><ul><li class=\"share-facebook\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-facebook-4153\" class=\"share-facebook sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=facebook\" target=\"_blank\" title=\"Click to share on Facebook\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Facebook (Opens in new window)<\/span><\/a><\/li><li class=\"share-twitter\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-twitter-4153\" class=\"share-twitter sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=twitter\" target=\"_blank\" title=\"Click to share on Twitter\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Twitter (Opens in new window)<\/span><\/a><\/li><li class=\"share-pinterest\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"sharing-pinterest-4153\" class=\"share-pinterest sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=pinterest\" target=\"_blank\" title=\"Click to share on Pinterest\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Pinterest (Opens in new window)<\/span><\/a><\/li><li class=\"share-tumblr\"><a rel=\"nofollow noopener noreferrer\" data-shared=\"\" class=\"share-tumblr sd-button share-icon no-text\" href=\"http:\/\/www.lordandrei.com\/blog\/2014\/01\/23\/the-project-a-peek-under-the-hood\/?share=tumblr\" target=\"_blank\" title=\"Click to share on Tumblr\" ><span><\/span><span class=\"sharing-screen-reader-text\">Click to share on Tumblr (Opens in new window)<\/span><\/a><\/li><li class=\"share-end\"><\/li><\/ul><\/div><\/div><\/div>","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_exactmetrics_skip_tracking":false,"_exactmetrics_sitenote_active":false,"_exactmetrics_sitenote_note":"","_exactmetrics_sitenote_category":0,"jetpack_publicize_message":"The Project: A Peek Under the Hood http:\/\/wp.me\/p1X6ba-14Z #java #coding","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true},"categories":[1373,9],"tags":[711,1406,190,1242,1379],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1X6ba-14Z","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/posts\/4153"}],"collection":[{"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/comments?post=4153"}],"version-history":[{"count":3,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/posts\/4153\/revisions"}],"predecessor-version":[{"id":4157,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/posts\/4153\/revisions\/4157"}],"wp:attachment":[{"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/media?parent=4153"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/categories?post=4153"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.lordandrei.com\/blog\/wp-json\/wp\/v2\/tags?post=4153"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}