Project

General

Profile

« Previous | Next » 

Revision 6497

Added by Matt Jones over 12 years ago

Pull the certificate path for dataone certificates from the metacat properties file.

View differences:

lib/metacat.properties
489 489
dataone.coordinatingNodeBaseURL=http://cn-dev.test.dataone.org
490 490
dataone.memberNodeId=METACAT1
491 491
dataone.subject=CN=METACAT1, DC=dataone, DC=org
492
dataone.certpath=/etc/dataone/client/certs
492 493
dataone.nodeName=My Metacat Node
493 494
dataone.nodeType=mn
494 495
dataone.nodeDescription=A DataONE member node implemented in Metacat.
src/edu/ucsb/nceas/metacat/admin/PropertiesAdmin.java
26 26

  
27 27
package edu.ucsb.nceas.metacat.admin;
28 28

  
29
import java.io.File;
29 30
import java.util.Vector;
30 31

  
31 32
import javax.servlet.http.HttpServletRequest;
......
56 57
import edu.ucsb.nceas.utilities.FileUtil;
57 58
import edu.ucsb.nceas.utilities.GeneralPropertyException;
58 59
import edu.ucsb.nceas.utilities.PropertiesMetaData;
60
import edu.ucsb.nceas.utilities.PropertyNotFoundException;
59 61
import edu.ucsb.nceas.utilities.SortedProperties;
60 62
import edu.ucsb.nceas.utilities.UtilException;
61 63

  
......
354 356
	private void registerDataONEMemberNode() {
355 357
        CNode cn;
356 358
        try {
359
            logMetacat.debug("Get the Node description.");
360
            Node node = MNodeService.getInstance().getCapabilities();
357 361
            logMetacat.debug("Setting client certificate location.");
358
            String mnCertificatePath = "/etc/dataone/client/certs/DEMO01.pem";
362
            String certificatePath = PropertyService.getProperty("dataone.certpath");
363
            if (!certificatePath.endsWith(File.separator)) {
364
                certificatePath = certificatePath + File.separator;
365
            }
366
            String mnCertificatePath = certificatePath + node.getIdentifier().getValue() + ".pem";
359 367
            CertificateManager.getInstance().setCertificateLocation(mnCertificatePath);
360 368
            cn = D1Client.getCN();
361
            logMetacat.debug("Get the Node description.");
362
            Node node = MNodeService.getInstance().getCapabilities();
363 369
            logMetacat.debug("Registering node with DataONE.");
364 370
            // Session is null, because the libclient code automatically sets up an
365 371
            // SSL session for us using the client certificate provided
......
375 381
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
376 382
        } catch (IdentifierNotUnique e) {
377 383
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
384
        } catch (PropertyNotFoundException e) {
385
            logMetacat.warn("Could not find the location for client certificates: " + e.getMessage());
378 386
        }
379 387
	}
380 388
}

Also available in: Unified diff