Skip to Content.
Sympa Menu

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

Subject: perfsonar development work

List archive

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


Chronological Thread 
  • From:
  • To:
  • Subject: perfsonar: r5359 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/registration/summarization main/java/org/perfsonar/service/lookupservice/summarization main/java/org/perfsonar/service/utilities test/java/org/perfsonar/tests test/java/org/perfsonar/tests/summarization
  • Date: Mon, 30 Nov 2009 06:00:27 -0500

Author: trzaszcz
Date: 2009-11-30 06:00:27 -0500 (Mon, 30 Nov 2009)
New Revision: 5359

Added:

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

branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/summarization/

branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/summarization/SummarizationTests.java
Removed:

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

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/DomainSummarizator.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/IpTrieNode.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/TrieNode.java

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

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

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

branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/utilities/ResourceBundle.java
Log:
refactoring

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/DomainSummarizator.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/DomainSummarizator.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/DomainSummarizator.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -3,9 +3,15 @@
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
-
+/**
+ *
+ * builds domains summary
+ *
+ * @author Slawomir Trzaszczka
+ */
public class DomainSummarizator {

+ private final static int NUMBER_OF_SUBDOMAINS=3;

/**
* Do domains summarization. Returns new, summarized set of data
Input data
@@ -18,10 +24,9 @@

Set<String> summarizedData = new HashSet<String>();
for (String s : data) {
- getSubDomains(s, 3, summarizedData);
+ processSubDomains(s, NUMBER_OF_SUBDOMAINS,
summarizedData);
}
return summarizedData;
-
}

/**
@@ -35,13 +40,12 @@
* number of subdomains to be returned. Value -1 means
"all"
* @param list
* collection where results are to be added
- * @return updated Collection
*/
- private static Collection<String> getSubDomains(String domain, int
limit,
+ private static void processSubDomains(String domain, int limit,
Collection<String> list) {

if (domain == null)
- return null;
+ return;

int last = domain.length();

@@ -57,7 +61,6 @@
limit--;
}
}
- return list;
}

}

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

Modified:
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/IPAddress.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IPAddress.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -3,6 +3,8 @@
/**
* Summarization code
*
+ * Representation of the IP address
+ *
* @author swany
*
*/

Modified:
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/IpTrieNode.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/IpTrieNode.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -18,7 +18,7 @@
long childCount;

public IpTrieNode(TrieNode tnode, long position, long currentKey) {
- HelperClass helper = new HelperClass();
+ SummarizationHelper helper = new SummarizationHelper();
trieNode = tnode;
mask = Constants.MAX_KEY_LENGTH - position;
key = currentKey;

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


Property changes on:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/SummarizationHelper.java
___________________________________________________________________
Name: svn:executable
+ *

Modified:
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/SummarizeIpAddrs.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/SummarizeIpAddrs.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -22,7 +22,7 @@
* @param ipAddresses
* @return set of strings containing IP addresses/masks
*/
- public static HashSet<String> getSummary(Collection<String> ipAddresses)
{
+ public static Set<String> getSummary(Collection<String> ipAddresses) {

final TrieNode ROOTNODE = new TrieNode(-1, Constants.MAX_KEY_LENGTH);
Trie trie = new Trie(ROOTNODE);

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/TrieNode.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/TrieNode.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/registration/summarization/TrieNode.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -25,7 +25,7 @@

private TrieNode childOne;

- HelperClass helper = new HelperClass();
+ SummarizationHelper helper = new SummarizationHelper();

public void incrementChildCount() {
this.childCount++;

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/LSSummarySynchronizationAction.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -20,7 +20,7 @@
* iteration nr summarization process is executed only if exists any
* modifications
*
- * @author trzaszcz
+ * @author Slawomir Trzaszczka
*/
public class LSSummarySynchronizationAction extends Action implements
SchedulerAction {

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/ModificationCounterComponent.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -7,19 +7,17 @@
*
* Simple class which contains COUNTER which increase when something id DB
will be changed
*
- *
- * @author trzaszcz
- *
+ * @author Slawomir Trzaszczka
*/
public class ModificationCounterComponent extends Component{

private int counter=0;

- private Logger
logger=Logger.getLogger(ModificationCounterComponent.class);
+ private final Logger
logger=Logger.getLogger(ModificationCounterComponent.class);

@Override
public void destroy() throws PerfSONARException {
-
+ //do nothing
}

@Override

Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/lookupservice/summarization/SummarizationBuilder.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -174,6 +174,7 @@
try {
result = SummarizeIpAddrs.getSummary(ipAddresses);
} catch (Exception ex) {
+ //TODO: change exception !!
logger.warn("IP summarization failed. " + "Exception:
" + ex
+ " : " + ex.getMessage());
result = ipAddresses;
@@ -190,7 +191,6 @@
* @return
*/
private Set<String> summarizeDomains(Set<String> data) {
-
return DomainSummarizator.summarizeDomains(data);
}


Modified:
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/utilities/ResourceBundle.java
===================================================================
---
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/utilities/ResourceBundle.java
2009-11-27 14:49:19 UTC (rev 5358)
+++
branches/new-structure-with-base2/ps-mdm-ls/src/main/java/org/perfsonar/service/utilities/ResourceBundle.java
2009-11-30 11:00:27 UTC (rev 5359)
@@ -2,37 +2,57 @@

import java.text.MessageFormat;

+/**
+ *
+ * Provides oportunity to read messages from properties files
+ *
+ * @author Slawomir Trzaszczka
+ */
public class ResourceBundle {
-
- private final static String
resourcePath="org/perfsonar/resources/resources";
-
+
+ /**
+ * path to the resource file
+ */
+ private final static String RESOURCE_FILE_PATH =
"org/perfsonar/resources/resources";
+
private static ResourceBundle rb;
private final java.util.ResourceBundle resourceBundle;
private volatile MessageFormat messageFormat;
-
-
- private ResourceBundle(){
-
resourceBundle=java.util.ResourceBundle.getBundle(resourcePath);
- messageFormat=new MessageFormat("");
+
+ private ResourceBundle() {
+ resourceBundle =
java.util.ResourceBundle.getBundle(RESOURCE_FILE_PATH);
+ messageFormat = new MessageFormat("");
}
-
- public static ResourceBundle getInstance(){
- if(rb==null){
- rb=new ResourceBundle();
+
+ public static ResourceBundle getInstance() {
+ if (rb == null) {
+ rb = new ResourceBundle();
}
return rb;
}
-
- public String getString(String key){
+
+ /**
+ *
+ * gets simple string from resource file
+ *
+ * @param key
+ * @return
+ */
+ public String getString(String key) {
return resourceBundle.getString(key);
}
-
-
- public String getString(String key,Object params[]){
+
+ /**
+ *
+ * gets string message from resource file with params
+ *
+ * @param key
+ * @param params
+ * @return
+ */
+ public String getString(String key, Object params[]) {
messageFormat.applyPattern(resourceBundle.getString(key));
return messageFormat.format(params);
}
-
-
-
+
}

Added:
branches/new-structure-with-base2/ps-mdm-ls/src/test/java/org/perfsonar/tests/summarization/SummarizationTests.java



  • perfsonar: r5359 - in branches/new-structure-with-base2/ps-mdm-ls/src: main/java/org/perfsonar/service/lookupservice/registration/summarization main/java/org/perfsonar/service/lookupservice/summarization main/java/org/perfsonar/service/utilities test/java/org/perfsonar/tests test/java/org/perfsonar/tests/summarization, svnlog, 11/30/2009

Archive powered by MHonArc 2.6.16.

Top of Page