perfsonar-dev - perfsonar: r5091 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
Subject: perfsonar development work
List archive
perfsonar: r5091 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
Chronological Thread
- From:
- To:
- Subject: perfsonar: r5091 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration
- Date: Tue, 17 Mar 2009 10:22:44 -0400
Author: mac
Date: 2009-03-17 10:22:43 -0400 (Tue, 17 Mar 2009)
New Revision: 5091
Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
Log:
registerEventType registration option support for registration to gLS
Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
2009-03-17 12:42:05 UTC (rev 5090)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
2009-03-17 14:22:43 UTC (rev 5091)
@@ -70,7 +70,7 @@
/**
* EventType name which is included in the metadata of LSRegisterRequest
message.
*/
- protected static final String REGISTRATION_EVENT_TYPE =
+ protected static final String DEFAULT_REGISTRATION_EVENT_TYPE =
"http://ogf.org/ns/nmwg/tools/org/perfsonar/service/lookup/registration/service/2.0";
/**
@@ -93,6 +93,8 @@
*/
protected RegisterDataSource dataSource = null;
+ protected String registrationEventType = DEFAULT_REGISTRATION_EVENT_TYPE;
+
/**
* Set of information about the service taken from the configuration.
*/
@@ -151,6 +153,7 @@
protected void init () throws PerfSONARException {
dataSource = getRegisterDataSource();
+ registrationEventType = getRegistrationEventType();
lookupInformation = getLookupInformation();
lsURLs = getLSAddresses();
@@ -261,7 +264,24 @@
}
+ /**
+ * get registerEventType option value. If not present, take default
+ * @return
+ */
+ private String getRegistrationEventType() {
+ try {
+ String evt = getOption("registerEventType").getValue();
+ if (evt != null) {
+ logger.debug("Found [registerEventType] option value
["+evt+"]");
+ return evt;
+ }
+ } catch (Exception ex) { }
+ logger.debug("Taking default [registerEventType] value
["+DEFAULT_REGISTRATION_EVENT_TYPE+"]");
+ return DEFAULT_REGISTRATION_EVENT_TYPE;
+ }
+
+
protected LookupInformation getLookupInformation() throws
PerfSONARException {
Configuration configuration =
ConfigurationManager.getInstance().getConfiguration();
@@ -405,7 +425,7 @@
message.setMetadata(metadata);
EventType eventType = new EventType();
- eventType.setEventType(REGISTRATION_EVENT_TYPE);
+ eventType.setEventType(registrationEventType);
metadata.setEventType(eventType);
Subject subject = new Subject("perfsonar");
@@ -417,9 +437,8 @@
subject.addChild(service);
Collection<String> keys = lookupInformation.getOptions().keySet();
- Element element = null;
for (String name: keys) {
- element = new Element(name, "psservice",
NMWGNamespaceFactory.getNamespace("psservice"));
+ Element element = new Element(name, "psservice",
NMWGNamespaceFactory.getNamespace("psservice"));
element.setText(lookupInformation.getOption(name).getValue());
service.addChild(element);
}
- perfsonar: r5091 - branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration, svnlog, 03/17/2009
Archive powered by MHonArc 2.6.16.