Project

General

Profile

« Previous | Next » 

Revision 6708

use shared method for looking up "docInfo" map -- both in Metacat replication and in D1 system metadata generation

View differences:

ObjectPathMap.java
1 1
package edu.ucsb.nceas.metacat.dataone.hazelcast;
2 2

  
3
import java.io.IOException;
3 4
import java.util.Collection;
4 5
import java.util.Collections;
5 6
import java.util.HashSet;
......
9 10
import java.util.Set;
10 11

  
11 12
import org.dataone.service.types.v1.Identifier;
13
import org.jibx.runtime.JiBXException;
14
import org.xml.sax.SAXException;
12 15

  
13 16
import com.hazelcast.core.MapLoader;
14 17

  
15 18
import edu.ucsb.nceas.metacat.IdentifierManager;
16 19
import edu.ucsb.nceas.metacat.McdbDocNotFoundException;
20
import edu.ucsb.nceas.metacat.McdbException;
21
import edu.ucsb.nceas.metacat.accesscontrol.AccessControlException;
17 22
import edu.ucsb.nceas.metacat.properties.PropertyService;
23
import edu.ucsb.nceas.metacat.replication.ReplicationService;
24
import edu.ucsb.nceas.metacat.shared.HandlerException;
18 25
import edu.ucsb.nceas.metacat.shared.ServiceException;
19 26
import edu.ucsb.nceas.utilities.FileUtil;
20 27
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
......
62 69
	 * the data.  The doctype value for metadata can vary, but for data
63 70
	 * is always 'BIN', so using a simple if-then-else to separate
64 71
	 */
65
	private String pathToDocid(String localid) throws McdbDocNotFoundException  
72
	private String pathToDocid(String localid) throws AccessControlException, HandlerException, JiBXException, IOException, McdbException, SAXException  
66 73
	{	
67
		Hashtable<String, Object> ht = im.getDocumentInfo(localid);
74
		Hashtable<String, String> ht = ReplicationService.getDocumentInfoMap(localid);
68 75
		if (ht.get("doctype").equals("BIN")) {
69 76
			return dataPath + FileUtil.getFS() + localid;
70 77
		} else {
......
88 95
		try {
89 96
			docid = im.getLocalId(key.getValue());
90 97
			path = pathToDocid(docid);			
91
		} catch (McdbDocNotFoundException e) {
98
		} catch (Exception e) {
92 99
			// TODO Auto-generated catch block
93 100
			e.printStackTrace();
94 101
			return null;
......
112 119
				String docid = im.getLocalId(id.getValue());
113 120
				map.put(id, pathToDocid(docid));
114 121

  
115
			} catch (McdbDocNotFoundException e) {
122
			} catch (Exception e) {
116 123
				// TODO should the map load an empty path instead of
117 124
				// leaving out the entire entry?
118 125
				e.printStackTrace();

Also available in: Unified diff