Revision 6092
Added by Matt Jones over 13 years ago
test/edu/ucsb/nceas/metacat/dataone/CrudServiceTest.java | ||
---|---|---|
35 | 35 |
|
36 | 36 |
import org.apache.commons.io.IOUtils; |
37 | 37 |
import org.dataone.service.exceptions.BaseException; |
38 |
import org.dataone.service.exceptions.NotFound; |
|
39 | 38 |
import org.dataone.service.types.AuthToken; |
40 | 39 |
import org.dataone.service.types.Checksum; |
41 | 40 |
import org.dataone.service.types.ChecksumAlgorithm; |
... | ... | |
47 | 46 |
import org.dataone.service.types.ObjectFormat; |
48 | 47 |
import org.dataone.service.types.ObjectInfo; |
49 | 48 |
import org.dataone.service.types.ObjectList; |
50 |
import org.dataone.service.types.Principal;
|
|
49 |
import org.dataone.service.types.Subject;
|
|
51 | 50 |
import org.dataone.service.types.SystemMetadata; |
52 | 51 |
|
53 | 52 |
import edu.ucsb.nceas.MCTestCase; |
... | ... | |
921 | 920 |
//set the size |
922 | 921 |
sm.setSize(testDoc.getBytes(MetaCatServlet.DEFAULT_ENCODING).length); |
923 | 922 |
//submitter |
924 |
Principal p = new Principal();
|
|
923 |
Subject p = new Subject();
|
|
925 | 924 |
p.setValue("joe"); |
926 | 925 |
sm.setSubmitter(p); |
927 | 926 |
sm.setRightsHolder(p); |
src/upgrade-db-to-1.10.0-postgres.sql | ||
---|---|---|
36 | 36 |
|
37 | 37 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
38 | 38 |
VALUES ('Schema', 'http://dataone.org/service/types/0.5.1', '/schema/D1_SCHEMA_0_5_1/dataoneTypes.xsd'); |
39 |
|
|
40 | 39 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
40 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.1', '/schema/D1_SCHEMA_0_6_1/dataoneTypes.xsd'); |
|
41 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
42 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.2', '/schema/D1_SCHEMA_0_6_2/dataoneTypes.xsd'); |
|
43 |
|
|
44 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
41 | 45 |
VALUES ('Schema', '@eml2_1_1namespace@', '/schema/eml-2.1.1/eml.xsd'); |
42 | 46 |
/* |
43 | 47 |
* update the database version |
src/loaddtdschema-postgres.sql | ||
---|---|---|
55 | 55 |
VALUES ('Schema', 'http://dataone.org/service/types/0.5.1', '/schema/D1_SCHEMA_0_5_1/dataoneTypes.xsd'); |
56 | 56 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
57 | 57 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.0', '/schema/D1_SCHEMA_0_6_0/dataoneTypes.xsd'); |
58 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
59 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.1', '/schema/D1_SCHEMA_0_6_1/dataoneTypes.xsd'); |
|
60 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
61 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.2', '/schema/D1_SCHEMA_0_6_2/dataoneTypes.xsd'); |
|
58 | 62 |
INSERT INTO db_version (version, status, date_created) |
59 | 63 |
VALUES ('1.10.0',1,CURRENT_DATE); |
src/upgrade-db-to-1.10.0-oracle.sql | ||
---|---|---|
35 | 35 |
*/ |
36 | 36 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
37 | 37 |
VALUES ('Schema', 'http://dataone.org/service/types/0.5.1', '/schema/D1_SCHEMA_0_5_1/dataoneTypes.xsd'); |
38 |
|
|
39 | 38 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
39 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.1', '/schema/D1_SCHEMA_0_6_1/dataoneTypes.xsd'); |
|
40 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
41 |
VALUES ('Schema', 'http://ns.dataone.org/service/types/0.6.2', '/schema/D1_SCHEMA_0_6_2/dataoneTypes.xsd'); |
|
42 |
|
|
43 |
INSERT INTO xml_catalog (entry_type, public_id, system_id) |
|
40 | 44 |
VALUES ('Schema', '@eml2_1_1namespace@', '/schema/eml-2.1.1/eml.xsd'); |
41 | 45 |
|
42 | 46 |
/* |
src/edu/ucsb/nceas/metacat/MetacatHandler.java | ||
---|---|---|
138 | 138 |
import org.dataone.service.types.ChecksumAlgorithm; |
139 | 139 |
import org.dataone.service.types.Identifier; |
140 | 140 |
import org.dataone.service.types.ObjectFormat; |
141 |
import org.dataone.service.types.Principal;
|
|
141 |
import org.dataone.service.types.Subject;
|
|
142 | 142 |
import org.dataone.service.types.SystemMetadata; |
143 | 143 |
|
144 | 144 |
import org.dataone.service.exceptions.BaseException; |
... | ... | |
3807 | 3807 |
sysMeta.setSize(sizeOfStream(inputStream)); |
3808 | 3808 |
|
3809 | 3809 |
//submitter |
3810 |
Principal principal = new Principal();
|
|
3811 |
principal.setValue((String) docInfo.get("user_owner"));
|
|
3812 |
sysMeta.setSubmitter(principal);
|
|
3813 |
sysMeta.setRightsHolder(principal);
|
|
3810 |
Subject subject = new Subject();
|
|
3811 |
subject.setValue((String) docInfo.get("user_owner"));
|
|
3812 |
sysMeta.setSubmitter(subject);
|
|
3813 |
sysMeta.setRightsHolder(subject);
|
|
3814 | 3814 |
|
3815 | 3815 |
try { |
3816 | 3816 |
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-DD"); |
src/edu/ucsb/nceas/metacat/util/MetacatPopulator.java | ||
---|---|---|
25 | 25 |
*/ |
26 | 26 |
package edu.ucsb.nceas.metacat.util; |
27 | 27 |
|
28 |
import java.io.ByteArrayInputStream; |
|
29 |
import java.io.InputStream; |
|
30 |
import java.io.OutputStream; |
|
31 |
import java.net.HttpURLConnection; |
|
32 |
import java.net.URL; |
|
28 | 33 |
import java.security.MessageDigest; |
29 |
import java.util.*;
|
|
30 |
import java.io.*;
|
|
31 |
import java.net.*;
|
|
34 |
import java.util.Calendar;
|
|
35 |
import java.util.Date;
|
|
36 |
import java.util.Vector;
|
|
32 | 37 |
|
33 | 38 |
import javax.activation.DataHandler; |
34 | 39 |
import javax.activation.DataSource; |
35 |
import javax.mail.MessagingException; |
|
36 | 40 |
import javax.mail.internet.MimeBodyPart; |
37 | 41 |
import javax.mail.internet.MimeMultipart; |
38 |
import javax.xml.parsers.DocumentBuilder; |
|
39 |
import javax.xml.parsers.DocumentBuilderFactory; |
|
40 |
import javax.xml.parsers.ParserConfigurationException; |
|
41 | 42 |
|
42 | 43 |
import org.apache.commons.io.IOUtils; |
43 |
|
|
44 |
import edu.ucsb.nceas.metacat.MetaCatServlet; |
|
45 |
import edu.ucsb.nceas.metacat.MetacatHandler; |
|
46 |
import edu.ucsb.nceas.metacat.MetacatResultSet; |
|
47 |
import edu.ucsb.nceas.metacat.MetacatResultSet.Document; |
|
48 |
import edu.ucsb.nceas.metacat.dataone.CrudService; |
|
49 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
|
50 |
import edu.ucsb.nceas.metacat.restservice.InputStreamDataSource; |
|
51 |
|
|
52 |
import org.dataone.service.exceptions.InvalidSystemMetadata; |
|
53 |
import org.dataone.service.exceptions.ServiceFailure; |
|
44 |
import org.dataone.client.D1Client; |
|
45 |
import org.dataone.client.MNode; |
|
46 |
import org.dataone.eml.DataoneEMLParser; |
|
47 |
import org.dataone.eml.EMLDocument; |
|
48 |
import org.dataone.eml.EMLDocument.DistributionMetadata; |
|
54 | 49 |
import org.dataone.service.types.AuthToken; |
55 | 50 |
import org.dataone.service.types.Checksum; |
56 | 51 |
import org.dataone.service.types.ChecksumAlgorithm; |
52 |
import org.dataone.service.types.Identifier; |
|
57 | 53 |
import org.dataone.service.types.NodeReference; |
58 | 54 |
import org.dataone.service.types.ObjectFormat; |
59 |
import org.dataone.service.types.Principal;
|
|
55 |
import org.dataone.service.types.Subject;
|
|
60 | 56 |
import org.dataone.service.types.SystemMetadata; |
61 |
import org.dataone.service.types.Identifier; |
|
62 |
import org.dataone.client.D1Client; |
|
63 |
import org.dataone.client.MNode; |
|
64 |
import org.dataone.eml.DataoneEMLParser; |
|
65 |
import org.dataone.eml.EMLDocument; |
|
66 |
import org.dataone.eml.EMLDocument.DistributionMetadata; |
|
67 | 57 |
|
68 |
//import sun.tools.jstat.Identifier; |
|
58 |
import edu.ucsb.nceas.metacat.MetaCatServlet; |
|
59 |
import edu.ucsb.nceas.metacat.properties.PropertyService; |
|
60 |
import edu.ucsb.nceas.metacat.restservice.InputStreamDataSource; |
|
69 | 61 |
|
70 |
import com.gc.iotools.stream.is.InputStreamFromOutputStream; |
|
71 |
|
|
72 | 62 |
/** |
73 | 63 |
* @author berkley |
74 | 64 |
* A class to populate a metacat instance based on documents returned from a query |
... | ... | |
309 | 299 |
sm.setSize(doc.doctext.getBytes(MetaCatServlet.DEFAULT_ENCODING).length); |
310 | 300 |
|
311 | 301 |
//submitter |
312 |
Principal p = new Principal();
|
|
302 |
Subject p = new Subject();
|
|
313 | 303 |
p.setValue("unknown"); |
314 | 304 |
sm.setSubmitter(p); |
315 | 305 |
sm.setRightsHolder(p); |
src/edu/ucsb/nceas/metacat/dataone/CrudService.java | ||
---|---|---|
84 | 84 |
import org.dataone.service.types.NodeReference; |
85 | 85 |
import org.dataone.service.types.ObjectFormat; |
86 | 86 |
import org.dataone.service.types.ObjectList; |
87 |
import org.dataone.service.types.Principal;
|
|
87 |
import org.dataone.service.types.Subject;
|
|
88 | 88 |
import org.dataone.service.types.SystemMetadata; |
89 | 89 |
import org.dataone.service.types.util.ServiceTypeUtil; |
90 | 90 |
|
... | ... | |
1292 | 1292 |
NodeReference memberNode = new NodeReference(); |
1293 | 1293 |
memberNode.setValue(ipAddress); |
1294 | 1294 |
le.setMemberNode(memberNode); |
1295 |
Principal princ = new Principal();
|
|
1295 |
Subject princ = new Subject();
|
|
1296 | 1296 |
princ.setValue(principal); |
1297 |
le.setPrincipal(princ);
|
|
1297 |
le.setSubject(princ);
|
|
1298 | 1298 |
le.setUserAgent("metacat/RESTService"); |
1299 | 1299 |
|
1300 | 1300 |
if(event == null) |
... | ... | |
2177 | 2177 |
sm.setSize(sizeOfStream(is)); |
2178 | 2178 |
|
2179 | 2179 |
//submitter |
2180 |
Principal p = new Principal();
|
|
2180 |
Subject p = new Subject();
|
|
2181 | 2181 |
p.setValue((String) docInfo.get("user_owner")); |
2182 | 2182 |
sm.setSubmitter(p); |
2183 | 2183 |
sm.setRightsHolder(p); |
build.xml | ||
---|---|---|
185 | 185 |
<property name="eml2_0_1-schema-tag" value="RELEASE_EML_2_0_1" /> |
186 | 186 |
<property name="eml2_1_0-schema-tag" value="RELEASE_EML_2_1_0" /> |
187 | 187 |
<property name="eml2_1_1-schema-tag" value="RELEASE_EML_2_1_1_RC_2" /> |
188 |
<property name="dataone-schema-tag" value="D1_SCHEMA_0_5_1" />
|
|
188 |
<property name="dataone-schema-tag" value="D1_SCHEMA_0_6_1" />
|
|
189 | 189 |
<property name="eml2-style-tag" value="RELEASE_EML_UTILS_1_0_0_RC12" /> |
190 | 190 |
<property name="eml2_0_0namespace" |
191 | 191 |
value="eml://ecoinformatics.org/eml-2.0.0" /> |
... | ... | |
342 | 342 |
<property name="svn.eml211SchemaUrl" |
343 | 343 |
value="https://code.ecoinformatics.org/code/eml/tags/${eml2_1_1-schema-tag}" /> |
344 | 344 |
<property name="svn.dataone-0.1-schema-url" |
345 |
value="https://repository.dataone.org/software/cicore/tags/${dataone-schema-tag}" />
|
|
345 |
value="https://repository.dataone.org/software/cicore/branches/${dataone-schema-tag}" />
|
|
346 | 346 |
<property name="svn.eml2StyleUrl" |
347 | 347 |
value="https://code.ecoinformatics.org/code/eml/tags/${eml2-style-tag}" /> |
348 | 348 |
|
Also available in: Unified diff
Modified Metacat to build against the D1_SCHEMA_0_6_1 branch of the dataone schemas by incorporating the 0.6.1-SNAPSHOT version of d1_common and d1_libclient libraries, and refactoring Metacat code references to the d1 schema changed types.