Project

General

Profile

« Previous | Next » 

Revision 6366

use new "v1" types from DataONE

View differences:

src/edu/ucsb/nceas/metacat/dataone/HealthService.java
1
/**
2
 *  '$RCSfile$'
3
 *  Copyright: 2000 Regents of the University of California and the
4
 *              National Center for Ecological Analysis and Synthesis
5
 *
6
 *   '$Author: $'
7
 *     '$Date: 2009-06-13 15:28:13 +0300  $'
8
 *
9
 * This program is free software; you can redistribute it and/or modify
10
 * it under the terms of the GNU General Public License as published by
11
 * the Free Software Foundation; either version 2 of the License, or
12
 * (at your option) any later version.
13
 *
14
 * This program is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17
 * GNU General Public License for more details.
18
 *
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program; if not, write to the Free Software
21
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
22
 */
23

  
24
package edu.ucsb.nceas.metacat.dataone;
25

  
26
import java.io.IOException;
27
import java.util.Date;
28

  
29
import javax.servlet.http.HttpServletRequest;
30
import javax.servlet.http.HttpServletResponse;
31

  
32
import org.dataone.service.mn.MemberNodeHealth;
33
import org.dataone.service.types.Identifier;
34
import org.dataone.service.types.ObjectFormat;
35
import org.dataone.service.types.ObjectInfo;
36
import org.omg.CORBA.portable.OutputStream;
37

  
38
/**
39
 * @author berkley
40
 * Class to implement the HealthService API for DataONE
41
 */
42
public class HealthService implements MemberNodeHealth
43
{    
44
    HttpServletRequest request;
45
    HttpServletResponse response;
46
    
47
    /**
48
     * Constructor
49
     * @param request
50
     * @param response
51
     */
52
    public HealthService(HttpServletRequest request, HttpServletResponse response)
53
    {
54
        this.request = request;
55
        this.response = response;
56
    }
57
    
58
    /**
59
     * Implements /monitory/ping from 
60
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
61
     */
62
    public void ping()
63
    {
64
        response.setStatus(200);
65
        try
66
        {
67
            response.getOutputStream().write("OK".getBytes());
68
        }
69
        catch (IOException e)
70
        {
71
            System.out.println("ERROR getting ping response: " + e.getMessage());
72
            e.printStackTrace();
73
            response.setStatus(500);
74
        }
75
    }
76
    
77
    /**
78
     * implements /monitor/object from 
79
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
80
     */
81
    public void getObjectStatistics(boolean reportDaily, 
82
            Identifier guid, String url, ObjectFormat format, Date time)
83
    {
84
        response.setStatus(500);
85
        try
86
        {
87
            response.getOutputStream().write("getObjectStatistics Not Implemented".getBytes());
88
            response.getOutputStream().flush();
89
        }
90
        catch (IOException e)
91
        {
92
            System.out.println("Error in getObjectStatistics: " + e.getMessage());
93
            e.printStackTrace();
94
        }
95
        
96
    }
97
    
98
    /**
99
     * implements /monitor/event from
100
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
101
     */
102
    public void getOperationStatistics(boolean reportDaily, Identifier pid, 
103
            ObjectFormat format, Date createDate, Date eventTime, String ipAddress, String event)
104
    {
105
        response.setStatus(500);
106
        try
107
        {
108
            response.getOutputStream().write("getOperationStatistics Not Implemented".getBytes());
109
            response.getOutputStream().flush();
110
        }
111
        catch (IOException e)
112
        {
113
            System.out.println("Error in getOperationStatistics: " + e.getMessage());
114
            e.printStackTrace();
115
        }
116
    }
117
    
118
    /**
119
     * Implements /monitor/status from
120
     * http://mule1.dataone.org/ArchitectureDocs-current/apis/REST_interface.html#get-monitor-object
121
     * This method is mostly unimplemented.  Right now it just does what ping does.
122
     * It should be updated in the future to return status information such as 
123
     * pending outages, software updates, etc.  See Use Case 10 for more 
124
     * info.
125
     */
126
    public void getStatus()
127
    {
128
        ping();
129
    }
130
}
test/edu/ucsb/nceas/metacat/dataone/MockCNode.java
27 27
import org.dataone.service.exceptions.NotFound;
28 28
import org.dataone.service.exceptions.NotImplemented;
29 29
import org.dataone.service.exceptions.ServiceFailure;
30
import org.dataone.service.types.Identifier;
31
import org.dataone.service.types.Session;
32
import org.dataone.service.types.SystemMetadata;
30
import org.dataone.service.types.v1.Identifier;
31
import org.dataone.service.types.v1.Session;
32
import org.dataone.service.types.v1.SystemMetadata;
33 33

  
34 34
/**
35 35
 * MockCNode mimics a DataONE Coordinating Node, and should be used only for testing
test/edu/ucsb/nceas/metacat/dataone/MNodeServiceTest.java
52 52
import org.dataone.service.exceptions.ServiceFailure;
53 53
import org.dataone.service.exceptions.SynchronizationFailed;
54 54
import org.dataone.service.exceptions.UnsupportedType;
55
import org.dataone.service.types.AccessPolicy;
56
import org.dataone.service.types.AccessRule;
57
import org.dataone.service.types.Checksum;
58
import org.dataone.service.types.DescribeResponse;
59
import org.dataone.service.types.Event;
60
import org.dataone.service.types.Identifier;
61
import org.dataone.service.types.Log;
62
import org.dataone.service.types.MonitorList;
63
import org.dataone.service.types.Node;
64
import org.dataone.service.types.NodeReference;
65
import org.dataone.service.types.ObjectFormat;
66
import org.dataone.service.types.ObjectFormatIdentifier;
67
import org.dataone.service.types.ObjectList;
68
import org.dataone.service.types.Permission;
69
import org.dataone.service.types.Session;
70
import org.dataone.service.types.Subject;
71
import org.dataone.service.types.SystemMetadata;
55
import org.dataone.service.types.v1.AccessPolicy;
56
import org.dataone.service.types.v1.AccessRule;
57
import org.dataone.service.types.v1.Checksum;
58
import org.dataone.service.types.v1.DescribeResponse;
59
import org.dataone.service.types.v1.Event;
60
import org.dataone.service.types.v1.Identifier;
61
import org.dataone.service.types.v1.Log;
62
import org.dataone.service.types.v1.MonitorList;
63
import org.dataone.service.types.v1.Node;
64
import org.dataone.service.types.v1.NodeReference;
65
import org.dataone.service.types.v1.ObjectFormat;
66
import org.dataone.service.types.v1.ObjectFormatIdentifier;
67
import org.dataone.service.types.v1.ObjectList;
68
import org.dataone.service.types.v1.Permission;
69
import org.dataone.service.types.v1.Session;
70
import org.dataone.service.types.v1.Subject;
71
import org.dataone.service.types.v1.SystemMetadata;
72 72
import org.junit.After;
73 73
import org.junit.Before;
74 74

  
......
414 414
        MNodeService.getInstance().getSystemMetadata(session, updatedPid);
415 415

  
416 416
      assertEquals(updatedPid.getValue(), newPid.getValue());
417
      assertTrue(updatedSysMeta.getObsolete(0).getValue().equals(pid.getValue()));
418
      assertTrue(updatedSysMeta.getDerivedFrom(0).getValue().equals(pid.getValue()));        
417
//      assertTrue(updatedSysMeta.getObsolete(0).getValue().equals(pid.getValue()));
418
//      assertTrue(updatedSysMeta.getDerivedFrom(0).getValue().equals(pid.getValue()));        
419 419
      
420 420
    } catch (UnsupportedEncodingException e) {
421 421
      e.printStackTrace();
......
756 756
        // pretend the sync failed
757 757
      SynchronizationFailed syncFailed = 
758 758
        new SynchronizationFailed("0000", "Testing Synch Failure");
759
      syncFailed.setPid(pid);
759
      syncFailed.setPid(pid.getValue());
760 760
      MNodeService.getInstance().synchronizationFailed(session, syncFailed );
761 761
    } catch (Exception e) {
762 762
      e.printStackTrace();
test/edu/ucsb/nceas/metacat/dataone/MetadataTypeRegisterTest.java
29 29

  
30 30
import org.dataone.client.ObjectFormatCache;
31 31
import org.dataone.service.exceptions.NotFound;
32
import org.dataone.service.types.ObjectFormat;
32
import org.dataone.service.types.v1.ObjectFormat;
33 33

  
34 34
import edu.ucsb.nceas.MCTestCase;
35 35

  
test/edu/ucsb/nceas/metacat/dataone/CNodeServiceTest.java
41 41
import org.dataone.service.exceptions.NotFound;
42 42
import org.dataone.service.exceptions.NotImplemented;
43 43
import org.dataone.service.exceptions.ServiceFailure;
44
import org.dataone.service.types.AccessPolicy;
45
import org.dataone.service.types.AccessRule;
46
import org.dataone.service.types.Checksum;
47
import org.dataone.service.types.Event;
48
import org.dataone.service.types.Identifier;
49
import org.dataone.service.types.Log;
50
import org.dataone.service.types.NodeReference;
51
import org.dataone.service.types.ObjectFormat;
52
import org.dataone.service.types.ObjectFormatIdentifier;
53
import org.dataone.service.types.ObjectFormatList;
54
import org.dataone.service.types.ObjectInfo;
55
import org.dataone.service.types.ObjectList;
56
import org.dataone.service.types.Permission;
57
import org.dataone.service.types.Replica;
58
import org.dataone.service.types.ReplicationPolicy;
59
import org.dataone.service.types.ReplicationStatus;
60
import org.dataone.service.types.Session;
61
import org.dataone.service.types.Subject;
62
import org.dataone.service.types.SystemMetadata;
44
import org.dataone.service.types.v1.AccessPolicy;
45
import org.dataone.service.types.v1.AccessRule;
46
import org.dataone.service.types.v1.Checksum;
47
import org.dataone.service.types.v1.Event;
48
import org.dataone.service.types.v1.Identifier;
49
import org.dataone.service.types.v1.Log;
50
import org.dataone.service.types.v1.NodeReference;
51
import org.dataone.service.types.v1.ObjectFormat;
52
import org.dataone.service.types.v1.ObjectFormatIdentifier;
53
import org.dataone.service.types.v1.ObjectFormatList;
54
import org.dataone.service.types.v1.ObjectInfo;
55
import org.dataone.service.types.v1.ObjectList;
56
import org.dataone.service.types.v1.Permission;
57
import org.dataone.service.types.v1.Replica;
58
import org.dataone.service.types.v1.ReplicationPolicy;
59
import org.dataone.service.types.v1.ReplicationStatus;
60
import org.dataone.service.types.v1.Session;
61
import org.dataone.service.types.v1.Subject;
62
import org.dataone.service.types.v1.SystemMetadata;
63 63

  
64 64
/**
65 65
 * A JUnit test for testing the dataone CNCore implementation
......
218 218
			SystemMetadata sysmeta = createSystemMetadata(guid, session.getSubject(), null);
219 219
			Identifier describePid = new Identifier();
220 220
			describePid.setValue("describePid." + System.currentTimeMillis());
221
			sysmeta.addDescribe(describePid);
221
			//sysmeta.addDescribe(describePid);
222 222
			// save it
223 223
			boolean result = CNodeService.getInstance().registerSystemMetadata(session, guid, sysmeta);
224 224
			assertTrue(result);
test/edu/ucsb/nceas/metacat/dataone/D1NodeServiceTest.java
38 38
import org.apache.commons.io.IOUtils;
39 39
import org.dataone.client.ObjectFormatCache;
40 40
import org.dataone.service.Constants;
41
import org.dataone.service.impl.ObjectFormatServiceImpl;
42
import org.dataone.service.types.AccessPolicy;
43
import org.dataone.service.types.AccessRule;
44
import org.dataone.service.types.Checksum;
45
import org.dataone.service.types.ChecksumAlgorithm;
46
import org.dataone.service.types.Identifier;
47
import org.dataone.service.types.NodeReference;
48
import org.dataone.service.types.ObjectFormatList;
49
import org.dataone.service.types.Permission;
50
import org.dataone.service.types.Session;
51
import org.dataone.service.types.Subject;
52
import org.dataone.service.types.SystemMetadata;
41
import org.dataone.service.types.v1.util.ObjectFormatServiceImpl;
42
import org.dataone.service.types.v1.AccessPolicy;
43
import org.dataone.service.types.v1.AccessRule;
44
import org.dataone.service.types.v1.Checksum;
45
import org.dataone.service.types.v1.ChecksumAlgorithm;
46
import org.dataone.service.types.v1.Identifier;
47
import org.dataone.service.types.v1.NodeReference;
48
import org.dataone.service.types.v1.ObjectFormatList;
49
import org.dataone.service.types.v1.Permission;
50
import org.dataone.service.types.v1.Session;
51
import org.dataone.service.types.v1.Subject;
52
import org.dataone.service.types.v1.SystemMetadata;
53 53
import org.dataone.service.types.util.ServiceTypeUtil;
54 54

  
55 55
import edu.ucsb.nceas.MCTestCase;
src/edu/ucsb/nceas/metacat/restservice/MNResourceHandler.java
57 57
import org.dataone.service.exceptions.ServiceFailure;
58 58
import org.dataone.service.exceptions.SynchronizationFailed;
59 59
import org.dataone.service.exceptions.UnsupportedType;
60
import org.dataone.service.types.AccessPolicy;
61
import org.dataone.service.types.Checksum;
62
import org.dataone.service.types.DescribeResponse;
63
import org.dataone.service.types.Event;
64
import org.dataone.service.types.Identifier;
65
import org.dataone.service.types.Log;
66
import org.dataone.service.types.MonitorList;
67
import org.dataone.service.types.Node;
68
import org.dataone.service.types.NodeList;
69
import org.dataone.service.types.NodeReference;
70
import org.dataone.service.types.ObjectFormat;
71
import org.dataone.service.types.ObjectFormatIdentifier;
72
import org.dataone.service.types.ObjectList;
73
import org.dataone.service.types.Permission;
74
import org.dataone.service.types.Subject;
75
import org.dataone.service.types.SystemMetadata;
60
import org.dataone.service.types.v1.AccessPolicy;
61
import org.dataone.service.types.v1.Checksum;
62
import org.dataone.service.types.v1.DescribeResponse;
63
import org.dataone.service.types.v1.Event;
64
import org.dataone.service.types.v1.Identifier;
65
import org.dataone.service.types.v1.Log;
66
import org.dataone.service.types.v1.MonitorList;
67
import org.dataone.service.types.v1.Node;
68
import org.dataone.service.types.v1.NodeList;
69
import org.dataone.service.types.v1.NodeReference;
70
import org.dataone.service.types.v1.ObjectFormat;
71
import org.dataone.service.types.v1.ObjectFormatIdentifier;
72
import org.dataone.service.types.v1.ObjectList;
73
import org.dataone.service.types.v1.Permission;
74
import org.dataone.service.types.v1.Subject;
75
import org.dataone.service.types.v1.SystemMetadata;
76 76
import org.jibx.runtime.JiBXException;
77 77

  
78 78
import edu.ucsb.nceas.metacat.dataone.MNodeService;
src/edu/ucsb/nceas/metacat/restservice/ResourceHandler.java
68 68
import org.dataone.service.exceptions.NotImplemented;
69 69
import org.dataone.service.exceptions.ServiceFailure;
70 70
import org.dataone.service.exceptions.UnsupportedType;
71
import org.dataone.service.types.AccessPolicy;
72
import org.dataone.service.types.Checksum;
73
import org.dataone.service.types.DescribeResponse;
74
import org.dataone.service.types.Event;
75
import org.dataone.service.types.Identifier;
76
import org.dataone.service.types.Log;
77
import org.dataone.service.types.Node;
78
import org.dataone.service.types.NodeList;
79
import org.dataone.service.types.NodeReference;
80
import org.dataone.service.types.NodeType;
81
import org.dataone.service.types.ObjectFormat;
82
import org.dataone.service.types.ObjectFormatIdentifier;
83
import org.dataone.service.types.ObjectFormatList;
84
import org.dataone.service.types.ObjectList;
85
import org.dataone.service.types.Service;
86
import org.dataone.service.types.Services;
87
import org.dataone.service.types.Session;
88
import org.dataone.service.types.SystemMetadata;
71
import org.dataone.service.types.v1.AccessPolicy;
72
import org.dataone.service.types.v1.Checksum;
73
import org.dataone.service.types.v1.DescribeResponse;
74
import org.dataone.service.types.v1.Event;
75
import org.dataone.service.types.v1.Identifier;
76
import org.dataone.service.types.v1.Log;
77
import org.dataone.service.types.v1.Node;
78
import org.dataone.service.types.v1.NodeList;
79
import org.dataone.service.types.v1.NodeReference;
80
import org.dataone.service.types.v1.NodeType;
81
import org.dataone.service.types.v1.ObjectFormat;
82
import org.dataone.service.types.v1.ObjectFormatIdentifier;
83
import org.dataone.service.types.v1.ObjectFormatList;
84
import org.dataone.service.types.v1.ObjectList;
85
import org.dataone.service.types.v1.Service;
86
import org.dataone.service.types.v1.Services;
87
import org.dataone.service.types.v1.Session;
88
import org.dataone.service.types.v1.SystemMetadata;
89
import org.dataone.service.types.v1.util.ChecksumUtil;
89 90
import org.dataone.service.types.util.ServiceTypeUtil;
90 91
import org.jibx.runtime.BindingDirectory;
91 92
import org.jibx.runtime.IBindingFactory;
......
95 96
import edu.ucsb.nceas.metacat.DBUtil;
96 97
import edu.ucsb.nceas.metacat.IdentifierManager;
97 98
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
98
import edu.ucsb.nceas.metacat.MetaCatServlet;
99 99
import edu.ucsb.nceas.metacat.MetacatHandler;
100 100
import edu.ucsb.nceas.metacat.dataone.CNodeService;
101
import edu.ucsb.nceas.metacat.dataone.HealthService;
102 101
import edu.ucsb.nceas.metacat.dataone.MNodeService;
103 102
import edu.ucsb.nceas.metacat.properties.PropertyService;
104 103
import edu.ucsb.nceas.metacat.service.SessionService;
......
574 573
                        System.out.println("verb is GET");
575 574
                        System.out.println("pathInfo is " + pathInfo);
576 575
                        pathInfo = pathInfo.substring(1);
577
                        HealthService hs = new HealthService(request, response);
578
                        if (pathInfo.toLowerCase().equals("ping")) {
579
                            System.out.println("processing ping request");
580
                            hs.ping();
581
                        } else if (pathInfo.toLowerCase().equals("status")) {
582
                            System.out.println("processing status request");
583
                            hs.getStatus();
584
                        } else if (pathInfo.toLowerCase().equals("object")) {
585
                            System.out.println("processing object request");
586
                            boolean day = false;
587
                            Identifier pid = null;
588
                            String url = null;
589
                            ObjectFormat of = null;
590
                            Date time = null;
591
                            
592
                            if(params.containsKey("day"))
593
                            {
594
                               day = true; 
595
                            }
596
                            if(params.containsKey("pid"))
597
                            {
598
                                String id = params.get("pid")[0];
599
                                pid = new Identifier();
600
                                pid.setValue(id);
601
                            }
602
                            if(params.containsKey("url"))
603
                            {
604
                                url = params.get("url")[0];
605
                            }
606
                            if(params.containsKey("format"))
607
                            {
608
                                String format = params.get("format")[0];
609
                                of = ObjectFormatCache.getInstance().getFormat(format);
610
                            }
611
                            if(params.containsKey("time"))
612
                            {
613
                                String t = params.get("time")[0];
614
                                time = dateFormat.parse(t);
615
                            }
616
                            
617
                            hs.getObjectStatistics(day, pid, url, of, time);
618
                        } else if (pathInfo.toLowerCase().equals("event")) {
619
                            System.out.println("processing event request");
620
                            boolean day = false;
621
                            Identifier pid = null;
622
                            Date created = null;
623
                            ObjectFormat of = null;
624
                            Date time = null;
625
                            String ipAddress = null;
626
                            String event = null;
627
                            
628
                            if(params.containsKey("day"))
629
                            {
630
                               day = true; 
631
                            }
632
                            if(params.containsKey("pid"))
633
                            {
634
                                String id = params.get("pid")[0];
635
                                pid = new Identifier();
636
                                pid.setValue(id);
637
                            }
638
                            if(params.containsKey("created"))
639
                            {
640
                                String t = params.get("created")[0];
641
                                created = dateFormat.parse(t);
642
                            }
643
                            if(params.containsKey("format"))
644
                            {
645
                                String format = params.get("format")[0];
646
                                of = ObjectFormatCache.getInstance().getFormat(format);
647
                            }
648
                            if(params.containsKey("eventtime"))
649
                            {
650
                                String t = params.get("eventtime")[0];
651
                                time = dateFormat.parse(t);
652
                            }
653
                            if(params.containsKey("ip_address"))
654
                            {
655
                                ipAddress = params.get("ip_address")[0];
656
                            }
657
                            if(params.containsKey("event"))
658
                            {
659
                                event = params.get("event")[0];
660
                            }
661
                            
662
                            hs.getOperationStatistics(day, pid, of, created, time, ipAddress, event);
663
                        }
576
                        // removed HealthService - BRL 20110727
664 577
                    }
665 578
                    status = true;
666 579
                } else if(resource.equals(RESOURCE_REPLICATE)) {
......
782 695
            
783 696
            //verify checksum
784 697
            System.out.println("verifying checksum");
785
            Checksum sourceFileChecksum = ServiceTypeUtil.checksum(new FileInputStream(outputTmpFile), 
698
            Checksum sourceFileChecksum = ChecksumUtil.checksum(new FileInputStream(outputTmpFile), 
786 699
                    sm.getChecksum().getAlgorithm());
787 700
            
788 701
            String cs1 = sm.getChecksum().getValue();
src/edu/ucsb/nceas/metacat/restservice/CNResourceHandler.java
51 51
import org.dataone.service.exceptions.NotImplemented;
52 52
import org.dataone.service.exceptions.ServiceFailure;
53 53
import org.dataone.service.exceptions.UnsupportedType;
54
import org.dataone.service.types.AccessPolicy;
55
import org.dataone.service.types.Checksum;
56
import org.dataone.service.types.Event;
57
import org.dataone.service.types.Identifier;
58
import org.dataone.service.types.Log;
59
import org.dataone.service.types.ObjectFormat;
60
import org.dataone.service.types.ObjectFormatIdentifier;
61
import org.dataone.service.types.ObjectFormatList;
62
import org.dataone.service.types.ObjectLocationList;
63
import org.dataone.service.types.Permission;
64
import org.dataone.service.types.QueryType;
65
import org.dataone.service.types.Subject;
66
import org.dataone.service.types.SystemMetadata;
54
import org.dataone.service.types.v1.AccessPolicy;
55
import org.dataone.service.types.v1.Checksum;
56
import org.dataone.service.types.v1.Event;
57
import org.dataone.service.types.v1.Identifier;
58
import org.dataone.service.types.v1.Log;
59
import org.dataone.service.types.v1.ObjectFormat;
60
import org.dataone.service.types.v1.ObjectFormatIdentifier;
61
import org.dataone.service.types.v1.ObjectFormatList;
62
import org.dataone.service.types.v1.ObjectLocationList;
63
import org.dataone.service.types.v1.Permission;
64
import org.dataone.service.types.v1.QueryType;
65
import org.dataone.service.types.v1.Subject;
66
import org.dataone.service.types.v1.SystemMetadata;
67 67
import org.jibx.runtime.JiBXException;
68 68

  
69 69
import edu.ucsb.nceas.metacat.dataone.CNodeService;
src/edu/ucsb/nceas/metacat/restservice/D1ResourceHandler.java
54 54
import org.dataone.service.exceptions.BaseException;
55 55
import org.dataone.service.exceptions.InvalidRequest;
56 56
import org.dataone.service.exceptions.ServiceFailure;
57
import org.dataone.service.types.Session;
58
import org.dataone.service.types.SystemMetadata;
57
import org.dataone.service.types.v1.Session;
58
import org.dataone.service.types.v1.SystemMetadata;
59 59
import org.dataone.service.types.util.ServiceTypeUtil;
60 60
import org.jibx.runtime.JiBXException;
61 61

  
src/edu/ucsb/nceas/metacat/MetacatHandler.java
76 76
import org.dataone.client.ObjectFormatCache;
77 77
import org.dataone.service.exceptions.BaseException;
78 78
import org.dataone.service.exceptions.NotFound;
79
import org.dataone.service.types.Checksum;
80
import org.dataone.service.types.ChecksumAlgorithm;
81
import org.dataone.service.types.Identifier;
82
import org.dataone.service.types.NodeReference;
83
import org.dataone.service.types.ObjectFormat;
84
import org.dataone.service.types.Subject;
85
import org.dataone.service.types.SystemMetadata;
79
import org.dataone.service.types.v1.Checksum;
80
import org.dataone.service.types.v1.ChecksumAlgorithm;
81
import org.dataone.service.types.v1.Identifier;
82
import org.dataone.service.types.v1.NodeReference;
83
import org.dataone.service.types.v1.ObjectFormat;
84
import org.dataone.service.types.v1.Subject;
85
import org.dataone.service.types.v1.SystemMetadata;
86
import org.dataone.service.types.v1.util.ChecksumUtil;
86 87
import org.dataone.service.types.util.ServiceTypeUtil;
87 88
import org.ecoinformatics.datamanager.DataManager;
88 89
import org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface;
......
3667 3668
                      Identifier dataGuid = new Identifier();
3668 3669
                      dataGuid.setValue(dataGuidString);
3669 3670
                      
3670
                      // add describes into EML system metadata
3671
                      sysMeta.addDescribe(dataGuid);
3671
                      // TODO: add describes for ORE
3672
                      sysMeta.addResourceMap(null);
3673
                      
3672 3674

  
3673
                      // add describedBy sysmeta
3674
                      logMetacat.debug("Setting describedBy for " + dataGuid.getValue() + " to " + identifier.getValue());
3675
                      dataSysMeta.addDescribedBy(identifier);
3675
                      // TODO add describedBy sysmeta ORE
3676
                      //logMetacat.debug("Setting describedBy for " + dataGuid.getValue() + " to " + identifier.getValue());
3677
                      dataSysMeta.addResourceMap(null);
3676 3678
                      
3677 3679
                      // set object format
3678 3680
                      logMetacat.debug("Updating system metadata for " + dataGuid.getValue() + " to " + dataDocMimeType);
......
3738 3740
      //create the checksum
3739 3741
      inputStream = this.read(localId);
3740 3742
      ChecksumAlgorithm algorithm = ChecksumAlgorithm.convert("MD5");
3741
      Checksum checksum = ServiceTypeUtil.checksum(inputStream, algorithm);
3743
      Checksum checksum = ChecksumUtil.checksum(inputStream, algorithm);
3742 3744
      sysMeta.setChecksum(checksum);
3743 3745
      
3744 3746
      //set the size
src/edu/ucsb/nceas/metacat/util/MetacatPopulator.java
46 46
import org.dataone.client.ObjectFormatCache;
47 47
import org.dataone.client.auth.CertificateManager;
48 48
import org.dataone.service.exceptions.NotFound;
49
import org.dataone.service.types.AccessPolicy;
50
import org.dataone.service.types.AccessRule;
51
import org.dataone.service.types.Checksum;
52
import org.dataone.service.types.ChecksumAlgorithm;
53
import org.dataone.service.types.Identifier;
54
import org.dataone.service.types.NodeReference;
55
import org.dataone.service.types.ObjectFormat;
56
import org.dataone.service.types.Permission;
57
import org.dataone.service.types.Session;
58
import org.dataone.service.types.Subject;
59
import org.dataone.service.types.SystemMetadata;
49
import org.dataone.service.types.v1.AccessPolicy;
50
import org.dataone.service.types.v1.AccessRule;
51
import org.dataone.service.types.v1.Checksum;
52
import org.dataone.service.types.v1.ChecksumAlgorithm;
53
import org.dataone.service.types.v1.Identifier;
54
import org.dataone.service.types.v1.NodeReference;
55
import org.dataone.service.types.v1.ObjectFormat;
56
import org.dataone.service.types.v1.Permission;
57
import org.dataone.service.types.v1.Session;
58
import org.dataone.service.types.v1.Subject;
59
import org.dataone.service.types.v1.SystemMetadata;
60 60
import org.ecoinformatics.datamanager.DataManager;
61 61
import org.ecoinformatics.datamanager.database.DatabaseConnectionPoolInterface;
62 62
import org.ecoinformatics.datamanager.parser.DataPackage;
......
191 191
	                    did.setValue(dataDocLocalId);
192 192
	                    
193 193
	                    //add the desribeby to the eml's sysmeta
194
	                    System.out.println("adding describe for doc " + 
195
	                            sysmeta.getIdentifier().getValue() + " :" + did.getValue());
196
	                    sysmeta.addDescribe(did);
194
	                    // TODO Use ORE
195
//	                    System.out.println("adding describe for doc " + 
196
//	                            sysmeta.getIdentifier().getValue() + " :" + did.getValue());
197
//	                    sysmeta.addDescribe(did);
197 198
	                    
198 199
	                    //create sysmeta for the data doc                    
199 200
	                    SystemMetadata dataDocSysMeta = generateSystemMetadata(doc);
......
213 214
	                    checksum.setValue(checksum(dataDocIs));
214 215
	                    dataDocSysMeta.setChecksum(checksum);
215 216
	                    dataDocSysMeta.setSize(dataDocText.getBytes(MetaCatServlet.DEFAULT_ENCODING).length);
216
	                    dataDocSysMeta.addDescribedBy(sysmeta.getIdentifier());
217
	                    // TODO use ORE map
218
	                    //dataDocSysMeta.addDescribedBy(sysmeta.getIdentifier());
217 219
	                    boolean error = false;
218 220
	                    
219 221
	                    // create access policy
src/edu/ucsb/nceas/metacat/dataone/ObjectFormatService.java
28 28
import java.util.HashMap;
29 29

  
30 30
import org.apache.log4j.Logger;
31
import org.dataone.cn.batch.utils.TypeMarshaller;
31
import org.dataone.service.util.TypeMarshaller;
32 32
import org.dataone.service.exceptions.InsufficientResources;
33 33
import org.dataone.service.exceptions.InvalidRequest;
34 34
import org.dataone.service.exceptions.NotFound;
35 35
import org.dataone.service.exceptions.NotImplemented;
36 36
import org.dataone.service.exceptions.ServiceFailure;
37
import org.dataone.service.types.ObjectFormat;
38
import org.dataone.service.types.ObjectFormatIdentifier;
39
import org.dataone.service.types.ObjectFormatList;
37
import org.dataone.service.types.v1.ObjectFormat;
38
import org.dataone.service.types.v1.ObjectFormatIdentifier;
39
import org.dataone.service.types.v1.ObjectFormatList;
40 40
import org.jibx.runtime.JiBXException;
41 41

  
42 42
import edu.ucsb.nceas.metacat.DBUtil;
......
235 235
		}
236 236

  
237 237
		// index the object format list based on the format identifier string
238
		int listSize = objectFormatList.sizeObjectFormats();
238
		int listSize = objectFormatList.sizeObjectFormatList();
239 239

  
240 240
		for (int i = 0; i < listSize; i++) {
241 241

  
src/edu/ucsb/nceas/metacat/dataone/SystemMetadataManager.java
3 3
 */
4 4
package edu.ucsb.nceas.metacat.dataone;
5 5

  
6
import org.dataone.service.types.SystemMetadata;
6
import org.dataone.service.types.v1.SystemMetadata;
7 7

  
8 8
import edu.ucsb.nceas.metacat.IdentifierManager;
9 9
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
src/edu/ucsb/nceas/metacat/dataone/MNodeService.java
47 47
import org.dataone.service.exceptions.ServiceFailure;
48 48
import org.dataone.service.exceptions.SynchronizationFailed;
49 49
import org.dataone.service.exceptions.UnsupportedType;
50
import org.dataone.service.mn.tier1.MNCore;
51
import org.dataone.service.mn.tier1.MNRead;
52
import org.dataone.service.mn.tier2.MNAuthorization;
53
import org.dataone.service.mn.tier3.MNStorage;
54
import org.dataone.service.mn.tier4.MNReplication;
55
import org.dataone.service.types.Checksum;
56
import org.dataone.service.types.ChecksumAlgorithm;
57
import org.dataone.service.types.DescribeResponse;
58
import org.dataone.service.types.Event;
59
import org.dataone.service.types.Group;
60
import org.dataone.service.types.Identifier;
61
import org.dataone.service.types.Log;
62
import org.dataone.service.types.LogEntry;
63
import org.dataone.service.types.MonitorInfo;
64
import org.dataone.service.types.MonitorList;
65
import org.dataone.service.types.Node;
66
import org.dataone.service.types.NodeHealth;
67
import org.dataone.service.types.NodeReference;
68
import org.dataone.service.types.NodeState;
69
import org.dataone.service.types.NodeType;
70
import org.dataone.service.types.ObjectFormat;
71
import org.dataone.service.types.ObjectFormatIdentifier;
72
import org.dataone.service.types.ObjectList;
73
import org.dataone.service.types.Permission;
74
import org.dataone.service.types.Ping;
75
import org.dataone.service.types.Schedule;
76
import org.dataone.service.types.Service;
77
import org.dataone.service.types.Services;
78
import org.dataone.service.types.Session;
79
import org.dataone.service.types.Status;
80
import org.dataone.service.types.Subject;
81
import org.dataone.service.types.Synchronization;
82
import org.dataone.service.types.SystemMetadata;
50
import org.dataone.service.mn.tier1.v1.MNCore;
51
import org.dataone.service.mn.tier1.v1.MNRead;
52
import org.dataone.service.mn.tier2.v1.MNAuthorization;
53
import org.dataone.service.mn.tier3.v1.MNStorage;
54
import org.dataone.service.mn.tier4.v1.MNReplication;
55
import org.dataone.service.types.v1.Checksum;
56
import org.dataone.service.types.v1.ChecksumAlgorithm;
57
import org.dataone.service.types.v1.DescribeResponse;
58
import org.dataone.service.types.v1.Event;
59
import org.dataone.service.types.v1.Group;
60
import org.dataone.service.types.v1.Identifier;
61
import org.dataone.service.types.v1.Log;
62
import org.dataone.service.types.v1.LogEntry;
63
import org.dataone.service.types.v1.MonitorInfo;
64
import org.dataone.service.types.v1.MonitorList;
65
import org.dataone.service.types.v1.Node;
66
import org.dataone.service.types.v1.NodeHealth;
67
import org.dataone.service.types.v1.NodeReference;
68
import org.dataone.service.types.v1.NodeState;
69
import org.dataone.service.types.v1.NodeType;
70
import org.dataone.service.types.v1.ObjectFormat;
71
import org.dataone.service.types.v1.ObjectFormatIdentifier;
72
import org.dataone.service.types.v1.ObjectList;
73
import org.dataone.service.types.v1.Permission;
74
import org.dataone.service.types.v1.Ping;
75
import org.dataone.service.types.v1.Schedule;
76
import org.dataone.service.types.v1.Service;
77
import org.dataone.service.types.v1.Services;
78
import org.dataone.service.types.v1.Session;
79
import org.dataone.service.types.v1.Status;
80
import org.dataone.service.types.v1.Subject;
81
import org.dataone.service.types.v1.Synchronization;
82
import org.dataone.service.types.v1.SystemMetadata;
83
import org.dataone.service.types.v1.util.ChecksumUtil;
83 84
import org.dataone.service.types.util.ServiceTypeUtil;
84 85

  
85 86
import edu.ucsb.nceas.metacat.DocumentImpl;
......
313 314
      SystemMetadata existingSysMeta = getSystemMetadata(session, pid);
314 315
      
315 316
      // add the newPid to the obsoletedBy list for the existing sysmeta
316
      existingSysMeta.addObsoletedBy(newPid);
317
      existingSysMeta.setObsoletedBy(newPid);
317 318
      
318 319
      // then update the existing system metadata
319 320
      updateSystemMetadata(existingSysMeta);
320 321
            
321 322
      // prep the new system metadata, add pid to the affected lists
322
      sysmeta.addObsolete(pid);
323
      sysmeta.addDerivedFrom(pid);
323
      sysmeta.setObsoletes(pid);
324
      //sysmeta.addDerivedFrom(pid);
324 325

  
325 326
      // and insert the new system metadata
326 327
      insertSystemMetadata(sysmeta);
......
553 554
    
554 555
    try {
555 556
      checksum = 
556
        ServiceTypeUtil.checksum(inputStream, ChecksumAlgorithm.convert(algorithm));
557
    	  ChecksumUtil.checksum(inputStream, ChecksumAlgorithm.convert(algorithm));
557 558
    
558 559
    } catch (NoSuchAlgorithmException e) {
559 560
      throw new ServiceFailure("1410", "The checksum for the object specified by " + 
......
936 937
    String localId;
937 938
    
938 939
    try {
939
      localId = IdentifierManager.getInstance().getLocalId(syncFailed.getPid().getValue());
940
      localId = IdentifierManager.getInstance().getLocalId(syncFailed.getPid());
940 941
    } catch (McdbDocNotFoundException e) {
941 942
      throw new ServiceFailure("2161", "The identifier specified by " +
942
          syncFailed.getPid().getValue() + 
943
          syncFailed.getPid() + 
943 944
          " was not found on this node.");
944 945
      
945 946
    }
946 947
    // TODO: update the CN URL below when the CNRead.SynchronizationFailed
947 948
    // method is changed to include the URL as a parameter
948 949
    logMetacat.debug("Synchronization for the object identified by " +
949
      syncFailed.getPid().getValue() + 
950
      syncFailed.getPid() + 
950 951
      " failed from " +
951 952
      "CN URL WILL GO HERE." +
952 953
      " Logging the event to the Metacat EventLog as a 'syncFailed' event.");
src/edu/ucsb/nceas/metacat/dataone/MetadataTypeRegister.java
28 28
import edu.ucsb.nceas.metacat.properties.*;
29 29

  
30 30
import org.apache.log4j.Logger;
31
import org.dataone.service.types.*;
31
import org.dataone.service.types.v1.*;
32 32

  
33 33
import edu.ucsb.nceas.metacat.properties.PropertyService;
34 34
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
src/edu/ucsb/nceas/metacat/dataone/CNodeService.java
27 27
import java.util.List;
28 28

  
29 29
import org.apache.log4j.Logger;
30
import org.dataone.service.cn.CNAuthorization;
31
import org.dataone.service.cn.CNCore;
32
import org.dataone.service.cn.CNRead;
33
import org.dataone.service.cn.CNReplication;
30
import org.dataone.service.cn.v1.CNAuthorization;
31
import org.dataone.service.cn.v1.CNCore;
32
import org.dataone.service.cn.v1.CNRead;
33
import org.dataone.service.cn.v1.CNReplication;
34 34
import org.dataone.service.exceptions.IdentifierNotUnique;
35 35
import org.dataone.service.exceptions.InsufficientResources;
36 36
import org.dataone.service.exceptions.InvalidRequest;
......
40 40
import org.dataone.service.exceptions.NotFound;
41 41
import org.dataone.service.exceptions.NotImplemented;
42 42
import org.dataone.service.exceptions.ServiceFailure;
43
import org.dataone.service.types.Checksum;
44
import org.dataone.service.types.Identifier;
45
import org.dataone.service.types.NodeList;
46
import org.dataone.service.types.ObjectFormat;
47
import org.dataone.service.types.ObjectFormatIdentifier;
48
import org.dataone.service.types.ObjectFormatList;
49
import org.dataone.service.types.ObjectList;
50
import org.dataone.service.types.ObjectLocationList;
51
import org.dataone.service.types.Permission;
52
import org.dataone.service.types.QueryType;
53
import org.dataone.service.types.Replica;
54
import org.dataone.service.types.ReplicationPolicy;
55
import org.dataone.service.types.ReplicationStatus;
56
import org.dataone.service.types.Session;
57
import org.dataone.service.types.Subject;
58
import org.dataone.service.types.SystemMetadata;
43
import org.dataone.service.types.v1.Checksum;
44
import org.dataone.service.types.v1.Identifier;
45
import org.dataone.service.types.v1.NodeList;
46
import org.dataone.service.types.v1.ObjectFormat;
47
import org.dataone.service.types.v1.ObjectFormatIdentifier;
48
import org.dataone.service.types.v1.ObjectFormatList;
49
import org.dataone.service.types.v1.ObjectList;
50
import org.dataone.service.types.v1.ObjectLocationList;
51
import org.dataone.service.types.v1.Permission;
52
import org.dataone.service.types.v1.QueryType;
53
import org.dataone.service.types.v1.Replica;
54
import org.dataone.service.types.v1.ReplicationPolicy;
55
import org.dataone.service.types.v1.ReplicationStatus;
56
import org.dataone.service.types.v1.Session;
57
import org.dataone.service.types.v1.Subject;
58
import org.dataone.service.types.v1.SystemMetadata;
59 59

  
60 60
import edu.ucsb.nceas.metacat.EventLog;
61 61
import edu.ucsb.nceas.metacat.IdentifierManager;
......
247 247
		}
248 248
				
249 249
		// check relationships
250
		// TODO: make this more strongly typed?
250
		// TODO: use ORE map
251 251
		if (relationship.equalsIgnoreCase("describes")) {
252
			for (Identifier pid: systemMetadata.getDescribeList()) {
253
				if (pid.getValue().equals(pidOfObject.getValue())) {
254
					return true;
255
				}
256
			}
257
			//return systemMetadata.getDescribeList().contains(pidOfObject);
252
			
258 253
		}
259 254
		if (relationship.equalsIgnoreCase("describedBy")) {
260
			for (Identifier pid: systemMetadata.getDescribedByList()) {
261
				if (pid.getValue().equals(pidOfObject.getValue())) {
262
					return true;
263
				}
264
			}
265
			//return systemMetadata.getDescribedByList().contains(pidOfObject);
255
			
266 256
		}
267 257
		if (relationship.equalsIgnoreCase("derivedFrom")) {
268
			for (Identifier pid: systemMetadata.getDerivedFromList()) {
269
				if (pid.getValue().equals(pidOfObject.getValue())) {
270
					return true;
271
				}
272
			}
273
			//return systemMetadata.getDerivedFromList().contains(pidOfObject);
258
			
274 259
		}
275 260
		if (relationship.equalsIgnoreCase("obsoletes")) {
276
			for (Identifier pid: systemMetadata.getObsoleteList()) {
277
				if (pid.getValue().equals(pidOfObject.getValue())) {
278
					return true;
279
				}
261
			Identifier pid = systemMetadata.getObsoletes();
262
			if (pid.getValue().equals(pidOfObject.getValue())) {
263
				return true;
280 264
			}
281 265
			//return systemMetadata.getObsoleteList().contains(pidOfObject);
282 266
		}
283 267
		if (relationship.equalsIgnoreCase("obsoletedBy")) {
284
			for (Identifier pid: systemMetadata.getObsoletedByList()) {
285
				if (pid.getValue().equals(pidOfObject.getValue())) {
286
					return true;
287
				}
268
			Identifier pid = systemMetadata.getObsoletedBy();
269
			if (pid.getValue().equals(pidOfObject.getValue())) {
270
				return true;
288 271
			}
289 272
			//return systemMetadata.getObsoletedByList().contains(pidOfObject);
290 273
		}
src/edu/ucsb/nceas/metacat/dataone/D1NodeService.java
55 55
import org.dataone.service.exceptions.NotImplemented;
56 56
import org.dataone.service.exceptions.ServiceFailure;
57 57
import org.dataone.service.exceptions.UnsupportedType;
58
import org.dataone.service.types.AccessPolicy;
59
import org.dataone.service.types.AccessRule;
60
import org.dataone.service.types.Event;
61
import org.dataone.service.types.Identifier;
62
import org.dataone.service.types.Group;
63
import org.dataone.service.types.Log;
64
import org.dataone.service.types.LogEntry;
65
import org.dataone.service.types.NodeReference;
66
import org.dataone.service.types.ObjectFormat;
67
import org.dataone.service.types.Permission;
68
import org.dataone.service.types.Person;
69
import org.dataone.service.types.Session;
70
import org.dataone.service.types.Subject;
71
import org.dataone.service.types.SubjectList;
72
import org.dataone.service.types.SystemMetadata;
58
import org.dataone.service.types.v1.AccessPolicy;
59
import org.dataone.service.types.v1.AccessRule;
60
import org.dataone.service.types.v1.Event;
61
import org.dataone.service.types.v1.Identifier;
62
import org.dataone.service.types.v1.Group;
63
import org.dataone.service.types.v1.Log;
64
import org.dataone.service.types.v1.LogEntry;
65
import org.dataone.service.types.v1.NodeReference;
66
import org.dataone.service.types.v1.ObjectFormat;
67
import org.dataone.service.types.v1.Permission;
68
import org.dataone.service.types.v1.Person;
69
import org.dataone.service.types.v1.Session;
70
import org.dataone.service.types.v1.Subject;
71
import org.dataone.service.types.v1.SubjectList;
72
import org.dataone.service.types.v1.SystemMetadata;
73 73

  
74 74
import edu.ucsb.nceas.metacat.AccessionNumberException;
75 75
import edu.ucsb.nceas.metacat.DocumentImpl;
src/edu/ucsb/nceas/metacat/admin/upgrade/GenerateSystemMetadata.java
40 40
import org.dataone.service.exceptions.NotImplemented;
41 41
import org.dataone.service.exceptions.ServiceFailure;
42 42
import org.dataone.service.types.AuthToken;
43
import org.dataone.service.types.SystemMetadata;
43
import org.dataone.service.types.v1.SystemMetadata;
44 44

  
45 45
import edu.ucsb.nceas.metacat.AccessionNumberException;
46 46
import edu.ucsb.nceas.metacat.IdentifierManager;
src/edu/ucsb/nceas/metacat/IdentifierManager.java
37 37
import org.apache.log4j.Logger;
38 38
import org.dataone.client.ObjectFormatCache;
39 39
import org.dataone.service.exceptions.NotFound;
40
import org.dataone.service.types.AccessPolicy;
41
import org.dataone.service.types.AccessRule;
42
import org.dataone.service.types.Checksum;
43
import org.dataone.service.types.ChecksumAlgorithm;
44
import org.dataone.service.types.Identifier;
45
import org.dataone.service.types.NodeReference;
46
import org.dataone.service.types.ObjectFormat;
47
import org.dataone.service.types.ObjectFormatIdentifier;
48
import org.dataone.service.types.ObjectInfo;
49
import org.dataone.service.types.ObjectList;
50
import org.dataone.service.types.Permission;
51
import org.dataone.service.types.Replica;
52
import org.dataone.service.types.ReplicationPolicy;
53
import org.dataone.service.types.ReplicationStatus;
54
import org.dataone.service.types.Session;
55
import org.dataone.service.types.Subject;
56
import org.dataone.service.types.SystemMetadata;
40
import org.dataone.service.types.v1.AccessPolicy;
41
import org.dataone.service.types.v1.AccessRule;
42
import org.dataone.service.types.v1.Checksum;
43
import org.dataone.service.types.v1.ChecksumAlgorithm;
44
import org.dataone.service.types.v1.Identifier;
45
import org.dataone.service.types.v1.NodeReference;
46
import org.dataone.service.types.v1.ObjectFormat;
47
import org.dataone.service.types.v1.ObjectFormatIdentifier;
48
import org.dataone.service.types.v1.ObjectInfo;
49
import org.dataone.service.types.v1.ObjectList;
50
import org.dataone.service.types.v1.Permission;
51
import org.dataone.service.types.v1.Replica;
52
import org.dataone.service.types.v1.ReplicationPolicy;
53
import org.dataone.service.types.v1.ReplicationStatus;
54
import org.dataone.service.types.v1.Session;
55
import org.dataone.service.types.v1.Subject;
56
import org.dataone.service.types.v1.SystemMetadata;
57 57

  
58 58
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlInterface;
59 59
import edu.ucsb.nceas.metacat.accesscontrol.XMLAccessAccess;
......
330 330
        }
331 331
        
332 332
        // look up provenance information
333
        sysMeta.setObsoleteList(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "obsoletes"));
334
        sysMeta.setObsoletedByList(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "obsoletedBy"));
335
        sysMeta.setDescribeList(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "describes"));
336
        sysMeta.setDescribedByList(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "describedBy"));
337
        sysMeta.setDerivedFromList(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "derivedFrom"));
333
        sysMeta.setObsoletes(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "obsoletes").get(0));
334
        sysMeta.setObsoletedBy(getSystemMetadataProvenance(sysMeta.getIdentifier().getValue(), "obsoletedBy").get(0));
338 335
        
339 336
        // look up replication policy
340 337
        ReplicationPolicy replicationPolicy = new ReplicationPolicy();
......
1233 1230
        
1234 1231
        // add provenance information
1235 1232
        String guid = sm.getIdentifier().getValue();
1236
        List<Identifier> idList = null;
1233
        Identifier id = null;
1237 1234
        List<String> targetGuids = null;
1238 1235
        String relationship = null;
1239 1236
        
1240 1237
        relationship = "obsoletedBy";
1241 1238
        targetGuids = new ArrayList<String>();
1242
        idList = sm.getObsoletedByList();
1243
        if (idList != null) {
1244
	        for (Identifier id: idList) {
1245
	        	targetGuids.add(id.getValue());
1246
	        }
1239
        id = sm.getObsoletedBy();
1240
        if (id != null) {
1241
	        targetGuids.add(id.getValue());
1247 1242
	        this.insertSystemMetadataProvenance(guid, relationship, targetGuids);
1248 1243
        }
1249 1244
        relationship = "obsoletes";
1250 1245
        targetGuids = new ArrayList<String>();
1251
        idList = sm.getObsoleteList();
1252
        if (idList != null) {
1253
	        for (Identifier id: idList) {
1254
	        	targetGuids.add(id.getValue());
1255
	        }
1246
        id = sm.getObsoletes();
1247
        if (id != null) {
1248
	        targetGuids.add(id.getValue());
1256 1249
	        this.insertSystemMetadataProvenance(guid, relationship, targetGuids);
1257 1250
        }
1258 1251
        
1252
        // TODO inspect the ORE map
1259 1253
        relationship = "describes";
1260
        targetGuids = new ArrayList<String>();
1261
        idList = sm.getDescribeList();
1262
        if (idList != null) {
1263
	        for (Identifier id: idList) {
1264
	        	targetGuids.add(id.getValue());
1265
	        }
1266
	        this.insertSystemMetadataProvenance(guid, relationship, targetGuids);
1267
        }
1268
        
1269
        relationship = "describedBy";
1270
        targetGuids = new ArrayList<String>();
1271
        idList = sm.getDescribedByList();
1272
        if (idList != null) {
1273
	        for (Identifier id: idList) {
1274
	        	targetGuids.add(id.getValue());
1275
	        }
1276
	        this.insertSystemMetadataProvenance(guid, relationship, targetGuids);
1277
        }
1278
        
1254
        relationship = "describedBy";        
1279 1255
        relationship = "derivedFrom";
1280
        targetGuids = new ArrayList<String>();
1281
        idList = sm.getDerivedFromList();
1282
        if (idList != null) {
1283
	        for (Identifier id: idList) {
1284
	        	targetGuids.add(id.getValue());
1285
	        }
1286
	        this.insertSystemMetadataProvenance(guid, relationship, targetGuids);
1287
        }
1288 1256
                
1289 1257
        // save replication policies
1290 1258
        if (replicationPolicy != null) {
src/edu/ucsb/nceas/metacat/replication/ReplicationHandler.java
54 54
import java.text.*;
55 55

  
56 56
import org.apache.log4j.Logger;
57
import org.dataone.service.types.SystemMetadata;
57
import org.dataone.service.types.v1.SystemMetadata;
58 58
import org.dataone.service.types.util.ServiceTypeUtil;
59 59
import org.xml.sax.ContentHandler;
60 60
import org.xml.sax.ErrorHandler;
src/edu/ucsb/nceas/metacat/replication/ReplicationService.java
57 57
import javax.servlet.http.HttpServletResponse;
58 58

  
59 59
import org.apache.log4j.Logger;
60
import org.dataone.service.types.SystemMetadata;
60
import org.dataone.service.types.v1.SystemMetadata;
61 61
import org.dataone.service.types.util.ServiceTypeUtil;
62 62
import org.xml.sax.InputSource;
63 63
import org.xml.sax.SAXException;

Also available in: Unified diff