perfsonar-dev - [pS-dev] [GEANT/SA2/ps-java-services] r5966 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service: measurementArchive/rrdType measu rementArchive/rrdType/storage/exist measurementArchive/rrd Type/storage/exist/query measurementArchive/rrdType/storag e/persistence measurementArchive/rrdType/storage/rrd measu rementArchive/rrdType/storage/sql measurementArchive/rrdTy pe/storage/sql/query temp
Subject: perfsonar development work
List archive
[pS-dev] [GEANT/SA2/ps-java-services] r5966 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service: measurementArchive/rrdType measu rementArchive/rrdType/storage/exist measurementArchive/rrd Type/storage/exist/query measurementArchive/rrdType/storag e/persistence measurementArchive/rrdType/storage/rrd measu rementArchive/rrdType/storage/sql measurementArchive/rrdTy pe/storage/sql/query temp
Chronological Thread
- From:
- To:
- Subject: [pS-dev] [GEANT/SA2/ps-java-services] r5966 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service: measurementArchive/rrdType measu rementArchive/rrdType/storage/exist measurementArchive/rrd Type/storage/exist/query measurementArchive/rrdType/storag e/persistence measurementArchive/rrdType/storage/rrd measu rementArchive/rrdType/storage/sql measurementArchive/rrdTy pe/storage/sql/query temp
- Date: Tue, 21 Aug 2012 11:48:06 +0100 (BST)
Author: nordunet.behrmann
Date: 2012-08-21 11:48:06 +0100 (Tue, 21 Aug 2012)
New Revision: 5966
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/ExistMetadataStorageDAOImpl.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/query/InterfaceBasedQueryGenerator.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/query/QueryGenerator.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/ConnectionTester.java
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/FetchData.java
Log:
perfsonar-java-rrd-ma-SQL_backend: Fixed various minor coding style issues
- Remove unnecessary type casts
- Use StringBuilder rather than StringBuffer
- Don't nest string concatenation in StringBuilder.append calls
- Remove unnecessary semicolons
- Make fields final when possible
Fixed automatically by IntelliJ.
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/EchoServiceEngine.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -91,15 +91,15 @@
testResponses[2] =
xmldbSimpleTestAction(getNewEchoMessage("EchoRequest",
ECHO_XMLDB_CONTENT_TEST), "xmldb-content-test");
Message response = getNewEchoMessage("EchoResponse",
ECHO_SELF_TEST+"/1.0");
- Data responseData = (Data)
response.getDataCollection().iterator().next();
+ Data responseData = response.getDataCollection().iterator().next();
Metadata metadata = null;
Data data = null;
for (int i = 0; i < testResponses.length; i++) {
- metadata = (Metadata)
testResponses[i].getMetadataCollection().iterator().next();
- data = (Data)
testResponses[i].getDataCollection().iterator().next();
+ metadata =
testResponses[i].getMetadataCollection().iterator().next();
+ data = testResponses[i].getDataCollection().iterator().next();
metadata.setId(metadata.getId() + "_t" + i);
data.setId(data.getId() + "_t" + i);
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/MetadataKeyMessageHandler.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -238,10 +238,10 @@
*/
else if (messagePairs.size() == 1 &&
messagePairs.get(0).getResponse().getText() != null &&
messagePairs.get(0).getResponse().getElement() == null){
- StringBuffer responseText = new StringBuffer();
+ StringBuilder responseText = new StringBuilder();
String t =
messagePairs.get(0).getRequest().getElement().getAttribute("type");
String type = (t == null? "": t.replaceFirst("Request",
"Response"));
- responseText.append("<nmwg:message type=\"" + type + "\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">");
+ responseText.append("<nmwg:message
type=\"").append(type).append("\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">");
responseText.append(messagePairs.get(0).getResponse().getText());
responseText.append("</nmwg:message>");
messagePairs.get(0).getResponse().setText(responseText.toString());
@@ -267,10 +267,10 @@
* Bug 508 fixing - BEGIN
*/
//Prepare Message Text
- StringBuffer responseText = new StringBuffer();
+ StringBuilder responseText = new StringBuilder();
String t =
messagePairs.get(0).getRequest().getElement().getAttribute("type");
String type = (t == null? "": t.replaceFirst("Request",
"Response"));
- responseText.append("<nmwg:message type=\"" + type + "\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">");
+ responseText.append("<nmwg:message
type=\"").append(type).append("\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">");
//Concatenate Messages
int messageCounter = 0;
@@ -436,7 +436,7 @@
*/
public Map<String,Metadata> mergeAllMetadata(Map<String,Metadata>
metadatas) {
return metadatas;
- };
+ }
/**
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/SetupDataServiceEngine.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -136,7 +136,7 @@
metadataCounter = 0;
for (Metadata metadata : message.getMetadataMap().values()) {
metadataCounter++;
-
if(data.getMetadataIdRef().toString().trim().equals(metadata.getId().toString().trim())){
+
if(data.getMetadataIdRef().trim().equals(metadata.getId().trim())){
pairs.put(metadata, data);
}
}
@@ -163,15 +163,15 @@
metadata.getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/") == null ||
metadata.getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/").getFirstParameterValue("file")
== null){
- if( ((Data)pairs.get(metadata)).getKey() == null ||
-
((Data)pairs.get(metadata)).getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/")
== null ||
-
((Data)pairs.get(metadata)).getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/").getFirstParameterValue("file")
== null){
+ if( pairs.get(metadata).getKey() == null ||
+
pairs.get(metadata).getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/")
== null ||
+
pairs.get(metadata).getKey().getParameters("http://ggf.org/ns/nmwg/base/2.0/").getFirstParameterValue("file")
== null){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata, pairs.get(metadata));
continue;
}else{
-
metadata.setKey(((Data)pairs.get(metadata)).getKey());
+ metadata.setKey(pairs.get(metadata).getKey());
}
}
else{
@@ -179,23 +179,23 @@
Element interf =
metadata.getSubject().getFirstChild("interface");
if (interf != null) {
if(interf.getFirstChild("ifAddress") ==
null || interf.getFirstChild("ifAddress").getText().trim().equals("")){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata,
pairs.get(metadata));
continue;
}
if(interf.getFirstChild("hostName") == null
|| interf.getFirstChild("hostName").getText().trim().equals("")){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata,
pairs.get(metadata));
continue;
}
if(interf.getFirstChild("ifName") == null
|| interf.getFirstChild("ifName").getText().trim().equals("")){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata,
pairs.get(metadata));
continue;
}
if(interf.getFirstChild("direction") ==
null || interf.getFirstChild("direction").getText().trim().equals("")){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata,
pairs.get(metadata));
continue;
}
if(interf.getFirstChild("capacity") == null
|| interf.getFirstChild("capacity").getText().trim().equals("")){
- _pairs.put(metadata,
(Data)pairs.get(metadata));
+ _pairs.put(metadata,
pairs.get(metadata));
continue;
}
}else{
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/ExistMetadataStorageDAOImpl.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/ExistMetadataStorageDAOImpl.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/ExistMetadataStorageDAOImpl.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -215,7 +215,7 @@
sb = new StringBuffer();
String type = (request.getAttribute("type") == null? "":
request.getAttribute("type").replaceFirst("Request", "Response"));
- sb.append("<nmwg:message type=\"" + type + "\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\">");
+ sb.append("<nmwg:message type=\"").append(type).append("\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\">");
sb.append(result);
sb.append("</nmwg:message>");
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/query/InterfaceBasedQueryGenerator.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/query/InterfaceBasedQueryGenerator.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/exist/query/InterfaceBasedQueryGenerator.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -47,7 +47,7 @@
String capacity = null;
Metadata metadata =
- (Metadata) message.getMetadataCollection().iterator().next();
+ message.getMetadataCollection().iterator().next();
eventType = metadata.getFirstEventType().getEventType().trim();
Parameters parameters = metadata.getParameters();
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/persistence/MetadaKeyResponse.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -23,7 +23,7 @@
public String fetchMetadataMessage(Iterator<Interfaces> ifIterator)
throws PerfSONARException {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
Interfaces intf;
String eol = System.getProperty("line.separator");
@@ -60,44 +60,31 @@
throw new PerfSONARException("query_exception",
"EventType: " + intf.getEventType() + " is incorrect");
}
- StringBuffer metadata = new StringBuffer();
+ StringBuilder metadata = new StringBuilder();
try {
- metadata.append("<nmwg:metadata
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\" id=\""
- + intf.getMetadataId() + "\">" +
"\n");
+ metadata.append("<nmwg:metadata
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"").append(intf.getMetadataId()).append("\">").append("\n");
+ metadata.append("<").append(subject).append(":subject
xmlns:").append(subject).append("=\"").append(intf.getEventType()).append("/\"
id=\"").append(intf.getSubjId()).append("\">").append("\n");
metadata.append(
- "<"+subject+":subject
xmlns:"+subject+"=\""+intf.getEventType()+"/\" id=\""
- + intf.getSubjId() + "\">" + "\n");
- metadata.append(
"<nmwgt:interface
xmlns:nmwgt=\"http://ggf.org/ns/nmwg/topology/2.0/\">"
+ "\n");
- metadata.append("<nmwgt:hostName>" +
intf.getHostName()
- + "</nmwgt:hostName>" + "\n");
+
metadata.append("<nmwgt:hostName>").append(intf.getHostName()).append("</nmwgt:hostName>").append("\n");
//ifAddresType is optional
if(intf.getIfAddressType() == null)
intf.setIfAddressType("");
- metadata.append("<nmwgt:ifAddress
type=\""+intf.getIfAddressType()+"\">"
- + intf.getIfAddress() +
"</nmwgt:ifAddress>" + "\n");
- metadata.append(
- "<nmwgt:ifName>" + intf.getIfName() +
"</nmwgt:ifName>"
- + "\n");
- metadata.append("<nmwgt:ifDescription>"
- + intf.getIfDescription() +
"</nmwgt:ifDescription>"
- + "\n");
- metadata.append("<nmwgt:direction>"
- + intf.getDirection() +
"</nmwgt:direction>" + "\n");
- metadata.append("<nmwgt:capacity>" +
intf.getCapacity()
- + "</nmwgt:capacity>" + "\n");
+ metadata.append("<nmwgt:ifAddress
type=\"").append(intf.getIfAddressType()).append("\">").append(intf.getIfAddress()).append("</nmwgt:ifAddress>").append("\n");
+
metadata.append("<nmwgt:ifName>").append(intf.getIfName()).append("</nmwgt:ifName>").append("\n");
+
metadata.append("<nmwgt:ifDescription>").append(intf.getIfDescription()).append("</nmwgt:ifDescription>").append("\n");
+
metadata.append("<nmwgt:direction>").append(intf.getDirection()).append("</nmwgt:direction>").append("\n");
+
metadata.append("<nmwgt:capacity>").append(intf.getCapacity()).append("</nmwgt:capacity>").append("\n");
metadata.append("<nmwgt:authRealm></nmwgt:authRealm>"
+ "\n");
metadata.append("</nmwgt:interface>" + "\n");
- metadata.append("</"+subject+":subject>" + "\n");
- metadata.append(
-
"<nmwg:eventType>"+intf.getEventType()+"</nmwg:eventType>"
- + "\n");
+
metadata.append("</").append(subject).append(":subject>").append("\n");
+
metadata.append("<nmwg:eventType>").append(intf.getEventType()).append("</nmwg:eventType>").append("\n");
if(intf.getKeyword() != null &&
!intf.getKeyword().trim().equals("")){
metadata.append("<parameters
id=\"params1\">\n");
- metadata.append("<parameter
name=\"keyword\">"+intf.getKeyword()+"</parameter>");
+ metadata.append("<parameter
name=\"keyword\">").append(intf.getKeyword()).append("</parameter>");
metadata.append("</parameters>");
}
metadata.append("</nmwg:metadata>");
@@ -116,16 +103,16 @@
public String fetchDataRowNmwg(Interfaces intf) throws
PerfSONARException {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
try {
- sb.append( "<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"data"+intf.getMetadataId().trim() + "\" metadataIdRef=\"" +
intf.getMetadataId().trim() +"\">" + "\n");
+ sb.append("<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"data").append(intf.getMetadataId().trim()).append("\"
metadataIdRef=\"").append(intf.getMetadataId().trim()).append("\">").append("\n");
sb.append("<nmwg:key>" + "\n");
sb.append("<nmwg:parameters>"+ "\n");
- sb.append("<nmwg:parameter name=\"file\">"+
intf.getFile().trim()+ "</nmwg:parameter>" + "\n");
- sb.append("<nmwg:parameter name=\"dataSource\">"+
intf.getDataSource().trim()+"</nmwg:parameter>"+ "\n");
- sb.append("<nmwg:parameter name=\"valueUnits\">"+
intf.getValueUnits().trim()+"</nmwg:parameter>" + "\n");
- sb.append("<nmwg:parameter name=\"eventType\">"+
intf.getEventType().trim() +"</nmwg:parameter>"+ "\n");
+ sb.append("<nmwg:parameter
name=\"file\">").append(intf.getFile().trim()).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSource\">").append(intf.getDataSource().trim()).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"valueUnits\">").append(intf.getValueUnits().trim()).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"eventType\">").append(intf.getEventType().trim()).append("</nmwg:parameter>").append("\n");
} catch (Exception e) {
@@ -137,19 +124,19 @@
//Optional parameters of RRD file
if(intf.getDataSource() == null)
intf.setDataSource("");
- sb.append("<nmwg:parameter name=\"dataSourceStep\">"+
intf.getDataSource().trim()+"</nmwg:parameter>"+ "\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceStep\">").append(intf.getDataSource().trim()).append("</nmwg:parameter>").append("\n");
if(intf.getDataSourceType() == null)
intf.setDataSourceType("");
- sb.append("<nmwg:parameter name=\"dataSourceType\">"+
intf.getDataSourceType().trim()+"</nmwg:parameter>" + "\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceType\">").append(intf.getDataSourceType().trim()).append("</nmwg:parameter>").append("\n");
if(intf.getEventType() == null)
intf.setEventType("");
- sb.append("<nmwg:parameter name=\"dataSourceHeartbeat\">"+
intf.getEventType().trim() +"</nmwg:parameter>"+ "\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceHeartbeat\">").append(intf.getEventType().trim()).append("</nmwg:parameter>").append("\n");
if(intf.getDataSourceMinValue() == null)
intf.setDataSourceMinValue("");
- sb.append("<nmwg:parameter name=\"dataSourceMinValue\">"+
intf.getDataSourceMinValue().trim()+"</nmwg:parameter>" + "\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceMinValue\">").append(intf.getDataSourceMinValue().trim()).append("</nmwg:parameter>").append("\n");
if(intf.getDataSourceMaxValue() == null)
intf.setDataSourceMaxValue("");
- sb.append("<nmwg:parameter
name=\"dataSourceMaxValue\">"+intf.getDataSourceMaxValue().trim()+"</nmwg:parameter>"
+ "\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceMaxValue\">").append(intf.getDataSourceMaxValue().trim()).append("</nmwg:parameter>").append("\n");
sb.append("</nmwg:parameters>"+ "\n");
sb.append("</nmwg:key>" + "\n");
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/rrd/RRDDataStorageDAOImpl.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -39,23 +39,23 @@
*
* @see Consolidation
*/
- public static String DEFAULT_CONSOLIDATION = CONSOLIDATION_AVERAGE;
+ public static final String DEFAULT_CONSOLIDATION = CONSOLIDATION_AVERAGE;
/**
* Default value for the resolution.
*/
- public static int DEFAULT_RESOLUTION = 300;
+ public static final int DEFAULT_RESOLUTION = 300;
/**
* Default value for start time parameter.
* Negative numbers are relative to the current time.
*/
- public static long DEFAULT_START = -86400;
+ public static final long DEFAULT_START = -86400;
/**
* Default value for end time parameter.
*/
- public static long DEFAULT_END = -1;
+ public static final long DEFAULT_END = -1;
// switches for RRDTool
public static final String FETCH = "fetch";
@@ -166,9 +166,12 @@
String _consolidationFunction = DEFAULT_CONSOLIDATION;
int _resolution = DEFAULT_RESOLUTION;
- try { _startTime = Long.parseLong(startTime); } catch (Exception ex)
{ ; }
- try { _endTime = Long.parseLong(endTime); } catch (Exception ex) { ;
}
- try { _resolution = Integer.parseInt(resolution); } catch
(Exception ex) { ; }
+ try { _startTime = Long.parseLong(startTime); } catch (Exception ex)
{
+ }
+ try { _endTime = Long.parseLong(endTime); } catch (Exception ex) {
+ }
+ try { _resolution = Integer.parseInt(resolution); } catch
(Exception ex) {
+ }
try {
if ( consolidationFunction.equals(CONSOLIDATION_AVERAGE) ||
@@ -179,7 +182,6 @@
_consolidationFunction = consolidationFunction;
} catch (Exception ex) {
- ;
}
try {
@@ -249,7 +251,7 @@
//Compose command string, e.g.:
//"fetch test.rrd AVERAGE --start -86000 --end 1200"
- StringBuffer cmd = new StringBuffer(FETCH);
+ StringBuilder cmd = new StringBuilder(FETCH);
cmd.append(SPACE);
cmd.append(filename);
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/MysqlMetadataStorageDAOImpl.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -33,7 +33,7 @@
protected EntityManager em;
- protected QueryGenerator qg = new QueryGenerator();
+ protected final QueryGenerator qg = new QueryGenerator();
@Override
public void destroy() throws PerfSONARException {
@@ -46,11 +46,11 @@
String DB_URI = ConfigurationManager.getInstance().
getConfiguration().getAuxiliaryComponent(MetadataStorageDAOFactory.METADATA_STORAGE_DAO_NAME).getOption("uri").getValue();
- String SCHEMA = (String)ConfigurationManager.getInstance().
+ String SCHEMA = ConfigurationManager.getInstance().
getConfiguration().getAuxiliaryComponent(MetadataStorageDAOFactory.METADATA_STORAGE_DAO_NAME).getOption("schema").getValue();
- String USERNAME = (String)ConfigurationManager.getInstance().
+ String USERNAME = ConfigurationManager.getInstance().
getConfiguration().getAuxiliaryComponent(MetadataStorageDAOFactory.METADATA_STORAGE_DAO_NAME).getOption("username").getValue();
- String PASSWORD = (String)ConfigurationManager.getInstance().
+ String PASSWORD = ConfigurationManager.getInstance().
getConfiguration().getAuxiliaryComponent(MetadataStorageDAOFactory.METADATA_STORAGE_DAO_NAME).getOption("password").getValue();
if(!DB_URI.endsWith("/"))
@@ -126,7 +126,7 @@
long t1 = System.currentTimeMillis();
checkMetadataCorectness((Message)request);
- Metadata metadata =
(Metadata)(((Message)request).getMetadataCollection().iterator().next());
+ Metadata metadata =
((Message)request).getMetadataCollection().iterator().next();
Query query = qg.getQuery(em, metadata, Interfaces.TABLE);
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/query/QueryGenerator.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/query/QueryGenerator.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/measurementArchive/rrdType/storage/sql/query/QueryGenerator.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -137,16 +137,16 @@
*/
protected Map<String, String> buildQuery(Map<String, String>
parametersMap, String tableName){
- StringBuffer sb = new StringBuffer();
- sb.append("select * from " + tableName + " where ");
+ StringBuilder sb = new StringBuilder();
+ sb.append("select * from ").append(tableName).append(" where
");
int i = 1;
for (String key : parametersMap.keySet()) {
if(i++ < parametersMap.size()){
- sb.append(key + " = :" + key + " AND ");
+ sb.append(key).append(" =
:").append(key).append(" AND ");
}
else{
- sb.append(key + " = :" + key + " ");
+ sb.append(key).append(" =
:").append(key).append(" ");
}
}
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/ConnectionTester.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/ConnectionTester.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/ConnectionTester.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -8,7 +8,9 @@
public class ConnectionTester {
public Connection conn;
- private String url, userName, password;
+ private final String url;
+ private final String userName;
+ private final String password;
public ConnectionTester(){
url = "jdbc:mysql://localhost:3306/rrd_sql_test600";
Modified:
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/FetchData.java
===================================================================
---
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/FetchData.java
2012-08-21 10:48:05 UTC (rev 5965)
+++
trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java/org/perfsonar/service/temp/FetchData.java
2012-08-21 10:48:06 UTC (rev 5966)
@@ -10,9 +10,9 @@
public class FetchData {
- ConnectionTester ct = new ConnectionTester();
+ final ConnectionTester ct = new ConnectionTester();
String resultXML = ""; // tutaj bedziemy budowac wynikowy xml message
- List<Metadata> metadataList = new ArrayList<Metadata>();
+ final List<Metadata> metadataList = new ArrayList<Metadata>();
List<Data> adataList = new ArrayList<Data>();
List<String> metadataStringList = new ArrayList<String>();
@@ -20,7 +20,7 @@
Statement statement;
public String MetadataContent;
- public Connection conn;
+ public final Connection conn;
public FetchData() {
ct.connect();
@@ -31,7 +31,7 @@
public void fetchMetadataMessage() {
ResultSet rs;
MetadataContent = "<nmwg:message type=\"MetadataKeyResponse\"
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
xmlns=\"http://ggf.org/ns/nmwg/base/2.0/\">\n";
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append(MetadataContent);
String metadataS = "";
String dataS = "";
@@ -161,19 +161,19 @@
public String fetchDataRowNmwg(ResultSet rs) {
String data ="";
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
try {
- sb.append( "<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\" id=\"" +
rs.getString("data_id") + "\" metadataIdRef=\"" +
rs.getString("metadataIdRef") +"\">" + "\n");
+ sb.append("<nmwg:data
xmlns:nmwg=\"http://ggf.org/ns/nmwg/base/2.0/\"
id=\"").append(rs.getString("data_id")).append("\"
metadataIdRef=\"").append(rs.getString("metadataIdRef")).append("\">").append("\n");
sb.append("<nmwg:key>" + "\n");
sb.append("<nmwg:parameters>"+ "\n");
- sb.append("<nmwg:parameter
name=\"file\">"+rs.getString("p_file") + "</nmwg:parameter>" + "\n");
- sb.append("<nmwg:parameter
name=\"dataSource\">"+rs.getString("p_dataSource")+"</nmwg:parameter>"+ "\n");
- sb.append("<nmwg:parameter
name=\"valueUnits\">"+rs.getString("p_valueUnits")+"</nmwg:parameter>" +
"\n");
- sb.append("<nmwg:parameter
name=\"eventType\">"+rs.getString("p_eventType")+"</nmwg:parameter>"+ "\n");
- sb.append("<nmwg:parameter
name=\"dataSourceStep\">"+rs.getString("p_dataSourceStep")+"</nmwg:parameter>"+
"\n");
- sb.append("<nmwg:parameter
name=\"dataSourceType\">"+rs.getString("p_dataSourceType")+"</nmwg:parameter>"
+ "\n");
- sb.append("<nmwg:parameter
name=\"dataSourceMinValue\">"+rs.getString("p_dataSourceMinValue")+"</nmwg:parameter>"
+ "\n");
- sb.append("<nmwg:parameter
name=\"dataSourceMaxValue\">"+rs.getString("p_dataSourceMaxValue")+"</nmwg:parameter>"
+ "\n");
+ sb.append("<nmwg:parameter
name=\"file\">").append(rs.getString("p_file")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSource\">").append(rs.getString("p_dataSource")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"valueUnits\">").append(rs.getString("p_valueUnits")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"eventType\">").append(rs.getString("p_eventType")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceStep\">").append(rs.getString("p_dataSourceStep")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceType\">").append(rs.getString("p_dataSourceType")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceMinValue\">").append(rs.getString("p_dataSourceMinValue")).append("</nmwg:parameter>").append("\n");
+ sb.append("<nmwg:parameter
name=\"dataSourceMaxValue\">").append(rs.getString("p_dataSourceMaxValue")).append("</nmwg:parameter>").append("\n");
sb.append("</nmwg:parameters>"+ "\n");
sb.append("</nmwg:key>" + "\n");
sb.append("</nmwg:data>"+ "\n");
- [pS-dev] [GEANT/SA2/ps-java-services] r5966 - in trunk/perfsonar-java-rrd-ma-SQL_backend/src/main/java /org/perfsonar/service: measurementArchive/rrdType measu rementArchive/rrdType/storage/exist measurementArchive/rrd Type/storage/exist/query measurementArchive/rrdType/storag e/persistence measurementArchive/rrdType/storage/rrd measu rementArchive/rrdType/storage/sql measurementArchive/rrdTy pe/storage/sql/query temp, svn-noreply, 08/21/2012
Archive powered by MHonArc 2.6.16.