Project

General

Profile

« Previous | Next » 

Revision 2737

Added by Matt Jones over 18 years ago

Initial checkin of LSID support code for metacat. The LSID support here
provides access to metacat documents through an LSID identifier. The
identifier takes the form:
urn:lsid:ecoinformatics.org:jones:1:1

See http://lsid.sourceforge.net for more details.

LSID build support has been added to build.properties and build.xml but
still needs work on integrating it with the main metacat build. Build
and deploy the "authority" servlet by setting properties in
build.properties and then running "ant deploy-lsid".

Still to do: finish integrating with build, add ability to insert,
update, and delete documents using LSID id, allow read using LSID ID,
convert xslts to optionally display and link the LSID ID, and add
support for hosting multiple LSID authorities (Foreign Authority
Notification is the likely approach).

View differences:

lib/lsid_conf/metacat-lsid.properties
1
metacatserver=@METACAT_SERVER@
2
metadatalabels=@METADATA_LABELS@
0 3

  
lib/lsid_conf/mdasdl.xml
1
<lsid-authority name="SEEK_RDF" xmlns="http://www.ibm.com/LSID/Standard/ASDL">
2
	<services>
3
		<service name="SEEK_RDF_HTTP">
4
			<protocol>http</protocol>
5
			<hostname>@LSID_AUTHORITY_HOSTNAME@</hostname>
6
			<path>/authority/metadata</path>
7
			<port>@LSID_AUTHORITY_PORT@</port>
8
		</service>
9
		<service name="SEEK_RDF_SOAP">
10
			<soap-endpoint>http://@LSID_AUTHORITY_HOSTNAME@:@LSID_AUTHORITY_PORT@/authority/metadata</soap-endpoint>
11
		</service>
12
	</services>
13
	<lsids>
14
		<lsid urn="urn:lsid:@METADATA_LABELS@:predicates:*">
15
			<meta-data-services>
16
				<service-ptr name="SEEK_RDF_SOAP" />
17
				<service-ptr name="SEEK_RDF_HTTP" />
18
			</meta-data-services>
19
		</lsid>	
20
		<lsid urn="urn:lsid:@METADATA_LABELS@:types:*">
21
			<meta-data-services>
22
				<service-ptr name="SEEK_RDF_SOAP" />
23
				<service-ptr name="SEEK_RDF_HTTP" />
24
			</meta-data-services>
25
		</lsid>	
26
	</lsids>
27
</lsid-authority>
0 28

  
lib/lsid_conf/services/default-services.xml
1
<deployment-descriptor xmlns="http://www.ibm.com/LSID/Standard/rsdl">
2
	<component-handlers>
3
		<!-- These handlers (along with "class" and "caching") are added by default, we include these as examples -->
4
		<component-handler type="asdl" classname="com.ibm.lsid.server.conf.ASDLComponentHandler" />
5
		<component-handler type="msdl" classname="com.ibm.lsid.server.conf.MSDLComponentHandler" />
6
	</component-handlers>
7
	<maps>
8
		<map name="all">
9
			<pattern auth="*" ns="*" />
10
		</map>
11
	</maps>
12
	<services>
13
		<service name="ReallySimpleAssigningService" >
14
			<components>
15
				<assn type="class">com.ibm.lsid.server.impl.ReallySimpleAssigningService</assn>
16
			</components>
17
		</service>
18
		<service name="CachingProxyResolutionService" >
19
			<components>
20
				<auth map="all" type="class">com.ibm.lsid.server.impl.CachingProxyAuthority</auth>
21
				<meta map="all" type="class">com.ibm.lsid.server.impl.CachingProxyAuthority</meta> 	
22
				<data map="all" type="class">com.ibm.lsid.server.impl.CachingProxyAuthority</data>
23
			</components>
24
		</service>	
25
	</services>
26
</deployment-descriptor>
0 27

  
lib/lsid_conf/services/metacat-services.xml
1
 <deployment-descriptor xmlns="http://www.ibm.com/LSID/Standard/rsdl">
2
                        <maps>
3
                                <map name="metacat-main">
4
                                        <pattern auth="@LSID_AUTHORITY_STRING@" ns="*" />
5
                                </map>
6
				<map name="metacat-rdf">
7
					<pattern auth="@LSID_AUTHORITY_STRING@" ns="predicates" />
8
					<pattern auth="@LSID_AUTHORITY_STRING@" ns="types" />
9
				</map>
10
                        </maps>
11
                        <services>
12
                                <service name="METACAT">
13
                                        <components>
14
						<auth map="metacat-rdf" type="asdl" location="java-resource">/edu/ucsb/nceas/metacat/lsid/mdasdl.xml</auth>
15
						<meta map="metacat-rdf" type="msdl" location="java-resource">/edu/ucsb/nceas/metacat/lsid/preds.xml</meta>
16
                                                <auth map="metacat-main" type="class">edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMain</auth>
17
                                                <meta map="metacat-main" type="class">edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData</meta>
18
                                                <data map="metacat-main" type="class">edu.ucsb.nceas.metacat.lsid.LSIDAuthorityData</data>
19
                                        </components>
20
                                </service>
21
                        </services>
22
                </deployment-descriptor>
23

  
0 24

  
lib/lsid_conf/WEB-INF/server-config.wsdd
1
<?xml version="1.0" encoding="UTF-8"?>
2
<deployment xmlns="http://xml.apache.org/axis/wsdd/" xmlns:java="http://xml.apache.org/axis/wsdd/providers/java">
3
 <globalConfiguration>
4
  <parameter name="adminPassword" value="admin"/>
5
  <parameter name="attachments.implementation" value="org.apache.axis.attachments.AttachmentsImpl"/>
6
  <parameter name="sendXsiTypes" value="true"/>
7
  <parameter name="sendMultiRefs" value="true"/>
8
  <parameter name="sendXMLDeclaration" value="true"/>
9
  <parameter name="axis.sendMinimizedElements" value="true"/>
10
  <requestFlow>
11
   <handler type="java:com.ibm.lsid.server.soap.LSIDURLMapper"/>
12
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
13
  </requestFlow>
14
 </globalConfiguration>
15
 <handler name="LSIDURLMapper" type="java:com.ibm.lsid.server.soap.LSIDURLMapper"/>
16
 <service name="AdminService" provider="java:MSG">
17
  <parameter name="allowedMethods" value="AdminService"/>
18
  <parameter name="enableRemoteAdmin" value="false"/>
19
  <parameter name="className" value="org.apache.axis.utils.Admin"/>
20
  <namespace>http://xml.apache.org/axis/wsdd/</namespace>
21
 </service>
22
 <service name="AuthorityWebService" provider="java:MSG" style="rpc" use="literal">
23
  <parameter name="allowedMethods" value="getAvailableServices,notifyForeignAuthority,revokeNotificationForeignAuthority"/>
24
  <parameter name="className" value="com.ibm.lsid.server.soap.AuthorityWebService"/>
25
 </service>
26
 <service name="MetadataWebService" provider="java:MSG" style="rpc" use="literal">
27
  <parameter name="allowedMethods" value="getMetadata"/>
28
  <parameter name="className" value="com.ibm.lsid.server.soap.MetadataWebService"/>
29
 </service>
30
 <service name="DataWebService" provider="java:MSG" style="rpc" use="literal">
31
  <parameter name="allowedMethods" value="getData,getDataByRange"/>
32
  <parameter name="className" value="com.ibm.lsid.server.soap.DataWebService"/>
33
 </service>
34
 <service name="AssigningWebService" provider="java:MSG" style="rpc" use="literal">
35
  <parameter name="allowedMethods" value="assignLSID,assignLSIDFromList,getLSIDPattern,getLSIDPatternFromList,assignLSIDForNewRevision,getAllowedPropertyNames,getAuthoritiesAndNamespaces"/>
36
  <parameter name="className" value="com.ibm.lsid.server.soap.AssigningWebService"/>
37
 </service>
38
 <service name="Version" provider="java:RPC">
39
  <parameter name="allowedMethods" value="getVersion"/>
40
  <parameter name="className" value="org.apache.axis.Version"/>
41
 </service>
42
 <transport name="http">
43
  <requestFlow>
44
   <handler type="java:org.apache.axis.handlers.http.HTTPAuthHandler"/>
45
  </requestFlow>
46
 </transport>
47
 <transport name="local">
48
  <responseFlow>
49
   <handler type="LocalResponder"/>
50
  </responseFlow>
51
 </transport>
52
</deployment>
0 53

  
lib/lsid_conf/WEB-INF/web.xml
1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">
3
<web-app id="WebApp">
4
	<display-name>LSID Server Web</display-name>
5
	<servlet>
6
		<servlet-name>AuthorityServlet</servlet-name>
7
		<display-name>AuthorityServlet</display-name>
8
		<servlet-class>com.ibm.lsid.server.servlet.AuthorityServlet</servlet-class>
9
		<init-param>
10
			<param-name>LSID_CLIENT_HOME</param-name>
11
			<param-value>/lsid/java/server</param-value>
12
		</init-param>
13
		<load-on-startup>-1</load-on-startup>
14
	</servlet>
15
	<servlet>
16
		<servlet-name>MetadataServlet</servlet-name>
17
		<display-name>MetadataServlet</display-name>
18
		<servlet-class>com.ibm.lsid.server.servlet.MetadataServlet</servlet-class>
19
		<init-param>
20
			<param-name>LSID_CLIENT_HOME</param-name>
21
			<param-value>/lsid/java/server</param-value>
22
		</init-param>
23
		<load-on-startup>-1</load-on-startup>
24
	</servlet>
25
	<servlet>
26
		<servlet-name>DataServlet</servlet-name>
27
		<display-name>DataServlet</display-name>
28
		<servlet-class>com.ibm.lsid.server.servlet.DataServlet</servlet-class>
29
		<init-param>
30
			<param-name>LSID_CLIENT_HOME</param-name>
31
			<param-value>/lsid/java/server</param-value>
32
		</init-param>
33
		<load-on-startup>-1</load-on-startup>
34
	</servlet>
35
	<servlet>
36
		<servlet-name>AssigningServlet</servlet-name>
37
		<display-name>AssigningServlet</display-name>
38
		<servlet-class>com.ibm.lsid.server.servlet.AssigningServlet</servlet-class>
39
		<init-param>
40
			<param-name>LSID_CLIENT_HOME</param-name>
41
			<param-value>/lsid/java/server</param-value>
42
		</init-param>
43
		<load-on-startup>-1</load-on-startup>
44
	</servlet>
45
	<servlet-mapping>
46
		<servlet-name>AuthorityServlet</servlet-name>
47
		<url-pattern>/</url-pattern>
48
	</servlet-mapping>
49
	<servlet-mapping>
50
		<servlet-name>MetadataServlet</servlet-name>
51
		<url-pattern>/metadata</url-pattern>
52
	</servlet-mapping>
53
	<servlet-mapping>
54
		<servlet-name>DataServlet</servlet-name>
55
		<url-pattern>/data</url-pattern>
56
	</servlet-mapping>
57
	<servlet-mapping>
58
		<servlet-name>AssigningServlet</servlet-name>
59
		<url-pattern>/assigning</url-pattern>
60
	</servlet-mapping>
61
	<servlet-mapping>
62
		<servlet-name>MetadataServlet</servlet-name>
63
		<url-pattern>/metadata/*</url-pattern>
64
	</servlet-mapping>
65
	<servlet-mapping>
66
		<servlet-name>DataServlet</servlet-name>
67
		<url-pattern>/data/*</url-pattern>
68
	</servlet-mapping>
69
	<servlet-mapping>
70
		<servlet-name>DataServlet</servlet-name>
71
		<url-pattern>/assigning/*</url-pattern>
72
	</servlet-mapping>
73
	<welcome-file-list>
74
		<welcome-file>index.html</welcome-file>
75
		<welcome-file>index.htm</welcome-file>
76
		<welcome-file>index.jsp</welcome-file>
77
		<welcome-file>default.html</welcome-file>
78
		<welcome-file>default.htm</welcome-file>
79
		<welcome-file>default.jsp</welcome-file>
80
	</welcome-file-list>
81
</web-app>
0 82

  
lib/lsid_conf/metacat.xslt
1
<?xml version="1.0" encoding='iso-8859-1' ?>
2
<xsl:stylesheet xmlns:xalan="http://xml.apache.org/xalan" 
3
   				 xmlns:java="http://xml.apache.org/xalan/java"
4
				xmlns:xsl="http://www.w3.org/1999/XSL/Transform" 
5
				version='1.0' 
6
				xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
7
				xmlns="urn:lsid:@METADATA_LABELS@:predicates:"
8
				xmlns:pred="urn:lsid:i3c.org:predicates:"
9
				xmlns:dc="http://purl.org/dc/elements/1.1/"
10
				xmlns:eml="eml://ecoinformatics.org/eml-2.0.1"
11
				exclude-result-prefixes="java seek">
12
				
13
				<xsl:template match="/eml:eml">
14

  
15
						<xsl:variable name="metacatServer">@METACAT_SERVER@</xsl:variable>
16
						<rdf:RDF>
17
							<xsl:apply-templates select="dataset" />				
18
		 					
19
							<rdf:Description>
20
								<xsl:attribute name="rdf:about">
21
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
22
							  </xsl:attribute> 
23
							  <xsl:element name="dc:format">
24
		 					  	<xsl:attribute name="rdf:resource">
25
		 					  	  <xsl:text>urn:lsid:i3c.org:formats:text</xsl:text>
26
		 					  	</xsl:attribute>
27
		 					  </xsl:element>	
28
						</rdf:Description>
29
						
30
						<rdf:Description>
31
								<xsl:attribute name="rdf:about">
32
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
33
							  </xsl:attribute> 
34
							  <xsl:element name="pred:storedas">
35
		 					  	<xsl:attribute name="rdf:resource">
36
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
37
		 					  	</xsl:attribute>
38
		 					  </xsl:element>
39
						</rdf:Description>
40
						
41
						<rdf:Description>
42
								<xsl:attribute name="rdf:about">
43
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
44
							  </xsl:attribute> 
45
							  <xsl:element name="rdf:type">
46
		 					  	<xsl:attribute name="rdf:resource">
47
		 					  	  <xsl:text>urn:lsid:i3c.org:types:content</xsl:text>
48
		 					  	</xsl:attribute>
49
		 					  </xsl:element>	
50
						</rdf:Description>
51

  
52
						<rdf:Description>
53
								<xsl:attribute name="rdf:about">
54
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
55
							  </xsl:attribute> 
56
		 					<pred:htmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
57
								<xsl:text>&lt;a href=&quot;</xsl:text>
58
								<xsl:value-of select="concat(concat($metacatServer,'?action=read&amp;qformat=knb&amp;docid='),@packageId)"/>
59
								<xsl:text>&quot;&gt;</xsl:text>
60
								<xsl:value-of select="concat(concat($metacatServer,'?action=read&amp;qformat=knb&amp;docid='),@packageId)"/>
61
								<xsl:text>&lt;/a&gt;</xsl:text>
62

  
63
		 					</pred:htmlVersion> 
64

  
65
						</rdf:Description>
66

  
67
						<rdf:Description>
68
								<xsl:attribute name="rdf:about">
69
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
70
							  </xsl:attribute> 
71
		 					<pred:xmlVersion xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
72
								<xsl:text>&lt;a href=&quot;</xsl:text>
73
								<xsl:value-of select="concat(concat($metacatServer,'?action=read&amp;qformat=xml&amp;docid='),@packageId)"/>
74
								<xsl:text>&quot;&gt;</xsl:text>
75
								<xsl:value-of select="concat(concat($metacatServer,'?action=read&amp;qformat=xml&amp;docid='),@packageId)"/>
76
								<xsl:text>&lt;/a&gt;</xsl:text>
77
		 					</pred:xmlVersion> 
78

  
79
						</rdf:Description>
80
						<rdf:Description>
81
								<xsl:attribute name="rdf:about">
82
								  <xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
83
							  </xsl:attribute> 
84
							  <xsl:element name="rdf:type">
85
		 					  	<xsl:attribute name="rdf:resource">
86
		 					  	  <xsl:text>urn:lsid:i3c.org:types:content</xsl:text>
87
		 					  	</xsl:attribute>
88
		 					  </xsl:element>	
89
						</rdf:Description>
90
						
91
					 </rdf:RDF>
92
				</xsl:template>
93
				
94
				<xsl:template match="dataset">
95
						<rdf:Description>
96
							<xsl:attribute name="rdf:about">
97
								<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
98
							</xsl:attribute>
99
		 					<pred:title xmlns:pred="http://purl.org/dc/elements/1.1/">
100
		 						<xsl:value-of select="title" />
101
		 					</pred:title> 
102
						</rdf:Description>
103

  
104
						<rdf:Description>
105
							<xsl:attribute name="rdf:about">
106
								<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
107
							</xsl:attribute>
108
		 					<pred:creator xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
109
		 						<xsl:value-of select="creator" />
110
		 					</pred:creator> 
111
						</rdf:Description>
112

  
113
						<rdf:Description>
114
							<xsl:attribute name="rdf:about">
115
								<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
116
							</xsl:attribute>
117
		 					<pred:contact xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
118
		 						<xsl:value-of select="contact" />
119
		 					</pred:contact> 
120
						</rdf:Description>
121

  
122
						<xsl:apply-templates select="keywordSet/keyword" />
123
						<xsl:apply-templates select="distribution/online/url" />
124
						
125
					</xsl:template>
126

  
127
					<xsl:template match="keyword">
128
						<rdf:Description>
129
							<xsl:attribute name="rdf:about">
130
								<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
131
							</xsl:attribute>
132
		 					<pred:keyword xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
133
								<xsl:value-of select="@keywordType"/>
134
								<xsl:text>=</xsl:text>
135
		 						<xsl:value-of select="." />
136
		 					</pred:keyword> 
137
						</rdf:Description>
138
					</xsl:template>
139

  
140
					<xsl:template match="url">
141
						<rdf:Description>
142
							<xsl:attribute name="rdf:about">
143
								<xsl:value-of select="java:edu.ucsb.nceas.metacat.lsid.LSIDAuthorityMetaData.getLSID()" />
144
							</xsl:attribute>
145
		 					<pred:associatedInfo xmlns:pred="urn:lsid:@METADATA_LABELS@:predicates:">
146
		 					
147
		 						<xsl:choose>
148
		 							<xsl:when test="starts-with(., 'ecogrid://')">
149
		 								<xsl:value-of select="concat('urn:lsid:@LSID_AUTHORITY_STRING@:',substring-after(.,'ecogrid://knr/'))"/>
150
									</xsl:when>
151
									<xsl:otherwise>
152
										<xsl:text>&lt;a href=&quot;</xsl:text>
153
										<xsl:value-of select="."/>
154
										<xsl:text>&quot;&gt;</xsl:text>
155
										<xsl:value-of select="."/>
156
										<xsl:text>&lt;/a&gt;</xsl:text>
157
									</xsl:otherwise>
158
								</xsl:choose>
159
		 					</pred:associatedInfo> 
160
						</rdf:Description>
161
				</xsl:template>
162
</xsl:stylesheet>
163

  
0 164

  
lib/lsid_conf/preds.xml
1
<metadata xmlns="http://www.ibm.com/LSID/Standard/msdl">
2
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:associatedInfo" location="inline">
3
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
4
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:associatedInfo">
5
				<rdfs:label>Associated Information</rdfs:label>
6
			</rdf:Description>
7
		</rdf:RDF>
8
	</lsid>
9
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:creator" location="inline">
10
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
11
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:creator">
12
				<rdfs:label>Creator</rdfs:label>
13
			</rdf:Description>
14
		</rdf:RDF>
15
	</lsid>
16
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:htmlVersion" location="inline">
17
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
18
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:htmlVersion">
19
				<rdfs:label>HTML Version</rdfs:label>
20
			</rdf:Description>
21
		</rdf:RDF>
22
	</lsid>
23
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:keyword" location="inline">
24
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
25
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:keyword">
26
				<rdfs:label>Keywords</rdfs:label>
27
			</rdf:Description>
28
		</rdf:RDF>
29
	</lsid>
30
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:xmlVersion" location="inline">
31
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
32
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:xmlVersion">
33
				<rdfs:label>XML Version</rdfs:label>
34
			</rdf:Description>
35
		</rdf:RDF>
36
	</lsid>
37
	<lsid uri="urn:lsid:@METADATA_LABELS@:predicates:contact" location="inline">
38
		<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#">
39
			<rdf:Description rdf:about="urn:lsid:@METADATA_LABELS@:predicates:contact">
40
				<rdfs:label>Contact Information</rdfs:label>
41
			</rdf:Description>
42
		</rdf:RDF>
43
	</lsid>
44
</metadata>
0 45

  
src/edu/ucsb/nceas/metacat/lsid/LSIDDataLookup.java
1
/**
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.*;
28
import java.net.*;
29

  
30
//import java.sql.Connection;
31
import java.util.ResourceBundle;
32

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

  
36
public class LSIDDataLookup {
37

  
38
//	private static Connection lsidLookup = null;
39

  
40
	public static final int UNKNOWN = 1;
41
	public static final int ABSTRACT = 2;
42
	public static final int CONCRETE = 4;
43

  
44

  
45
	public LSIDDataLookup() throws LSIDServerException {
46
        System.out.println("Creating LSIDDataLookup (Metacat).");
47
  	}
48

  
49

  
50
	public int lsidType(LSID lsid) throws LSIDServerException {
51

  
52
		int result = CONCRETE;
53
		return result;
54
	}
55

  
56
	public InputStream lsidData(LSID lsid) throws LSIDServerException {
57
		String ns = lsid.getNamespace();
58
		String id = lsid.getObject();
59
		String ver = lsid.getRevision();
60
		InputStream docStream = null;
61
		
62

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

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

  
84

  
85
		return docStream;
86
	}
87

  
88
}
0 89

  
src/edu/ucsb/nceas/metacat/lsid/LSIDAuthorityMetaData.java
1
/**
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
import java.io.ByteArrayInputStream;
29

  
30
import com.ibm.lsid.LSID;
31
import com.ibm.lsid.MetadataResponse;
32
import com.ibm.lsid.MalformedLSIDException;
33

  
34
import com.ibm.lsid.server.LSIDMetadataService;
35
import com.ibm.lsid.server.LSIDServerException;
36
import com.ibm.lsid.server.LSIDServiceConfig;
37

  
38
import com.ibm.lsid.server.LSIDRequestContext;
39

  
40
import java.io.ByteArrayOutputStream;
41
import java.io.IOException;
42
import java.io.Reader;
43
import java.io.StringReader;
44
import java.io.InputStreamReader;
45
import java.io.BufferedReader;
46

  
47
import javax.xml.transform.Transformer;
48
import javax.xml.transform.TransformerFactory;
49
import javax.xml.transform.stream.StreamResult;
50
import javax.xml.transform.stream.StreamSource;
51

  
52
import java.util.Hashtable;
53

  
54
import edu.ucsb.nceas.metacat.client.*;
55
import java.util.ResourceBundle;
56

  
57
public class LSIDAuthorityMetaData implements LSIDMetadataService {
58

  
59
	private LSIDDataLookup lookup = null;
60
	private static Hashtable currentLSIDs = new Hashtable();
61

  
62
	public void initService(LSIDServiceConfig cf) throws LSIDServerException {
63
        System.out.println("Starting LSIDAuthorityMetadata (Metacat).");
64
		lookup = new LSIDDataLookup();
65
	}
66

  
67
	private static final String RDF_NS =
68
		"http://www.w3.org/1999/02/22-rdf-syntax-ns#";
69
	private static final String DC_NS = "http://purl.org/dc/elements/1.1/";
70
	private static final String I3CP_NS = "urn:lsid:i3c.org:predicates:";
71
	private static final String I3C_CONTENT = "urn:lsid:i3c.org:types:content";
72

  
73
	public MetadataResponse getMetadata(
74
		LSIDRequestContext req,
75
		String[] formats)
76
		throws LSIDServerException {
77
		LSID lsid = req.getLsid();
78
		ByteArrayInputStream theMetadata = doMetadataRequest(lsid);
79
		return new MetadataResponse(
80
			theMetadata,
81
			null,
82
			MetadataResponse.RDF_FORMAT);
83
	}
84

  
85
	private ByteArrayInputStream doMetadataRequest(LSID lsid)
86
		throws LSIDServerException {
87
		System.out.println("getting metadata for lsid " + lsid.getLsid());
88
		try {
89

  
90
			String styleSheetName = null;
91
			styleSheetName = "metacat.xslt";
92
			LSIDDataLookup myLookup = new LSIDDataLookup();
93
			InputStream content = myLookup.lsidData(lsid);
94
			InputStream content2 = myLookup.lsidData(lsid);
95
			if (!isEML(content2)) {
96
				content = getEML(lsid);
97
			}
98
			content2.close();
99
			setCurrentLSID(lsid);
100
			InputStream styleSheet =
101
				getClass().getResourceAsStream(styleSheetName);
102
			TransformerFactory factory = TransformerFactory.newInstance();
103
			Transformer transformer =
104
				factory.newTransformer(new StreamSource(styleSheet));
105
			ByteArrayOutputStream out = new ByteArrayOutputStream();
106
			transformer.transform(
107
				new StreamSource(content),
108
				new StreamResult(out));
109
			content.close();
110
			clearState();
111
			return new ByteArrayInputStream(out.toByteArray());
112
		} catch (Exception e) {
113
			throw new LSIDServerException(
114
				e,
115
				"Error transforming XML for: " + lsid);
116
		}
117
	}
118

  
119
	private String getStringFromInputStream(InputStream input) {
120
		StringBuffer result = new StringBuffer();
121
		BufferedReader in = new BufferedReader(new InputStreamReader(input));
122
		String line;
123
		try {
124
			while ((line = in.readLine()) != null) {
125
				result.append(line);
126
			}
127
		} catch (IOException e) {
128
			System.out.println("IOexception " + e);
129
		}
130

  
131
		return result.toString();
132

  
133
	}
134

  
135
	/**
136
	 * figure out is this inputstream is an eml document or not
137
		 */
138

  
139
	/* TODO: need a better way to figure out if this is an eml document */
140
	private boolean isEML(InputStream input) {
141

  
142
		if (input == null) {
143
			return false;
144
		}
145

  
146
		int loop = 0;
147
		boolean itIsEML = false;
148
		String line = "";
149
		try {
150
			BufferedReader in =
151
				new BufferedReader(new InputStreamReader(input));
152
			while ((loop < 20) && (line != null) && (!itIsEML)) {
153
				line = in.readLine();
154
				line = line.toLowerCase();
155
				if (line.indexOf("eml:eml") != -1) {
156
					itIsEML = true;
157
				}
158
				loop++;
159
			}
160
		} catch (IOException e) {
161
			System.out.println("ioerror in LSIDAuthorityMetadata: " + e);
162
		}
163
		return itIsEML;
164
	}
165

  
166
	/**
167
	 *  this lsid points to a data object - get the
168
	     *  metadata objects which refer to this document
169
	     */
170

  
171
	private InputStream getEML(LSID theLSID) {
172

  
173
		InputStream response = null;
174

  
175
		// need to find things with this object in any of the elements
176
		// using the metacat api
177
		// get back dataset/docid and dataset/title
178

  
179
		// create the query
180
		String theQuery = getMetaCatQuery(theLSID);
181

  
182
		// get the metacat record
183
		Reader metaCatResponse = getMetaCatResponse(theQuery);
184

  
185
		// parse the metadata to get the applicable rdf information
186
		response = parseMetaCatResponse(metaCatResponse, theLSID);
187

  
188
		return response;
189

  
190
	}
191

  
192
	/** 
193
	 * given an LSID return a metacat query which will return docs mentioning this LSID
194
	 */
195

  
196
	private String getMetaCatQuery(LSID lsid) {
197
        System.out.println("getting Metacat Query for: " + lsid.toString());
198
		String ns = lsid.getNamespace();
199
		String id = lsid.getObject();
200
		String ver = lsid.getRevision();
201
		String theName = ns + "." + id + "." + ver;
202

  
203
		String theQuery = null;
204
		theQuery =
205
			"<?xml version=\"1.0\"?>\n"
206
				+ "<pathquery version=\"1.2\">\n"
207
				+ "  <querytitle>"
208
				+ theName
209
				+ " search</querytitle>\n"
210
				+ "  <returnfield>dataset/docid</returnfield>\n"
211
				+ "  <returnfield>dataset/title</returnfield>\n"
212
				+ "  <querygroup operator=\"UNION\">\n"
213
				+ "    <queryterm searchmode=\"contains\" casesensitive=\"false\">\n"
214
				+ "      <value>"
215
				+ theName
216
				+ "</value>\n"
217
				+ "      <pathexpr>anyfield</pathexpr>\n"
218
				+ "    </queryterm>\n"
219
				+ "  </querygroup>\n"
220
				+ "<pathquery>\n";
221

  
222
		return theQuery;
223

  
224
	}
225

  
226
	/* 
227
	 * given a query string, query MetaCat and return the response
228
	 */
229
	private Reader getMetaCatResponse(String query) {
230
        System.out.println("Querying the metacat server.");
231
		//  get the metacat server from the configuration file
232
		//
233
		ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid");
234
		String url = rb.getString("metacatserver");
235
		Reader r = null;
236
		try {
237

  
238
			Metacat m = MetacatFactory.createMetacatConnection(url);
239
			r = m.query(new StringReader(query));
240

  
241
		} catch (MetacatInaccessibleException mie) {
242
			System.out.println("Metacat Inaccessible:\n" + mie.getMessage());
243
		} catch (Exception e) {
244
			System.out.println("General exception:\n" + e.getMessage());
245
		}
246
		return r;
247
	}
248

  
249
	/**
250
	 * Given a reader which is a metacat response, parse it and return the appropriate rdf
251
	 */
252
	private InputStream parseMetaCatResponse(Reader reader, LSID theLSID) {
253
		InputStream response = null;
254
        System.out.println("Parsing the metacat response.");
255
		// if there's more than one document, then return rdf listing the documents
256
		// otherwise get the document and return rdf  based on it
257

  
258
		String contents = getStringFromReader(reader);
259
		if (numberDocuments(contents) < 1) {
260
			response = noMetaDataResponse(theLSID);
261
		} else if (numberDocuments(contents) > 1) {
262
			response = metaDataList(contents, theLSID);
263
		} else {
264
			response = getMetaData(contents, theLSID);
265
		}
266
		return response;
267
	}
268

  
269
	/**
270
	 *  There's no metadata for this document 
271
	*/
272

  
273
	private ByteArrayInputStream noMetaDataResponse(LSID theLSID) {
274
		ResourceBundle rb = ResourceBundle.getBundle("metacat-lsid");
275
		String metadataLabels = rb.getString("metadatalabels");
276

  
277
		String result =
278
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
279
				+ "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n"
280
				+ "	xmlns:dc=\"http://purl.org/dc/elements/1.1/\" \n"
281
				+ "	xmlns:pred=\"urn:lsid:i3c.org:predicates:\" xmlns=\"urn:lsid:" 
282
				+ metadataLabels + ":predicates:\"> \n"
283
				+ "<rdf:Description rdf:about=\""
284
				+ theLSID.getLsid()
285
				+ "\"> \n"
286
				+ "	<pred:title xmlns:pred=\"http://purl.org/dc/elements/1.1/\">There is no metadata for this LSID.</pred:title>\n"
287
				+ "</rdf:Description>\n"
288
				+ "</rdf:RDF>\n";
289
			
290

  
291
		return new ByteArrayInputStream(result.getBytes());
292
	}
293

  
294
	/**
295
	 *  There's more than one metdata document
296
	     */
297

  
298
	private ByteArrayInputStream metaDataList(String contents, LSID theLSID) {
299
		ResourceBundle rb = ResourceBundle.getBundle("metacat");
300
		String metadataLabels = rb.getString("metadatalabels");
301

  
302
		String result =
303
			"<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
304
				+ "<rdf:RDF xmlns:rdf=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\" \n"
305
				+ "	xmlns:dc=\"http://purl.org/dc/elements/1.1/\" \n"
306
				+ "	xmlns:pred=\"urn:lsid:i3c.org:predicates:\" xmlns=\"urn:lsid:"
307
				+ metadataLabels + ":predicates:\"> \n"
308
				+ "<rdf:Description rdf:about=\""
309
				+ theLSID.getLsid()
310
				+ "\"> \n"
311
				+ "	<pred:title xmlns:pred=\"http://purl.org/dc/elements/1.1/\">There is more than one metadata document for this LSID - which confuses me right now.  Try again soon and I'll be less confused.</pred:title>\n"
312
				+ "</rdf:Description>\n"
313
				+ "</rdf:RDF>\n";
314

  
315
		return new ByteArrayInputStream(result.getBytes());
316
	}
317

  
318
	/**
319
	 *  There's just one metadata document 
320
	     */
321

  
322
	private ByteArrayInputStream getMetaData(String contents, LSID theLSID) {
323
		String paramString = "<param name=\"dataset/title\">";
324
		ByteArrayInputStream result = null;
325

  
326
		if (contents.indexOf(paramString) == -1) {
327
			return noMetaDataResponse(theLSID);
328
		} else {
329
			String parts[] = contents.split(paramString);
330
			String parts2[] = parts[1].split("</param>");
331
			try {
332
				LSID newLSID = new LSID(parts2[0]);
333
				result = doMetadataRequest(newLSID);
334

  
335
			} catch (MalformedLSIDException e) {
336
				System.out.println("problem generating LSID: " + e);
337
				e.printStackTrace();
338
			} catch (LSIDServerException e) {
339
				System.out.println("problem generating LSID: " + e);
340
				e.printStackTrace();
341
			}
342
		}
343
		return result;
344
	}
345

  
346
	/**
347
	 *  Find out how many contents are in this metacat response
348
	 *  I'm just using string stuff for this - sort of lame, but does the trick
349
	 *  more cool would be to use xml stuff
350
	 */
351
	private int numberDocuments(String contents) {
352

  
353
		String[] docSplit = contents.split("<document>");
354
		return (docSplit.length - 1);
355
	}
356

  
357
	/**
358
	 * Given a reader, return a string
359
	 */
360
	private String getStringFromReader(Reader reader) {
361
		StringBuffer response = new StringBuffer();
362

  
363
		try {
364
			BufferedReader bufReader = new BufferedReader(reader);
365

  
366
			String line = null;
367
			while ((line = bufReader.readLine()) != null) {
368
				response.append(line);
369
			}
370
			bufReader.close();
371

  
372
		} catch (IOException e) {
373
			System.out.println("error getting string from reader " + e);
374
		}
375
		return response.toString();
376
	}
377

  
378
	/**
379
	 * set the LSID for the current thread
380
	 */
381
	static void setCurrentLSID(LSID lsid) {
382
		currentLSIDs.put(Thread.currentThread(), lsid);
383
	}
384

  
385
	static void clearState() {
386
		currentLSIDs.remove(Thread.currentThread());
387
	}
388

  
389
	/**
390
	 * get the current LSID for the given thread, for use in XSLT so return a string
391
	 */
392
	//	public static String getLSID() throws MalformedLSIDException {
393
	//		return ((LSID)currentLSIDs.get(Thread.currentThread())).toString();
394
	//	}
395

  
396
	public static String getLSID(
397
		org.apache.xalan.extensions.XSLProcessorContext foo,
398
		org.apache.xalan.templates.ElemExtensionCall bar)
399
		throws MalformedLSIDException {
400
		return ((LSID) currentLSIDs.get(Thread.currentThread())).toString();
401
	}
402

  
403
	public static String getLSID() throws MalformedLSIDException {
404
		return ((LSID) currentLSIDs.get(Thread.currentThread())).toString();
405
	}
406
}
0 407

  
src/edu/ucsb/nceas/metacat/lsid/LSIDAuthorityMain.java
1
/**
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.util.regex.Pattern;
28
import java.util.regex.Matcher;
29

  
30
import com.ibm.lsid.LSID;
31
import com.ibm.lsid.ExpiringResponse;
32
import com.ibm.lsid.wsdl.LSIDDataPort;
33
import com.ibm.lsid.wsdl.LSIDMetadataPort;
34

  
35
import com.ibm.lsid.wsdl.SOAPLocation;
36
import com.ibm.lsid.wsdl.HTTPLocation;
37

  
38
import com.ibm.lsid.server.LSIDServerException;
39
import com.ibm.lsid.server.LSIDServiceConfig;
40

  
41
import com.ibm.lsid.server.impl.SimpleAuthority;
42

  
43
public class LSIDAuthorityMain extends SimpleAuthority {
44

  
45
	private LSIDDataLookup lookup = null;
46

  
47
	public void initService(LSIDServiceConfig cf) throws LSIDServerException {
48
        System.out.println("Starting LSIDAuthorityMain (Metacat).");
49
		lookup = new LSIDDataLookup();
50
	}
51

  
52
	public ExpiringResponse getKnownURIs() throws LSIDServerException {
53
		return null;
54
	}
55

  
56
	public LSIDMetadataPort[] getMetadataLocations(LSID lsid, String url) {
57
		if (lookup == null)
58
			return null;
59

  
60
		int lsType;
61
		try {
62
			lsType = lookup.lsidType(lsid);
63
		}
64
		catch (LSIDServerException ex) {
65
			ex.printStackTrace();
66
			lsType = LSIDDataLookup.UNKNOWN;
67
		}
68
		if (lsType == LSIDDataLookup.UNKNOWN)
69
			return null;
70

  
71
		HostDescriptor hd = new HostDescriptor(url);
72
		return new LSIDMetadataPort[] {
73
		// thau added http metadata port here
74
			new HTTPLocation(
75
				hd.host, hd.port,
76
				hd.pathPrefix + "/authority/metadata" 
77
			),
78
		new SOAPLocation(
79
				hd.baseURL + "metadata"
80
			)
81
		};
82
	}
83

  
84
	public LSIDDataPort[] getDataLocations(LSID lsid, String url) {
85
		if (lookup == null)
86
			return null;
87

  
88
		int lsType;
89
		try {
90
			lsType = lookup.lsidType(lsid);
91
		}
92
		catch (LSIDServerException ex) {
93
			ex.printStackTrace();
94
			lsType = LSIDDataLookup.UNKNOWN;
95
		}
96
		if (lsType == LSIDDataLookup.UNKNOWN)
97
			return null;
98
		if (lsType == LSIDDataLookup.ABSTRACT)
99
			return new LSIDDataPort[0];
100
		
101
		HostDescriptor hd = new HostDescriptor(url);
102
		return new LSIDDataPort[] {
103
			new HTTPLocation(
104
				hd.host, hd.port,
105
				hd.pathPrefix + "/authority/data"
106
			),
107
			new SOAPLocation(
108
				hd.baseURL + "data"
109
			)
110
		};
111
	}
112

  
113
	private static final Pattern HOST_PTN = Pattern.compile(
114
		"https?://([^/:]+)(?::(\\d+))?(.*)/authority(.*)"
115
	);
116
	
117
	/* Q&D implementation */
118
	private class HostDescriptor {
119
		public String host;
120
		public int port;
121
		public String pathPrefix;
122
		public String baseURL;
123
		
124
		public HostDescriptor(String url) {
125
			host = "localhost";
126
			port = -1;
127
			pathPrefix = "";
128
			if (url != null || url.length() > 0) {
129
				Matcher m = HOST_PTN.matcher(url);
130
				if (m.lookingAt()) {
131
					host = m.group(1);
132
					if ((m.group(2) != null) && (m.group(2).length() > 0))
133
						port = Integer.parseInt(m.group(2));
134
					pathPrefix = m.group(3);
135
				}
136
			}
137
			if (port > 0)
138
				baseURL = "http://" + host + ":" + port +
139
					pathPrefix + "/authority/";
140
			else
141
				baseURL = "http://" + host + pathPrefix + "/authority/";
142
		}
143
	}
144
}
0 145

  
src/edu/ucsb/nceas/metacat/lsid/LSIDAuthorityData.java
1
/**
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;
26
package edu.ucsb.nceas.metacat.lsid;
27

  
28
import java.io.InputStream;
29

  
30
import com.ibm.lsid.server.LSIDDataService;
31
import com.ibm.lsid.server.LSIDServerException;
32
import com.ibm.lsid.server.LSIDServiceConfig;
33
import com.ibm.lsid.server.LSIDRequestContext;
34

  
35
public class LSIDAuthorityData implements LSIDDataService {
36

  
37
	private LSIDDataLookup lookup = null;
38

  
39
	public InputStream getData(LSIDRequestContext lsid) throws LSIDServerException {
40
        System.out.println("Getting data (Metacat): " + lsid.getLsid().toString());
41
		if (lookup == null)
42
			throw new LSIDServerException(500, "Cannot query database");
43
		return lookup.lsidData(lsid.getLsid());
44
	}
45

  
46
	public InputStream getDataByRange(LSIDRequestContext lsid, int start, int end) throws LSIDServerException {
47
		if (lookup == null)
48
			throw new LSIDServerException(500, "Cannot query database");
49
		return lookup.lsidData(lsid.getLsid());
50
	}
51

  
52
	public void initService(LSIDServiceConfig cf) throws LSIDServerException {
53
        System.out.println("Starting LSIDAuthorityData (Metacat).");
54
		lookup = new LSIDDataLookup();
55
	}
56
}
0 57

  
build.properties
1
# Trying to create an Ant build properties files
1
# Ant build properties files for the metacat build
2 2

  
3 3
# Tomcat Properties
4 4
tomcat=/usr/local/devtools/jakarta-tomcat
5
deploy.dir=/var/www/org.ecoinformatics.knb
6
#deploy.dir=${tomcat}/webapps
7

  
5 8
# Tomcat version - tomcat3 or tomcat4 or tomcat5
6 9
tomcatversion=tomcat5
7
webapps=/var/www/org.ecoinformatics.knb
8
context=knb
9 10

  
11
# Servlet properties
12
metacat.context=knb
13
authority.context=authority
14

  
10 15
# Server Properties
11
# this server should be with ssl port if it is tomcat stand-alone
12
server=knb.ecoinformatics.org
13
# this server should be with http plaint port if it is tomcat stand-alone
14
httpserver=knb.ecoinformatics.org
16
config.hostname=knb.ecoinformatics.org
17
config.port=80
18
server=${config.hostname}
19
httpserver=${server}
20
config.metacatserver=http://${server}/${metacat.context}/metacat
21
config.lsidauthority=ecoinformatics.org
15 22

  
16 23
# Installation directory for registry CGI scripts
17 24
inst.cgi.dir=/var/www/cgi-knb
18
cgi-prefix=http://knb.ecoinformatics.org/cgi-bin
25
cgi-prefix=http://${server}/cgi-bin
19 26
ldapUrl=ldap://ldap.ecoinformatics.org/dc=ecoinformatics,dc=org
20 27

  
21 28
# Select the database to use for metadata storage
22 29
# Valid values are oracle, postgresql, sqlserver
23
database=oracle
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff