Project

General

Profile

Revision 8202

use optional template for registering DOIs at a given target. https://projects.ecoinformatics.org/ecoinfo/issues/6092

View differences:

lib/metacat.properties
597 597
guid.ezid.username=apitest
598 598
guid.ezid.password=apitest
599 599
guid.ezid.baseurl=https://n2t.net/ezid/
600
# optional path for target. do not include hostname here. <IDENTIFIER> is replaced with real value
601
guid.ezid.uritemplate.metadata=/metacatui/#view/<IDENTIFIER>
602
#guid.ezid.uritemplate.data=
600 603
guid.ezid.doishoulder.1=doi:10.5072/FK2
601 604
#guid.ezid.doishoulder.1=doi:10.5072/FK2/KNB/
602 605
#guid.ezid.doishoulder.3=doi:10.5072/FK2/PISCO/
src/edu/ucsb/nceas/metacat/dataone/DOIService.java
59 59
import edu.ucsb.nceas.ezid.profile.InternalProfile;
60 60
import edu.ucsb.nceas.ezid.profile.InternalProfileValues;
61 61
import edu.ucsb.nceas.metacat.properties.PropertyService;
62
import edu.ucsb.nceas.metacat.util.SystemUtil;
62 63
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
63 64

  
64 65
/**
......
186 187
				
187 188
				// target (URL)
188 189
				String target = node.getBaseURL() + "/v1/object/" + identifier;
190
				String uriTemplate = null;
191
				String uriTemplateKey = "guid.ezid.uritemplate.data";
192
				ObjectFormat objectFormat = null;
193
				try {
194
					objectFormat = D1Client.getCN().getFormat(sysMeta.getFormatId());
195
				} catch (NotFound e1) {
196
					logMetacat.warn("Could not check format type for: " + sysMeta.getFormatId());
197
				}
198
				if (objectFormat != null && objectFormat.getFormatType().equals("METADATA")) {
199
					uriTemplateKey = "guid.ezid.uritemplate.metadata";
200
				}
201
				try {
202
					uriTemplate = PropertyService.getProperty(uriTemplateKey);
203
					target =  SystemUtil.getSecureContextURL() + uriTemplate.replaceAll("<IDENTIFIER>", identifier);
204
				} catch (PropertyNotFoundException e) {
205
					logMetacat.warn("No target URI template found in the configuration for: " + uriTemplateKey);
206
				}
189 207
				
190 208
				// status and export fields for public/protected data
191 209
				String status = InternalProfileValues.UNAVAILABLE.toString();

Also available in: Unified diff