Project

General

Profile

« Previous | Next » 

Revision 6635

DataONE MN registration/configuration is now its own configuration page in the admin interface.
http://bugzilla.ecoinformatics.org/show_bug.cgi?id=5531

View differences:

PropertiesAdmin.java
263 263
					logMetacat.error(errorString);
264 264
					validationErrors.add(errorString);
265 265
				}
266

  
267
		        // Register as a DataONE Member Node
268
				registerDataONEMemberNode();
269 266
				
270 267
				// write the backup properties to a location outside the 
271 268
				// application directories so they will be available after
......
348 345
		return errorVector;
349 346
	}
350 347
	
351
	/**
352
	 * Register as a member node on the DataONE network.  The node description is
353
	 * retrieved from the getCapabilities() service, and so this should only be called
354
	 * after the properties have been properly set up in Metacat.
355
	 */
356
	private void registerDataONEMemberNode() {
357
        CNode cn;
358
        try {
359
            logMetacat.debug("Get the Node description.");
360
            Node node = MNodeService.getInstance(null).getCapabilities();
361
            logMetacat.debug("Setting client certificate location.");
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";
367
            CertificateManager.getInstance().setCertificateLocation(mnCertificatePath);
368
            cn = D1Client.getCN();
369
            logMetacat.debug("Registering node with DataONE. " + cn.getNodeBaseServiceUrl());
370
            // Session is null, because the libclient code automatically sets up an
371
            // SSL session for us using the client certificate provided
372
            Session session = null;
373
            NodeReference mnode = cn.register(session, node);
374
        } catch (ServiceFailure e) {
375
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
376
        } catch (NotImplemented e) {
377
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
378
        } catch (NotAuthorized e) {
379
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
380
        } catch (InvalidRequest e) {
381
            logMetacat.warn("Could not register as node with DataONE (" + e.getCode() + "/" + e.getDetail_code() + "): " + e.getDescription());
382
        } catch (IdentifierNotUnique e) {
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());
386
        }
387
	}
348

  
388 349
}

Also available in: Unified diff