Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r4479 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration

Subject: perfsonar development work

List archive

perfsonar: r4479 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r4479 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration
  • Date: Fri, 12 Sep 2008 07:20:24 -0400

Author: mac
Date: 2008-09-12 07:20:24 -0400 (Fri, 12 Sep 2008)
New Revision: 4479

Modified:

trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
Log:
Support for root.hints gLS-es list

Modified:
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
===================================================================
---
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
2008-09-11 14:15:45 UTC (rev 4478)
+++
trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration/LSRegistrationComponent.java
2008-09-12 11:20:24 UTC (rev 4479)
@@ -153,49 +153,46 @@

//initialize Registration
registrator.initRegistrator();
+ responseMessages.clear(); //clear content of array list.

- String lsURLs = configuration.getProperty("service.r.ls_url");
- if (lsURLs == null)
+ //register to either ls_url explicit URL or one taken from root
hints
+ String localLsUrls =
configuration.getProperty("service.r.ls_url");
+ String rootHints =
configuration.getProperty("service.r.root_hints");
+
+ //if no LS to register with throw exception
+ if ((localLsUrls == null)&&(rootHints == null))
throw new
PerfSONARException("error.lsregistration.no_ls_url");
-
+
logger.debug("LSRegistrationComponent.runAction: "
- + "register to LS [" + lsURLs + "]");
-
- // process all URLs - splitted by comma sign
- //
-
- responseMessages.clear(); //clear content of array list.
-
- String[] urls = lsURLs.split(",");
+ + "register to gLS-es");
+
+ //register to all explicit LSes from service.r.ls_url
+ ArrayList<String> urls = new ArrayList<String>();
+ LSListAddresses list = new LSListAddresses();
+ if (rootHints != null)
+ list.addFromString(urls, localLsUrls);
int i = 1;
for (String url : urls) {

- try {
+ logger.debug("LSRegistrationComponent send to [" + i + "/"
+ + urls.size() + "] url: [" + url + "]: ");
+ registerToLS(registrator, url);
+ i++;

- logger.debug("LSRegistrationComponent send to [" + i +
"/"
- + urls.length + "] url: [" + url + "]: ");
+ }

- // send registration request
- Message rspMsg = registrator.register(url);
- // store result
- responseMessages.add(rspMsg);
- i++;
+ //register to one of LSes from root.hints ( service.r.root_hints
prop.)
+ ArrayList<String> remoteUrls = new ArrayList<String>();
+ if (rootHints != null)
+ list.addFromMultipleURLs(remoteUrls, rootHints);
+ for (String url : remoteUrls) {

- } catch (Exception ex) {
- String errorMsg = "LSRegistrationComponent error
sending to [" + url + "]: " + ex.getClass().getName() + "->"+ ex.getMessage();
-
- StackTraceElement[] stack = ex.getStackTrace();
- if(stack!=null && stack.length > 0) {
- errorMsg += " at " + stack[0].getClassName()
+ ":" + stack[0].getLineNumber();
- }
-
- if(ex.getCause() != null) {
- errorMsg += " underlaying cause: " +
ex.getCause().getMessage();
- }
- logger.error(errorMsg);

- }
+ logger.debug("LSRegistrationComponent send to gLS url from
roots.hints: [" + url + "]: ");
+ if (registerToLS(registrator, url) == true)
+ break; //break after first success
+
}
-
+
} catch (PerfSONARException e) {
logger.error("LSRegistrationComponent.runAction: Error while
registration: "
+ e.getMessage());
@@ -203,6 +200,36 @@
}


+ protected boolean registerToLS(ServiceLSRegistrator registrator, String
url) {
+
+ try {
+
+ // send registration request
+ Message rspMsg = registrator.register(url);
+ // store result
+ responseMessages.add(rspMsg);
+ return true;
+
+ } catch (Exception ex) {
+ String errorMsg = "LSRegistrationComponent error sending to
[" + url + "]: " + ex.getClass().getName() + "->"+ ex.getMessage();
+
+ StackTraceElement[] stack = ex.getStackTrace();
+ if(stack!=null && stack.length > 0) {
+ errorMsg += " at " + stack[0].getClassName() + ":" +
stack[0].getLineNumber();
+ }
+
+ if(ex.getCause() != null) {
+ errorMsg += " underlaying cause: " +
ex.getCause().getMessage();
+ }
+ logger.error(errorMsg);
+ }
+ return false;
+
+ }
+
+
+
+
private ServiceContent getLSSummaryContent() {

return new LSSummaryServiceContent();
@@ -326,13 +353,4 @@
componentName = name;
}

-
- // ---------------------------------------------------------- test main()
- // method
- // TODO remove?
- public static void main(String[] args) throws Exception {
-
- AuxiliaryComponentManager.getInstance();
- }
-
} // LSRegistrationComponent



  • perfsonar: r4479 - trunk/perfsonar_base/src/main/java/org/perfsonar/service/base/registration, svnlog, 09/12/2008

Archive powered by MHonArc 2.6.16.

Top of Page