Skip to Content.
Sympa Menu

perfsonar-dev - perfsonar: r5062 - in branches/new-structure-with-base2: ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler ps-mdm-base2/src/main/java/org/perfsonar/test ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization

Subject: perfsonar development work

List archive

perfsonar: r5062 - in branches/new-structure-with-base2: ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler ps-mdm-base2/src/main/java/org/perfsonar/test ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r5062 - in branches/new-structure-with-base2: ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler ps-mdm-base2/src/main/java/org/perfsonar/test ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization
  • Date: Thu, 12 Mar 2009 11:12:21 -0400

Author: mac
Date: 2009-03-12 11:12:20 -0400 (Thu, 12 Mar 2009)
New Revision: 5062

Added:

branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/FileTestServiceServiceEngine.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/DiscoveryRequestGenerator.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/Constants.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/HelperClass.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IPAddress.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IPAddressConvertor.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/InvalidIPAddressException.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IpTrie.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IpTrieNode.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/StringBufferUtilities.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/SummarizeIpAddrs.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/Trie.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/TrieNode.java
Removed:

branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/ExistDBRegisterDataSource.java
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/scheduler/SchedulingComponent.java

branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/test/ElementToJavaGenerator.java

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSDeregisterServiceEngine.java
Log:
Registration action for registration LS to gLS
Summarization


Deleted:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/ExistDBRegisterDataSource.java

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-12 15:09:41 UTC (rev 5061)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/LSRegistrationAction.java
2009-03-12 15:12:20 UTC (rev 5062)
@@ -4,37 +4,33 @@
*/
package org.perfsonar.base2.service.registration;

+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.net.URLConnection;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.log4j.Logger;
import org.perfsonar.base2.service.configuration.Action;
-import org.perfsonar.base2.service.configuration.LookupInformation;
import org.perfsonar.base2.service.configuration.Configuration;
import org.perfsonar.base2.service.configuration.ConfigurationManager;
-import org.perfsonar.base2.service.scheduler.SchedulerAction;
+import org.perfsonar.base2.service.configuration.LookupInformation;
import org.perfsonar.base2.service.exceptions.PerfSONARException;
import org.perfsonar.base2.service.requesthandler.ServiceMessage;
-
+import org.perfsonar.base2.service.scheduler.SchedulerAction;
import org.perfsonar.base2.xml.Element;
-import org.perfsonar.base2.xml.nmwg.Message;
-import org.perfsonar.base2.xml.nmwg.Metadata;
import org.perfsonar.base2.xml.nmwg.Data;
import org.perfsonar.base2.xml.nmwg.EventType;
-import org.perfsonar.base2.xml.nmwg.Subject;
-import org.perfsonar.base2.xml.nmwg.Key;
+import org.perfsonar.base2.xml.nmwg.Message;
+import org.perfsonar.base2.xml.nmwg.Metadata;
import org.perfsonar.base2.xml.nmwg.NMWGNamespaceFactory;
+import org.perfsonar.base2.xml.nmwg.Subject;

-import java.net.URL;
-import java.net.MalformedURLException;
-import java.util.List;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.io.BufferedReader;
-import java.io.InputStream;
-import java.io.InputStreamReader;
-import java.io.EOFException;
-import java.io.IOException;

-import org.apache.log4j.Logger;
-
-
public class LSRegistrationAction extends Action implements SchedulerAction {


@@ -163,7 +159,7 @@
return;
}

- ServiceMessage serviceRequestMessage = getLSRegsiterMessage();
+ ServiceMessage serviceRequestMessage = getLSRegisterMessage();
Message requestMessage = (Message)
serviceRequestMessage.getElement();

ServiceMessage[] serviceResponseMessage = new
ServiceMessage[lsURLs.length];
@@ -184,15 +180,16 @@
Element eventType = null;

if (responseMessage != null) {
- responseMetadata =
responseMessage.getChildren("metadata").iterator().next();
+ responseMetadata = responseMessage.getFirstChild("metadata");
if (responseMetadata != null) {
- eventType =
responseMetadata.getChildren("eventType").iterator().next();
+ eventType = responseMetadata.getFirstChild("eventType");
}
}
+
if (eventType != null) {
- if
(eventType.getText().trim().indexOf("success.ls.register") != -1) {
- lsKeys[i] =
responseMetadata.getChildren("key").iterator().next();
- } else if (eventType.getText().trim().indexOf("success.ls")
== -1) {
+ if (eventType.getText().trim().indexOf("success") != -1) {
+ lsKeys[i] = responseMetadata.getFirstChild("key");
+ } else {
lsKeys[i] = null;
try {
// in case of LSKeepaliveRequest failed
LsRegiserRequest should be sent
@@ -263,121 +260,88 @@

}

-
+ /**
+ * Get list of URLs to Lookup Services to register to.
+ * @return
+ * @throws PerfSONARException
+ */
protected URL[] getLSAddresses() throws PerfSONARException {

List<URL> list = new ArrayList<URL>();

- Collection<String> lsAddressNames = options.keySet();
- for (String lsAddressName : lsAddressNames) {
+ //get values from options lsAddress-1, lsAddress-2, lsAddress-3, ...
+ //and get LSes lists from URLs
+
+ for (String optName : options.keySet()) {

- if (lsAddressName.startsWith("lsAddress")) {
- URL url = null;
+ //handles lsAddress-1, lsAddress-2, lsAddress-3, ...
+ if (optName.startsWith("lsAddress")) {
+
try {
- url = new URL(getOption(lsAddressName).getValue());
+ URL url = new URL(getOption(optName).getValue());
+ list.add(url);
} catch (Exception ex) {
- logger.warn("Unable to convert LS address " +
lsAddressName + "into URL object");
- continue;
+ //MalformedURLException or NullPointerException
+ logger.warn("Unable to convert LS address [" + optName +
"] into URL object. Exception was: "+ex.getMessage());
}
- list.add(url);
+
+ //handles lsList-1, lsList-2, ...
+ } else if (optName.startsWith("lsList")) {
+
+ try {
+ String remoteResource = getOption(optName).getValue();
+ addLSAddressesFromURL(list, remoteResource);
+ } catch (Exception ex) {
+ //NullPointerException
+ logger.warn("Unable to read LS list from URL address ["
+ optName + "] into URL object. Exception was: "+ex.getMessage());
+ }
+
}
}

- // ls addresses fetched from remote file
- URL[] lsAddressesFromUrl = getLSAddressesFromURL();
- if (lsAddressesFromUrl != null) {
- for (int i = 0; i < lsAddressesFromUrl.length; i++)
- list.add(lsAddressesFromUrl[i]);
- }
-
+ //TODO: is the result code needed?
if (list.size() == 0)
throw new PerfSONARException(
"warning",
"No LS addresses");

- return ((URL[])list.toArray(new URL[list.size()]));
+ return list.toArray(new URL[list.size()]);

}

-
- protected URL[] getLSAddressesFromURL() throws PerfSONARException {
-
- Configuration configuration =
ConfigurationManager.getInstance().getConfiguration();
- String url = null;
- try {
- url =
configuration.getExtensionOption(REGISTER_LS_ADDRESSES_EXTENSION_NAME, "url");
- } catch (Exception ex ) {
- return null;
- }
- if (url != null)
- if (!url.trim().equals(""))
- return getLSAddressesFromURL(url);
- return null;
-
- }
-
-
- protected URL[] getLSAddressesFromURL(String url) {
-
- List<URL> list = new ArrayList<URL>();
- BufferedReader br = null;
-
- try {
-
- URL urlAdr = new URL(url);
- InputStream is = urlAdr.openStream();
- br = new BufferedReader(new InputStreamReader(is));
-
- } catch (MalformedURLException ex) {
- logger.error("Bad url of the file with ls addresses: "
- + url.toString());
- } catch (IOException ex) {
- logger.error("IO error while reading ls addresses from remote
file: "
- + ex.toString());
- }
-
- String s = null;
- boolean eof = false;
-
- while( !eof ) {
+
+ /**
+ * Populates urls collection with urls/lines downloaded from urlString
+ * @param urls
+ * @param urlString
+ * @throws MalformedURLException
+ * @throws IOException
+ */
+ public void addLSAddressesFromURL(Collection<URL> urls, String
urlString) throws MalformedURLException,IOException {
+
+ URL rootHintsUrl = new URL(urlString);
+ URLConnection rhc = rootHintsUrl.openConnection();
+ BufferedReader in = new BufferedReader(
+ new InputStreamReader(
+ rhc.getInputStream()));
+ String line;
+ while ((line = in.readLine()) != null) {
try {
- s = br.readLine();
- if ( s == null ) {
- //eof = true;
- br.close();
- break;
- } else if (s.trim().equals("")) {
- continue;
- } else if (s.trim().startsWith("#")) {
- continue;
- }
- } catch (EOFException e1) {
- //eof = true;
- //continue;
- break;
- } catch (IOException e2) {
- logger.warn("IO error: " + e2.getMessage());
- continue;
- }
+ String s = line.trim();
+ if ((s.length() > 0) && //not empty
+ (!s.startsWith("#")) && (!s.startsWith("//"))) { //not
commentary # or //

- URL lsUrl = null;
- try {
- lsUrl = new URL(s);
- list.add(lsUrl);
- } catch (MalformedURLException ex) {
- logger.warn("Bad url of ls address: " + url.toString());
- }
-
+ URL lsUrl = new URL(line);
+ urls.add(lsUrl); //so, add it!
+
+ }
+ } catch (RuntimeException rex) { /* just omit this line */ }
}
+ in.close();

- if (list.size() != 0)
- return ((URL[])list.toArray(new URL[list.size()]));
- else
- return null;
+ }

- }

-
protected LSRegistrator getLSRegistrator() throws PerfSONARException {

String className = getOption("registrator").getValue();
@@ -417,7 +381,7 @@
}


- protected ServiceMessage getLSRegsiterMessage() throws
PerfSONARException {
+ protected ServiceMessage getLSRegisterMessage() throws
PerfSONARException {

ServiceMessage serviceMessage = new ServiceMessage();


Copied:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
(from rev 5051,
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/ExistDBRegisterDataSource.java)


Property changes on:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration/MetadataExistDBRegisterDataSource.java
___________________________________________________________________
Name: svn:mergeinfo
+

Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
2009-03-12 15:09:41 UTC (rev 5061)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler/SchedulingComponent.java
2009-03-12 15:12:20 UTC (rev 5062)
@@ -149,7 +149,7 @@
//NullPointer if no option
//or
//NumberFormatException
- ex.printStackTrace();
+ logger.warn("Taking default ["+actionInterval+"] value
of action interval");
}
scheduler.addTask(actionInterval, (SchedulerAction) action);


Modified:
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/test/ElementToJavaGenerator.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/test/ElementToJavaGenerator.java
2009-03-12 15:09:41 UTC (rev 5061)
+++
branches/new-structure-with-base2/ps-mdm-base2/src/main/java/org/perfsonar/test/ElementToJavaGenerator.java
2009-03-12 15:12:20 UTC (rev 5062)
@@ -17,7 +17,7 @@
public static void main(String args[]) throws FileNotFoundException,
XMLStreamException {
StaxParser sp = new StaxParser();
Element e = sp.parse(new FileInputStream(
-
"/home/mac/projects/perfsonar/simple-service/samples/requests/LSControlRequest-join.xml"));
+ "/tmp/b.xml"));
ElementToJavaGenerator gen = new ElementToJavaGenerator();



Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/FileTestServiceServiceEngine.java

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSDeregisterServiceEngine.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSDeregisterServiceEngine.java
2009-03-12 15:09:41 UTC (rev 5061)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/LSDeregisterServiceEngine.java
2009-03-12 15:12:20 UTC (rev 5062)
@@ -6,7 +6,6 @@
import org.perfsonar.base2.service.util.ResultCodesUtil;
import org.perfsonar.base2.xml.nmwg.Message;
import org.perfsonar.base2.xml.nmwg.Metadata;
-import org.perfsonar.service.lookupservice.storage.LookupServiceDAO;


/**

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/DiscoveryRequestGenerator.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/LSSummaryRegisterDataSource.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/Constants.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/HelperClass.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IPAddress.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IPAddressConvertor.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/InvalidIPAddressException.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IpTrie.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IpTrieNode.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/StringBufferUtilities.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/SummarizeIpAddrs.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/Trie.java

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/TrieNode.java



  • perfsonar: r5062 - in branches/new-structure-with-base2: ps-mdm-base2/src/main/java/org/perfsonar/base2/service/registration ps-mdm-base2/src/main/java/org/perfsonar/base2/service/scheduler ps-mdm-base2/src/main/java/org/perfsonar/test ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization, svnlog, 03/12/2009

Archive powered by MHonArc 2.6.16.

Top of Page