1 |
2737
|
jones
|
/**
|
2 |
|
|
* '$RCSfile$'
|
3 |
|
|
* Copyright: 2000-2005 Regents of the University of California and the
|
4 |
|
|
* National Center for Ecological Analysis and Synthesis
|
5 |
|
|
*
|
6 |
|
|
* '$Author$'
|
7 |
|
|
* '$Date$'
|
8 |
|
|
* '$Revision$'
|
9 |
|
|
*
|
10 |
|
|
* This program is free software; you can redistribute it and/or modify
|
11 |
|
|
* it under the terms of the GNU General Public License as published by
|
12 |
|
|
* the Free Software Foundation; either version 2 of the License, or
|
13 |
|
|
* (at your option) any later version.
|
14 |
|
|
*
|
15 |
|
|
* This program is distributed in the hope that it will be useful,
|
16 |
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
17 |
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
18 |
|
|
* GNU General Public License for more details.
|
19 |
|
|
*
|
20 |
|
|
* You should have received a copy of the GNU General Public License
|
21 |
|
|
* along with this program; if not, write to the Free Software
|
22 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
23 |
|
|
*/
|
24 |
|
|
|
25 |
|
|
package edu.ucsb.nceas.metacat.lsid;
|
26 |
|
|
|
27 |
|
|
import java.io.InputStream;
|
28 |
|
|
|
29 |
2818
|
jones
|
import org.apache.commons.logging.Log;
|
30 |
|
|
import org.apache.commons.logging.LogFactory;
|
31 |
|
|
|
32 |
2737
|
jones
|
import com.ibm.lsid.server.LSIDDataService;
|
33 |
2818
|
jones
|
import com.ibm.lsid.server.LSIDRequestContext;
|
34 |
2737
|
jones
|
import com.ibm.lsid.server.LSIDServerException;
|
35 |
|
|
import com.ibm.lsid.server.LSIDServiceConfig;
|
36 |
|
|
|
37 |
2819
|
jones
|
public class LSIDAuthorityData implements LSIDDataService
|
38 |
|
|
{
|
39 |
|
|
private LSIDDataLookup lookup = null;
|
40 |
|
|
private static Log logger = LogFactory
|
41 |
|
|
.getLog("edu.ucsb.nceas.metacat.lsid");
|
42 |
2737
|
jones
|
|
43 |
2819
|
jones
|
public InputStream getData(LSIDRequestContext lsid)
|
44 |
|
|
throws LSIDServerException
|
45 |
|
|
{
|
46 |
2818
|
jones
|
logger.debug("Getting data (Metacat): " + lsid.getLsid().toString());
|
47 |
2819
|
jones
|
if (lookup == null)
|
48 |
|
|
throw new LSIDServerException(500, "Cannot query database");
|
49 |
|
|
return lookup.lsidData(lsid.getLsid());
|
50 |
|
|
}
|
51 |
2737
|
jones
|
|
52 |
2819
|
jones
|
public InputStream getDataByRange(LSIDRequestContext lsid, int start,
|
53 |
|
|
int end) throws LSIDServerException
|
54 |
|
|
{
|
55 |
|
|
if (lookup == null)
|
56 |
|
|
throw new LSIDServerException(500, "Cannot query database");
|
57 |
|
|
return lookup.lsidData(lsid.getLsid());
|
58 |
|
|
}
|
59 |
2737
|
jones
|
|
60 |
2819
|
jones
|
public void initService(LSIDServiceConfig cf) throws LSIDServerException
|
61 |
|
|
{
|
62 |
2818
|
jones
|
logger.info("Starting LSIDAuthorityData (Metacat).");
|
63 |
2819
|
jones
|
lookup = new LSIDDataLookup();
|
64 |
|
|
}
|
65 |
2737
|
jones
|
}
|