Project

General

Profile

« Previous | Next » 

Revision 2893

Added by sgarg over 18 years ago

Making changes for passing the params to the xsl for skins.

View differences:

src/edu/ucsb/nceas/metacat/MetaCatUtil.java
30 30
import java.io.File;
31 31
import java.net.MalformedURLException;
32 32
import java.net.URL;
33
import java.util.HashMap;
33 34
import java.util.Hashtable;
34 35
import java.util.Stack;
35 36
import java.util.Vector;
......
49 50
    public static AbstractDatabase dbAdapter;
50 51

  
51 52
    public static Vector pathsForIndexing;
53
    
54
    public static HashMap skinconfigs = new HashMap();
52 55

  
53 56
    private static Options options = null;
54 57

  
src/edu/ucsb/nceas/metacat/MetaCatServlet.java
42 42
import java.text.ParseException;
43 43
import java.text.SimpleDateFormat;
44 44
import java.util.Enumeration;
45
import java.util.HashMap;
45 46
import java.util.Hashtable;
46 47
import java.util.Iterator;
47 48
import java.util.Timer;
......
160 161
            }
161 162

  
162 163
            MetaCatUtil util = new MetaCatUtil();
163

  
164
            
164 165
            //initialize DBConnection pool
165 166
            DBConnectionPool connPool = DBConnectionPool.getInstance();
166 167
            
......
178 179
            	timer.schedule(new IndexingTimerTask(), 0, indexingTimerTaskTime);
179 180
            }
180 181
            
182
            // read the config files: 
183
            Vector skins = MetaCatUtil.getOptionList(MetaCatUtil.getOption("skinconfigfiles"));
184
            String skinName, skinDirPath = null;
185
            File skinPropertyFile = null;
186
           
187
            for (int i = 0; i < skins.size(); i++) {
188
            	skinName = (String) skins.elementAt(i);
189
                skinDirPath = context.getRealPath(CONFIG_DIR + "/skin.configs/" + skinName);
190
                skinPropertyFile = new File(skinDirPath, skinName + ".config"); 
191
                Options skinOption = null;
192
                try	{
193
                	skinOption = Options.initialize(skinPropertyFile);
194
                } catch (IOException ioe) {
195
                    Logger logMetacat = Logger.getLogger(MetaCatServlet.class);
196
                    logMetacat.error("Error in loading options for skin " + "skinName" +" : "
197
                            + ioe.getMessage());
198
                }
199
                
200
                MetaCatUtil.skinconfigs.put(skinName, skinOption);
201
            }
202
            
181 203
            MetaCatUtil.printMessage("Metacat (" + Version.getVersion()
182 204
                               + ") initialized.");
183 205

  
src/edu/ucsb/nceas/metacat/DBTransform.java
71 71
import org.w3c.dom.Element;
72 72
import org.xml.sax.SAXException;
73 73

  
74
import edu.ucsb.nceas.utilities.Options;
75

  
74 76
/**
75 77
 * A Class that transforms XML documents utitlizing XSL style sheets
76 78
 */
......
265 267
                                  new StreamSource(xslSystemId));
266 268
        transformer.setParameter("qformat", qformat);
267 269
        logMetacat.warn("qformat: "+qformat);
268

  
270
        
271
        if (MetaCatUtil.skinconfigs.containsKey(qformat)){
272
        	Options skinOptions = (Options)MetaCatUtil.skinconfigs.get(qformat);
273
        	transformer.setParameter("lsidauthority", skinOptions.getOption("lsidauthority"));
274
           	transformer.setParameter("registryurl", skinOptions.getOption("registryurl"));
275
           	transformer.setParameter("registryname", skinOptions.getOption("registryname"));
276
        }
277
        
269 278
        if(sessionid != null)
270 279
        {
271 280
          transformer.setParameter("sessid", sessionid);

Also available in: Unified diff