350 likes | 379 Views
Explore the history, goals, and implementation of WDK Model, incorporating MVC design for web development. Learn about the WDK query model, records, tables, and XML configuration. Discover upcoming features and implementation details.
E N D
The GUS Web Development Kit (WDK) Starting with the WDK Model
Overview • WDK Goals • What is the “model” • User’s perspective • Implementation
Overall WDK Goals • Ease the development of Query and Record based web sites • (What about data input sites like StudyAnnotator?) • Site authors use declarative specifications • Substantial reuse across projects • Model • View • Use industry standard technologies
History • A re-design of the WDK-Classic (Crabtree) • Used for PlasmoDB, EPConDB, AllGenes • Incorporating ideas of CBIL’s CSP (Schug, Fischer, Crabtree) • “CBIL Style Police” • An abstraction of Parameter acquisition dialogues • Incorporating ideas from PageMaker (Schug)
Model-View-Controller (MVC) Design • The Model describes the data • The View displays it • The controller • Directs program flow based on the user’s action • Updates the model accordingly • The View knows about the Model • But, not vice versa
Why is MVC important? • By defining the Model separately we: • Understand it better • Don’t pollute it with View implementations • Don’t commit to any particular view • By defining the View separately we: • Can write multiple views • Have multiple views operate in one application • Don’t pollute the view with Model logic
The WDK Model – what’s in it?(so far) • Queries • Parameters • Results • Tables • Records • Primary Key • Fields • Tables
The Flow of a Query TABLE w/ MAIN RESULT 12344 23324 4344 343344 373422 4444 44444 35555 09734 23477 424 342477 9823 2783247 Dialogue GeneName: Species: GoFunction: Page of Details 4344 Blah blah blah 343344 blah blah blah 373422 blah blah blah Main Query Page Query params rows Record DT.373422 Mouse Brca1
Pageable Query(Encapsulates two queries) TABLE w/ MAIN RESULT 12344 23324 4344 343344 373422 4444 44444 35555 09734 23477 424 342477 9823 2783247 Dialogue GeneName: Species: GoFunction: Page of Details 4344 Blah blah blah 343344 blah blah blah 373422 blah blah blah Main Query Page Query Record DT.373422 Mouse Brca1 params rows
See sample file… classic.config How was this specified in WDK-Classic?
The New WDK Uses JSP for the View • JSP looks like HTML but, embeds calls to JavaBean objects. • The reverse of how we used to make dynamic web pages: • Instead of the Java/Perl formatting the HTML, the HTML calls the Java • See file… simpleQueryDemo1.jsp
A WDK Query Model in XML • <wdkModel> • <simpleQuerySet> • <simpleQuery> • <param> • <pageableQuerySet> • <pageableQuery mainQuery=q1 pageQuery=q2>
Take a look at the real XML • See file… sampleQuerySet.xml
Test the Model - without the view! • Three commands to test a model that you are creating • wdkXml – parses and checks the XML • wdkQuery – runs a Query • wdkRecord – retrieves a Record
wdkXml • Parses and checks the Model XML file • Prints out the model • See file… wdkXml_output.txt
wdkQuery • Tests a query found in a ModelXML file • Can run a SimpleQuery or a PageableQuery • See file… wdkQuery_output.txt
Records - What are They? • They tell about an entity • Parameterized by a primary key (eg DT.xxxx) • Have: • Fields • A column from a Query • A block of text • Tables • A result from a query
AllGenes Record Again Tables Fields
A WDK Record Model in XML • <wdkModel> • <simpleQuerySet> • <simpleQuery> • <param> • <wdkModel> • <simpleQuerySet> • <simpleQuery> • <param> • <column> • <recordSet> • <record> • <tableQuery reference> • <fieldQuery reference> • <textField>
Take a Look at the Real XML • See file… sampleRecordSet.xml
wdkRecord • Tests a Record found in an XML file • See file… wdkRecord_output.txt
ConfigFile (XML) • A little XML file configures the model • Specifies site-specific stuff • (the Model XML is not site specific) • See file… sampleModelConfig.xml
Upcoming (major) Features • DTD/XMLSchema for Model XML? • Import model files into each othe • ParamSets • Boolean Queries • Query History • Flat file queries • Process queries • Allow multiple PageQueries in PageableQueries • Define special data types to handle eg URLs • Nested results (eg Gene-Centrism) • Lots of param types (hierarchy, …)
Implementation • Uses Java Interfaces to abstract away SQL details • Clear definition of what is public (ie, visible to view)
Third Party Resources • From Jakarta: • Command Line Interpreter • XML Digester • Connection Pool • Logging
Digester • A very convenient way to transform XML into JavaBeans Objects • See file… ModelXmlParser.java
Command Line Interpreter (CLI) • A Java equivalent to Getopt in Perl • Parses command line args • Produces nice Usage • See file… wdkQuery_usage.txt
Quick Look at Accessing the Model • public ResultSet getResult(String querySetName, String queryName, • Hashtable paramHash, • boolean useCache) throws Exception, QueryParamsException { • SimpleQuerySet simpleQuerySet • = wdkModel.getSimpleQuerySet(querySetName); • SimpleQueryI query = simpleQuerySet.getQuery(queryName); • SimpleQueryInstanceI instance = query.makeInstance(); • instance.setIsCacheable(useCache); • instance.setValues(paramHash); • return instance.getResult(); • }
The QueryInstance Table • Previously known as “the cache” • Captures details of a QueryInstance: • Query name • Parameter values • Link to table holding result • Used for caching and/or pageable queries • wdkCache • Program to create, reset and drop a cache
JavaDoc Take a tour of the Java API See files… wdkjdoc/index.html