Project

General

Profile

« Previous | Next » 

Revision 7558

draft for sharing the metacat.properties with the metacat-index webapp. https://projects.ecoinformatics.org/ecoinfo/issues/5909

View differences:

metacat-index/src/main/java/edu/ucsb/nceas/metacat/index/MetacatIndexServlet.java
38 38
import javax.servlet.http.HttpServletRequest;
39 39
import javax.servlet.http.HttpServletResponse;
40 40

  
41
import org.dataone.cn.indexer.parser.IDocumentSubprocessor;
42
import org.dataone.cn.indexer.parser.ScienceMetadataDocumentSubprocessor;
41
import org.apache.commons.configuration.ConfigurationException;
42
import org.apache.commons.logging.Log;
43
import org.apache.commons.logging.LogFactory;
44
import org.dataone.configuration.Settings;
43 45

  
44 46

  
45

  
46

  
47

  
48 47
/**
49 48
 * A servlet class for the Metadata Index module. This class only does one thing - initialize the ApplicationController class.
50 49
 * @author tao
......
55 54
    //Use the file prefix to indicate this is a absolute path.
56 55
    // seet http://www.docjar.com/docs/api/org/springframework/context/support/FileSystemXmlApplicationContext.html
57 56
    private static final String FILEPREFIX = "file:";
57
    
58
	private static Log log = LogFactory.getLog(MetacatIndexServlet.class);
59

  
58 60
    /**
59 61
     * Initialize the servlet 
60 62
     */
61 63
    public void init(ServletConfig config) throws ServletException {
62 64
        //System.out.println("++++++++++++++++++++++++------------------- start the servlet");
65
    	
66
    	// load the metacat.prioerties into D1 Settings utility
67
    	// this gives us access to all metacat properties as well as 
68
    	// overriding the d1 properties as needed
69
		try {
70
			// find the sibling metacat.properties file
71
			String metacatPropertiesFilePath = config.getInitParameter("metacat.properties.path");
72
			String fullMetacatPropertiesFilePath = config.getServletContext().getRealPath(metacatPropertiesFilePath);
73
			Settings.augmentConfiguration(fullMetacatPropertiesFilePath);
74
		} catch (ConfigurationException e) {
75
			log.error("Could not initialize shared Metacat properties. " + e.getMessage(), e);
76
		}
77
		
63 78
        URL url = getClass().getResource("/index-processor-context.xml");
64 79
        //System.out.println("the url is "+url);
65 80
        //System.out.println("the path is "+url.getPath());
metacat-index/src/main/webapp/WEB-INF/web.xml
14 14
    </context-param>
15 15
    
16 16
    <context-param>
17
      <param-name>configFileName</param-name>
18
      <param-value>metacat.properties</param-value>
19
      <description>The main configuration file for application</description>
17
      <param-name>metacat.properties.path</param-name>
18
      <param-value>/knb/WEB-INF/metacat.properties</param-value>
19
      <description>The metacat.properties file for sibling metacat deployment. Note that the context can change</description>
20 20
    </context-param>
21 21

  
22 22
  

Also available in: Unified diff