codingI’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’ve been on what The Project is. I’m still shooting for a grand unveiling upon the ides of March. (March 15 for those who read not the Shakespeare)

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’s not my intent. I know what I’m showing is intentionally obfuscated to hide The Project’s intent.

However, I want to show a checkin from one of the classes that I did today to talk about what’s going on.

I’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.

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)

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.

Below is my checkin comments from today’s abstract Class work. (Note there are redactions)

(Ah, the fun of Java)

imports java.util.List
adds ivars
	MUST BE OVERRIDDEN List requiredHeaders
	MUST BE OVERRIDDEN List usableHeaders
	String sqlQueryHeaders (for building sql update)
	String sqlQueryValues (for building sql update)
doSQLQuery() now doSQL()
	setRC not setRS with executeUpdate instead of executeQuery
goGet()
	Sends a formatted json error response (put, not get)
validateSubClass() (new)
	Checks to see that there is at least 1 usableHeaders
	Checks to see that there are no more required headers than usable headers
	Checks that all required Headers are in usable Headers
	Checks that there is a table conversion equiv in getDbaseTable() {below}
	Throws Exception (Programming error) if any of these cases fail.
validateRequest() (new)
	Verifies that required headers are in the request http Header
	Returns first missing required header if failure
processHeaderPair() (new)
	examines each HTTP header pair
	searches for headers that are: Package.Command.usableHeader
	converts them into caseCorrected usableHeader and Value
	Appends them into Strings for use in SQL Update request
getDbaseTable() (new)
	converts servlet full DNS name into table in Database
	returns null if not set.
doPost() now doPut()
	Adds failNote as a return from validateRequest()
	Calls validateSubclass()
	Calls and evaluates validateRequest()
	Runs ProcessHeader() while iteration headers
	Builds SQLQuery (Should be update)
	Calls doSQL() and evaluates
	re-Enables SqlResult display in output
	ErrorIn -> ErrorLoc
	Shows failNote

On top of this, since you can’t test a PUT command in a browser; I’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.