Project

General

Profile

1
Metacat Turnkey Installation
2
Token Replacement
3
Michael Daigle
4
April 2, 2008
5

    
6
The basic approach for token replacement has been to use metacat.properties as the central point of configuration for the entire Metacat product.  This is possible for all but a few skin specific values that will live in <skin>.properties files.  At this point, I've just been working on using various approaches to replacing ANT tokens from all files.  
7

    
8
Note that the metacat.properties file still uses ANT tokens.  Once all the tokens have been replaced everywhere but metacat.properties and the product is tested and stable, the next step will be to explore possibilities for configuring metacat.properties and <skin>.properties files.  This will be done in conjunction with phase I of the Metacat Turnkey Installation project, which is the creation of a WAR file installation of the product.
9

    
10
SKINS
11

    
12
I've made all the token replacements to the skins directories with the exception of Perl changes and the first* skins which Ben is working on.  Shaun is working on Perl now and will hand that off me when it reaches a logical stopping point.  I will coordinate with Ben on the first* skins to bring them up to speed.
13
The following categories of changes were made to skins:
14

    
15
   * style/common/common-settings.jsp - global configuration values are 
16
     retrieved here using java MetaCatUtil class.
17
   * jsp files - all other jsp files include common-settings.jsp for
18
     configuration values.  In the process, the *_SEARCH_METACAT_POST_FIELDS
19
     variable definitions were removed from individual skins.  If needed, an
20
     additional post field might be appended to the fields defined in 
21
     common-settings.jsp.  An example is: skins/default/settings.jsp.  
22
     Also, all calls to insert*() java scripts now pass the
23
     CONTEXT_URL as a parameter (see .js section).
24
   * <skin>.xml - these are used by DBTransform.java to do drive xslt tranforms.
25
     The tokens were removed in the publicid targets that give a full url to the
26
     skins directory.  DBTransform.java knows (thanks to Ben) to prepend the
27
     server name to those values if it does not already exist.
28
   * *.xsl - all configuration values were made available during in 
29
     DBTransform.java using MetaCatUtil.  Tokens were replaced with {$variable} 
30
     syntax. Also, all calls to insert*() java scripts now pass the $contextURL
31
     as a parameter (see .js section).
32
   * *.html - all html files in the skins directories were replaced with jsp 
33
     files.  All references to those html files were changed to jsp.
34
   * .js files - tokens that referenced the fully qualified skins url were
35
     replaced with style/skins.  The js functions in style/common/branding.js 
36
     had already been updated to accept a serverContextUrl parameter, which
37
     would be appended to the skins path if provided.  (see the jsp and xsl
38
     sections for changes to the js calls).   
39
   * .css - fully qualified references to images were changed to be relative paths.
40

    
41
I spent quite a bit of time testing my changes to skins, including setting each skin to the default style, viewing the skin by specifying it in the url, searching for documents, and viewing documents by various methods.  I think if we put it on the dev server and a few people had a chance to stress it, any existing issues could be fixed fairly quickly.
42

    
43
JAVA FILES
44
I changed a few java files.  Some of these changes were just addressing issues I found while testing.
45

    
46
   * src/.../DBTransform.java - I made the httpServer and servletURL values
47
     available during tranform.  I followed the pattern that was already in place
48
     for the contextURL value.
49
   * src/.../DBQuery.java - I put a try/catch around the section that tries to get
50
     the qformat value from params hashTable.  Currently, if qformat does not 
51
     exist, an exception gets thrown and shown on the browser.  I catch the
52
     exception, log an error, and allow the process to continue.  The system
53
     recognizes that qformat is not set and sends a more human readable error to
54
     the browser.
55
   * src/.../MetaCatUtil.java - I added a check to see if getOption() returns a
56
     value.  If not, a warning is written to the log.
57
   * src/.../upgrade_db_to_1_5.java - replaced ANT tokens with values retrieved
58
     from MetaCatUtil.
59
   * test/.../*Test.java - replaced ANT tokens with values retrieved from
60
     MetaCatUtil.
61

    
62
All of the changes above, with the exception of upgrade_db_to_1_5.java and *Test.java were either done directly to support token replacement in skins, or were to address issues found during testing.  As such, those were tested. 
63

    
64
DOC HTML FILES
65

    
66
In all the html files under the metacat/docs directory that referenced @docrooturl@, I replaced the token with ?./?.  This has been tested.
(25-25/30)