Project

General

Profile

« Previous | Next » 

Revision 2818

Added by Matt Jones over 18 years ago

Added apache commons logging to the LSID servlet using log4j. Remove println statements.

View differences:

LSIDDataLookup.java
24 24

  
25 25
package edu.ucsb.nceas.metacat.lsid;
26 26

  
27
import java.io.*;
28
import java.net.*;
29

  
30
//import java.sql.Connection;
27
import java.io.IOException;
28
import java.io.InputStream;
29
import java.net.MalformedURLException;
30
import java.net.URL;
31 31
import java.util.ResourceBundle;
32 32

  
33
import org.apache.commons.logging.Log;
34
import org.apache.commons.logging.LogFactory;
35

  
33 36
import com.ibm.lsid.LSID;
34 37
import com.ibm.lsid.server.LSIDServerException;
35 38

  
......
40 43
	public static final int UNKNOWN = 1;
41 44
	public static final int ABSTRACT = 2;
42 45
	public static final int CONCRETE = 4;
46
    
47
    private static Log logger = LogFactory.getLog( "edu.ucsb.nceas.metacat.lsid" );
43 48

  
44

  
45 49
	public LSIDDataLookup() throws LSIDServerException {
46
        System.out.println("Creating LSIDDataLookup (Metacat).");
50
        logger.info("Creating LSIDDataLookup (Metacat).");
47 51
  	}
48 52

  
49 53

  
......
64 68
		// http://metacat.nceas.ucsb.edu/knb/metacat?action=read&qformat=xml&docid=knb-lter-gce.109.6
65 69
		//
66 70
		
67
    ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid");
68
    String theServer = rb.getString("metacatserver");
69
		System.out.println("the server is " + theServer);
71
		ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid");
72
		String theServer = rb.getString("metacatserver");
73
		logger.debug("the server is " + theServer);
70 74

  
71 75
		String url = theServer + "?action=read&qformat=xml&docid=";
72 76
		url = url + ns + "." + id + "." + ver;
......
74 78
			URL theDoc = new URL(url);
75 79
			docStream  = theDoc.openStream();
76 80
		} catch (MalformedURLException mue) {
77
         		System.out.println("MalformedURLException in LSIDDataLookup: " + mue);
81
         		logger.error("MalformedURLException in LSIDDataLookup: " + mue);
78 82
         		mue.printStackTrace();
79 83
   		} catch (IOException ioe) {
80
         		System.out.println("IOException in LSIDDataLookup: " + ioe);
84
         		logger.error("IOException in LSIDDataLookup: " + ioe);
81 85
         		ioe.printStackTrace();
82 86
		}
83 87

  

Also available in: Unified diff