You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@oodt.apache.org by ma...@apache.org on 2015/11/01 01:44:51 UTC
[01/12] oodt git commit: OODT-911 make code clearer
Repository: oodt
Updated Branches:
refs/heads/master d606af112 -> 35d3b2219
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
index 3694b74..7ec6643 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/XMLQuery.java
@@ -179,17 +179,29 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
mimeAccept = new ArrayList();
mimeAccept.add("*/*");
}
- if (keywordQuery == null) keywordQuery = "UNKNOWN";
+ if (keywordQuery == null) {
+ keywordQuery = "UNKNOWN";
+ }
// init query header (object attributes)
- if (id == null) id = "UNKNOWN";
- if (title == null) title = "UNKNOWN";
- if (desc == null) desc = "UNKNOWN";
- if (ddId == null) ddId = "UNKNOWN";
+ if (id == null) {
+ id = "UNKNOWN";
+ }
+ if (title == null) {
+ title = "UNKNOWN";
+ }
+ if (desc == null) {
+ desc = "UNKNOWN";
+ }
+ if (ddId == null) {
+ ddId = "UNKNOWN";
+ }
queryHeader = new QueryHeader(id, title, desc, /*type*/"QUERY", /*status*/"ACTIVE", /*security*/"UNKNOWN",
/*revision*/"1999-12-12 JSH V1.0 Under Development", ddId);
// init query attributes
- if (resultModeId == null) resultModeId = "ATTRIBUTE";
+ if (resultModeId == null) {
+ resultModeId = "ATTRIBUTE";
+ }
if (propType == null) {
propType = "BROADCAST";
propLevels = "N/A";
@@ -223,7 +235,9 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
* @param xmlQueryString The XML query structure in string format.
*/
public XMLQuery (String xmlQueryString) throws SAXException {
- if (xmlQueryString == null) xmlQueryString = BLANK;
+ if (xmlQueryString == null) {
+ xmlQueryString = BLANK;
+ }
try {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setCoalescing(false);
@@ -828,8 +842,9 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node n = children.item(i);
- if (n.getNodeType() == Node.ELEMENT_NODE)
- list.add(new QueryElement(n));
+ if (n.getNodeType() == Node.ELEMENT_NODE) {
+ list.add(new QueryElement(n));
+ }
}
}
@@ -854,8 +869,12 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof XMLQuery)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof XMLQuery)) {
+ return false;
+ }
XMLQuery obj = (XMLQuery) rhs;
return resultModeId.equals(obj.resultModeId) && propogationType.equals(obj.propogationType)
&& propogationLevels.equals(obj.propogationLevels) && maxResults == obj.maxResults
@@ -905,8 +924,9 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
XMLQuery q;
if (argv[0].equals("-expr")) {
StringBuilder expr = new StringBuilder();
- for (int i = 1; i < argv.length; ++i)
- expr.append(argv[i]).append(' ');
+ for (int i = 1; i < argv.length; ++i) {
+ expr.append(argv[i]).append(' ');
+ }
q = new XMLQuery(expr.toString().trim(), "expr1", "Command-line Expression Query",
"The expression for this query came from the command-line", /*ddId*/ null,
/*resultModeId*/ null, /*propType*/ null, /*propLevels*/ null, XMLQuery.DEFAULT_MAX_RESULTS);
@@ -914,11 +934,14 @@ public class XMLQuery implements java.io.Serializable, Cloneable {
BufferedReader reader = new BufferedReader(new FileReader(argv[1]));
StringBuilder str = new StringBuilder();
String line;
- while ((line = reader.readLine()) != null)
- str.append(line).append('\n');
+ while ((line = reader.readLine()) != null) {
+ str.append(line).append('\n');
+ }
reader.close();
q = new XMLQuery(str.toString());
- } else throw new IllegalStateException("Can't get here; only -expr or -file allowed, but got \"" + argv[0] + "\"");
+ } else {
+ throw new IllegalStateException("Can't get here; only -expr or -file allowed, but got \"" + argv[0] + "\"");
+ }
System.out.println("kwdQueryString: " + q.getKwdQueryString());
System.out.println("fromElementSet: " + q.getFromElementSet());
[06/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
index bd5551f..38094c6 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrClient.java
@@ -87,7 +87,9 @@ public class SolrClient {
LOG.info(response);
// commit changes ?
- if (commit) this.commit();
+ if (commit) {
+ this.commit();
+ }
LOG.info(response);
return response;
@@ -112,7 +114,9 @@ public class SolrClient {
// build POST request
String url = this.buildUpdateUrl();
- if (commit) url += "?commit=true";
+ if (commit) {
+ url += "?commit=true";
+ }
String message = "<delete><query>id:"+id+"</query></delete>";
// send POST request
@@ -240,7 +244,9 @@ public class SolrClient {
}
}
// request results in JSON format
- if (mimeType.equals(Parameters.MIME_TYPE_JSON)) nvps.add(new NameValuePair("wt", "json"));
+ if (mimeType.equals(Parameters.MIME_TYPE_JSON)) {
+ nvps.add(new NameValuePair("wt", "json"));
+ }
method.setQueryString( nvps.toArray( new NameValuePair[nvps.size()] ) );
LOG.info("GET url: "+url+" query string: "+method.getQueryString());
@@ -307,7 +313,12 @@ public class SolrClient {
} finally {
// must release the connection even if an exception occurred
method.releaseConnection();
- if (br!=null) try { br.close(); } catch (Exception ignored) {}
+ if (br!=null) {
+ try {
+ br.close();
+ } catch (Exception ignored) {
+ }
+ }
}
return response.toString();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
index 6f6bf9f..53cbedb 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/cli/action/IngestProductCliAction.java
@@ -93,8 +93,9 @@ public class IngestProductCliAction extends FileManagerCliAction {
List<String> uriRefs = Lists.newArrayList();
for (String ref : references) {
URI uri = URI.create(ref);
- if (!uri.getScheme().equals("stream"))
- throw new IllegalArgumentException("Streaming data must use 'stream' scheme not "+uri.getScheme());
+ if (!uri.getScheme().equals("stream")) {
+ throw new IllegalArgumentException("Streaming data must use 'stream' scheme not " + uri.getScheme());
+ }
uriRefs.add(uri.toString());
}
references = uriRefs;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java
index 66c8172..e873b8d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/RemoteDataTransferer.java
@@ -175,11 +175,13 @@ public class RemoteDataTransferer implements DataTransfer {
while (true) {
fileData = (byte[]) client.retrieveFile(
dataStoreFile.getAbsolutePath(), offset, 1024);
- if (fileData.length <= 0)
- break;
+ if (fileData.length <= 0) {
+ break;
+ }
fOut.write(fileData);
- if (fileData.length < 1024)
- break;
+ if (fileData.length < 1024) {
+ break;
+ }
offset += 1024;
}
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java
index f6a7944..95723bb 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/datatransfer/TransferStatusTracker.java
@@ -74,8 +74,9 @@ public class TransferStatusTracker {
if (transfers != null && transfers.size() > 0) {
return (FileTransferStatus) transfers.get(0);
- } else
+ } else {
return null;
+ }
}
public void transferringProduct(Product product) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
index dcdfa04..626be9a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/LocalCache.java
@@ -117,10 +117,11 @@ public class LocalCache implements Cache {
this.uniqueElementName = uniqueElementName;
this.uniqueElementProductTypeNames = uniqueElementProductTypeNames;
List<Product> products = new Vector<Product>();
- for (String productType : this.uniqueElementProductTypeNames)
+ for (String productType : this.uniqueElementProductTypeNames) {
products.addAll(getProductsOverDateRange(
this.rangeQueryElementName, productType, this.startOfQuery,
this.endOfQuery));
+ }
clear();
for (Product product : products) {
String value = getValueForMetadata(product, uniqueElementName);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java
index 828dea7..2ad6aef 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/ingest/StdIngester.java
@@ -172,8 +172,9 @@ public class StdIngester implements Ingester, CoreMetKeys {
// try and guess the structure
if (prodFile.isDirectory()) {
productStructure = Product.STRUCTURE_HIERARCHICAL;
- } else
+ } else {
productStructure = Product.STRUCTURE_FLAT;
+ }
}
// create the product
@@ -235,8 +236,9 @@ public class StdIngester implements Ingester, CoreMetKeys {
LOG.log(Level.WARNING, "Property: [" + propName
+ "] is not provided");
return false;
- } else
+ } else {
return true;
+ }
}
private void checkOrSetFileManager(URL url) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/FinalFileLocationExtractor.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/FinalFileLocationExtractor.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/FinalFileLocationExtractor.java
index 7e786e8..db66eb1 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/FinalFileLocationExtractor.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/metadata/extractors/examples/FinalFileLocationExtractor.java
@@ -101,8 +101,9 @@ public class FinalFileLocationExtractor extends AbstractFilemgrMetExtractor
}
private void scrubRefs(Product p) {
- if (p.getProductReferences() == null)
+ if (p.getProductReferences() == null) {
return;
+ }
for (Reference r : p.getProductReferences()) {
r.setDataStoreReference("");
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/BooleanQueryCriteria.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/BooleanQueryCriteria.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/BooleanQueryCriteria.java
index d76d0bc..bf19b42 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/BooleanQueryCriteria.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/BooleanQueryCriteria.java
@@ -160,17 +160,19 @@ public class BooleanQueryCriteria extends QueryCriteria {
*/
public String toString() {
String query = "";
- if (operator == AND)
+ if (operator == AND) {
query += "AND(";
- else if (operator == OR)
+ } else if (operator == OR) {
query += "OR(";
- else
+ } else {
query += "NOT(";
+ }
for (int i = 0; i < terms.size(); i++) {
query += ((QueryCriteria) terms.get(i)).toString();
- if (i < (terms.size() - 1))
+ if (i < (terms.size() - 1)) {
query += ", ";
+ }
}
query += ")";
return query;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/FreeTextQueryCriteria.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/FreeTextQueryCriteria.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/FreeTextQueryCriteria.java
index 5fc05e9..daf9fa3 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/FreeTextQueryCriteria.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/FreeTextQueryCriteria.java
@@ -125,8 +125,9 @@ public class FreeTextQueryCriteria extends QueryCriteria {
// filter noise words and add to values vector
while (tok.hasMoreElements()) {
token = tok.nextToken();
- if (!noiseWordHash.contains(token))
+ if (!noiseWordHash.contains(token)) {
values.add(token);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
index 242db6d..f857cbd 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Product.java
@@ -183,8 +183,9 @@ public class Product {
*/
public void setProductStructure(String productStructure) {
//Guard clause, according to a unit test null is a valid value
- if (!java.util.Arrays.asList(VALID_STRUCTURES).contains(productStructure) && productStructure != null)
- throw new IllegalArgumentException("Undefined product structure: "+productStructure);
+ if (!java.util.Arrays.asList(VALID_STRUCTURES).contains(productStructure) && productStructure != null) {
+ throw new IllegalArgumentException("Undefined product structure: " + productStructure);
+ }
this.productStructure = productStructure;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java
index 257d69a..4b9d552 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Query.java
@@ -49,10 +49,11 @@ public class Query {
* @param criteria
*/
public Query(List<QueryCriteria> criteria) {
- if (criteria == null)
+ if (criteria == null) {
this.criteria = new Vector<QueryCriteria>();
- else
+ } else {
this.criteria = criteria;
+ }
}
/**
@@ -67,8 +68,9 @@ public class Query {
* The criteria to set.
*/
public void setCriteria(List<QueryCriteria> criteria) {
- if (criteria != null)
+ if (criteria != null) {
this.criteria = criteria;
+ }
}
public void addCriterion(QueryCriteria qc) {
@@ -87,8 +89,9 @@ public class Query {
for (int i = 0; i < numCriteria; i++) {
QueryCriteria c = (QueryCriteria) criteria.get(i);
rStr.append(c.toString());
- if (i != numCriteria - 1)
+ if (i != numCriteria - 1) {
rStr.append(" AND ");
+ }
}
return rStr.toString();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
index 7e7c246..b041f5d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/Reference.java
@@ -209,7 +209,9 @@ public class Reference {
* the String name of the mimetype of this reference
*/
public void setMimeType(String name) {
- if(name == null || (name.equals(""))) return;
+ if(name == null || (name.equals(""))) {
+ return;
+ }
try {
this.mimeType = mimeTypeRepository.forName(name);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/ComplexQuery.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/ComplexQuery.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/ComplexQuery.java
index ee696e9..998b02c 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/ComplexQuery.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/ComplexQuery.java
@@ -65,8 +65,9 @@ public class ComplexQuery extends Query {
public void setReducedMetadata(List<String> reducedMetadata) {
this.reducedMetadata = reducedMetadata;
if (this.sortByMetKey != null && this.reducedMetadata != null
- && !this.reducedMetadata.contains(this.sortByMetKey))
+ && !this.reducedMetadata.contains(this.sortByMetKey)) {
this.reducedMetadata.add(this.sortByMetKey);
+ }
}
public QueryFilter getQueryFilter() {
@@ -84,8 +85,9 @@ public class ComplexQuery extends Query {
public void setSortByMetKey(String sortByMetKey) {
this.sortByMetKey = sortByMetKey;
if (this.reducedMetadata != null && this.sortByMetKey != null
- && !this.reducedMetadata.contains(this.sortByMetKey))
+ && !this.reducedMetadata.contains(this.sortByMetKey)) {
this.reducedMetadata.add(this.sortByMetKey);
+ }
}
public String getToStringResultFormat() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryFilter.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryFilter.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryFilter.java
index 0f38412..cf9e60a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryFilter.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryFilter.java
@@ -74,8 +74,9 @@ public class QueryFilter {
}
public void setFilterAlgor(FilterAlgor filterAlgor) {
- if (filterAlgor != null)
+ if (filterAlgor != null) {
this.filterAlgor = filterAlgor;
+ }
}
public VersionConverter getConverter() {
@@ -83,8 +84,9 @@ public class QueryFilter {
}
public void setConverter(VersionConverter converter) {
- if (converter != null)
+ if (converter != null) {
this.converter = converter;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
index 18c983c..190e6a5 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResult.java
@@ -76,46 +76,58 @@ public class QueryResult {
}
private static String convertMetadataToString(Metadata metadata, String format) {
- if (format == null)
- return concatMetadataIntoString(metadata);
+ if (format == null) {
+ return concatMetadataIntoString(metadata);
+ }
String outputString = format;
- for (String key : metadata.getAllKeys())
- outputString = outputString.replaceAll("\\$" + key,
- StringUtils.collectionToCommaDelimitedString(metadata.getAllMetadata(key)));
+ for (String key : metadata.getAllKeys()) {
+ outputString = outputString.replaceAll("\\$" + key,
+ StringUtils.collectionToCommaDelimitedString(metadata.getAllMetadata(key)));
+ }
return outputString;
}
private static String concatMetadataIntoString(Metadata metadata) {
List<String> outputString = new ArrayList<String>();
- for (String key : metadata.getAllKeys())
- outputString.add(StringUtils.collectionToCommaDelimitedString(metadata.getAllMetadata(key)));
+ for (String key : metadata.getAllKeys()) {
+ outputString.add(StringUtils.collectionToCommaDelimitedString(metadata.getAllMetadata(key)));
+ }
return StringUtils.collectionToCommaDelimitedString(outputString);
}
@Override
public boolean equals(Object obj) {
- if (this == obj)
+ if (this == obj) {
return true;
- if (obj == null)
+ }
+ if (obj == null) {
return false;
- if (getClass() != obj.getClass())
+ }
+ if (getClass() != obj.getClass()) {
return false;
+ }
QueryResult other = (QueryResult) obj;
if (metadata == null) {
- if (other.metadata != null)
+ if (other.metadata != null) {
return false;
- } else if (!metadata.equals(other.metadata))
+ }
+ } else if (!metadata.equals(other.metadata)) {
return false;
+ }
if (product == null) {
- if (other.product != null)
+ if (other.product != null) {
return false;
- } else if (!product.equals(other.product))
+ }
+ } else if (!product.equals(other.product)) {
return false;
+ }
if (toStringFormat == null) {
- if (other.toStringFormat != null)
+ if (other.toStringFormat != null) {
return false;
- } else if (!toStringFormat.equals(other.toStringFormat))
+ }
+ } else if (!toStringFormat.equals(other.toStringFormat)) {
return false;
+ }
return true;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java
index 9552d11..a654e3a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/QueryResultComparator.java
@@ -45,13 +45,16 @@ public class QueryResultComparator implements Comparator<QueryResult> {
public int compare(QueryResult qr1, QueryResult qr2) {
String m1 = qr1.getMetadata().getMetadata(sortByMetKey);
String m2 = qr2.getMetadata().getMetadata(sortByMetKey);
- if (m1 == m2)
+ if (m1 == m2) {
return 0;
+ }
// return null last, since they are the least interesting
- if (m1 == null)
+ if (m1 == null) {
return 1;
- if (m2 == null)
+ }
+ if (m2 == null) {
return -1;
+ }
return m1.compareTo(m2);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
index 23be461..41ee00e 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/conv/AsciiSortableVersionConverter.java
@@ -31,8 +31,9 @@ public class AsciiSortableVersionConverter implements VersionConverter {
public double convertToPriority(String version) {
double priority = 0;
char[] versionCharArray = version.toCharArray();
- for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--)
+ for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--) {
priority += (((int) versionCharArray[i]) * Math.pow(10, j));
+ }
return priority;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
index 4c16804..b429f5f 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/ObjectTimeEvent.java
@@ -47,8 +47,9 @@ public class ObjectTimeEvent<objType> extends TimeEvent {
if (obj instanceof ObjectTimeEvent) {
ObjectTimeEvent<?> ote = (ObjectTimeEvent<?>) obj;
return super.equals(obj) && this.timeObj.equals(ote.timeObj);
- } else
+ } else {
return false;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
index bbc0a98..dec2f9c 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/query/filter/TimeEvent.java
@@ -68,8 +68,9 @@ public class TimeEvent implements Comparable<TimeEvent> {
if (obj instanceof TimeEvent) {
TimeEvent te = (TimeEvent) obj;
return te.startTime == this.startTime && te.endTime == this.endTime;
- } else
+ } else {
return false;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/TypeHandler.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/TypeHandler.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/TypeHandler.java
index f9f6227..fdb18d1 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/TypeHandler.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/TypeHandler.java
@@ -75,8 +75,9 @@ public abstract class TypeHandler {
*/
public Query preQueryHandle(Query query) throws QueryFormulationException {
LinkedList<QueryCriteria> qcList = new LinkedList<QueryCriteria>();
- for (QueryCriteria qc : query.getCriteria())
+ for (QueryCriteria qc : query.getCriteria()) {
qcList.add(this.handleQueryCriteria(qc));
+ }
query.setCriteria(qcList);
return query;
}
@@ -84,13 +85,15 @@ public abstract class TypeHandler {
private QueryCriteria handleQueryCriteria(QueryCriteria qc) throws QueryFormulationException {
if (qc instanceof BooleanQueryCriteria) {
LinkedList<QueryCriteria> qcList = new LinkedList<QueryCriteria>();
- for (QueryCriteria criteria : ((BooleanQueryCriteria) qc).getTerms())
+ for (QueryCriteria criteria : ((BooleanQueryCriteria) qc).getTerms()) {
qcList.add(this.handleQueryCriteria(criteria));
+ }
BooleanQueryCriteria bqc = new BooleanQueryCriteria();
bqc.setOperator(((BooleanQueryCriteria) qc).getOperator());
bqc.setElementName(qc.getElementName());
- for (QueryCriteria criteria : qcList)
+ for (QueryCriteria criteria : qcList) {
bqc.addTerm(criteria);
+ }
return bqc;
}else if (qc.getElementName().equals(elementName) && qc instanceof TermQueryCriteria) {
return this.handleTermQueryCriteria((TermQueryCriteria) qc);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/ValueReplaceTypeHandler.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/ValueReplaceTypeHandler.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/ValueReplaceTypeHandler.java
index e04262a..2e33b12 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/ValueReplaceTypeHandler.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/structs/type/ValueReplaceTypeHandler.java
@@ -63,10 +63,12 @@ public abstract class ValueReplaceTypeHandler extends TypeHandler {
*/
@Override
protected QueryCriteria handleRangeQueryCriteria(RangeQueryCriteria rqc) {
- if (rqc.getEndValue() != null)
+ if (rqc.getEndValue() != null) {
rqc.setEndValue(this.getCatalogValue(rqc.getEndValue()));
- if (rqc.getStartValue() != null)
+ }
+ if (rqc.getStartValue() != null) {
rqc.setStartValue(this.getCatalogValue(rqc.getStartValue()));
+ }
return rqc;
}
@@ -75,8 +77,9 @@ public abstract class ValueReplaceTypeHandler extends TypeHandler {
*/
@Override
protected QueryCriteria handleTermQueryCriteria(TermQueryCriteria tqc) {
- if (tqc.getValue() != null)
+ if (tqc.getValue() != null) {
tqc.setValue(this.getCatalogValue(tqc.getValue()));
+ }
return tqc;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
index 0be545d..3c2a17e 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManager.java
@@ -173,8 +173,9 @@ public class XmlRpcFileManager {
.getCurrentFileTransfer();
if (status == null) {
return new Hashtable<String, Object>();
- } else
- return XmlRpcStructFactory.getXmlRpcFileTransferStatus(status);
+ } else {
+ return XmlRpcStructFactory.getXmlRpcFileTransferStatus(status);
+ }
}
public Vector<Hashtable<String, Object>> getCurrentFileTransfers() {
@@ -183,8 +184,9 @@ public class XmlRpcFileManager {
if (currentTransfers != null && currentTransfers.size() > 0) {
return XmlRpcStructFactory
.getXmlRpcFileTransferStatuses(currentTransfers);
- } else
- return new Vector<Hashtable<String, Object>>();
+ } else {
+ return new Vector<Hashtable<String, Object>>();
+ }
}
public double getProductPctTransferred(Hashtable<String, Object> productHash) {
@@ -589,9 +591,10 @@ public class XmlRpcFileManager {
} else {
productTypes = new Vector<ProductType>();
for (String productTypeName : complexQuery
- .getReducedProductTypeNames())
- productTypes.add(this.repositoryManager
- .getProductTypeByName(productTypeName));
+ .getReducedProductTypeNames()) {
+ productTypes.add(this.repositoryManager
+ .getProductTypeByName(productTypeName));
+ }
}
// get Metadata
@@ -623,9 +626,10 @@ public class XmlRpcFileManager {
}
// sort query results
- if (complexQuery.getSortByMetKey() != null)
- queryResults = sortQueryResultList(queryResults, complexQuery
- .getSortByMetKey());
+ if (complexQuery.getSortByMetKey() != null) {
+ queryResults = sortQueryResultList(queryResults, complexQuery
+ .getSortByMetKey());
+ }
return XmlRpcStructFactory.getXmlRpcQueryResults(queryResults);
} catch (Exception e) {
@@ -923,9 +927,10 @@ public class XmlRpcFileManager {
} catch (CatalogException e) {
throw new DataTransferException(e.getMessage(),e);
}
- } else
- throw new UnsupportedOperationException(
- "Moving of heirarhical and stream products not supported yet");
+ } else {
+ throw new UnsupportedOperationException(
+ "Moving of heirarhical and stream products not supported yet");
+ }
}
public boolean removeFile(String filePath) throws DataTransferException, IOException {
@@ -1013,11 +1018,12 @@ public class XmlRpcFileManager {
@SuppressWarnings("unused")
XmlRpcFileManager manager = new XmlRpcFileManager(portNum);
- for (;;)
- try {
- Thread.currentThread().join();
- } catch (InterruptedException ignore) {
- }
+ for (;;) {
+ try {
+ Thread.currentThread().join();
+ } catch (InterruptedException ignore) {
+ }
+ }
}
public boolean shutdown() {
@@ -1025,8 +1031,9 @@ public class XmlRpcFileManager {
this.webServer.shutdown();
this.webServer = null;
return true;
- } else
- return false;
+ } else {
+ return false;
+ }
}
private synchronized String catalogProduct(Product p)
@@ -1181,7 +1188,9 @@ public class XmlRpcFileManager {
}else {
m = this.getMetadata(product);
}
- if(this.expandProductMet) m = this.buildProductMetadata(product, m);
+ if(this.expandProductMet) {
+ m = this.buildProductMetadata(product, m);
+ }
return this.getOrigValues(m, product.getProductType());
} catch (Exception e) {
e.printStackTrace();
@@ -1196,7 +1205,9 @@ public class XmlRpcFileManager {
private Metadata getMetadata(Product product) throws CatalogException {
try {
Metadata m = catalog.getMetadata(product);
- if(this.expandProductMet) m = this.buildProductMetadata(product, m);
+ if(this.expandProductMet) {
+ m = this.buildProductMetadata(product, m);
+ }
return this.getOrigValues(m, product.getProductType());
} catch (Exception e) {
e.printStackTrace();
@@ -1268,9 +1279,10 @@ public class XmlRpcFileManager {
}
events = queryFilter.getFilterAlgor().filterEvents(events);
List<QueryResult> filteredQueryResults = new LinkedList<QueryResult>();
- for (TimeEvent event : events)
- filteredQueryResults.add(((ObjectTimeEvent<QueryResult>) event)
- .getTimeObject());
+ for (TimeEvent event : events) {
+ filteredQueryResults.add(((ObjectTimeEvent<QueryResult>) event)
+ .getTimeObject());
+ }
return filteredQueryResults;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
index a4fdf78..9bf6f1d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/XmlRpcFileManagerClient.java
@@ -1054,9 +1054,10 @@ public class XmlRpcFileManagerClient {
if (productTypeHash == null) {
return null;
- } else
- return XmlRpcStructFactory
- .getProductTypeFromXmlRpc(productTypeHash);
+ } else {
+ return XmlRpcStructFactory
+ .getProductTypeFromXmlRpc(productTypeHash);
+ }
}
@SuppressWarnings("unchecked")
@@ -1077,9 +1078,10 @@ public class XmlRpcFileManagerClient {
if (productTypeHash == null) {
return null;
- } else
- return XmlRpcStructFactory
- .getProductTypeFromXmlRpc(productTypeHash);
+ } else {
+ return XmlRpcStructFactory
+ .getProductTypeFromXmlRpc(productTypeHash);
+ }
}
@SuppressWarnings("unchecked")
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/Result.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/Result.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/Result.java
index 90f443a..e1b68a1 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/Result.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/Result.java
@@ -38,8 +38,9 @@ public class Result {
if (kind != null) {
java.lang.reflect.Constructor ctor = kind.getConstructor(ARGS);
this.value = ctor.newInstance(new Object[] { value });
- } else
+ } else {
this.value = value;
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
index 445c052..6c7604a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/system/auth/SecureWebServer.java
@@ -82,9 +82,10 @@ public final class SecureWebServer extends org.apache.xmlrpc.WebServer
*
*/
public void addDispatcher(Dispatcher dispatcher) {
- if (dispatcher == null)
+ if (dispatcher == null) {
throw new IllegalArgumentException(
- "Non-null dispatchers are illegal");
+ "Non-null dispatchers are illegal");
+ }
dispatchers.add(dispatcher);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java
index 6dbfbfd..79d0ab7 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/CatalogSearch.java
@@ -122,8 +122,9 @@ public class CatalogSearch {
System.out.println("No product found with ID: " + filter);
productFilter = "";
}
- if (!productFilter.equals(""))
+ if (!productFilter.equals("")) {
System.out.println("Filtering for " + productFilter + " products.");
+ }
}
public static void removeFilter() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java
index f85853e..f1a0f88 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/DeleteProduct.java
@@ -113,8 +113,9 @@ public class DeleteProduct {
String prodId = (String) prodId1;
remover.remove(prodId);
}
- } else
+ } else {
remover.remove(productId);
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
index ef90492..982c11b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ExpImpCatalog.java
@@ -154,9 +154,10 @@ public class ExpImpCatalog {
.log(Level.INFO,
"Source types and Dest types match: beginning processing");
}
- } else
- LOG.log(Level.INFO,
- "Skipping type validation: catalog i/f impls being used.");
+ } else {
+ LOG.log(Level.INFO,
+ "Skipping type validation: catalog i/f impls being used.");
+ }
// we'll use the get product page method for each product type
// paginate through products using source product type
@@ -176,9 +177,10 @@ public class ExpImpCatalog {
}
public void doExpImport() throws RepositoryManagerException, FileManagerException, CatalogException {
- if (sourceClient == null)
- throw new RuntimeException(
- "Cannot request exp/imp of all product types if no filemgr url specified!");
+ if (sourceClient == null) {
+ throw new RuntimeException(
+ "Cannot request exp/imp of all product types if no filemgr url specified!");
+ }
List sourceProductTypes = sourceClient.getProductTypes();
doExpImport(sourceProductTypes);
}
@@ -192,17 +194,20 @@ public class ExpImpCatalog {
page = sourceClient.getFirstPage(type);
}
- if (page == null)
- return;
+ if (page == null) {
+ return;
+ }
exportProductsToDest(page.getPageProducts(), type);
while (!page.isLastPage()) {
if (this.srcCatalog != null) {
page = srcCatalog.getNextPage(type, page);
- } else
- page = sourceClient.getNextPage(type, page);
- if (page == null)
- break;
+ } else {
+ page = sourceClient.getNextPage(type, page);
+ }
+ if (page == null) {
+ break;
+ }
exportProductsToDest(page.getPageProducts(), type);
}
}
@@ -373,14 +378,16 @@ public class ExpImpCatalog {
if (srcCatPropFile != null) {
tool = new ExpImpCatalog(srcCatPropFile, destCatPropFile, unique);
- } else
- tool = new ExpImpCatalog(new URL(sourceUrl), new URL(destUrl),
- unique);
+ } else {
+ tool = new ExpImpCatalog(new URL(sourceUrl), new URL(destUrl),
+ unique);
+ }
if (types != null && types.size() > 0) {
tool.doExpImport(types);
- } else
- tool.doExpImport();
+ } else {
+ tool.doExpImport();
+ }
}
private boolean typesExist(List sourceList, List destList) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
index b842dd2..d1615e3 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/MetadataDumper.java
@@ -161,8 +161,9 @@ public final class MetadataDumper {
MetadataDumper dumper = new MetadataDumper(fileManagerUrlStr);
if (outDirPath != null) {
dumper.dumpMetadata(productId, outDirPath);
- } else
+ } else {
dumper.dumpMetadata(productId);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
index da98438..e606797 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/ProductDumper.java
@@ -173,8 +173,9 @@ public final class ProductDumper {
ProductDumper dumper = new ProductDumper(fileManagerUrlStr);
if (outDirPath != null) {
dumper.dumpProduct(productId, outDirPath);
- } else
+ } else {
dumper.dumpProduct(productId);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
index c1c1a0b..343408a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/QueryTool.java
@@ -188,27 +188,32 @@ public final class QueryTool {
QueryType queryType = null;
for (int i = 0; i < args.length; i++) {
if (args[i].equals("--lucene")) {
- if (queryType != null)
+ if (queryType != null) {
exit("ERROR: Can only perform one query at a time! \n" + usage);
- if (args[++i].equals("-query"))
+ }
+ if (args[++i].equals("-query")) {
queryStr = args[++i];
- else
+ } else {
exit("ERROR: Must specify a query! \n" + usage);
+ }
queryType = QueryType.LUCENE;
}else if (args[i].equals("--sql")) {
- if (queryType != null)
+ if (queryType != null) {
exit("ERROR: Can only perform one query at a time! \n" + usage);
- if (args[++i].equals("-query"))
+ }
+ if (args[++i].equals("-query")) {
queryStr = args[++i];
- else
+ } else {
exit("ERROR: Must specify a query! \n" + usage);
+ }
for (; i < args.length; i++) {
- if (args[i].equals("-sortBy"))
+ if (args[i].equals("-sortBy")) {
sortBy = args[++i];
- else if (args[i].equals("-outputFormat"))
+ } else if (args[i].equals("-outputFormat")) {
outputFormat = args[++i];
- else if (args[i].equals("-delimiter"))
+ } else if (args[i].equals("-delimiter")) {
delimiter = args[++i];
+ }
}
queryType = QueryType.SQL;
}else if (args[i].equals("--url")) {
@@ -216,8 +221,9 @@ public final class QueryTool {
}
}
- if (queryStr == null || fmUrlStr == null)
+ if (queryStr == null || fmUrlStr == null) {
exit("Must specify a query and filemgr url! \n" + usage);
+ }
if (queryType == QueryType.LUCENE) {
URL fmUrl = new URL(fmUrlStr);
@@ -245,8 +251,9 @@ public final class QueryTool {
complexQuery.setToStringResultFormat(outputFormat);
List<QueryResult> results = new XmlRpcFileManagerClient(new URL(filemgrUrl)).complexQuery(complexQuery);
StringBuilder returnString = new StringBuilder("");
- for (QueryResult qr : results)
+ for (QueryResult qr : results) {
returnString.append(qr.toString()).append(delimiter);
+ }
return returnString.substring(0, returnString.length() - delimiter.length());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/RangeQueryTester.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/RangeQueryTester.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/RangeQueryTester.java
index bd7c84d..3b476e4 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/RangeQueryTester.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/RangeQueryTester.java
@@ -215,8 +215,9 @@ public final class RangeQueryTester {
String productFile = (String) productFile1;
System.out.println(productFile);
}
- } else
+ } else {
System.out.println("No results found!");
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
index 89e1226..20ed97f 100755
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/tools/SolrIndexer.java
@@ -561,8 +561,9 @@ public class SolrIndexer {
private String formatDate(SimpleDateFormat format, String value)
throws java.text.ParseException {
// Ignore formating if its an ignore value
- if (config.getIgnoreValues().contains(value.trim()))
- return value;
+ if (config.getIgnoreValues().contains(value.trim())) {
+ return value;
+ }
return solrFormat.format(format.parse(value));
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java
index 8972ea0..7ec4da9 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/QueryUtils.java
@@ -42,8 +42,9 @@ public class QueryUtils {
public static String getQueryResultsAsString(
List<QueryResult> queryResults, String delimiter) {
StringBuilder returnString = new StringBuilder("");
- for (QueryResult qr : queryResults)
+ for (QueryResult qr : queryResults) {
returnString.append(qr.toString()).append(delimiter);
+ }
return returnString.substring(0, returnString.length() - delimiter.length());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java
index 9d98f96..37f9a24 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/SqlParser.java
@@ -78,19 +78,21 @@ public class SqlParser {
public static ComplexQuery parseSqlQueryMethod(String sqlStringQueryMethod)
throws QueryFormulationException {
- if (!Pattern.matches("((?:SQL)|(?:sql))\\s*(.*)\\s*\\{\\s*SELECT.*FROM.*(?:WHERE.*){0,1}\\}", sqlStringQueryMethod))
+ if (!Pattern.matches("((?:SQL)|(?:sql))\\s*(.*)\\s*\\{\\s*SELECT.*FROM.*(?:WHERE.*){0,1}\\}", sqlStringQueryMethod)) {
throw new QueryFormulationException("Malformed SQL method");
+ }
try {
ComplexQuery complexQuery = parseSqlQuery(stripOutSqlDefinition(sqlStringQueryMethod));
for (Expression expr : getSqlStatementArgs(sqlStringQueryMethod)) {
- if (expr.getKey().toUpperCase().equals("FORMAT"))
+ if (expr.getKey().toUpperCase().equals("FORMAT")) {
complexQuery.setToStringResultFormat(expr.getValue());
- else if (expr.getKey().toUpperCase().equals("SORT_BY"))
+ } else if (expr.getKey().toUpperCase().equals("SORT_BY")) {
complexQuery.setSortByMetKey(expr.getValue());
- else if (expr.getKey().toUpperCase().equals("FILTER"))
+ } else if (expr.getKey().toUpperCase().equals("FILTER")) {
complexQuery.setQueryFilter(createFilter(expr));
+ }
}
return complexQuery;
@@ -108,15 +110,18 @@ public class SqlParser {
String[] fromValues = (splitSqlStatement[2].trim() + ",").split(",");
ComplexQuery sq = new ComplexQuery();
List<String> selectValuesList = Arrays.asList(selectValues);
- if (!selectValuesList.contains("*"))
+ if (!selectValuesList.contains("*")) {
sq.setReducedMetadata(Arrays.asList(selectValues));
+ }
List<String> fromValuesList = Arrays.asList(fromValues);
- if (!fromValuesList.contains("*"))
+ if (!fromValuesList.contains("*")) {
sq.setReducedProductTypeNames(fromValuesList);
+ }
- if (splitSqlStatement.length > 3)
+ if (splitSqlStatement.length > 3) {
sq.addCriterion(parseStatement(toPostFix(splitSqlStatement[3]
- .trim())));
+ .trim())));
+ }
return sq;
}
@@ -127,10 +132,12 @@ public class SqlParser {
public static String unparseSqlQuery(ComplexQuery complexQuery) throws QueryFormulationException {
LinkedList<String> outputArgs = new LinkedList<String>();
- if (complexQuery.getToStringResultFormat() != null)
+ if (complexQuery.getToStringResultFormat() != null) {
outputArgs.add("FORMAT = '" + complexQuery.getToStringResultFormat() + "'");
- if (complexQuery.getSortByMetKey() != null)
+ }
+ if (complexQuery.getSortByMetKey() != null) {
outputArgs.add("SORT_BY = '" + complexQuery.getSortByMetKey() + "'");
+ }
if (complexQuery.getQueryFilter() != null) {
String filterString = "FILTER = '"
+ complexQuery.getQueryFilter().getStartDateTimeMetKey() + ","
@@ -141,8 +148,9 @@ public class SqlParser {
outputArgs.add(filterString + "'");
}
String sqlQueryString = getInfixCriteriaString(complexQuery.getCriteria());
- if (sqlQueryString != null && sqlQueryString.startsWith("(") && sqlQueryString.endsWith(")"))
- sqlQueryString = sqlQueryString.substring(1, sqlQueryString.length() - 1);
+ if (sqlQueryString != null && sqlQueryString.startsWith("(") && sqlQueryString.endsWith(")")) {
+ sqlQueryString = sqlQueryString.substring(1, sqlQueryString.length() - 1);
+ }
return "SQL ("
+ listToString(outputArgs)
+ ") { SELECT " + listToString(complexQuery.getReducedMetadata())
@@ -151,12 +159,13 @@ public class SqlParser {
}
public static String getInfixCriteriaString(List<QueryCriteria> criteriaList) throws QueryFormulationException {
- if (criteriaList.size() > 1)
+ if (criteriaList.size() > 1) {
return getInfixCriteriaString(new BooleanQueryCriteria(criteriaList, BooleanQueryCriteria.AND));
- else if (criteriaList.size() == 1)
+ } else if (criteriaList.size() == 1) {
return getInfixCriteriaString(criteriaList.get(0));
- else
+ } else {
return null;
+ }
}
public static String getInfixCriteriaString(QueryCriteria criteria) {
@@ -167,14 +176,16 @@ public class SqlParser {
switch(bqc.getOperator()){
case 0:
returnString = "(" + getInfixCriteriaString((QueryCriteria) terms.get(0));
- for (int i = 1; i < terms.size(); i++)
+ for (int i = 1; i < terms.size(); i++) {
returnString += " AND " + getInfixCriteriaString((QueryCriteria) terms.get(i));
+ }
returnString += ")";
break;
case 1:
returnString = "(" + getInfixCriteriaString((QueryCriteria) terms.get(0));
- for (int i = 1; i < terms.size(); i++)
+ for (int i = 1; i < terms.size(); i++) {
returnString += " OR " + getInfixCriteriaString((QueryCriteria) terms.get(i));
+ }
returnString += ")";
break;
case 2:
@@ -192,8 +203,9 @@ public class SqlParser {
String opString = rqc.getInclusive() ? "=" : "";
if (rqc.getStartValue() != null) {
opString = ">" + opString + " '" + rqc.getStartValue() + "'";
- }else
+ }else {
opString = "<" + opString + " '" + rqc.getEndValue() + "'";
+ }
returnString = rqc.getElementName() + " " + opString;
}else if (criteria instanceof TermQueryCriteria) {
TermQueryCriteria tqc = (TermQueryCriteria) criteria;
@@ -219,8 +231,9 @@ public class SqlParser {
if (!inExpr) {
String[] args = sqlStringQueryMethod.substring(startArgs, i).trim().split("'\\s*,");
LinkedList<Expression> argsList = new LinkedList<Expression>();
- for (String arg : args)
+ for (String arg : args) {
argsList.add(new Expression((arg = arg.trim()).endsWith("'") ? arg : (arg + "'")));
+ }
return argsList;
} else {
break;
@@ -257,25 +270,29 @@ public class SqlParser {
break;
case ')':
String value;
- while (!(value = stack.pop()).equals("("))
+ while (!(value = stack.pop()).equals("(")) {
postFix.add(value);
- if (stack.peek().equals("NOT"))
+ }
+ if (stack.peek().equals("NOT")) {
postFix.add(stack.pop());
+ }
break;
case ' ':
break;
default:
if (statement.substring(i, i + 3).equals("AND")) {
while (!stack.isEmpty()
- && (stack.peek().equals("AND")))
+ && (stack.peek().equals("AND"))) {
postFix.add(stack.pop());
+ }
stack.push("AND");
i += 2;
} else if (statement.substring(i, i + 2).equals("OR")) {
while (!stack.isEmpty()
&& (stack.peek().equals("AND") || stack.peek()
- .equals("OR")))
+ .equals("OR"))) {
postFix.add(stack.pop());
+ }
stack.push("OR");
i += 1;
} else if (statement.substring(i, i + 3).equals("NOT")) {
@@ -290,8 +307,9 @@ public class SqlParser {
}
}
- while (!stack.isEmpty())
+ while (!stack.isEmpty()) {
postFix.add(stack.pop());
+ }
return postFix;
}
@@ -327,8 +345,9 @@ public class SqlParser {
String arrayString = "";
if (list.size() > 0) {
arrayString = list.get(0);
- for (int i = 1; i < list.size(); i++)
+ for (int i = 1; i < list.size(); i++) {
arrayString += "," + list.get(i);
+ }
}
return arrayString;
}
@@ -377,13 +396,15 @@ public class SqlParser {
this.key = expression.substring(0, matcher.start()).trim();
this.val = this.removeTickBounds(expression.substring(matcher.end()).trim());
String opString = matcher.group();
- for (char c : opString.toCharArray())
+ for (char c : opString.toCharArray()) {
this.op = this.op | this.getShortValueForOp(c);
+ }
}
private String removeTickBounds(String value) {
- if (value.startsWith("'") && value.endsWith("'"))
+ if (value.startsWith("'") && value.endsWith("'")) {
value = value.substring(1, value.length() - 1);
+ }
return value;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
index feab94c..115ec65 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlRpcStructFactory.java
@@ -134,20 +134,26 @@ public final class XmlRpcStructFactory {
public static Hashtable<String, Object> getXmlRpcComplexQuery(ComplexQuery complexQuery) {
Hashtable<String, Object> complexQueryHash = getXmlRpcQuery(complexQuery);
- if (complexQuery.getReducedProductTypeNames() != null)
- complexQueryHash.put("reducedProductTypeNames", new Vector<String>(complexQuery.getReducedProductTypeNames()));
- else
+ if (complexQuery.getReducedProductTypeNames() != null) {
+ complexQueryHash
+ .put("reducedProductTypeNames", new Vector<String>(complexQuery.getReducedProductTypeNames()));
+ } else {
complexQueryHash.put("reducedProductTypeNames", new Vector<String>());
- if (complexQuery.getReducedMetadata() != null)
+ }
+ if (complexQuery.getReducedMetadata() != null) {
complexQueryHash.put("reducedMetadata", new Vector<String>(complexQuery.getReducedMetadata()));
- else
+ } else {
complexQueryHash.put("reducedMetadata", new Vector<String>());
- if (complexQuery.getSortByMetKey() != null)
+ }
+ if (complexQuery.getSortByMetKey() != null) {
complexQueryHash.put("sortByMetKey", complexQuery.getSortByMetKey());
- if (complexQuery.getToStringResultFormat() != null)
+ }
+ if (complexQuery.getToStringResultFormat() != null) {
complexQueryHash.put("toStringResultFormat", complexQuery.getToStringResultFormat());
- if (complexQuery.getQueryFilter() != null)
+ }
+ if (complexQuery.getQueryFilter() != null) {
complexQueryHash.put("queryFilter", getXmlRpcQueryFilter(complexQuery.getQueryFilter()));
+ }
return complexQueryHash;
}
@@ -155,14 +161,18 @@ public final class XmlRpcStructFactory {
public static ComplexQuery getComplexQueryFromXmlRpc(Hashtable<String, Object> complexQueryHash) {
ComplexQuery complexQuery = new ComplexQuery();
complexQuery.setCriteria(getQueryFromXmlRpc(complexQueryHash).getCriteria());
- if (((Vector<String>) complexQueryHash.get("reducedProductTypeNames")).size() > 0)
+ if (((Vector<String>) complexQueryHash.get("reducedProductTypeNames")).size() > 0) {
complexQuery.setReducedProductTypeNames((Vector<String>) complexQueryHash.get("reducedProductTypeNames"));
- if (((Vector<String>) complexQueryHash.get("reducedMetadata")).size() > 0)
+ }
+ if (((Vector<String>) complexQueryHash.get("reducedMetadata")).size() > 0) {
complexQuery.setReducedMetadata((Vector<String>) complexQueryHash.get("reducedMetadata"));
+ }
complexQuery.setSortByMetKey((String) complexQueryHash.get("sortByMetKey"));
complexQuery.setToStringResultFormat((String) complexQueryHash.get("toStringResultFormat"));
- if (complexQueryHash.get("queryFilter") != null)
- complexQuery.setQueryFilter(getQueryFilterFromXmlRpc((Hashtable<String, Object>) complexQueryHash.get("queryFilter")));
+ if (complexQueryHash.get("queryFilter") != null) {
+ complexQuery.setQueryFilter(
+ getQueryFilterFromXmlRpc((Hashtable<String, Object>) complexQueryHash.get("queryFilter")));
+ }
return complexQuery;
}
@@ -204,22 +214,25 @@ public final class XmlRpcStructFactory {
public static Vector<Hashtable<String, Object>> getXmlRpcQueryResults(List<QueryResult> queryResults) {
Vector<Hashtable<String, Object>> queryResultHashVector = new Vector<Hashtable<String, Object>>();
- for (QueryResult queryResult : queryResults)
+ for (QueryResult queryResult : queryResults) {
queryResultHashVector.add(getXmlRpcQueryResult(queryResult));
+ }
return queryResultHashVector;
}
public static List<QueryResult> getQueryResultsFromXmlRpc(Vector<Hashtable<String, Object>> queryResultHashVector) {
List<QueryResult> queryResults = new Vector<QueryResult>();
- for (Hashtable<String, Object> queryResultHash : queryResultHashVector)
+ for (Hashtable<String, Object> queryResultHash : queryResultHashVector) {
queryResults.add(getQueryResultFromXmlRpc(queryResultHash));
+ }
return queryResults;
}
public static Hashtable<String, Object> getXmlRpcQueryResult(QueryResult queryResult) {
Hashtable<String, Object> queryResultHash = new Hashtable<String, Object>();
- if (queryResult.getToStringFormat() != null)
+ if (queryResult.getToStringFormat() != null) {
queryResultHash.put("toStringFormat", queryResult.getToStringFormat());
+ }
queryResultHash.put("product", getXmlRpcProduct(queryResult.getProduct()));
queryResultHash.put("metadata", queryResult.getMetadata().getHashtable());
return queryResultHash;
@@ -470,8 +483,9 @@ public final class XmlRpcStructFactory {
Hashtable<String, Object> typeHandlerHash) {
TypeHandler typeHandler = GenericFileManagerObjectFactory
.getTypeHandlerFromClassName((String) typeHandlerHash.get("className"));
- if(typeHandler != null)
- typeHandler.setElementName((String) typeHandlerHash.get("elementName"));
+ if(typeHandler != null) {
+ typeHandler.setElementName((String) typeHandlerHash.get("elementName"));
+ }
return typeHandler;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
index 46b1a7a..71e76e5 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/util/XmlStructFactory.java
@@ -247,8 +247,9 @@ public final class XmlStructFactory {
// Also print types without elements but just with parents
ArrayList<String> allTypes = new ArrayList<String>(productTypeMap.keySet());
for(String type: subToSuperMap.keySet()) {
- if(!allTypes.contains(type))
+ if(!allTypes.contains(type)) {
allTypes.add(type);
+ }
}
for (String typeId : allTypes) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
index f690847..c3c211d 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/versioning/VersioningUtils.java
@@ -70,10 +70,12 @@ public final class VersioningUtils {
public static List<Reference> getReferencesFromDir(File dirRoot) {
List<Reference> references;
- if (dirRoot == null)
+ if (dirRoot == null) {
throw new IllegalArgumentException("null");
- if (!dirRoot.isDirectory())
+ }
+ if (!dirRoot.isDirectory()) {
dirRoot = dirRoot.getParentFile();
+ }
references = new Vector<Reference>();
@@ -115,10 +117,11 @@ public final class VersioningUtils {
}
File[] subdirs = dir.listFiles(DIR_FILTER);
- if (subdirs != null)
+ if (subdirs != null) {
for (File subdir : subdirs) {
stack.push(subdir);
}
+ }
}
return references;
@@ -127,10 +130,12 @@ public final class VersioningUtils {
public static List<String> getURIsFromDir(File dirRoot) {
List<String> uris;
- if (dirRoot == null)
+ if (dirRoot == null) {
throw new IllegalArgumentException("null");
- if (!dirRoot.isDirectory())
+ }
+ if (!dirRoot.isDirectory()) {
dirRoot = dirRoot.getParentFile();
+ }
uris = new Vector<String>();
@@ -152,10 +157,11 @@ public final class VersioningUtils {
}
File[] subdirs = dir.listFiles(DIR_FILTER);
- if (subdirs != null)
+ if (subdirs != null) {
for (File subdir : subdirs) {
stack.push(subdir);
}
+ }
}
return uris;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java b/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
index ba7afd6..ef4ca62 100755
--- a/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
+++ b/grid/src/main/java/org/apache/oodt/grid/ConfigBean.java
@@ -60,8 +60,9 @@ public class ConfigBean implements Serializable {
* Message to display.
*/
public void setMessage(String message) {
- if (message == null)
+ if (message == null) {
throw new IllegalArgumentException("message cannot be null");
+ }
this.message = message;
}
@@ -158,8 +159,9 @@ public class ConfigBean implements Serializable {
* if the administrator's not authenticated.
*/
private void checkAuthenticity() throws AuthenticationRequiredException {
- if (isAuthentic() && configuration != null)
+ if (isAuthentic() && configuration != null) {
return;
+ }
message = "";
throw new AuthenticationRequiredException();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java b/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
index 3d8cd5b..8a5b0a3 100755
--- a/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
+++ b/grid/src/main/java/org/apache/oodt/grid/ConfigServlet.java
@@ -50,13 +50,15 @@ public class ConfigServlet extends GridServlet {
throws ServletException, IOException {
Configuration config = getConfiguration(); // Get the singleton
// configuration
- if (!approveAccess(config, req, res))
+ if (!approveAccess(config, req, res)) {
return; // Check if the user can access this page
+ }
ConfigBean cb = getConfigBean(req); // Get the bean
cb.setMessage(""); // Clear out any message
- if (!cb.isAuthentic())
+ if (!cb.isAuthentic()) {
throw new ServletException(new AuthenticationRequiredException());
+ }
boolean needSave = false; // Assume no changes for now
String newPass = req.getParameter("password"); // See if she wants to change
@@ -99,8 +101,9 @@ public class ConfigServlet extends GridServlet {
// property
if (newKey != null && newKey.length() > 0) { // And make sure it's nonempty
String newVal = req.getParameter("newval"); // Got one, get its value
- if (newVal == null)
+ if (newVal == null) {
newVal = ""; // Make sure it's at least an empty string
+ }
config.getProperties().setProperty(newKey, newVal); // Set the new
// property
needSave = true; // We need to save
@@ -245,11 +248,15 @@ public class ConfigServlet extends GridServlet {
if (newClass != null && newClass.length() > 0) { // And nonempty
Server server;
if (type == 'd') // If it's data
+ {
server = new ProductServer(config, newClass); // It's a product
- // server
+ }
+// server
else
// otherwise it's metadata
+ {
server = new ProfileServer(config, newClass); // Which is a profile
+ }
// server
servers.add(server); // Add it to the set of servers
needSave = true; // And after all this, we need to save!
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/Configuration.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/Configuration.java b/grid/src/main/java/org/apache/oodt/grid/Configuration.java
index ee5cdc6..ed82943 100755
--- a/grid/src/main/java/org/apache/oodt/grid/Configuration.java
+++ b/grid/src/main/java/org/apache/oodt/grid/Configuration.java
@@ -63,8 +63,9 @@ public class Configuration implements Serializable {
*/
public Configuration(File file) throws IOException, SAXException {
this.file = file;
- if (file.isFile() && file.length() > 0)
+ if (file.isFile() && file.length() > 0) {
parse(file);
+ }
}
/**
@@ -80,7 +81,9 @@ public class Configuration implements Serializable {
elem.setAttribute("localhost", localhostRequired? "true" : "false"); // Add localhost attribute
if (password != null && password.length > 0) // If we have a password
+ {
elem.setAttribute("password", encode(password)); // Add passowrd attribute
+ }
for (Object productServer : productServers) { // For each product server
ProductServer ps = (ProductServer) productServer; // Get the product server
@@ -209,8 +212,9 @@ public class Configuration implements Serializable {
* @param password Administrator password.
*/
public void setPassword(byte[] password) {
- if (password == null)
+ if (password == null) {
throw new IllegalArgumentException("Non-null passwords not allowed");
+ }
this.password = password;
}
@@ -235,9 +239,12 @@ public class Configuration implements Serializable {
} catch (TransformerException ex) {
throw new IllegalStateException("Unexpected TransformerException: " + ex.getMessage());
} finally {
- if (writer != null) try { // And if we got a writer, try ...
- writer.close(); // to close it
- } catch (IOException ignore) {} // Ignoring any error
+ if (writer != null) {
+ try { // And if we got a writer, try ...
+ writer.close(); // to close it
+ } catch (IOException ignore) {
+ } // Ignoring any error
+ }
}
}
@@ -263,7 +270,9 @@ public class Configuration implements Serializable {
String passwordAttr = root.getAttribute("password"); // Get the password attribute
if (passwordAttr != null && passwordAttr.length() > 0) // If it's there, and non-empty
+ {
password = decode(passwordAttr); // Then decode it
+ }
NodeList children = root.getChildNodes(); // Get the child nodes
for (int i = 0; i < children.getLength(); ++i) { // For each child node
@@ -274,10 +283,14 @@ public class Configuration implements Serializable {
// Keep these in separate sets?
if (server instanceof ProductServer) // Is a product server?
+ {
productServers.add(server); // Add to product servers
- else if (server instanceof ProfileServer) // Is a profile server?
+ } else if (server instanceof ProfileServer) // Is a profile server?
+ {
profileServers.add(server); // Add to profile servers
- else throw new IllegalArgumentException("Unexpected server type " + server + " in " + file);
+ } else {
+ throw new IllegalArgumentException("Unexpected server type " + server + " in " + file);
+ }
} else if ("properties".equals(child.getNodeName())) { // Is it a <properties>?
NodeList props = child.getChildNodes(); // Get its children
for (int j = 0; j < props.getLength(); ++j) { // For each child
@@ -287,8 +300,10 @@ public class Configuration implements Serializable {
Element propNode = (Element) node; // Great, use it as an element
String key = propNode.getAttribute("key"); // Get its key attribute
if (key == null || key.length() == 0) // Make sure it's there
+ {
throw new SAXException("Required 'key' attribute missing from "
- + "<property> element");
+ + "<property> element");
+ }
properties.setProperty(key, text(propNode)); // And set it
}
}
@@ -300,9 +315,10 @@ public class Configuration implements Serializable {
&& "codeBase".equals(node.getNodeName())) {
Element cbNode = (Element) node;
String u = cbNode.getAttribute("url");
- if (u == null || u.length() == 0)
+ if (u == null || u.length() == 0) {
throw new SAXException("Required 'url' attribute missing from "
- + "<codeBase> element");
+ + "<codeBase> element");
+ }
try {
codeBases.add(new URL(u));
} catch (MalformedURLException ex) {
@@ -356,15 +372,19 @@ public class Configuration implements Serializable {
*/
private static void text0(Node node, StringBuffer b) {
NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i)
+ for (int i = 0; i < children.getLength(); ++i) {
text0(children.item(i), b);
+ }
short type = node.getNodeType();
- if (type == Node.CDATA_SECTION_NODE || type == Node.TEXT_NODE)
+ if (type == Node.CDATA_SECTION_NODE || type == Node.TEXT_NODE) {
b.append(node.getNodeValue());
+ }
}
public boolean equals(Object obj) {
- if (obj == this) return true;
+ if (obj == this) {
+ return true;
+ }
if (obj instanceof Configuration) {
Configuration rhs = (Configuration) obj;
return codeBases.equals(rhs.codeBases) && productServers.equals(rhs.productServers)
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/GridServlet.java b/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
index 7a039ff..8f5ccdd 100755
--- a/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
+++ b/grid/src/main/java/org/apache/oodt/grid/GridServlet.java
@@ -51,11 +51,16 @@ public abstract class GridServlet extends HttpServlet {
* @throws IOException if an error occurs.
*/
protected Configuration getConfiguration() throws ServletException, IOException {
- if (configuration != null) return configuration;
+ if (configuration != null) {
+ return configuration;
+ }
String path = getServletContext().getInitParameter("org.apache.oodt.grid.GridServlet.config");
- if (path == null) path = getServletContext().getRealPath("/WEB-INF/config.xml");
- if (path == null)
- throw new ServletException("The config.xml file can't be accessed. Are we running from a war file!??!");
+ if (path == null) {
+ path = getServletContext().getRealPath("/WEB-INF/config.xml");
+ }
+ if (path == null) {
+ throw new ServletException("The config.xml file can't be accessed. Are we running from a war file!??!");
+ }
File file = new File(path);
Configuration c;
try {
@@ -64,8 +69,9 @@ public abstract class GridServlet extends HttpServlet {
throw new ServletException("Cannot parse config.xml file", ex);
}
synchronized (GridServlet.class) {
- while (configuration == null)
- configuration = c;
+ while (configuration == null) {
+ configuration = c;
+ }
}
return configuration;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java b/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
index 3fa9882..01e186a 100755
--- a/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
+++ b/grid/src/main/java/org/apache/oodt/grid/LoginServlet.java
@@ -38,7 +38,9 @@ public class LoginServlet extends GridServlet {
*/
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException {
Configuration config = getConfiguration(); // Get configuration
- if (!approveAccess(config, req, res)) return; // Do https, localhost checking first
+ if (!approveAccess(config, req, res)) {
+ return; // Do https, localhost checking first
+ }
ConfigBean cb = getConfigBean(req); // Get bean
if (cb.isAuthentic()) { // Already authentic?
@@ -47,7 +49,9 @@ public class LoginServlet extends GridServlet {
}
String password = req.getParameter("password"); // Get submitted password
- if (password == null) password = ""; // If none, use an empty string
+ if (password == null) {
+ password = ""; // If none, use an empty string
+ }
byte[] bytes = password.getBytes(); // Get the bytes
if (!Arrays.equals(config.getPassword(), bytes)) { // Compare to stored password bytes
cb.setMessage("Password incorrect"); // Not equal! Set message.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
index fdf3d61..3ea12ed 100755
--- a/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
+++ b/grid/src/main/java/org/apache/oodt/grid/ProductQueryServlet.java
@@ -99,12 +99,17 @@ public class ProductQueryServlet extends QueryServlet {
byte[] buf = new byte[512]; // And a byte buffer for data
int num; // And a place to count data
while ((num = in.read(buf)) != -1) // While we read
- res.getOutputStream().write(buf, 0, num); // We write
+ {
+ res.getOutputStream().write(buf, 0, num); // We write
+ }
res.getOutputStream().flush(); // Flush to commit response
} finally { // And finally
- if (in != null) try { // If we opened it
- in.close(); // Close it
- } catch (IOException ignore) {} // Ignoring any error during closing
+ if (in != null) {
+ try { // If we opened it
+ in.close(); // Close it
+ } catch (IOException ignore) {
+ } // Ignoring any error during closing
+ }
} // Because come on, it's just closing!
} // For fsck's sake!
@@ -118,10 +123,13 @@ public class ProductQueryServlet extends QueryServlet {
String contentType = result.getMimeType(); // Grab the content type
res.setContentType(contentType); // Set it
long size = result.getSize(); // Grab the size
- if (size >= 0)
- res.addHeader("Content-Length", String.valueOf(size)); // Don't use setContentLength(int)
+ if (size >= 0) {
+ res.addHeader("Content-Length", String.valueOf(size)); // Don't use setContentLength(int)
+ }
if (!displayable(contentType)) // Finally, if a browser can't show it
- this.suggestFilename(handler, result, res); // Then suggest a save-as filename
+ {
+ this.suggestFilename(handler, result, res); // Then suggest a save-as filename
+ }
}
/**
@@ -149,7 +157,9 @@ public class ProductQueryServlet extends QueryServlet {
protected void suggestFilename(QueryHandler handler, Result result, HttpServletResponse res) {
String resource = result.getResourceID();
- if (resource == null || resource.length() == 0) resource = "product.dat";
+ if (resource == null || resource.length() == 0) {
+ resource = "product.dat";
+ }
// suggest some names based on resource mime type
String contentType = res.getContentType();
[03/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
index abecbd9..1c1f243 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolHandler.java
@@ -107,10 +107,11 @@ public class ProtocolHandler {
try {
Protocol protocol = getAppropriateProtocol(pFile, allowReuse);
if (protocol != null && navigateToPathLoc) {
- if (pFile.isDir())
+ if (pFile.isDir()) {
this.cd(protocol, pFile);
- else if (pFile.getParent() != null)
+ } else if (pFile.getParent() != null) {
this.cd(protocol, new RemoteSiteFile(pFile.getParent(), pFile.getSite()));
+ }
}
return protocol;
} catch (Exception e) {
@@ -165,18 +166,20 @@ public class ProtocolHandler {
+ " for " + remoteSite.getURL());
}
}
- if (protocol == null)
+ if (protocol == null) {
throw new ProtocolException("Failed to get appropriate protocol for "
- + remoteSite);
+ + remoteSite);
+ }
} else {
connect(protocol = protocolFactory.newInstance(), remoteSite, false);
}
- if (allowReuse)
+ if (allowReuse) {
try {
this.reuseProtocols.put(remoteSite.getURL().toURI(), protocol);
} catch (URISyntaxException e) {
LOG.log(Level.SEVERE, "Couildn't covert URL to URI Mesage: " + e.getMessage());
}
+ }
}
} catch (URISyntaxException e) {
LOG.log(Level.SEVERE, "could not convert url to uri: Message: "+e.getMessage());
@@ -220,8 +223,9 @@ public class ProtocolHandler {
List<RemoteSiteFile> page = new LinkedList<RemoteSiteFile>();
int curLoc = pgInfo.getPageLoc();
for (; page.size() < pi.getPageSize() && curLoc < fileList.size(); curLoc++) {
- if (filter == null || filter.accept(fileList.get(curLoc)))
+ if (filter == null || filter.accept(fileList.get(curLoc))) {
page.add(fileList.get(curLoc));
+ }
}
pgInfo.updatePageInfo(curLoc, fileList);
@@ -266,12 +270,13 @@ public class ProtocolHandler {
// delete file is specified
if (delete) {
- if (!this.delete(protocol, fromFile))
+ if (!this.delete(protocol, fromFile)) {
LOG.log(Level.WARNING, "Failed to delete file '" + fromFile
- + "' from server '" + fromFile.getSite() + "'");
- else
+ + "' from server '" + fromFile.getSite() + "'");
+ } else {
LOG.log(Level.INFO, "Successfully deleted file '" + fromFile
- + "' from server '" + fromFile.getSite() + "'");
+ + "' from server '" + fromFile.getSite() + "'");
+ }
}
LOG.log(Level.INFO, "Finished downloading " + fromFile + " to " + toFile);
@@ -333,8 +338,9 @@ public class ProtocolHandler {
+ " with protocol '" + protocol.getClass().getCanonicalName()
+ "' and username '" + remoteSite.getUsername() + "'");
return true;
- } else
+ } else {
return false;
+ }
} catch (Exception e) {
LOG.log(Level.WARNING, "Error occurred while connecting to "
@@ -354,14 +360,16 @@ public class ProtocolHandler {
this.cdToHOME(protocol);
RemoteSiteFile home = this.pwd(remoteSite, protocol);
this.ls(remoteSite, protocol);
- if (remoteSite.getCdTestDir() != null)
+ if (remoteSite.getCdTestDir() != null) {
this.cd(protocol, new RemoteSiteFile(home, remoteSite.getCdTestDir(),
true, remoteSite));
- else
+ } else {
this.cdToROOT(protocol);
+ }
this.cdToHOME(protocol);
- if (home == null || !home.equals(this.pwd(remoteSite, protocol)))
+ if (home == null || !home.equals(this.pwd(remoteSite, protocol))) {
throw new ProtocolException("Home directory not the same after cd");
+ }
} catch (Exception e) {
LOG.log(Level.SEVERE, "Protocol "
+ protocol.getClass().getCanonicalName()
@@ -404,10 +412,11 @@ public class ProtocolHandler {
System.out.println("IndexOfFile: " + indexOfFile + " PageIndex: "
+ pgInfo.getPageLoc());
if (indexOfFile < pgInfo.getPageLoc()
- || indexOfFile == fileList.size() - 1)
+ || indexOfFile == fileList.size() - 1) {
pgInfo.updatePageInfo(pgInfo.getPageLoc() - 1, fileList);
- else
+ } else {
pgInfo.updatePageInfo(pgInfo.getPageLoc(), fileList);
+ }
return true;
} else {
return false;
@@ -424,8 +433,9 @@ public class ProtocolHandler {
private synchronized PagingInfo getPagingInfo(RemoteSiteFile pFile) {
PagingInfo pgInfo = this.pageInfos.get(pFile);
- if (pgInfo == null)
+ if (pgInfo == null) {
this.putPgInfo(pgInfo = new PagingInfo(), pFile);
+ }
return pgInfo;
}
@@ -445,16 +455,18 @@ public class ProtocolHandler {
public List<RemoteSiteFile> ls(RemoteSite site, Protocol protocol) throws ProtocolException {
List<RemoteSiteFile> fileList = this.getDynamicFileList(site, protocol);
- if (fileList == null)
+ if (fileList == null) {
fileList = toRemoteSiteFiles(protocol.ls(), site);
+ }
return fileList;
}
public List<RemoteSiteFile> ls(RemoteSite site, Protocol protocol, ProtocolFileFilter filter)
throws ProtocolException {
List<RemoteSiteFile> fileList = this.getDynamicFileList(site, protocol);
- if (fileList == null)
+ if (fileList == null) {
fileList = toRemoteSiteFiles(protocol.ls(filter), site);
+ }
return fileList;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
index 6ea4f5d..b0a8944 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/protocol/ProtocolPath.java
@@ -55,8 +55,9 @@ public class ProtocolPath implements Serializable {
}
protected String checkForDelimiters(String path) {
- if (path.endsWith("/") && path.length() > 1)
+ if (path.endsWith("/") && path.length() > 1) {
path = path.substring(0, path.length() - 1);
+ }
relativeToHOME = !path.startsWith("/");
return path;
}
@@ -116,8 +117,9 @@ public class ProtocolPath implements Serializable {
}
public String getParentDirPath() {
- if (path.length() <= 1)
+ if (path.length() <= 1) {
return null;
+ }
return path.substring(0, path.lastIndexOf("/"));
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
index ccf28b1..8a765e1 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/ListRetriever.java
@@ -70,8 +70,9 @@ public class ListRetriever implements RetrievalMethod {
propFile), fileMetadata);
DownloadInfo di = dfi.getDownloadInfo();
if (!di.isAllowAliasOverride()
- || (remoteSite = vfs.getRemoteSite()) == null)
- remoteSite = di.getRemoteSite();
+ || (remoteSite = vfs.getRemoteSite()) == null) {
+ remoteSite = di.getRemoteSite();
+ }
LinkedList<String> fileList = FileRestrictions.toStringList(vfs
.getRootVirtualFile());
@@ -81,8 +82,9 @@ public class ListRetriever implements RetrievalMethod {
linker.addPropFileToDataFileLink(propFile, file);
if (!frs.addToDownloadQueue(remoteSite, file, di
.getRenamingConv(), di.getStagingArea(), dfi
- .getQueryMetadataElementName(), di.deleteFromServer(), fileMetadata))
- linker.eraseLinks(propFile);
+ .getQueryMetadataElementName(), di.deleteFromServer(), fileMetadata)) {
+ linker.eraseLinks(propFile);
+ }
} catch (ToManyFailedDownloadsException e) {
throw new RetrievalMethodException(
"Connection appears to be down. . .unusual number of download failures. . .stopping : "
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
index 925a65d..d3030e3 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalmethod/RemoteCrawler.java
@@ -89,8 +89,9 @@ public class RemoteCrawler implements RetrievalMethod {
// determine RemoteSite
DownloadInfo di = dfi.getDownloadInfo();
if (!di.isAllowAliasOverride()
- || (remoteSite = vfs.getRemoteSite()) == null)
- remoteSite = di.getRemoteSite();
+ || (remoteSite = vfs.getRemoteSite()) == null) {
+ remoteSite = di.getRemoteSite();
+ }
// modify vfs to be root based if HOME directory based
if (!vfs.isRootBased()) {
@@ -132,11 +133,12 @@ public class RemoteCrawler implements RetrievalMethod {
});
// if directory had more children then add them
- if (children.size() > 0)
- files.addAll(children);
- // otherwise remove the directory from the crawl list
- else
- files.pop();
+ if (children.size() > 0) {
+ files.addAll(children);
+ }// otherwise remove the directory from the crawl list
+ else {
+ files.pop();
+ }
// if file, then download it
} else {
@@ -144,8 +146,9 @@ public class RemoteCrawler implements RetrievalMethod {
if (!frs.addToDownloadQueue(files.pop(), di
.getRenamingConv(), di.getStagingArea(), dfi
.getQueryMetadataElementName(), di
- .deleteFromServer(), fileMetadata))
- linker.eraseLinks(propFile);
+ .deleteFromServer(), fileMetadata)) {
+ linker.eraseLinks(propFile);
+ }
}
} catch (ToManyFailedDownloadsException e) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
index b6b87bd..790eb1d 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DataFileToPropFileLinker.java
@@ -68,10 +68,11 @@ public class DataFileToPropFileLinker implements DownloadListener {
public synchronized void markAsFailed(File propFile, String errorMsg) {
String errors = this.propFileToErrorsMap.get(propFile);
- if (errors == null)
- this.propFileToErrorsMap.put(propFile, errorMsg);
- else
- this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
+ if (errors == null) {
+ this.propFileToErrorsMap.put(propFile, errorMsg);
+ } else {
+ this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
+ }
}
public synchronized void markAsFailed(ProtocolFile pFile, String errorMsg) {
@@ -82,10 +83,11 @@ public class DataFileToPropFileLinker implements DownloadListener {
File propFile = this.protocolFilePathAndPropFileMap.get(pFilePath);
if (propFile != null) {
String errors = this.propFileToErrorsMap.get(propFile);
- if (errors == null)
- this.propFileToErrorsMap.put(propFile, errorMsg);
- else
- this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
+ if (errors == null) {
+ this.propFileToErrorsMap.put(propFile, errorMsg);
+ } else {
+ this.propFileToErrorsMap.put(propFile, errors + "," + errorMsg);
+ }
}
}
@@ -97,11 +99,14 @@ public class DataFileToPropFileLinker implements DownloadListener {
public synchronized void eraseLinks(File propFile) {
LinkedList<String> keysToRemove = new LinkedList<String>();
for (Entry<String, File> entry : this.protocolFilePathAndPropFileMap
- .entrySet())
- if (entry.getValue().equals(propFile))
- keysToRemove.add(entry.getKey());
- for (String key : keysToRemove)
- this.protocolFilePathAndPropFileMap.remove(key);
+ .entrySet()) {
+ if (entry.getValue().equals(propFile)) {
+ keysToRemove.add(entry.getKey());
+ }
+ }
+ for (String key : keysToRemove) {
+ this.protocolFilePathAndPropFileMap.remove(key);
+ }
}
public synchronized String getErrors(File propFile) {
@@ -145,8 +150,9 @@ public class DataFileToPropFileLinker implements DownloadListener {
File propFile, LinkedList<ProtocolFile> list) {
LinkedList<ProtocolFile> returnList = new LinkedList<ProtocolFile>();
for (ProtocolFile pFile : list) {
- if (this.protocolFilePathAndPropFileMap.get(pFile.getPath()) != null)
- returnList.add(pFile);
+ if (this.protocolFilePathAndPropFileMap.get(pFile.getPath()) != null) {
+ returnList.add(pFile);
+ }
}
return returnList;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
index 2fd093a..81ed683 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/DownloadThreadEvaluator.java
@@ -57,9 +57,10 @@ public class DownloadThreadEvaluator {
public synchronized void startTrackingDownloadRuntimeForFile(File file)
throws ThreadEvaluatorException {
long curTime = System.currentTimeMillis();
- if (++this.currentThreadCount > this.MAX_THREADS)
+ if (++this.currentThreadCount > this.MAX_THREADS) {
throw new ThreadEvaluatorException(
- "Number of threads exceeds max allows threads");
+ "Number of threads exceeds max allows threads");
+ }
updateThreadCounts(curTime);
fileAndDownloadingFileInfo.put(file, new DownloadingFileInfo(file,
curTime, this.currentThreadCount));
@@ -93,10 +94,11 @@ public class DownloadThreadEvaluator {
long nextTime;
for (int i = 0; i < tatcList.size(); i++) {
TimeAndThreadCount tatc = tatcList.get(i);
- if (i + 1 >= tatcList.size())
+ if (i + 1 >= tatcList.size()) {
nextTime = finishTime;
- else
+ } else {
nextTime = tatcList.get(i + 1).getStartTimeInMillis();
+ }
long threadCountTime = nextTime - tatc.getStartTimeInMillis();
total += ((double) (tatc.getThreadCount() * threadCountTime))
/ (double) runtime;
@@ -107,10 +109,11 @@ public class DownloadThreadEvaluator {
double downloadSpeed = (file.length() * avgThreadCountForFile)
/ calculateRuntime(dfi.getStartTimeInMillis());
double currentAvgSpeed = this.downloadSpeedsForEachThread[avgThreadCountForFile];
- if (currentAvgSpeed == 0)
+ if (currentAvgSpeed == 0) {
this.downloadSpeedsForEachThread[avgThreadCountForFile] = downloadSpeed;
- else
+ } else {
this.downloadSpeedsForEachThread[avgThreadCountForFile] = (currentAvgSpeed + downloadSpeed) / 2;
+ }
} catch (Exception e) {
e.printStackTrace();
throw new ThreadEvaluatorException("Failed to register file "
@@ -137,14 +140,16 @@ public class DownloadThreadEvaluator {
}
if (curRecThreadCount != this.MAX_THREADS
- && this.downloadSpeedsForEachThread[curRecThreadCount + 1] == 0)
+ && this.downloadSpeedsForEachThread[curRecThreadCount + 1] == 0) {
curRecThreadCount++;
- else if (this.downloadSpeedsForEachThread[curRecThreadCount - 1] == 0)
+ } else if (this.downloadSpeedsForEachThread[curRecThreadCount - 1] == 0) {
curRecThreadCount--;
+ }
System.out.print("[ ");
- for (double time : downloadSpeedsForEachThread)
+ for (double time : downloadSpeedsForEachThread) {
System.out.print(time + " ");
+ }
System.out.println("]");
System.out.println("Recommended Threads: " + curRecThreadCount);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
index d9ab5c5..1559069 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/FileRetrievalSystem.java
@@ -236,8 +236,9 @@ public class FileRetrievalSystem {
threadController = new ThreadPoolExecutor(this.max_sessions,
this.max_sessions, EXTRA_LAZY_SESSIONS_TIMEOUT,
TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>());
- if (config.useTracker())
- dtEval = new DownloadThreadEvaluator(this.absMaxAllowedSessions);
+ if (config.useTracker()) {
+ dtEval = new DownloadThreadEvaluator(this.absMaxAllowedSessions);
+ }
}
/**
@@ -277,67 +278,74 @@ public class FileRetrievalSystem {
public void changeToRoot(RemoteSite remoteSite) throws
org.apache.oodt.cas.protocol.exceptions.ProtocolException {
- if (validate(remoteSite))
- protocolHandler.cdToROOT(protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ protocolHandler.cdToROOT(protocolHandler
+ .getAppropriateProtocolBySite(remoteSite, true));
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public void changeToHOME(RemoteSite remoteSite) throws ProtocolException {
- if (validate(remoteSite))
- protocolHandler.cdToHOME(protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ protocolHandler.cdToHOME(protocolHandler
+ .getAppropriateProtocolBySite(remoteSite, true));
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public void changeToDir(String dir, RemoteSite remoteSite)
throws MalformedURLException, ProtocolException {
- if (validate(remoteSite))
- this
- .changeToDir(protocolHandler.getProtocolFileFor(remoteSite,
- protocolHandler.getAppropriateProtocolBySite(
- remoteSite, true), dir, true));
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ this
+ .changeToDir(protocolHandler.getProtocolFileFor(remoteSite,
+ protocolHandler.getAppropriateProtocolBySite(
+ remoteSite, true), dir, true));
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public void changeToDir(RemoteSiteFile pFile) throws ProtocolException {
RemoteSite remoteSite = pFile.getSite();
- if (validate(remoteSite))
- protocolHandler.cd(protocolHandler.getAppropriateProtocolBySite(
- remoteSite, true), pFile);
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ protocolHandler.cd(protocolHandler.getAppropriateProtocolBySite(
+ remoteSite, true), pFile);
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public ProtocolFile getHomeDir(RemoteSite remoteSite)
throws ProtocolException {
- if (validate(remoteSite))
- return protocolHandler.getHomeDir(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ return protocolHandler.getHomeDir(remoteSite, protocolHandler
+ .getAppropriateProtocolBySite(remoteSite, true));
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public ProtocolFile getProtocolFile(RemoteSite remoteSite, String file,
boolean isDir) throws ProtocolException {
- if (validate(remoteSite))
- return protocolHandler.getProtocolFileFor(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true), file,
- isDir);
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ return protocolHandler.getProtocolFileFor(remoteSite, protocolHandler
+ .getAppropriateProtocolBySite(remoteSite, true), file,
+ isDir);
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public ProtocolFile getCurrentFile(RemoteSite remoteSite)
throws ProtocolException {
- if (validate(remoteSite))
- return protocolHandler.pwd(remoteSite, protocolHandler
- .getAppropriateProtocolBySite(remoteSite, true));
- else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ if (validate(remoteSite)) {
+ return protocolHandler.pwd(remoteSite, protocolHandler
+ .getAppropriateProtocolBySite(remoteSite, true));
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
// returns true if download was added to queue. . .false otherwise
@@ -349,14 +357,16 @@ public class FileRetrievalSystem {
AlreadyInDatabaseException, UndefinedTypeException,
CatalogException, IOException {
if (validate(remoteSite)) {
- if (!file.startsWith("/"))
- file = "/" + file;
+ if (!file.startsWith("/")) {
+ file = "/" + file;
+ }
return addToDownloadQueue(protocolHandler.getProtocolFileFor(remoteSite,
protocolHandler.getAppropriateProtocolBySite(remoteSite,
true), file, false), renamingString, downloadToDir,
uniqueMetadataElement, deleteAfterDownload, fileMetadata);
- } else
- throw new ProtocolException("Not a valid remote site " + remoteSite);
+ } else {
+ throw new ProtocolException("Not a valid remote site " + remoteSite);
+ }
}
public boolean validate(RemoteSite remoteSite) {
@@ -378,10 +388,11 @@ public class FileRetrievalSystem {
synchronized (this) {
for (int i = 0; i < 180; i++) {
try {
- if (this.avaliableSessions.size() == this.numberOfSessions)
- return;
- else
- this.wait(5000);
+ if (this.avaliableSessions.size() == this.numberOfSessions) {
+ return;
+ } else {
+ this.wait(5000);
+ }
} catch (Exception ignored) {
}
}
@@ -401,12 +412,13 @@ public class FileRetrievalSystem {
UndefinedTypeException,
CatalogException,
IOException {
- if (this.failedDownloadList.size() > max_allowed_failed_downloads)
- throw new ToManyFailedDownloadsException(
- "Number of failed downloads exceeds "
- + max_allowed_failed_downloads
- + " . . . blocking all downloads from being added to queue . . . "
- + "reset error flag in order to force allow downloads into queue");
+ if (this.failedDownloadList.size() > max_allowed_failed_downloads) {
+ throw new ToManyFailedDownloadsException(
+ "Number of failed downloads exceeds "
+ + max_allowed_failed_downloads
+ + " . . . blocking all downloads from being added to queue . . . "
+ + "reset error flag in order to force allow downloads into queue");
+ }
if (this.isDownloading(file)) {
LOG.log(Level.WARNING, "Skipping file '" + file
+ "' because it is already on the download queue");
@@ -451,8 +463,9 @@ public class FileRetrievalSystem {
downloadToDir = new File(downloadToDir.isAbsolute() ? downloadToDir
.getAbsolutePath() : this.config.getBaseStagingArea() + "/"
+ downloadToDir.getPath());
- if (!this.isStagingAreaInitialized(downloadToDir))
- this.initializeStagingArea(downloadToDir);
+ if (!this.isStagingAreaInitialized(downloadToDir)) {
+ this.initializeStagingArea(downloadToDir);
+ }
remoteFile.addMetadata(RemoteFile.DOWNLOAD_TO_DIR, downloadToDir.getAbsolutePath());
@@ -510,9 +523,10 @@ public class FileRetrievalSystem {
+ " because it is already in staging area");
return false;
}
- } else
- throw new AlreadyInDatabaseException("File " + file
- + " is already the database");
+ } else {
+ throw new AlreadyInDatabaseException("File " + file
+ + " is already the database");
+ }
}
private boolean isStagingAreaInitialized(File stagingArea) {
@@ -541,9 +555,10 @@ public class FileRetrievalSystem {
} else {
LOG.log(Level.INFO, "Staging area " + stagingArea.getAbsolutePath()
+ " does not exist! -- trying to create it ");
- if (!stagingArea.mkdirs())
- throw new IOException("Failed to create staging area at "
- + stagingArea.getAbsolutePath());
+ if (!stagingArea.mkdirs()) {
+ throw new IOException("Failed to create staging area at "
+ + stagingArea.getAbsolutePath());
+ }
}
this.stagingAreas.add(stagingArea);
}
@@ -560,8 +575,9 @@ public class FileRetrievalSystem {
+ "/"
+ RenamingConvention.rename(remoteFile, renamingString));
if (!newFile.getParentFile().equals(
- remoteFile.getMetadata(RemoteFile.DOWNLOAD_TO_DIR)))
- newFile.getParentFile().mkdirs();
+ remoteFile.getMetadata(RemoteFile.DOWNLOAD_TO_DIR))) {
+ newFile.getParentFile().mkdirs();
+ }
return newFile;
}
}
@@ -650,11 +666,12 @@ public class FileRetrievalSystem {
false, /* navigate */true);
} else {
try {
- if (file.isDir())
- protocolHandler.cd(session, file);
- else
- protocolHandler.cd(session,
- new RemoteSiteFile(file.getParent(), file.getSite()));
+ if (file.isDir()) {
+ protocolHandler.cd(session, file);
+ } else {
+ protocolHandler.cd(session,
+ new RemoteSiteFile(file.getParent(), file.getSite()));
+ }
} catch (Exception e) {
e.printStackTrace();
try {
@@ -711,9 +728,10 @@ public class FileRetrievalSystem {
int retries = 0;
Protocol curSession = session;
- if (FileRetrievalSystem.this.dListener != null)
- FileRetrievalSystem.this.dListener
- .downloadStarted(remoteFile.getProtocolFile());
+ if (FileRetrievalSystem.this.dListener != null) {
+ FileRetrievalSystem.this.dListener
+ .downloadStarted(remoteFile.getProtocolFile());
+ }
// try until successful or all retries have been used
do {
@@ -741,10 +759,11 @@ public class FileRetrievalSystem {
}
successful = true;
- if (FileRetrievalSystem.this.dListener != null)
- FileRetrievalSystem.this.dListener
- .downloadFinished(remoteFile
- .getProtocolFile());
+ if (FileRetrievalSystem.this.dListener != null) {
+ FileRetrievalSystem.this.dListener
+ .downloadFinished(remoteFile
+ .getProtocolFile());
+ }
remoteFile.addMetadata(RemoteFile.FILE_SIZE, newFile
.length()
@@ -770,8 +789,9 @@ public class FileRetrievalSystem {
} catch (Exception e) {
// if tracker is being used cancel tracking
- if (config.useTracker())
- dtEval.cancelRuntimeTracking(newFile);
+ if (config.useTracker()) {
+ dtEval.cancelRuntimeTracking(newFile);
+ }
// delete any created file from staging area
newFile.delete();
@@ -785,11 +805,12 @@ public class FileRetrievalSystem {
LOG.log(Level.SEVERE, "Failed to download "
+ remoteFile.getProtocolFile() + " : "
+ e.getMessage());
- if (FileRetrievalSystem.this.dListener != null)
- FileRetrievalSystem.this.dListener
- .downloadFailed(remoteFile
- .getProtocolFile(), e
- .getMessage());
+ if (FileRetrievalSystem.this.dListener != null) {
+ FileRetrievalSystem.this.dListener
+ .downloadFailed(remoteFile
+ .getProtocolFile(), e
+ .getMessage());
+ }
break;
} else if (FileRetrievalSystem.this.failedDownloadList
.size() < max_allowed_failed_downloads) {
@@ -823,11 +844,12 @@ public class FileRetrievalSystem {
.getProtocolFile()
+ " do to too many previous download failures : "
+ e.getMessage(), e);
- if (FileRetrievalSystem.this.dListener != null)
- FileRetrievalSystem.this.dListener
- .downloadFailed(remoteFile
- .getProtocolFile(), e
- .getMessage());
+ if (FileRetrievalSystem.this.dListener != null) {
+ FileRetrievalSystem.this.dListener
+ .downloadFailed(remoteFile
+ .getProtocolFile(), e
+ .getMessage());
+ }
break;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
index 3847ba5..68b0dcb 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RemoteFile.java
@@ -80,11 +80,13 @@ public class RemoteFile implements RemoteFileMetKeys {
try {
SerializableMetadata sMetadata = new SerializableMetadata("UTF-8",
false);
- for (String metadataKey : metadataToWriteOut)
+ for (String metadataKey : metadataToWriteOut) {
if (this.metadata.getMetadata(metadataKey) != null
- && !this.metadata.getMetadata(metadataKey).equals(""))
+ && !this.metadata.getMetadata(metadataKey).equals("")) {
sMetadata.addMetadata(metadataKey, this.metadata
- .getMetadata(metadataKey));
+ .getMetadata(metadataKey));
+ }
+ }
sMetadata.writeMetadataToXmlStream(new FileOutputStream(filePath));
} catch (Exception e) {
throw new IOException("Failed to write metadata file for "
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
index 3908f29..4b547be 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/retrievalsystem/RetrievalSetup.java
@@ -122,8 +122,9 @@ public class RetrievalSetup {
for (File propFile : propFiles) {
try {
if (pfi.getLocalDir().equals(pfi.getOnSuccessDir())
- || pfi.getLocalDir().equals(pfi.getOnFailDir()))
- alreadyProcessedPropFiles.add(propFile);
+ || pfi.getLocalDir().equals(pfi.getOnFailDir())) {
+ alreadyProcessedPropFiles.add(propFile);
+ }
this.movePropsFileToFinalDestination(pfi, propFile,
linker.getErrorsAndEraseLinks(propFile));
} catch (Exception e) {
@@ -138,8 +139,9 @@ public class RetrievalSetup {
} catch (Exception e) {
e.printStackTrace();
} finally {
- if (dataFilesFRS != null)
- dataFilesFRS.shutdown();
+ if (dataFilesFRS != null) {
+ dataFilesFRS.shutdown();
+ }
alreadyProcessedPropFiles.clear();
linker.clear();
}
@@ -184,8 +186,9 @@ public class RetrievalSetup {
} catch (Exception e) {
e.printStackTrace();
} finally {
- if (frs != null)
- frs.shutdown();
+ if (frs != null) {
+ frs.shutdown();
+ }
RetrievalSetup.this.downloadingProps = false;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java b/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java
index 16eaaac..79916ad 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/batchmgr/XmlRpcBatchMgrProxy.java
@@ -117,10 +117,11 @@ public class XmlRpcBatchMgrProxy extends Thread implements Runnable {
parent.jobExecuting(jobSpec);
result = (Boolean) client
.execute("batchstub.executeJob", argList);
- if (result)
- parent.jobSuccess(jobSpec);
- else
- throw new Exception("batchstub.executeJob returned false");
+ if (result) {
+ parent.jobSuccess(jobSpec);
+ } else {
+ throw new Exception("batchstub.executeJob returned false");
+ }
} catch (Exception e) {
LOG.log(Level.SEVERE, "Job execution failed for jobId '" + jobSpec.getJob().getId() + "' : " + e.getMessage(), e);
parent.jobFailure(jobSpec);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetJobInfoCliAction.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetJobInfoCliAction.java b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetJobInfoCliAction.java
index a5cb480..f040a38 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetJobInfoCliAction.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetJobInfoCliAction.java
@@ -70,7 +70,8 @@ public class GetJobInfoCliAction extends ResourceCliAction {
return "SCHEDULED";
} else if (status.equals(JobStatus.KILLED)) {
return "KILLED";
- } else
+ } else {
return null;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodesInQueueCliAction.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodesInQueueCliAction.java b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodesInQueueCliAction.java
index b42a0a4..20eaf61 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodesInQueueCliAction.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetNodesInQueueCliAction.java
@@ -42,8 +42,9 @@ public class GetNodesInQueueCliAction extends ResourceCliAction {
List<String> nodeIds = getClient().getNodesInQueue(queueName);
printer.println("Nodes in Queue '" + queueName + "':");
- for (String nodeId : nodeIds)
+ for (String nodeId : nodeIds) {
printer.println(" - " + nodeId);
+ }
printer.println();
} catch (Exception e) {
throw new CmdLineActionException("Failed to get nodes in queue '"
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesCliAction.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesCliAction.java b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesCliAction.java
index f97b2be..48d7c02 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesCliAction.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesCliAction.java
@@ -35,8 +35,9 @@ public class GetQueuesCliAction extends ResourceCliAction {
try {
List<String> queueNames = getClient().getQueues();
printer.println("Queues:");
- for (String queueName : queueNames)
- printer.println(" - " + queueName);
+ for (String queueName : queueNames) {
+ printer.println(" - " + queueName);
+ }
printer.println();
} catch (Exception e) {
throw new CmdLineActionException("Failed to get queues : "
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesWithNodeCliAction.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesWithNodeCliAction.java b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesWithNodeCliAction.java
index 11b59a5..e4b3e89 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesWithNodeCliAction.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/cli/action/GetQueuesWithNodeCliAction.java
@@ -42,8 +42,9 @@ public class GetQueuesWithNodeCliAction extends ResourceCliAction {
List<String> queueNames = getClient().getQueuesWithNode(nodeId);
printer.println("Queues with node '" + nodeId + "':");
- for (String queueName : queueNames)
+ for (String queueName : queueNames) {
printer.println(" - " + queueName);
+ }
printer.println();
} catch (Exception e) {
throw new CmdLineActionException("Failed to get queues with node '"
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/jobqueue/JobStack.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/jobqueue/JobStack.java b/resource/src/main/java/org/apache/oodt/cas/resource/jobqueue/JobStack.java
index 5118a72..9312580 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/jobqueue/JobStack.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/jobqueue/JobStack.java
@@ -75,9 +75,10 @@ public class JobStack implements JobQueue {
spec.getJob().setStatus(JobStatus.QUEUED);
safeUpdateJob(spec);
return jobId;
- } else
+ } else {
throw new JobQueueException("Reached max queue size: [" + maxQueueSize
- + "]: Unable to add job: [" + spec.getJob().getId() + "]");
+ + "]: Unable to add job: [" + spec.getJob().getId() + "]");
+ }
}
/*
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/MemoryJobRepository.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/MemoryJobRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/MemoryJobRepository.java
index b9283e6..3c4424f 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/MemoryJobRepository.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/MemoryJobRepository.java
@@ -59,8 +59,9 @@ public class MemoryJobRepository implements JobRepository {
spec.getJob().setId(jobId);
jobMap.put(jobId, spec);
return jobId;
- } else
+ } else {
throw new JobRepositoryException("Exception persisting job: job is null!");
+ }
}
/*
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepository.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepository.java
index 93ba9cc..cb6edaa 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepository.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepository.java
@@ -63,13 +63,16 @@ public class XStreamJobRepository implements JobRepository {
XStream xstream = new XStream();
FileOutputStream os = null;
try {
- if (this.jobMap.size() >= this.maxHistory)
- FileUtils.forceDelete(new File(jobMap.remove(jobPrecedence.remove(0))));
+ if (this.jobMap.size() >= this.maxHistory) {
+ FileUtils.forceDelete(new File(jobMap.remove(jobPrecedence.remove(0))));
+ }
- if (spec.getJob().getId() == null)
- spec.getJob().setId(UUID.randomUUID().toString());
- else if (this.jobMap.containsKey(spec.getJob().getId()))
- throw new JobRepositoryException("JobId '" + spec.getJob().getId() + "' already in use -- must pick unique JobId");
+ if (spec.getJob().getId() == null) {
+ spec.getJob().setId(UUID.randomUUID().toString());
+ } else if (this.jobMap.containsKey(spec.getJob().getId())) {
+ throw new JobRepositoryException(
+ "JobId '" + spec.getJob().getId() + "' already in use -- must pick unique JobId");
+ }
File file = this.generateFilePath(spec.getJob().getId());
os = new FileOutputStream(file);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepositoryFactory.java b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepositoryFactory.java
index 9e0288c..f5a5fc0 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepositoryFactory.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/jobrepo/XStreamJobRepositoryFactory.java
@@ -38,13 +38,15 @@ public class XStreamJobRepositoryFactory implements JobRepositoryFactory {
public XStreamJobRepository createRepository() {
try {
String workingDirPropVal = System.getProperty("org.apache.oodt.cas.resource.jobrepo.xstream.working.dir");
- if (workingDirPropVal == null)
- return null;
- else
- workingDirPropVal = PathUtils.doDynamicReplacement(workingDirPropVal);
+ if (workingDirPropVal == null) {
+ return null;
+ } else {
+ workingDirPropVal = PathUtils.doDynamicReplacement(workingDirPropVal);
+ }
File working = new File(workingDirPropVal);
- if (!working.exists())
- working.mkdirs();
+ if (!working.exists()) {
+ working.mkdirs();
+ }
int maxHistory = Integer.parseInt(System.getProperty("org.apache.oodt.cas.resource.jobrepo.xstream.max.history", "-1"));
return new XStreamJobRepository(working, maxHistory);
}catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
index 77fb4a2..bc969b0 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/AssignmentMonitor.java
@@ -86,8 +86,9 @@ public class AssignmentMonitor implements Monitor {
throws MonitorException {
int load = loadMap.get(node.getNodeId());
int newVal = load - loadValue;
- if (newVal < 0)
+ if (newVal < 0) {
newVal = 0; // should not happen but just in case
+ }
loadMap.remove(node.getNodeId());
loadMap.put(node.getNodeId(), newVal);
return true;
@@ -141,8 +142,9 @@ public class AssignmentMonitor implements Monitor {
public void addNode(ResourceNode node) throws MonitorException {
nodesMap.put(node.getNodeId(), node);
- if (!loadMap.containsKey(node.getNodeId()))
+ if (!loadMap.containsKey(node.getNodeId())) {
loadMap.put(node.getNodeId(), 0);
+ }
}
public void removeNodeById(String nodeId) throws MonitorException {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
index 5725a83..cb2a938 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/monitor/ganglia/GangliaResourceMonitor.java
@@ -229,7 +229,9 @@ public class GangliaResourceMonitor implements Monitor {
private ResourceNode nodeFromMap(Map<String, String> map)
throws MalformedURLException {
- if (map == null) return null;
+ if (map == null) {
+ return null;
+ }
ResourceNode node = new ResourceNode();
System.out.println("MAP IS "+map);
System.out.println("Setting hostname to "+map.get(NAME));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/mux/StandardBackendManager.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/mux/StandardBackendManager.java b/resource/src/main/java/org/apache/oodt/cas/resource/mux/StandardBackendManager.java
index 1ccdb17..6647588 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/mux/StandardBackendManager.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/mux/StandardBackendManager.java
@@ -60,8 +60,9 @@ public class StandardBackendManager implements BackendManager {
*/
public Monitor getMonitor(String queue) throws QueueManagerException {
BackendSet set = queueToBackend.get(queue);
- if (set == null)
+ if (set == null) {
throw new QueueManagerException("Queue '" + queue + "' does not exist");
+ }
return set.monitor;
}
/**
@@ -72,8 +73,9 @@ public class StandardBackendManager implements BackendManager {
*/
public Batchmgr getBatchmgr(String queue) throws QueueManagerException {
BackendSet set = queueToBackend.get(queue);
- if (set == null)
+ if (set == null) {
throw new QueueManagerException("Queue '" + queue + "' does not exist");
+ }
return set.batchmgr;
}
/**
@@ -84,8 +86,9 @@ public class StandardBackendManager implements BackendManager {
*/
public Scheduler getScheduler(String queue) throws QueueManagerException {
BackendSet set = queueToBackend.get(queue);
- if (set == null)
+ if (set == null) {
throw new QueueManagerException("Queue '" + queue + "' does not exist");
+ }
return set.scheduler;
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java b/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java
index da0a82d..5ab08ff 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/mux/XmlBackendRepository.java
@@ -54,8 +54,9 @@ public class XmlBackendRepository implements BackendRepository {
* @param uri - uri of XML file containing mapping
*/
public XmlBackendRepository(String uri) {
- if (uri == null)
+ if (uri == null) {
throw new NullPointerException("URI for queue-to-backend xml file cannot be null");
+ }
this.uri = uri;
}
/* (non-Javadoc)
@@ -149,8 +150,9 @@ public class XmlBackendRepository implements BackendRepository {
String factory = getFactoryAttribute(queue, node, SCHEDULER);
LOG.log(Level.INFO,"Loading monitor from: "+factory);
Scheduler sch = GenericResourceManagerObjectFactory.getSchedulerServiceFromFactory(factory);
- if (sch != null)
+ if (sch != null) {
return sch;
+ }
throw new RepositoryException("Could instantiate from: "+factory);
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java b/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java
index c6a7522..c90896d 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/scheduler/QueueManager.java
@@ -49,13 +49,15 @@ public class QueueManager {
}
public synchronized void addNodeToQueue(String nodeId, String queueName) throws QueueManagerException {
- if (queueName == null || !this.queueToNodesMapping.containsKey(queueName))
- throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ if (queueName == null || !this.queueToNodesMapping.containsKey(queueName)) {
+ throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ }
// add node to queue
LinkedHashSet<String> nodes = this.queueToNodesMapping.get(queueName);
- if (nodes == null)
- nodes = new LinkedHashSet<String>();
+ if (nodes == null) {
+ nodes = new LinkedHashSet<String>();
+ }
nodes.add(nodeId);
// put node list back into map
@@ -63,15 +65,17 @@ public class QueueManager {
}
public synchronized void addQueue(String queueName) {
- if (queueName != null && !this.queueToNodesMapping.containsKey(queueName))
- this.queueToNodesMapping.put(queueName, new LinkedHashSet<String>());
+ if (queueName != null && !this.queueToNodesMapping.containsKey(queueName)) {
+ this.queueToNodesMapping.put(queueName, new LinkedHashSet<String>());
+ }
}
public synchronized List<String> getNodes(String queueName) throws QueueManagerException {
- if (queueName != null && this.queueToNodesMapping.containsKey(queueName))
- return new Vector<String>(this.queueToNodesMapping.get(queueName));
- else
- throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ if (queueName != null && this.queueToNodesMapping.containsKey(queueName)) {
+ return new Vector<String>(this.queueToNodesMapping.get(queueName));
+ } else {
+ throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ }
}
public synchronized List<String> getQueues() {
@@ -80,22 +84,26 @@ public class QueueManager {
public synchronized List<String> getQueues(String nodeId) {
Vector<String> queueNames = new Vector<String>();
- for (String queueName : this.queueToNodesMapping.keySet())
- if (this.queueToNodesMapping.get(queueName).contains(nodeId))
- queueNames.add(queueName);
+ for (String queueName : this.queueToNodesMapping.keySet()) {
+ if (this.queueToNodesMapping.get(queueName).contains(nodeId)) {
+ queueNames.add(queueName);
+ }
+ }
return queueNames;
}
public synchronized void removeNodeFromQueue(String nodeId, String queueName) throws QueueManagerException {
- if (queueName != null && this.queueToNodesMapping.containsKey(queueName))
- this.queueToNodesMapping.get(queueName).remove(nodeId);
- else
- throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ if (queueName != null && this.queueToNodesMapping.containsKey(queueName)) {
+ this.queueToNodesMapping.get(queueName).remove(nodeId);
+ } else {
+ throw new QueueManagerException("Queue '" + queueName + "' does not exist");
+ }
}
public synchronized void removeQueue(String queueName) {
- if (queueName != null)
- this.queueToNodesMapping.remove(queueName);
+ if (queueName != null) {
+ this.queueToNodesMapping.remove(queueName);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
index e35d1d5..9157d6d 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManager.java
@@ -267,8 +267,9 @@ public class XmlRpcResourceManager {
LOG.log(Level.WARNING, "Job: [" + jobId
+ "] not currently executing on any known node");
return "";
- } else
+ } else {
return execNode;
+ }
}
public List<String> getQueues() throws QueueManagerException {
@@ -326,8 +327,9 @@ public class XmlRpcResourceManager {
this.webServer.shutdown();
this.webServer = null;
return true;
- } else
- return false;
+ } else {
+ return false;
+ }
}
public String getNodeLoad(String nodeId) throws MonitorException{
@@ -441,11 +443,12 @@ public class XmlRpcResourceManager {
new XmlRpcResourceManager(portNum);
- for (;;)
+ for (;;) {
try {
Thread.currentThread().join();
} catch (InterruptedException ignore) {
}
+ }
}
public boolean setNodeCapacity(String nodeId, int capacity){
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
index aa9181e..0c6a318 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/XmlRpcResourceManagerClient.java
@@ -533,6 +533,8 @@ public class XmlRpcResourceManagerClient {
} else if (status.equals(JobStatus.KILLED)) {
return "KILLED";
}
- else return null;
+ else {
+ return null;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
index 77d7275..9427c42 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/system/extern/XmlRpcBatchStub.java
@@ -162,16 +162,18 @@ public class XmlRpcBatchStub {
+ "]: killed: exiting gracefully");
synchronized (jobThreadMap) {
Thread endThread = (Thread) jobThreadMap.get(job.getId());
- if (endThread != null)
+ if (endThread != null) {
endThread = null;
+ }
}
return false;
}
synchronized (jobThreadMap) {
Thread endThread = (Thread) jobThreadMap.get(job.getId());
- if (endThread != null)
+ if (endThread != null) {
endThread = null;
+ }
}
return runner.wasSuccessful();
@@ -198,11 +200,12 @@ public class XmlRpcBatchStub {
XmlRpcBatchStub stub = new XmlRpcBatchStub(portNum);
- for (;;)
+ for (;;) {
try {
Thread.currentThread().join();
} catch (InterruptedException ignore) {
}
+ }
}
private class RunnableJob implements Runnable {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/tools/RunDirJobSubmitter.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/tools/RunDirJobSubmitter.java b/resource/src/main/java/org/apache/oodt/cas/resource/tools/RunDirJobSubmitter.java
index 5f32b04..d73c819 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/tools/RunDirJobSubmitter.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/tools/RunDirJobSubmitter.java
@@ -104,8 +104,9 @@ public final class RunDirJobSubmitter {
try {
BufferedReader in = new BufferedReader(new FileReader(inputFname));
- if (!in.ready())
+ if (!in.ready()) {
throw new IOException();
+ }
String line;
String jobId;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/resource/src/main/java/org/apache/oodt/cas/resource/util/UlimitProperty.java
----------------------------------------------------------------------
diff --git a/resource/src/main/java/org/apache/oodt/cas/resource/util/UlimitProperty.java b/resource/src/main/java/org/apache/oodt/cas/resource/util/UlimitProperty.java
index fb1a578..cffbccb 100644
--- a/resource/src/main/java/org/apache/oodt/cas/resource/util/UlimitProperty.java
+++ b/resource/src/main/java/org/apache/oodt/cas/resource/util/UlimitProperty.java
@@ -98,8 +98,9 @@ public class UlimitProperty {
public int getIntValue() {
if (isUnlimited()) {
return -1;
- } else
+ } else {
return Integer.parseInt(this.value);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java b/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
index 318ff9d..1688d4f 100755
--- a/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
+++ b/sso/src/main/java/org/apache/oodt/security/sso/OpenSSOImpl.java
@@ -68,8 +68,9 @@ public class OpenSSOImpl extends AbstractWebBasedSingleSignOn implements
}
return details.getAttributes().getMetadata(UID_ATTRIBUTE_NAME) != null ? details
.getAttributes().getMetadata(UID_ATTRIBUTE_NAME) : UNKNOWN_USER;
- } else
+ } else {
return UNKNOWN_USER;
+ }
} else {
return new String(Base64.decodeBase64(cookieVal.getBytes()));
}
@@ -153,8 +154,9 @@ public class OpenSSOImpl extends AbstractWebBasedSingleSignOn implements
String cookieVal = this.getCookieVal(SSO_COOKIE_KEY);
if (cookieVal != null) {
return cookieVal;
- } else
+ } else {
return null;
+ }
}
private String getCookieVal(String name) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
----------------------------------------------------------------------
diff --git a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
index 7e24413..137238d 100755
--- a/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
+++ b/sso/src/main/java/org/apache/oodt/security/sso/opensso/SSOProxy.java
@@ -183,8 +183,9 @@ public class SSOProxy implements SSOMetKeys {
try {
while ((line = br.readLine()) != null) {
- if (line.equals(IDENTITY_DETAILS_ATTR_SKIP_LINE))
+ if (line.equals(IDENTITY_DETAILS_ATTR_SKIP_LINE)) {
continue;
+ }
String key, val;
if (line.startsWith(IDENTITY_DETAILS_REALM)) {
// can't parse it the same way
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
----------------------------------------------------------------------
diff --git a/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java b/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
index e2bb66a..dd9c50b 100644
--- a/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
+++ b/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/instance/WorkflowInstancesViewer.java
@@ -291,8 +291,9 @@ public class WorkflowInstancesViewer extends Panel {
}
return null;
- } else
- return null;
+ } else {
+ return null;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java
----------------------------------------------------------------------
diff --git a/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java b/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java
index b3a22a1..969d213 100644
--- a/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java
+++ b/webapp/components/src/main/java/org/apache/oodt/cas/webcomponents/workflow/model/WorkflowViewer.java
@@ -136,8 +136,9 @@ public class WorkflowViewer extends Panel {
if (summarizedString.length() > maxLengthTotal) {
return summarizedString.substring(0,
Math.min(maxLengthTotal, summarizedString.length()) - 3) + "...";
- } else
- return summarizedString.toString();
+ } else {
+ return summarizedString.toString();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java
----------------------------------------------------------------------
diff --git a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java
index 586f1c9..abfc5ed 100644
--- a/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java
+++ b/webapp/components/src/main/java/org/apache/oodt/pcs/webcomponents/health/VisibilityAndSortToggler.java
@@ -111,8 +111,9 @@ class VisibilityAndSortToggler extends VisibilityToggler {
PCSDaemonStatus stat2 = (PCSDaemonStatus) o2;
return stat1.getStatus().compareTo(stat2.getStatus());
- } else
+ } else {
return 0;
+ }
}
});
@@ -133,8 +134,9 @@ class VisibilityAndSortToggler extends VisibilityToggler {
PCSDaemonStatus stat2 = (PCSDaemonStatus) o2;
return stat1.getDaemonName().compareTo(stat2.getDaemonName());
- } else
+ } else {
return 0;
+ }
}
});
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
index 970eff4..b29c693 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataDeliveryServlet.java
@@ -114,11 +114,13 @@ public class DataDeliveryServlet extends HttpServlet implements
throws ServletException, IOException {
try {
String productID = req.getParameter("productID");
- if (productID == null)
+ if (productID == null) {
throw new IllegalArgumentException("productID is required");
+ }
String refIndex = req.getParameter("refIndex");
- if (refIndex == null)
+ if (refIndex == null) {
refIndex = "0";
+ }
int index = Integer.parseInt(refIndex);
String format = req.getParameter("format");
@@ -187,8 +189,9 @@ public class DataDeliveryServlet extends HttpServlet implements
o2 = res.getOutputStream();
byte[] buf = new byte[512];
int n;
- while ((n = in.read(buf)) != -1)
+ while ((n = in.read(buf)) != -1) {
o2.write(buf, 0, n);
+ }
} catch (Exception e) {
e.printStackTrace();
LOG.log(Level.WARNING, "Exception delivering data!: Message: "
@@ -240,8 +243,9 @@ public class DataDeliveryServlet extends HttpServlet implements
OutputStream out = res.getOutputStream();
byte[] buf = new byte[512];
int n;
- while ((n = in.read(buf)) != -1)
+ while ((n = in.read(buf)) != -1) {
out.write(buf, 0, n);
+ }
in.close();
out.close();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataUtils.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataUtils.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataUtils.java
index d692f4a..cb2267f 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataUtils.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DataUtils.java
@@ -178,28 +178,29 @@ public final class DataUtils implements DataDeliveryKeys {
*/
public static String guessTypeFromName(String name) {
name = name.toLowerCase();
- if (name.endsWith(".jpg") || name.endsWith(".jpeg"))
+ if (name.endsWith(".jpg") || name.endsWith(".jpeg")) {
return "image/jpeg";
- else if (name.endsWith(".png"))
+ } else if (name.endsWith(".png")) {
return "image/png";
- else if (name.endsWith(".gif"))
+ } else if (name.endsWith(".gif")) {
return "image/gif";
- else if (name.endsWith(".doc"))
+ } else if (name.endsWith(".doc")) {
return "application/msword";
- else if (name.endsWith(".pdf"))
+ } else if (name.endsWith(".pdf")) {
return "application/pdf";
- else if (name.endsWith(".rtf"))
+ } else if (name.endsWith(".rtf")) {
return "application/rtf";
- else if (name.endsWith(".xls"))
+ } else if (name.endsWith(".xls")) {
return "application/vnd.ms-excel";
- else if (name.endsWith(".ppt"))
+ } else if (name.endsWith(".ppt")) {
return "application/vnd.ms-powerpoint";
- else if (name.endsWith(".html") || name.endsWith(".htm"))
+ } else if (name.endsWith(".html") || name.endsWith(".htm")) {
return "text/html";
- else if (name.endsWith(".xml"))
+ } else if (name.endsWith(".xml")) {
return "text/xml";
- else if (name.endsWith(".txt"))
+ } else if (name.endsWith(".txt")) {
return "text/plain";
+ }
return "application/octet-stream";
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DatasetDeliveryServlet.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DatasetDeliveryServlet.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DatasetDeliveryServlet.java
index 3f0ee6f..86ef290 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DatasetDeliveryServlet.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/data/DatasetDeliveryServlet.java
@@ -194,8 +194,9 @@ public class DatasetDeliveryServlet extends HttpServlet implements
o2 = res.getOutputStream();
byte[] buf = new byte[512];
int n;
- while ((n = in.read(buf)) != -1)
+ while ((n = in.read(buf)) != -1) {
o2.write(buf, 0, n);
+ }
} catch (Exception e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/ProductTypeFilter.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/ProductTypeFilter.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/ProductTypeFilter.java
index aaeab6a..ffd415a 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/ProductTypeFilter.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/ProductTypeFilter.java
@@ -43,12 +43,15 @@ public class ProductTypeFilter {
public ProductTypeFilter(String filter) {
this.constraints = new Properties();
- if (filter != null)
+ if (filter != null) {
this.parse(filter);
+ }
}
public void parse(String filter) {
- if(filter == null) return;
+ if(filter == null) {
+ return;
+ }
String[] attrConstrs = filter.split(",");
for (String attrConstr : attrConstrs) {
String[] attrConstPair = attrConstr.split("\\:");
@@ -57,7 +60,9 @@ public class ProductTypeFilter {
}
public boolean filter(ProductType type) {
- if(this.constraints == null) return true;
+ if(this.constraints == null) {
+ return true;
+ }
if (type.getTypeMetadata() != null) {
Metadata typeMet = type.getTypeMetadata();
for (Object constraintObj : this.constraints.keySet()) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFConfig.java
----------------------------------------------------------------------
diff --git a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFConfig.java b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFConfig.java
index e62f0d4..9bf336e 100644
--- a/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFConfig.java
+++ b/webapp/fmprod/src/main/java/org/apache/oodt/cas/product/rdf/RDFConfig.java
@@ -175,8 +175,9 @@ public class RDFConfig {
public String getKeyNs(String key) {
if (this.keyNsMap != null && this.keyNsMap.containsKey(key)) {
return this.keyNsMap.get(key);
- } else
+ } else {
return this.getDefaultKeyNs();
+ }
}
/**
@@ -192,8 +193,9 @@ public class RDFConfig {
public String getTypeNs(String type) {
if (this.typesNsMap != null && this.typesNsMap.containsKey(type)) {
return this.typesNsMap.get(type);
- } else
+ } else {
return this.getDefaultTypeNs();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
index 690928b..655766c 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowByIdCliAction.java
@@ -39,7 +39,9 @@ public class GetWorkflowByIdCliAction extends WorkflowCliAction {
String taskIds = "";
for (WorkflowTask wt : workflow.getTasks()) {
- if (taskIds.length()>0) taskIds += ", ";
+ if (taskIds.length()>0) {
+ taskIds += ", ";
+ }
taskIds += wt.getTaskId();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
index 155291a..7661cad 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/cli/action/GetWorkflowsByEventCliAction.java
@@ -49,7 +49,9 @@ public class GetWorkflowsByEventCliAction extends WorkflowCliAction {
String taskIds = "";
for (WorkflowTask wt : workflow.getTasks()) {
- if (taskIds.length()>0) taskIds += ", ";
+ if (taskIds.length()>0) {
+ taskIds += ", ";
+ }
taskIds += wt.getTaskId();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
index 56e6fe5..8f37643 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/TaskQuerier.java
@@ -138,8 +138,9 @@ public class TaskQuerier implements Runnable {
}
synchronized (runnableProcessors) {
- if (running)
+ if (running) {
runnableProcessors = processorsToRun;
+ }
}
} else {
@@ -192,8 +193,9 @@ public class TaskQuerier implements Runnable {
* {@link #runnableProcessors}.
*/
public TaskProcessor getNext() {
- if (getRunnableProcessors().size() == 0)
+ if (getRunnableProcessors().size() == 0) {
return null;
+ }
return (TaskProcessor) getRunnableProcessors().remove(0);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
index 805d782..aa096fd 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/ThreadPoolWorkflowEngine.java
@@ -118,8 +118,9 @@ public class ThreadPoolWorkflowEngine implements WorkflowEngine, WorkflowStatus
workerMap = new HashMap();
- if (resUrl != null)
+ if (resUrl != null) {
rClient = new XmlRpcResourceManagerClient(resUrl);
+ }
}
/*
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
index 32cc608..e14336a 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/SequentialProcessor.java
@@ -41,10 +41,11 @@ public class SequentialProcessor extends WorkflowProcessor {
@Override
public List<WorkflowProcessor> getRunnableSubProcessors() {
WorkflowProcessor nextWP = this.getNext();
- if (nextWP != null)
+ if (nextWP != null) {
return Collections.singletonList(nextWP);
- else
+ } else {
return new Vector<WorkflowProcessor>();
+ }
}
@Override
@@ -53,10 +54,12 @@ public class SequentialProcessor extends WorkflowProcessor {
}
private WorkflowProcessor getNext() {
- for (WorkflowProcessor wp : this.getSubProcessors())
+ for (WorkflowProcessor wp : this.getSubProcessors()) {
if (!wp.getWorkflowInstance().getState().getCategory().getName()
- .equals("done") && !wp.getWorkflowInstance().getState().getName().equals("Executing"))
+ .equals("done") && !wp.getWorkflowInstance().getState().getName().equals("Executing")) {
return wp;
+ }
+ }
return null;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
index 613eb55..0ec3744 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/TaskProcessor.java
@@ -89,8 +89,9 @@ public class TaskProcessor extends WorkflowProcessor {
calendar.setTime(this.getWorkflowInstance().getState().getStartTime());
long elapsedTime = ((System.currentTimeMillis() - calendar
.getTimeInMillis()) / 1000) / 60;
- if (elapsedTime >= requiredBlockTimeElapse)
+ if (elapsedTime >= requiredBlockTimeElapse) {
tps.add(this);
+ }
} else if (this.isAnyState("Loaded", "Queued", "PreConditionSuccess") &&
!this.isAnyState("Executing") && this.passedPreConditions()){
tps.add(this);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
index 3c4b086..2e76972 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessor.java
@@ -219,8 +219,9 @@ public abstract class WorkflowProcessor implements WorkflowProcessorListener,
*/
@Override
public void notifyChange(WorkflowProcessor processor, ChangeType changeType) {
- for (WorkflowProcessorListener listener : this.getListeners())
+ for (WorkflowProcessorListener listener : this.getListeners()) {
listener.notifyChange(this, changeType);
+ }
}
public synchronized List<TaskProcessor> getRunnableWorkflowProcessors() {
@@ -238,8 +239,9 @@ public abstract class WorkflowProcessor implements WorkflowProcessorListener,
} else if (this.isDone().getName().equals("ResultsFailure")) {
// do nothing -- this workflow failed!!!
} else if (this.isDone().getName().equals("ResultsBail")) {
- for (WorkflowProcessor subProcessor : this.getRunnableSubProcessors())
+ for (WorkflowProcessor subProcessor : this.getRunnableSubProcessors()) {
runnableTasks.addAll(subProcessor.getRunnableWorkflowProcessors());
+ }
} else if (!this.passedPostConditions()) {
for (WorkflowProcessor subProcessor : this.getPostConditions()
.getRunnableSubProcessors()) {
@@ -402,10 +404,11 @@ public abstract class WorkflowProcessor implements WorkflowProcessorListener,
List<WorkflowProcessor> failedSubProcessors = this.helper
.getWorkflowProcessorsByState(this.getSubProcessors(), "Failure");
if (this.minReqSuccessfulSubProcessors != -1
- && failedSubProcessors.size() > (this.getSubProcessors().size() - this.minReqSuccessfulSubProcessors))
+ && failedSubProcessors.size() > (this.getSubProcessors().size() - this.minReqSuccessfulSubProcessors)) {
return lifecycleManager.getDefaultLifecycle().createState(
"ResultsFailure", "results",
"More than the allowed number of sub-processors failed");
+ }
for (WorkflowProcessor subProcessor : failedSubProcessors) {
if (!this.getExcusedSubProcessorIds().contains(
subProcessor.getWorkflowInstance().getId())) {
@@ -417,12 +420,13 @@ public abstract class WorkflowProcessor implements WorkflowProcessorListener,
}
}
if (this.helper
- .allProcessorsSameCategory(this.getSubProcessors(), "done"))
+ .allProcessorsSameCategory(this.getSubProcessors(), "done")) {
return lifecycleManager.getDefaultLifecycle().createState(
"ResultsSuccess",
"results",
"Workflow Processor: processing instance id: ["
- + workflowInstance.getId() + "] is Done.");
+ + workflowInstance.getId() + "] is Done.");
+ }
}
return lifecycleManager.getDefaultLifecycle().createState(
"ResultsBail",
[11/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
OODT-911 make code clearer
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/abd71645
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/abd71645
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/abd71645
Branch: refs/heads/master
Commit: abd716458ce378f02210cd1ef9713cb125319458
Parents: d606af1
Author: Tom Barber <to...@analytical-labs.com>
Authored: Sun Nov 1 00:30:44 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Sun Nov 1 00:30:44 2015 +0000
----------------------------------------------------------------------
.../browser/controller/TableListener.java | 3 +-
.../oodt/cas/filemgr/browser/model/CasDB.java | 9 +-
.../view/prompts/QueryBuilderPrompt.java | 12 +-
.../oodt/cas/workflow/gui/WorkflowGUI.java | 23 +-
.../oodt/cas/workflow/gui/model/ModelGraph.java | 90 ++++--
.../oodt/cas/workflow/gui/model/ModelNode.java | 38 ++-
.../model/repo/XmlWorkflowModelRepository.java | 54 ++--
.../repo/XmlWorkflowModelRepositoryFactory.java | 6 +-
.../gui/perspective/MultiStatePerspective.java | 3 +-
.../workflow/gui/perspective/Perspective.java | 3 +-
.../gui/perspective/build/BuildPerspective.java | 21 +-
.../cas/workflow/gui/perspective/view/View.java | 6 +-
.../gui/perspective/view/ViewState.java | 39 ++-
.../perspective/view/impl/DefaultPropView.java | 76 +++--
.../perspective/view/impl/DefaultTreeView.java | 69 +++--
.../perspective/view/impl/GlobalConfigView.java | 9 +-
.../gui/perspective/view/impl/GraphView.java | 158 ++++++----
.../perspective/view/impl/TreeProjectView.java | 18 +-
.../oodt/cas/workflow/gui/toolbox/Tool.java | 5 +-
.../oodt/cas/workflow/gui/toolbox/ToolBox.java | 6 +-
.../oodt/cas/workflow/gui/util/GuiUtils.java | 112 ++++---
.../apache/oodt/cas/workflow/gui/util/Line.java | 15 +-
.../catalog/cli/action/PagedQueryCliAction.java | 28 +-
.../cas/catalog/cli/action/QueryCliAction.java | 16 +-
.../cli/action/ReducedPagedQueryCliAction.java | 39 ++-
.../cli/action/ReducedQueryCliAction.java | 26 +-
.../catalog/mapping/DataSourceIngestMapper.java | 32 +-
.../mapping/MemoryBasedIngestMapper.java | 111 +++----
.../oodt/cas/catalog/page/IndexPager.java | 5 +-
.../apache/oodt/cas/catalog/page/PageInfo.java | 9 +-
.../oodt/cas/catalog/page/QueryPager.java | 19 +-
.../cas/catalog/page/TransactionReceipt.java | 9 +-
.../query/ComparisonQueryExpression.java | 29 +-
.../catalog/query/CustomQueryExpression.java | 9 +-
.../catalog/query/FreeTextQueryExpression.java | 5 +-
.../cas/catalog/query/QueryLogicalGroup.java | 5 +-
.../time/MetadataTimeEventQueryFilter.java | 18 +-
.../conv/AsciiSortableVersionConverter.java | 3 +-
.../catalog/query/parser/ParseException.java | 4 +-
.../query/parser/QueryParserTokenManager.java | 204 ++++++++-----
.../catalog/query/parser/SimpleCharStream.java | 46 +--
.../repository/SerializedCatalogRepository.java | 30 +-
.../XmlRpcCommunicationChannelClient.java | 5 +-
.../XmlRpcCommunicationChannelServer.java | 9 +-
.../oodt/cas/catalog/struct/TransactionId.java | 13 +-
.../dictionary/WorkflowManagerDictionary.java | 10 +-
.../struct/impl/index/DataSourceIndex.java | 120 +++++---
.../index/WorkflowManagerDataSourceIndex.java | 38 ++-
.../apache/oodt/cas/catalog/system/Catalog.java | 78 +++--
.../oodt/cas/catalog/system/CatalogFactory.java | 5 +-
.../impl/CatalogServiceClientFactory.java | 5 +-
.../system/impl/CatalogServiceLocal.java | 305 ++++++++++++-------
.../org/apache/oodt/cas/catalog/term/Term.java | 10 +-
.../oodt/cas/catalog/term/TermBucket.java | 10 +-
.../util/CasPropertyPlaceholderConfigurer.java | 9 +-
.../cas/catalog/util/PluginClassLoader.java | 10 +-
.../oodt/cas/catalog/util/Serializer.java | 9 +-
.../oodt/cas/catalog/util/SpringUtils.java | 7 +-
.../cas/cli/option/SimpleCmdLineOption.java | 3 +-
.../apache/oodt/cas/cli/util/CmdLineUtils.java | 33 +-
.../org/apache/oodt/commons/Configuration.java | 160 ++++++----
.../commons/ConfigurationEntityResolver.java | 5 +-
.../org/apache/oodt/commons/ExecServer.java | 32 +-
.../apache/oodt/commons/ExecServerConfig.java | 20 +-
.../org/apache/oodt/commons/Executable.java | 5 +-
.../org/apache/oodt/commons/MultiServer.java | 61 ++--
.../apache/oodt/commons/activity/Activity.java | 8 +-
.../oodt/commons/activity/ActivityTracker.java | 13 +-
.../commons/activity/CompositeActivity.java | 5 +-
.../DatagramLoggingActivityFactory.java | 8 +-
.../apache/oodt/commons/activity/History.java | 33 +-
.../apache/oodt/commons/activity/Incident.java | 17 +-
.../commons/activity/SQLDatabaseRetrieval.java | 8 +-
.../apache/oodt/commons/database/SqlScript.java | 6 +-
.../org/apache/oodt/commons/date/DateUtils.java | 6 +-
.../apache/oodt/commons/exec/EnvUtilities.java | 12 +-
.../apache/oodt/commons/exec/ExecHelper.java | 5 +-
.../apache/oodt/commons/exec/StreamGobbler.java | 9 +-
.../oodt/commons/filter/ObjectTimeEvent.java | 3 +-
.../apache/oodt/commons/filter/TimeEvent.java | 3 +-
.../commons/filter/TimeEventWeightedHash.java | 60 ++--
.../commons/io/Base64DecodingInputStream.java | 64 ++--
.../commons/io/Base64EncodingOutputStream.java | 48 +--
.../commons/io/FixedBufferOutputStream.java | 28 +-
.../java/org/apache/oodt/commons/io/Log.java | 44 +--
.../org/apache/oodt/commons/io/LogFilter.java | 14 +-
.../org/apache/oodt/commons/io/LogWriter.java | 33 +-
.../apache/oodt/commons/io/NullInputStream.java | 4 +-
.../oodt/commons/io/NullOutputStream.java | 17 +-
.../apache/oodt/commons/io/WriterLogger.java | 17 +-
.../oodt/commons/object/jndi/HTTPContext.java | 42 ++-
.../oodt/commons/object/jndi/ObjectContext.java | 176 +++++++----
.../oodt/commons/object/jndi/RMIContext.java | 64 ++--
.../commons/pagination/PaginationUtils.java | 9 +-
.../postprocessor/SetIdBeanPostProcessor.java | 5 +-
.../org/apache/oodt/commons/util/Base64.java | 117 ++++---
.../org/apache/oodt/commons/util/CacheMap.java | 27 +-
.../org/apache/oodt/commons/util/DOMParser.java | 5 +-
.../commons/util/EnterpriseEntityResolver.java | 34 ++-
.../org/apache/oodt/commons/util/JDBC_DB.java | 102 ++++---
.../org/apache/oodt/commons/util/LogInit.java | 10 +-
.../apache/oodt/commons/util/MemoryLogger.java | 22 +-
.../org/apache/oodt/commons/util/Utility.java | 26 +-
.../java/org/apache/oodt/commons/util/XML.java | 63 ++--
.../org/apache/oodt/commons/util/XMLRPC.java | 63 ++--
.../org/apache/oodt/commons/xml/XMLUtils.java | 9 +-
.../cas/crawl/MetExtractorProductCrawler.java | 15 +-
.../oodt/cas/crawl/action/GroupAction.java | 7 +-
.../cas/crawl/action/MimeTypeCrawlerAction.java | 3 +-
.../apache/oodt/cas/crawl/action/MoveFile.java | 11 +-
.../oodt/cas/crawl/action/ToggleAction.java | 3 +-
.../handler/CrawlerActionInfoHandler.java | 7 +-
.../cas/crawl/daemon/CrawlDaemonController.java | 3 +-
.../crawl/typedetection/MetExtractorSpec.java | 6 +-
.../MimeExtractorConfigReader.java | 21 +-
.../crawl/typedetection/MimeExtractorRepo.java | 37 ++-
.../cas/curation/service/IngestionResource.java | 3 +-
.../cas/curation/service/MetadataResource.java | 15 +-
.../curation/util/ExtractorConfigWriter.java | 3 +-
.../apache/oodt/cas/curation/CurationApp.java | 6 +-
.../cas/filemgr/catalog/DataSourceCatalog.java | 51 ++--
.../catalog/LenientDataSourceCatalog.java | 48 ++-
.../oodt/cas/filemgr/catalog/LuceneCatalog.java | 24 +-
.../catalog/MappedDataSourceCatalog.java | 3 +-
.../catalog/solr/DefaultProductSerializer.java | 20 +-
.../cas/filemgr/catalog/solr/SolrCatalog.java | 16 +-
.../cas/filemgr/catalog/solr/SolrClient.java | 19 +-
.../cli/action/IngestProductCliAction.java | 5 +-
.../datatransfer/RemoteDataTransferer.java | 10 +-
.../datatransfer/TransferStatusTracker.java | 3 +-
.../oodt/cas/filemgr/ingest/LocalCache.java | 3 +-
.../oodt/cas/filemgr/ingest/StdIngester.java | 6 +-
.../examples/FinalFileLocationExtractor.java | 3 +-
.../filemgr/structs/BooleanQueryCriteria.java | 10 +-
.../filemgr/structs/FreeTextQueryCriteria.java | 3 +-
.../oodt/cas/filemgr/structs/Product.java | 5 +-
.../apache/oodt/cas/filemgr/structs/Query.java | 11 +-
.../oodt/cas/filemgr/structs/Reference.java | 4 +-
.../cas/filemgr/structs/query/ComplexQuery.java | 6 +-
.../cas/filemgr/structs/query/QueryFilter.java | 6 +-
.../cas/filemgr/structs/query/QueryResult.java | 44 ++-
.../structs/query/QueryResultComparator.java | 9 +-
.../conv/AsciiSortableVersionConverter.java | 3 +-
.../structs/query/filter/ObjectTimeEvent.java | 3 +-
.../filemgr/structs/query/filter/TimeEvent.java | 3 +-
.../cas/filemgr/structs/type/TypeHandler.java | 9 +-
.../structs/type/ValueReplaceTypeHandler.java | 9 +-
.../cas/filemgr/system/XmlRpcFileManager.java | 62 ++--
.../filemgr/system/XmlRpcFileManagerClient.java | 14 +-
.../oodt/cas/filemgr/system/auth/Result.java | 3 +-
.../filemgr/system/auth/SecureWebServer.java | 5 +-
.../oodt/cas/filemgr/tools/CatalogSearch.java | 3 +-
.../oodt/cas/filemgr/tools/DeleteProduct.java | 3 +-
.../oodt/cas/filemgr/tools/ExpImpCatalog.java | 41 +--
.../oodt/cas/filemgr/tools/MetadataDumper.java | 3 +-
.../oodt/cas/filemgr/tools/ProductDumper.java | 3 +-
.../oodt/cas/filemgr/tools/QueryTool.java | 29 +-
.../cas/filemgr/tools/RangeQueryTester.java | 3 +-
.../oodt/cas/filemgr/tools/SolrIndexer.java | 5 +-
.../oodt/cas/filemgr/util/QueryUtils.java | 3 +-
.../apache/oodt/cas/filemgr/util/SqlParser.java | 75 +++--
.../cas/filemgr/util/XmlRpcStructFactory.java | 48 +--
.../oodt/cas/filemgr/util/XmlStructFactory.java | 3 +-
.../cas/filemgr/versioning/VersioningUtils.java | 18 +-
.../java/org/apache/oodt/grid/ConfigBean.java | 6 +-
.../org/apache/oodt/grid/ConfigServlet.java | 15 +-
.../org/apache/oodt/grid/Configuration.java | 46 ++-
.../java/org/apache/oodt/grid/GridServlet.java | 18 +-
.../java/org/apache/oodt/grid/LoginServlet.java | 8 +-
.../apache/oodt/grid/ProductQueryServlet.java | 26 +-
.../java/org/apache/oodt/grid/QueryServlet.java | 42 ++-
.../main/java/org/apache/oodt/grid/Server.java | 14 +-
.../oodt/cas/metadata/AbstractMetExtractor.java | 3 +-
.../org/apache/oodt/cas/metadata/Metadata.java | 103 ++++---
.../oodt/cas/metadata/SerializableMetadata.java | 17 +-
.../metadata/extractors/ExternConfigReader.java | 25 +-
.../metadata/extractors/ExternMetExtractor.java | 25 +-
.../extractors/FilenameTokenConfig.java | 3 +-
.../metadata/extractors/MetReaderExtractor.java | 11 +-
.../preconditions/MimeTypeComparator.java | 7 +-
.../preconditions/PreConditionComparator.java | 14 +-
.../preconditions/RegExExcludeComparator.java | 5 +-
.../oodt/cas/metadata/util/MimeTypeUtils.java | 12 +-
.../oodt/cas/metadata/util/PathUtils.java | 43 +--
.../apache/oodt/opendapps/DatasetExtractor.java | 7 +-
.../OpendapProfileElementExtractor.java | 12 +-
.../oodt/opendapps/util/ProfileChecker.java | 24 +-
.../oodt/opendapps/util/ProfileUtils.java | 4 +-
.../apache/oodt/pcs/listing/ListingConf.java | 3 +-
.../apache/oodt/pcs/pedigree/PedigreeTree.java | 3 +-
.../oodt/pcs/pedigree/PedigreeTreeNode.java | 3 +-
.../apache/oodt/pcs/query/AbstractPCSQuery.java | 3 +-
.../apache/oodt/pcs/tools/PCSHealthMonitor.java | 3 +-
.../oodt/pcs/util/WorkflowManagerUtils.java | 3 +-
.../org/apache/oodt/pcs/input/PGEGroup.java | 24 +-
.../oodt/pcs/services/HealthResource.java | 20 +-
.../oodt/pcs/services/PedigreeResource.java | 6 +-
.../apache/oodt/cas/pge/PGETaskInstance.java | 7 +-
.../oodt/cas/pge/metadata/PgeMetadata.java | 3 +-
.../org/apache/oodt/cas/pge/util/XmlHelper.java | 22 +-
.../MetadataKeyReplacerTemplateWriter.java | 3 +-
.../metlist/MetadataListPcsMetFileWriter.java | 20 +-
.../handlers/ofsn/AbstractCrawlLister.java | 8 +-
.../ofsn/OFSNFileHandlerConfiguration.java | 6 +-
.../product/handlers/ofsn/URLGetHandler.java | 30 +-
.../xmlquery/ChunkedProductInputStream.java | 54 ++--
.../org/apache/oodt/xmlquery/LargeResult.java | 27 +-
.../oodt/profile/EnumeratedProfileElement.java | 9 +-
.../java/org/apache/oodt/profile/Profile.java | 53 ++--
.../apache/oodt/profile/ProfileAttributes.java | 45 +--
.../org/apache/oodt/profile/ProfileElement.java | 112 ++++---
.../apache/oodt/profile/ResourceAttributes.java | 107 ++++---
.../java/org/apache/oodt/profile/Utility.java | 12 +-
.../handlers/DatabaseProfileManager.java | 8 +-
.../lightweight/ConstantExpression.java | 9 +-
.../lightweight/LightweightProfileServer.java | 17 +-
.../lightweight/OperatorExpression.java | 42 +--
.../SearchableEnumeratedProfileElement.java | 10 +-
.../SearchableRangedProfileElement.java | 24 +-
.../SearchableResourceAttributes.java | 137 +++++----
.../protocol/verify/BasicProtocolVerifier.java | 7 +-
.../cas/protocol/ftp/CommonsNetFtpProtocol.java | 22 +-
.../oodt/cas/protocol/http/HttpProtocol.java | 19 +-
.../oodt/cas/protocol/http/util/HttpUtils.java | 5 +-
.../oodt/cas/protocol/imaps/ImapsProtocol.java | 43 ++-
.../protocol/imaps/ImapsProtocolFactory.java | 3 +-
.../apache/oodt/cas/pushpull/config/Config.java | 3 +-
.../oodt/cas/pushpull/config/DaemonInfo.java | 41 +--
.../oodt/cas/pushpull/config/PropFilesInfo.java | 9 +-
.../oodt/cas/pushpull/config/ProtocolInfo.java | 9 +-
.../oodt/cas/pushpull/config/RemoteSpecs.java | 24 +-
.../oodt/cas/pushpull/config/SiteInfo.java | 31 +-
.../apache/oodt/cas/pushpull/daemon/Daemon.java | 23 +-
.../cas/pushpull/daemon/DaemonController.java | 3 +-
.../cas/pushpull/daemon/DaemonLauncher.java | 13 +-
.../oodt/cas/pushpull/daemon/DaemonManager.java | 5 +-
.../oodt/cas/pushpull/expressions/Method.java | 24 +-
.../filerestrictions/FileRestrictions.java | 10 +-
.../pushpull/filerestrictions/VirtualFile.java | 41 ++-
.../parsers/ClassNoaaEmailParser.java | 20 +-
.../parsers/DirStructXmlParser.java | 28 +-
.../renamingconventions/RenamingConvention.java | 6 +-
.../cas/pushpull/protocol/ProtocolHandler.java | 50 +--
.../cas/pushpull/protocol/ProtocolPath.java | 6 +-
.../pushpull/retrievalmethod/ListRetriever.java | 10 +-
.../pushpull/retrievalmethod/RemoteCrawler.java | 21 +-
.../DataFileToPropFileLinker.java | 36 ++-
.../DownloadThreadEvaluator.java | 23 +-
.../retrievalsystem/FileRetrievalSystem.java | 198 ++++++------
.../pushpull/retrievalsystem/RemoteFile.java | 8 +-
.../retrievalsystem/RetrievalSetup.java | 15 +-
.../resource/batchmgr/XmlRpcBatchMgrProxy.java | 9 +-
.../cli/action/GetJobInfoCliAction.java | 3 +-
.../cli/action/GetNodesInQueueCliAction.java | 3 +-
.../resource/cli/action/GetQueuesCliAction.java | 5 +-
.../cli/action/GetQueuesWithNodeCliAction.java | 3 +-
.../oodt/cas/resource/jobqueue/JobStack.java | 5 +-
.../resource/jobrepo/MemoryJobRepository.java | 3 +-
.../resource/jobrepo/XStreamJobRepository.java | 15 +-
.../jobrepo/XStreamJobRepositoryFactory.java | 14 +-
.../cas/resource/monitor/AssignmentMonitor.java | 6 +-
.../monitor/ganglia/GangliaResourceMonitor.java | 4 +-
.../resource/mux/StandardBackendManager.java | 9 +-
.../cas/resource/mux/XmlBackendRepository.java | 6 +-
.../cas/resource/scheduler/QueueManager.java | 46 +--
.../resource/system/XmlRpcResourceManager.java | 11 +-
.../system/XmlRpcResourceManagerClient.java | 4 +-
.../resource/system/extern/XmlRpcBatchStub.java | 9 +-
.../cas/resource/tools/RunDirJobSubmitter.java | 3 +-
.../oodt/cas/resource/util/UlimitProperty.java | 3 +-
.../apache/oodt/security/sso/OpenSSOImpl.java | 6 +-
.../oodt/security/sso/opensso/SSOProxy.java | 3 +-
.../instance/WorkflowInstancesViewer.java | 5 +-
.../workflow/model/WorkflowViewer.java | 5 +-
.../health/VisibilityAndSortToggler.java | 6 +-
.../cas/product/data/DataDeliveryServlet.java | 12 +-
.../apache/oodt/cas/product/data/DataUtils.java | 23 +-
.../product/data/DatasetDeliveryServlet.java | 3 +-
.../oodt/cas/product/rdf/ProductTypeFilter.java | 11 +-
.../apache/oodt/cas/product/rdf/RDFConfig.java | 6 +-
.../cli/action/GetWorkflowByIdCliAction.java | 4 +-
.../action/GetWorkflowsByEventCliAction.java | 4 +-
.../oodt/cas/workflow/engine/TaskQuerier.java | 6 +-
.../engine/ThreadPoolWorkflowEngine.java | 3 +-
.../engine/processor/SequentialProcessor.java | 11 +-
.../engine/processor/TaskProcessor.java | 3 +-
.../engine/processor/WorkflowProcessor.java | 14 +-
.../processor/WorkflowProcessorBuilder.java | 9 +-
.../processor/WorkflowProcessorHelper.java | 78 +++--
.../processor/WorkflowProcessorQueue.java | 7 +-
.../engine/runner/AbstractEngineRunnerBase.java | 9 +-
.../runner/AsynchronousLocalEngineRunner.java | 3 +-
.../workflow/engine/runner/ResourceRunner.java | 6 +-
.../workflow/examples/CheckForMetadataKeys.java | 5 +-
.../cas/workflow/examples/LongCondition.java | 4 +-
.../workflow/lifecycle/WorkflowLifecycle.java | 6 +-
.../lifecycle/WorkflowLifecycleManager.java | 15 +-
.../cas/workflow/lifecycle/WorkflowState.java | 9 +-
.../DataSourceWorkflowRepository.java | 6 +-
.../repository/PackagedWorkflowRepository.java | 31 +-
.../repository/XMLWorkflowRepository.java | 13 +-
.../apache/oodt/cas/workflow/structs/Graph.java | 5 +-
.../oodt/cas/workflow/structs/Priority.java | 18 +-
.../oodt/cas/workflow/structs/TaskJobInput.java | 9 +-
.../cas/workflow/structs/WorkflowInstance.java | 7 +-
.../workflow/system/XmlRpcWorkflowManager.java | 93 +++---
.../system/XmlRpcWorkflowManagerClient.java | 13 +-
.../oodt/cas/workflow/util/DbStructFactory.java | 6 +-
.../util/GenericWorkflowObjectFactory.java | 36 ++-
.../cas/workflow/util/XmlStructFactory.java | 20 +-
.../apache/oodt/xmlps/mapping/MappingField.java | 6 +-
.../oodt/xmlps/mapping/MappingReader.java | 6 +-
.../oodt/xmlps/product/XMLPSProductHandler.java | 12 +-
.../xmlps/queryparser/HandlerQueryParser.java | 12 +-
.../oodt/xmlps/queryparser/WildcardLiteral.java | 4 +-
.../apache/oodt/xmlps/structs/CDEResult.java | 16 +-
.../xmlps/structs/CDEResultInputStream.java | 18 +-
.../apache/oodt/xmlquery/ByteArrayCodec.java | 13 +-
.../org/apache/oodt/xmlquery/CodecFactory.java | 10 +-
.../oodt/xmlquery/CompressedObjectCodec.java | 9 +-
.../oodt/xmlquery/CompressedStringCodec.java | 14 +-
.../java/org/apache/oodt/xmlquery/Header.java | 33 +-
.../org/apache/oodt/xmlquery/ObjectCodec.java | 9 +-
.../org/apache/oodt/xmlquery/QueryElement.java | 32 +-
.../org/apache/oodt/xmlquery/QueryHeader.java | 56 ++--
.../org/apache/oodt/xmlquery/QueryResult.java | 16 +-
.../java/org/apache/oodt/xmlquery/Result.java | 82 +++--
.../org/apache/oodt/xmlquery/Statistic.java | 11 +-
.../java/org/apache/oodt/xmlquery/XMLQuery.java | 55 +++-
329 files changed, 4771 insertions(+), 2836 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
index 3e86b7a..81ac61f 100644
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
+++ b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/controller/TableListener.java
@@ -120,8 +120,9 @@ public class TableListener implements MouseListener, ActionListener {
// write out excel file
String fullFileName = (fc.getSelectedFile()).getAbsolutePath();
- if (!fullFileName.endsWith(".xls"))
+ if (!fullFileName.endsWith(".xls")) {
fullFileName += ".xls";
+ }
HSSFWorkbook wb = new HSSFWorkbook();
HSSFSheet sheet = wb.createSheet("results");
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
index 5359941..badd8c8 100644
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
+++ b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/model/CasDB.java
@@ -116,8 +116,9 @@ public class CasDB {
ProductType type = client.getProductTypeByName(productType);
Vector<Product> products = (Vector<Product>) client.query(query, type);
int maxVal = 20;
- if (products.size() < maxVal)
+ if (products.size() < maxVal) {
maxVal = products.size();
+ }
for (int i = 0; i < maxVal; i++) {
Metadata m = client.getMetadata(products.get(i));
results.addProduct(m);
@@ -140,8 +141,9 @@ public class CasDB {
.getProductsByProductType(type);
// for(int i=0;i<products.size();i++){
int maxVal = 20;
- if (products.size() < maxVal)
+ if (products.size() < maxVal) {
maxVal = products.size();
+ }
for (int i = 0; i < maxVal; i++) {
Metadata m = client.getMetadata(products.get(i));
results.addProduct(m);
@@ -159,8 +161,9 @@ public class CasDB {
type = client.getProductTypeByName(productType);
Vector<Product> products = (Vector<Product>) client.query(casQ, type);
int maxVal = 20;
- if (products.size() < maxVal)
+ if (products.size() < maxVal) {
maxVal = products.size();
+ }
for (int i = 0; i < maxVal; i++) {
Metadata m = client.getMetadata(products.get(i));
results.addProduct(m);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
----------------------------------------------------------------------
diff --git a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
index b030ee6..49ab623 100644
--- a/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
+++ b/app/fmbrowser/src/main/java/org/apache/oodt/cas/filemgr/browser/view/prompts/QueryBuilderPrompt.java
@@ -257,21 +257,25 @@ public class QueryBuilderPrompt extends JFrame {
public void actionPerformed(ActionEvent arg0) {
if (arg0.getActionCommand().equals("Add Term Criteria")) {
TermQueryPanel tq = new TermQueryPanel(prompt);
- if (this.getComponentCount() > 1)
+ if (this.getComponentCount() > 1) {
tq.addOp();
+ }
int insertOrder = this.getComponentCount() - 1;
- if (insertOrder < 0)
+ if (insertOrder < 0) {
insertOrder = 0;
+ }
this.add(tq, insertOrder);
this.validate();
prompt.scrollPane.validate();
} else if (arg0.getActionCommand().equals("Add Range Criteria")) {
RangeQueryPanel rq = new RangeQueryPanel(prompt);
- if (this.getComponentCount() > 1)
+ if (this.getComponentCount() > 1) {
rq.addOp();
+ }
int insertOrder = this.getComponentCount() - 1;
- if (insertOrder < 0)
+ if (insertOrder < 0) {
insertOrder = 0;
+ }
this.add(rq, insertOrder);
this.validate();
prompt.scrollPane.validate();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
index 13ba5f0..85ed681 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/WorkflowGUI.java
@@ -80,12 +80,15 @@ public class WorkflowGUI extends JFrame {
this.addWindowFocusListener(new WindowFocusListener() {
public void windowGainedFocus(WindowEvent e) {
- if (menu != null)
+ if (menu != null) {
menu.revalidate();
- if (toolbox != null)
+ }
+ if (toolbox != null) {
toolbox.revalidate();
- if (perspective != null)
+ }
+ if (perspective != null) {
perspective.refresh();
+ }
}
public void windowLostFocus(WindowEvent e) {
@@ -158,10 +161,11 @@ public class WorkflowGUI extends JFrame {
}
private void updateWorkspaceText() {
- if (this.workspace == null)
+ if (this.workspace == null) {
this.setTitle(null);
- else
+ } else {
this.setTitle(StringUtils.leftPad("Workspace: " + this.workspace, 100));
+ }
}
private void loadProjects() {
@@ -173,9 +177,11 @@ public class WorkflowGUI extends JFrame {
"parallel", "task", "condition")));
for (File file : repo.getFiles()) {
List<ModelGraph> graphs = new Vector<ModelGraph>();
- for (ModelGraph graph : repo.getGraphs())
- if (graph.getModel().getFile().equals(file))
+ for (ModelGraph graph : repo.getGraphs()) {
+ if (graph.getModel().getFile().equals(file)) {
graphs.add(graph);
+ }
+ }
System.out.println(graphs);
perspective.addState(new ViewState(file, null, graphs, repo
.getGlobalConfigGroups()));
@@ -222,8 +228,9 @@ public class WorkflowGUI extends JFrame {
public void actionPerformed(ActionEvent event) {
try {
- if (workspace == null)
+ if (workspace == null) {
return;
+ }
JFileChooser chooser = new JFileChooser(new File("."));
int value = chooser.showOpenDialog(WorkflowGUI.this);
if (value == JFileChooser.APPROVE_OPTION) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
index 6801340..3305763 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelGraph.java
@@ -50,8 +50,9 @@ public class ModelGraph {
this.isPreCondition = isPostCondition = false;
this.model = model;
this.children = new Vector<ModelGraph>();
- if (this.model.isParentType())
+ if (this.model.isParentType()) {
this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
+ }
}
public void setIsRef(boolean isRef) {
@@ -61,10 +62,12 @@ public class ModelGraph {
ModelGraph curGraph = stack.pop();
curGraph.getModel().setIsRef(isRef);
stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null)
+ if (curGraph.getPreConditions() != null) {
stack.add(curGraph.getPreConditions());
- if (curGraph.getPostConditions() != null)
+ }
+ if (curGraph.getPostConditions() != null) {
stack.add(curGraph.getPostConditions());
+ }
}
}
@@ -85,17 +88,19 @@ public class ModelGraph {
public void setParent(ModelGraph parent) {
if (this.parent != null) {
if (this.isCondition() && !this.parent.isCondition()) {
- if (this.isPreCondition)
+ if (this.isPreCondition) {
this.parent.preConditions = null;
- else
+ } else {
this.parent.postConditions = null;
+ }
} else {
this.parent.removeChild(this);
}
}
this.parent = parent;
- if (!this.getModel().isRef() && parent != null && parent.getModel().isRef())
+ if (!this.getModel().isRef() && parent != null && parent.getModel().isRef()) {
this.getModel().setIsRef(true);
+ }
}
public ModelGraph getParent() {
@@ -103,10 +108,11 @@ public class ModelGraph {
}
public ModelGraph getRootParent() {
- if (this.parent == null)
+ if (this.parent == null) {
return this;
- else
+ } else {
return this.parent.getRootParent();
+ }
}
public List<ModelGraph> getPathFromRootParent() {
@@ -121,8 +127,9 @@ public class ModelGraph {
public void addChild(ModelGraph graph) {
if (this.children.size() == 1
- && GuiUtils.isDummyNode(this.children.get(0).getModel()))
+ && GuiUtils.isDummyNode(this.children.get(0).getModel())) {
this.children.clear();
+ }
this.children.add(graph);
graph.setParent(this);
}
@@ -132,22 +139,25 @@ public class ModelGraph {
this.getModel().getExcusedSubProcessorIds()
.remove(graph.getModel().getModelId());
graph.parent = null;
- if (this.children.size() == 0)
+ if (this.children.size() == 0) {
this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
+ }
}
public List<ModelGraph> getChildren() {
- if (this.getModel().isParentType() && children.size() == 0)
+ if (this.getModel().isParentType() && children.size() == 0) {
this.addChild(new ModelGraph(GuiUtils.createDummyNode()));
+ }
return children;
}
public boolean hasChildren() {
if (this.children.size() == 1
- && GuiUtils.isDummyNode(this.children.get(0).getModel()))
+ && GuiUtils.isDummyNode(this.children.get(0).getModel())) {
return false;
- else
+ } else {
return this.children.size() > 0;
+ }
}
public ModelNode getModel() {
@@ -162,12 +172,15 @@ public class ModelGraph {
Metadata m = new Metadata();
if (this.parent != null) {
m.replaceMetadata(this.parent.getInheritedStaticMetadata(state));
- if (this.parent.getModel().getStaticMetadata() != null)
+ if (this.parent.getModel().getStaticMetadata() != null) {
m.replaceMetadata(this.parent.getModel().getStaticMetadata());
- if (this.parent.getModel().getExtendsConfig() != null)
- for (String configGroup : this.parent.getModel().getExtendsConfig())
+ }
+ if (this.parent.getModel().getExtendsConfig() != null) {
+ for (String configGroup : this.parent.getModel().getExtendsConfig()) {
m.replaceMetadata(state.getGlobalConfigGroups().get(configGroup)
- .getMetadata());
+ .getMetadata());
+ }
+ }
}
return m;
}
@@ -177,8 +190,9 @@ public class ModelGraph {
}
public void setPreConditions(ModelGraph preConditions) {
- if (this.preConditions != null)
+ if (this.preConditions != null) {
this.preConditions.setParent(null);
+ }
Stack<ModelGraph> stack = new Stack<ModelGraph>();
stack.add(preConditions);
while (!stack.empty()) {
@@ -194,8 +208,9 @@ public class ModelGraph {
}
public void setPostConditions(ModelGraph postConditions) {
- if (this.postConditions != null)
+ if (this.postConditions != null) {
this.postConditions.setParent(null);
+ }
Stack<ModelGraph> stack = new Stack<ModelGraph>();
stack.add(postConditions);
while (!stack.empty()) {
@@ -211,13 +226,16 @@ public class ModelGraph {
stack.add(this);
while (!stack.empty()) {
ModelGraph curGraph = stack.pop();
- if (curGraph.getId().equals(id))
+ if (curGraph.getId().equals(id)) {
return curGraph;
+ }
stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null)
+ if (curGraph.getPreConditions() != null) {
stack.add(curGraph.getPreConditions());
- if (curGraph.getPostConditions() != null)
+ }
+ if (curGraph.getPostConditions() != null) {
stack.add(curGraph.getPostConditions());
+ }
}
return null;
}
@@ -227,13 +245,16 @@ public class ModelGraph {
stack.add(this);
while (!stack.empty()) {
ModelGraph curGraph = stack.pop();
- if (curGraph.getModel().getModelId().equals(modelId))
+ if (curGraph.getModel().getModelId().equals(modelId)) {
return curGraph;
+ }
stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null)
+ if (curGraph.getPreConditions() != null) {
stack.add(curGraph.getPreConditions());
- if (curGraph.getPostConditions() != null)
+ }
+ if (curGraph.getPostConditions() != null) {
stack.add(curGraph.getPostConditions());
+ }
}
return null;
}
@@ -244,10 +265,11 @@ public class ModelGraph {
stack.add(this);
while (!stack.empty()) {
ModelGraph curGraph = stack.pop();
- if (curGraph.getChildren().size() == 0)
+ if (curGraph.getChildren().size() == 0) {
leafNodes.add(curGraph);
- else
+ } else {
stack.addAll(curGraph.getChildren());
+ }
}
return leafNodes;
}
@@ -257,10 +279,11 @@ public class ModelGraph {
}
public boolean equals(Object obj) {
- if (obj instanceof ModelGraph)
+ if (obj instanceof ModelGraph) {
return this.getId().equals(((ModelGraph) obj).getId());
- else
+ } else {
return false;
+ }
}
public String toString() {
@@ -270,12 +293,15 @@ public class ModelGraph {
public ModelGraph clone() {
ModelNode cloneNode = this.model.clone();
ModelGraph clone = new ModelGraph(cloneNode);
- for (ModelGraph child : this.children)
+ for (ModelGraph child : this.children) {
clone.addChild(child.clone());
- if (this.preConditions != null)
+ }
+ if (this.preConditions != null) {
clone.setPreConditions(this.preConditions.clone());
- if (this.postConditions != null)
+ }
+ if (this.postConditions != null) {
clone.setPostConditions(this.postConditions.clone());
+ }
return clone;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
index 14283e8..20a4562 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/ModelNode.java
@@ -135,28 +135,31 @@ public class ModelNode {
public Color getColor() {
if (this.isParentType()) {
- if (this.getExecutionType().equals("sequential"))
+ if (this.getExecutionType().equals("sequential")) {
return new Color(100, 149, 237);
- else if (this.getExecutionType().equals("parallel"))
+ } else if (this.getExecutionType().equals("parallel")) {
return new Color(143, 188, 143);
- else
+ } else {
return Color.darkGray;
+ }
} else {
- if (this.getExecutionType().equals("task"))
+ if (this.getExecutionType().equals("task")) {
return Color.orange;
- else
+ } else {
return Color.cyan;
+ }
}
}
public Color getGradientColor() {
if (this.isParentType()) {
- if (this.getExecutionType().equals("sequential"))
+ if (this.getExecutionType().equals("sequential")) {
return new Color(200, 200, 200);
- else if (this.getExecutionType().equals("parallel"))
+ } else if (this.getExecutionType().equals("parallel")) {
return new Color(200, 200, 200);
- else
+ } else {
return Color.white;
+ }
} else {
return Color.darkGray;
}
@@ -183,8 +186,9 @@ public class ModelNode {
}
public List<String> getExcusedSubProcessorIds() {
- if (this.excusedSubProcessorIds == null)
+ if (this.excusedSubProcessorIds == null) {
this.excusedSubProcessorIds = new Vector<String>();
+ }
return this.excusedSubProcessorIds;
}
@@ -198,18 +202,20 @@ public class ModelNode {
}
public boolean equals(Object obj) {
- if (obj instanceof ModelNode)
+ if (obj instanceof ModelNode) {
return this.getId().equals(((ModelNode) obj).getId());
- else
+ } else {
return false;
+ }
}
public String toString() {
if (this.textVisible) {
- if (this.isParentType())
+ if (this.isParentType()) {
return this.getModelName() + " : " + this.getExecutionType();
- else
+ } else {
return this.getModelName();
+ }
} else {
return null;
}
@@ -218,17 +224,19 @@ public class ModelNode {
public ModelNode clone() {
ModelNode clone = new ModelNode(this.file);
clone.id = this.id;
- if (this.excusedSubProcessorIds != null)
+ if (this.excusedSubProcessorIds != null) {
clone.excusedSubProcessorIds = new Vector<String>(
this.excusedSubProcessorIds);
+ }
clone.executionType = this.executionType;
clone.instanceClass = this.instanceClass;
clone.modelId = this.modelId;
clone.modelName = this.modelName;
clone.staticMetadata = null;
clone.textVisible = this.textVisible;
- if (this.staticMetadata != null)
+ if (this.staticMetadata != null) {
clone.staticMetadata = new Metadata(this.staticMetadata);
+ }
return clone;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
index e43a305..1976369 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepository.java
@@ -78,9 +78,11 @@ public class XmlWorkflowModelRepository {
public XmlWorkflowModelRepository(File workspace) {
this.files = new Vector<File>();
- for (File file : (this.workspace = workspace).listFiles())
- if (!file.isDirectory())
+ for (File file : (this.workspace = workspace).listFiles()) {
+ if (!file.isDirectory()) {
this.files.add(file);
+ }
+ }
}
public void loadGraphs(Set<String> supportedProcessorIds)
@@ -99,17 +101,18 @@ public class XmlWorkflowModelRepository {
for (FileBasedElement root : rootElements) {
loadConfiguration(rootElements, root, null, globalConfGroups);
NodeList rootChildren = root.getElement().getChildNodes();
- for (int i = 0; i < rootChildren.getLength(); i++)
+ for (int i = 0; i < rootChildren.getLength(); i++) {
if (rootChildren.item(i).getNodeType() == Node.ELEMENT_NODE
&& !rootChildren.item(i).getNodeName().equals("configuration")
&& !rootChildren.item(i).getNodeName().equals("event")) {
System.out.println("node name: ["
- + rootChildren.item(i).getNodeName() + "]");
+ + rootChildren.item(i).getNodeName() + "]");
ModelGraph graph = this.loadGraph(rootElements, new FileBasedElement(
- root.getFile(), (Element) rootChildren.item(i)), new Metadata(),
+ root.getFile(), (Element) rootChildren.item(i)), new Metadata(),
globalConfGroups, supportedProcessorIds);
this.graphs.add(graph);
}
+ }
}
ensureUniqueIds(graphs);
this.globalConfigGroups = globalConfGroups;
@@ -302,11 +305,13 @@ public class XmlWorkflowModelRepository {
while (!stack.isEmpty()) {
ModelGraph currentGraph = stack.remove(0);
String currentId = currentGraph.getId();
- for (int i = 1; names.contains(currentId); i++)
+ for (int i = 1; names.contains(currentId); i++) {
currentId = currentGraph.getId() + "-" + i;
+ }
names.add(currentId);
- if (!currentId.equals(currentGraph.getId()))
+ if (!currentId.equals(currentGraph.getId())) {
currentGraph.getModel().setModelId(currentId);
+ }
stack.addAll(currentGraph.getChildren());
}
}
@@ -361,8 +366,9 @@ public class XmlWorkflowModelRepository {
}
}
- if (modelId == null && modelIdRef == null)
+ if (modelId == null && modelIdRef == null) {
modelId = UUID.randomUUID().toString();
+ }
ModelGraph graph = null;
if (modelId != null) {
@@ -380,9 +386,10 @@ public class XmlWorkflowModelRepository {
executionType = workflowNode.getElement().getNodeName();
}
- if (!supportedProcessorIds.contains(executionType))
+ if (!supportedProcessorIds.contains(executionType)) {
LOG.log(Level.WARNING, "Unsupported execution type id '"
- + executionType + "'");
+ + executionType + "'");
+ }
ModelNode modelNode = new ModelNode(workflowNode.getFile());
modelNode.setModelId(modelId);
@@ -407,18 +414,20 @@ public class XmlWorkflowModelRepository {
if (curChild.getNodeName().equals("conditions")) {
boolean isPreCondition = !loadedPreConditions;
String type = ((Element) curChild).getAttribute("type");
- if (type.length() > 0)
+ if (type.length() > 0) {
isPreCondition = type.toLowerCase().equals("pre");
- if (isPreCondition)
+ }
+ if (isPreCondition) {
graph.setPreConditions(this.loadGraph(rootElements,
new FileBasedElement(workflowNode.getFile(),
(Element) curChild), new Metadata(staticMetadata),
globalConfGroups, supportedProcessorIds));
- else
+ } else {
graph.setPostConditions(this.loadGraph(rootElements,
new FileBasedElement(workflowNode.getFile(),
(Element) curChild), new Metadata(staticMetadata),
globalConfGroups, supportedProcessorIds));
+ }
loadedPreConditions = true;
} else if (!curChild.getNodeName().equals("configuration")
&& !curChild.getNodeName().equals("requiredMetFields")) {
@@ -433,9 +442,10 @@ public class XmlWorkflowModelRepository {
} else if (modelIdRef != null) {
graph = this.findGraph(rootElements, modelIdRef, new Metadata(
staticMetadata), globalConfGroups, supportedProcessorIds);
- if (graph == null)
+ if (graph == null) {
throw new WorkflowException("Workflow '" + modelIdRef
- + "' has not been defined in this context");
+ + "' has not been defined in this context");
+ }
graph.setIsRef(true);
graph.getModel().setStaticMetadata(new Metadata());
loadConfiguration(rootElements, workflowNode, graph.getModel(),
@@ -477,9 +487,10 @@ public class XmlWorkflowModelRepository {
if (curChild.getNodeName().equals("configuration")) {
Metadata curMetadata = new Metadata();
if (modelNode != null
- && !((Element) curChild).getAttribute("extends").equals(""))
+ && !((Element) curChild).getAttribute("extends").equals("")) {
modelNode.setExtendsConfig(Arrays.asList(((Element) curChild)
.getAttribute("extends").split(",")));
+ }
curMetadata.replaceMetadata(this.loadConfiguration(rootElements,
curChild, globalConfGroups));
if (!((Element) curChild).getAttribute("name").equals("")) {
@@ -512,13 +523,15 @@ public class XmlWorkflowModelRepository {
String envReplace = property.getAttribute("envReplace");
String name = property.getAttribute("name");
String value = property.getAttribute("value");
- if (Boolean.parseBoolean(envReplace))
+ if (Boolean.parseBoolean(envReplace)) {
curMetadata.replaceMetadata(name + "/envReplace", "true");
+ }
List<String> values = new Vector<String>();
- if (delim.length() > 0)
+ if (delim.length() > 0) {
values.addAll(Arrays.asList(value.split("\\" + delim)));
- else
+ } else {
values.add(value);
+ }
curMetadata.replaceMetadata(name, values);
}
}
@@ -589,8 +602,9 @@ public class XmlWorkflowModelRepository {
if (obj instanceof ConfigGroup) {
ConfigGroup comp = (ConfigGroup) obj;
return comp.name.equals(this.name);
- } else
+ } else {
return false;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
index 704b071..8cf683f 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/model/repo/XmlWorkflowModelRepositoryFactory.java
@@ -33,10 +33,12 @@ public class XmlWorkflowModelRepositoryFactory {
private String workspace;
public XmlWorkflowModelRepository createModelRepository() {
- if (workspace == null)
+ if (workspace == null) {
return null;
- if (!new File(workspace).exists())
+ }
+ if (!new File(workspace).exists()) {
new File(workspace).mkdirs();
+ }
return new XmlWorkflowModelRepository(new File(workspace));
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
index b55f7f5..5503c6b 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/MultiStatePerspective.java
@@ -82,8 +82,9 @@ public abstract class MultiStatePerspective extends Perspective {
public void setMode(Mode mode) {
this.mode = mode;
- for (ViewState state : states.values())
+ for (ViewState state : states.values()) {
state.setMode(mode);
+ }
this.refresh();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
index c19eda0..0df667a 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/Perspective.java
@@ -64,8 +64,9 @@ public abstract class Perspective extends JPanel implements ViewListener {
}
public void save() {
- if (this.state != null)
+ if (this.state != null) {
this.state.save();
+ }
}
public void undo() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
index 3209a3b..b73fe3b 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/build/BuildPerspective.java
@@ -148,10 +148,11 @@ public class BuildPerspective extends MultiStatePerspective {
}
public View getActiveView() {
- if (this.getActiveState() != null)
+ if (this.getActiveState() != null) {
return this.stateViews.get(this.getActiveState()).getActiveView();
- else
+ } else {
return null;
+ }
}
@Override
@@ -165,10 +166,11 @@ public class BuildPerspective extends MultiStatePerspective {
@Override
public void handleRemoveState(ViewState state) {
this.stateViews.remove(state);
- if (this.stateViews.size() > 0)
+ if (this.stateViews.size() > 0) {
this.activeState = this.stateViews.keySet().iterator().next();
- else
+ } else {
this.activeState = null;
+ }
this.refresh();
}
@@ -186,11 +188,12 @@ public class BuildPerspective extends MultiStatePerspective {
panel = new JPanel();
}
- if (this.projectView instanceof MultiStateView)
+ if (this.projectView instanceof MultiStateView) {
((MultiStateView) this.projectView).refreshView(this.activeState,
this.getStates());
- else
+ } else {
this.projectView.refreshView(this.activeState);
+ }
this.globalConfigView.refreshView(this.activeState);
@@ -200,12 +203,14 @@ public class BuildPerspective extends MultiStatePerspective {
globalPanel.add(this.globalConfigView, BorderLayout.SOUTH);
int dividerLocation = -1;
- if (projectSplitPane != null)
+ if (projectSplitPane != null) {
dividerLocation = projectSplitPane.getDividerLocation();
+ }
projectSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, globalPanel,
panel);
- if (dividerLocation != -1)
+ if (dividerLocation != -1) {
projectSplitPane.setDividerLocation(dividerLocation);
+ }
this.add(projectSplitPane, BorderLayout.CENTER);
this.revalidate();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
index 4f6c35d..b8341e1 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/View.java
@@ -48,8 +48,9 @@ public abstract class View extends JPanel {
public View(String name) {
super();
this.id = UUID.randomUUID().toString();
- if (name != null)
+ if (name != null) {
this.setName(name);
+ }
this.listeners = new Vector<ViewListener>();
}
@@ -74,8 +75,9 @@ public abstract class View extends JPanel {
}
public void notifyListeners(ViewChange<?> change) {
- for (ViewListener listener : listeners)
+ for (ViewListener listener : listeners) {
listener.stateChangeNotify(change);
+ }
}
public void notifyListeners() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
index 1513b7e..ff863fc 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/ViewState.java
@@ -106,8 +106,9 @@ public class ViewState {
public String getFirstPropertyValue(String key) {
List<String> values = this.getProperty(key);
- if (values == null || values.size() == 0)
+ if (values == null || values.size() == 0) {
return null;
+ }
return values.get(0);
}
@@ -122,9 +123,11 @@ public class ViewState {
public List<String> getKeysRecur(String subGroup) {
Vector<String> keys = new Vector<String>();
- for (String key : this.properties.getAllKeys())
- if (key.contains(subGroup))
+ for (String key : this.properties.getAllKeys()) {
+ if (key.contains(subGroup)) {
keys.add(key);
+ }
+ }
return keys;
}
@@ -138,16 +141,18 @@ public class ViewState {
}
public ModelGraph getSelected() {
- if (this.mode.equals(Mode.EDIT))
+ if (this.mode.equals(Mode.EDIT)) {
return this.selected;
- else
+ } else {
return null;
+ }
}
public Set<String> getGraphIds() {
HashSet<String> graphIds = new HashSet<String>();
- for (ModelGraph graph : this.getGraphs())
+ for (ModelGraph graph : this.getGraphs()) {
graphIds.add(graph.getModel().getModelId());
+ }
return graphIds;
}
@@ -188,10 +193,12 @@ public class ViewState {
public void save() {
if (this.change) {
Stack<ViewState> stack = undoHistory.get(this.id);
- if (stack == null)
+ if (stack == null) {
stack = new Stack<ViewState>();
- if (stack.size() >= 100)
+ }
+ if (stack.size() >= 100) {
stack.remove(stack.size() - 1);
+ }
stack.push(this.clone());
undoHistory.put(this.id, stack);
this.change = false;
@@ -212,11 +219,13 @@ public class ViewState {
this.selected = null;
if (state.graphs != null) {
this.graphs = new Vector<ModelGraph>();
- for (ModelGraph graph : state.graphs)
+ for (ModelGraph graph : state.graphs) {
this.graphs.add(graph.clone());
- if (state.selected != null)
+ }
+ if (state.selected != null) {
this.selected = GuiUtils.find(this.graphs, state.selected.getModel()
- .getModelId());
+ .getModelId());
+ }
}
this.properties = new Metadata(state.properties);
this.id = state.id;
@@ -229,11 +238,13 @@ public class ViewState {
ModelGraph selected = null;
if (this.graphs != null) {
cloneGraphs = new Vector<ModelGraph>();
- for (ModelGraph graph : this.graphs)
+ for (ModelGraph graph : this.graphs) {
cloneGraphs.add(graph.clone());
- if (this.selected != null)
+ }
+ if (this.selected != null) {
selected = GuiUtils.find(cloneGraphs, this.selected.getModel()
- .getModelId());
+ .getModelId());
+ }
}
ViewState clone = new ViewState(this.file, selected, cloneGraphs,
this.globalConfigGroups);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
index d8724fc..3836137 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultPropView.java
@@ -144,8 +144,9 @@ public class DefaultPropView extends View {
List<String> keys = completeMet.getAllKeys();
Collections.sort(keys);
for (String key : keys) {
- if (key.endsWith("/envReplace"))
+ if (key.endsWith("/envReplace")) {
continue;
+ }
String values = StringUtils.join(completeMet.getAllMetadata(key), ",");
Vector<String> row = new Vector<String>();
row.add(keyToGroupMap.get(key));
@@ -182,13 +183,16 @@ public class DefaultPropView extends View {
}
public Object getValueAt(int row, int col) {
- if (row >= rows.size())
+ if (row >= rows.size()) {
return null;
+ }
String value = rows.get(row).get(col);
- if (value == null && col == 3)
+ if (value == null && col == 3) {
return "false";
- if (value == null && col == 0)
+ }
+ if (value == null && col == 0) {
return "__local__";
+ }
return value;
}
@@ -197,8 +201,9 @@ public class DefaultPropView extends View {
return selected.getModel().getStaticMetadata()
.containsGroup(state.getCurrentMetGroup());
}
- if (col == 0)
+ if (col == 0) {
return false;
+ }
String key = rows.get(row).get(1);
return key == null
|| (selected.getModel().getStaticMetadata() != null && selected
@@ -241,12 +246,14 @@ public class DefaultPropView extends View {
if (column == 0) {
field.setForeground(Color.gray);
} else {
- if (isSelected)
+ if (isSelected) {
field.setBorder(new EtchedBorder(1));
- if (table.isCellEditable(row, 1))
+ }
+ if (table.isCellEditable(row, 1)) {
field.setForeground(Color.black);
- else
+ } else {
field.setForeground(Color.gray);
+ }
}
return field;
}
@@ -309,16 +316,18 @@ public class DefaultPropView extends View {
String key = getKey(
(String) DefaultPropView.this.table.getValueAt(row, 1), state);
Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null)
+ if (staticMet == null) {
staticMet = new Metadata();
+ }
if (e.getActionCommand().equals(OVERRIDE)) {
if (!staticMet.containsKey(key)) {
staticMet.addMetadata(key,
(String) DefaultPropView.this.table.getValueAt(row, 2));
String envReplace = (String) DefaultPropView.this.table.getValueAt(
row, 3);
- if (Boolean.valueOf(envReplace))
+ if (Boolean.valueOf(envReplace)) {
staticMet.addMetadata(key + "/envReplace", envReplace);
+ }
state.getSelected().getModel().setStaticMetadata(staticMet);
DefaultPropView.this.notifyListeners();
}
@@ -333,8 +342,9 @@ public class DefaultPropView extends View {
String key = getKey(
(String) DefaultPropView.this.table.getValueAt(row, 1), state);
Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null)
+ if (staticMet == null) {
staticMet = new Metadata();
+ }
staticMet.removeMetadata(key);
staticMet.removeMetadata(key + "/envReplace");
state.getSelected().getModel().setStaticMetadata(staticMet);
@@ -350,8 +360,9 @@ public class DefaultPropView extends View {
masterPanel.setLayout(new BoxLayout(masterPanel, BoxLayout.Y_AXIS));
masterPanel.add(this.getModelIdPanel(state.getSelected(), state));
masterPanel.add(this.getModelNamePanel(state.getSelected(), state));
- if (!state.getSelected().getModel().isParentType())
+ if (!state.getSelected().getModel().isParentType()) {
masterPanel.add(this.getInstanceClassPanel(state.getSelected(), state));
+ }
masterPanel.add(this.getExecutionTypePanel(state.getSelected(), state));
masterPanel.add(this.getPriorityPanel(state));
masterPanel.add(this.getExecusedIds(state.getSelected()));
@@ -497,8 +508,9 @@ public class DefaultPropView extends View {
private JList createJList(DefaultListModel model,
final List<String> list) {
- for (String value : list)
+ for (String value : list) {
model.addElement(value);
+ }
JList jList = new JList(model);
jList.setSelectionMode(ListSelectionModel.SINGLE_INTERVAL_SELECTION);
jList.setLayoutOrientation(JList.VERTICAL);
@@ -710,12 +722,13 @@ public class DefaultPropView extends View {
checkbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED)
+ if (e.getStateChange() == ItemEvent.DESELECTED) {
graph.getModel().setOptional(false);
- else if (e.getStateChange() == ItemEvent.SELECTED)
+ } else if (e.getStateChange() == ItemEvent.SELECTED) {
graph.getModel().setOptional(true);
- else
+ } else {
return;
+ }
DefaultPropView.this.notifyListeners();
DefaultPropView.this.refreshView(state);
}
@@ -742,12 +755,13 @@ public class DefaultPropView extends View {
checkbox.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
- if (e.getStateChange() == ItemEvent.DESELECTED)
+ if (e.getStateChange() == ItemEvent.DESELECTED) {
graph.getModel().getExcusedSubProcessorIds().remove(modelId);
- else if (e.getStateChange() == ItemEvent.SELECTED)
+ } else if (e.getStateChange() == ItemEvent.SELECTED) {
graph.getModel().getExcusedSubProcessorIds().add(modelId);
- else
+ } else {
return;
+ }
DefaultPropView.this.notifyListeners();
}
@@ -773,8 +787,9 @@ public class DefaultPropView extends View {
System.out.println(oldKey + " " + oldValue + " " + oldEnvReplace);
if (e.getType() == TableModelEvent.UPDATE) {
Metadata staticMet = state.getSelected().getModel().getStaticMetadata();
- if (staticMet == null)
+ if (staticMet == null) {
staticMet = new Metadata();
+ }
if (e.getColumn() == 1) {
String newGrouplessKey = (String) table.getValueAt(e.getFirstRow(),
e.getColumn());
@@ -789,11 +804,13 @@ public class DefaultPropView extends View {
System.out.println("newKey: " + newKey);
if (oldKey != null) {
staticMet.replaceMetadata(newKey, staticMet.getAllMetadata(oldKey));
- if (staticMet.containsKey(oldKey + "/envReplace"))
+ if (staticMet.containsKey(oldKey + "/envReplace")) {
staticMet.replaceMetadata(newKey,
staticMet.getAllMetadata(oldKey + "/envReplace"));
- if (!newKey.equals(oldKey))
+ }
+ if (!newKey.equals(oldKey)) {
staticMet.removeMetadata(oldKey);
+ }
notifyListeners();
} else {
staticMet.replaceMetadata(oldKey = newKey, (String) null);
@@ -804,11 +821,12 @@ public class DefaultPropView extends View {
e.getColumn());
if (oldKey.endsWith("/envReplace")) {
newValue = newValue.toLowerCase();
- if (newValue.equals("false"))
+ if (newValue.equals("false")) {
staticMet.removeMetadata(oldKey);
- else
+ } else {
staticMet.replaceMetadata(oldKey,
Arrays.asList(newValue.split(",")));
+ }
} else {
staticMet.replaceMetadata(oldKey,
Arrays.asList(newValue.split(",")));
@@ -819,10 +837,11 @@ public class DefaultPropView extends View {
if (oldKey != null) {
String newEnvReplace = ((String) table.getValueAt(e.getFirstRow(),
e.getColumn())).toLowerCase();
- if (newEnvReplace.equals("true"))
+ if (newEnvReplace.equals("true")) {
staticMet.replaceMetadata(oldKey + "/envReplace", newEnvReplace);
- else
+ } else {
staticMet.removeMetadata(oldKey + "/envReplace");
+ }
notifyListeners();
}
}
@@ -840,10 +859,11 @@ public class DefaultPropView extends View {
}
private String getKey(String key, ViewState state) {
- if (key != null && state.getCurrentMetGroup() != null)
+ if (key != null && state.getCurrentMetGroup() != null) {
return state.getCurrentMetGroup() + "/" + key;
- else
+ } else {
return key;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
index 51c517f..f679fa7 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/DefaultTreeView.java
@@ -86,8 +86,9 @@ public class DefaultTreeView extends View {
// node.getChildAt(i)).getUserObject());
TreePath treePath = this.getTreePath(
(DefaultMutableTreeNode) node.getChildAt(i), graph);
- if (treePath != null)
+ if (treePath != null) {
return treePath;
+ }
}
return null;
}
@@ -98,13 +99,15 @@ public class DefaultTreeView extends View {
Stack<DefaultMutableTreeNode> stack = new Stack<DefaultMutableTreeNode>();
DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) currentPath
.getLastPathComponent();
- for (int i = 0; i < baseNode.getChildCount(); i++)
+ for (int i = 0; i < baseNode.getChildCount(); i++) {
stack.push((DefaultMutableTreeNode) baseNode.getChildAt(i));
+ }
while (!stack.empty()) {
DefaultMutableTreeNode node = stack.pop();
if (node.getUserObject().equals("static-metadata")) {
- for (int i = 0; i < node.getChildCount(); i++)
+ for (int i = 0; i < node.getChildCount(); i++) {
stack.push((DefaultMutableTreeNode) node.getChildAt(i));
+ }
} else if (node.getUserObject() instanceof HashMap) {
String key = (String) ((HashMap<String, String>) node.getUserObject())
.keySet().iterator().next();
@@ -114,8 +117,9 @@ public class DefaultTreeView extends View {
lookingForPath = lookingForPath
.substring(lookingForPath.indexOf("/") + 1);
stack.clear();
- for (int i = 0; i < node.getChildCount(); i++)
+ for (int i = 0; i < node.getChildCount(); i++) {
stack.add((DefaultMutableTreeNode) node.getChildAt(i));
+ }
}
}
}
@@ -131,16 +135,18 @@ public class DefaultTreeView extends View {
@Override
public void refreshView(final ViewState state) {
Rectangle visibleRect = null;
- if (this.tree != null)
+ if (this.tree != null) {
visibleRect = this.tree.getVisibleRect();
+ }
this.removeAll();
this.actionsMenu = this.createPopupMenu(state);
DefaultMutableTreeNode root = new DefaultMutableTreeNode("WORKFLOWS");
- for (ModelGraph graph : state.getGraphs())
+ for (ModelGraph graph : state.getGraphs()) {
root.add(this.buildTree(graph, state));
+ }
tree = new JTree(root);
tree.setShowsRootHandles(true);
tree.setRootVisible(false);
@@ -165,9 +171,10 @@ public class DefaultTreeView extends View {
}
} else if (Boolean.parseBoolean(state
.getFirstPropertyValue(EXPAND_PRECONDITIONS))) {
- if (treePath == null)
+ if (treePath == null) {
treePath = this.getTreePath(root, state.getSelected()
- .getPreConditions());
+ .getPreConditions());
+ }
DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath
.getLastPathComponent();
for (int i = 0; i < baseNode.getChildCount(); i++) {
@@ -180,9 +187,10 @@ public class DefaultTreeView extends View {
}
} else if (Boolean.parseBoolean(state
.getFirstPropertyValue(EXPAND_POSTCONDITIONS))) {
- if (treePath == null)
+ if (treePath == null) {
treePath = this.getTreePath(root, state.getSelected()
- .getPostConditions());
+ .getPostConditions());
+ }
DefaultMutableTreeNode baseNode = (DefaultMutableTreeNode) treePath
.getLastPathComponent();
for (int i = 0; i < baseNode.getChildCount(); i++) {
@@ -231,14 +239,15 @@ public class DefaultTreeView extends View {
metNode = (DefaultMutableTreeNode) path[i];
break;
} else if (((DefaultMutableTreeNode) path[i]).getUserObject() instanceof HashMap) {
- if (group == null)
+ if (group == null) {
group = (String) ((HashMap<String, String>) ((DefaultMutableTreeNode) path[i])
.getUserObject()).keySet().iterator().next();
- else
+ } else {
group = (String) ((HashMap<String, String>) ((DefaultMutableTreeNode) path[i])
.getUserObject()).keySet().iterator().next()
- + "/"
- + group;
+ + "/"
+ + group;
+ }
}
}
ModelGraph graph = (ModelGraph) metNode.getUserObject();
@@ -312,8 +321,9 @@ public class DefaultTreeView extends View {
.getSelectionPath().getLastPathComponent();
if (node.getUserObject() instanceof String
&& !(node.getUserObject().equals("pre-conditions") || node
- .getUserObject().equals("post-conditions")))
+ .getUserObject().equals("post-conditions"))) {
return;
+ }
orderSubMenu.setEnabled(node.getUserObject() instanceof ModelGraph
&& !((ModelGraph) node.getUserObject()).isCondition()
&& ((ModelGraph) node.getUserObject()).getParent() != null);
@@ -338,8 +348,9 @@ public class DefaultTreeView extends View {
JScrollPane.VERTICAL_SCROLLBAR_ALWAYS,
JScrollPane.HORIZONTAL_SCROLLBAR_ALWAYS);
this.add(this.scrollPane, BorderLayout.CENTER);
- if (visibleRect != null)
+ if (visibleRect != null) {
this.tree.scrollRectToVisible(visibleRect);
+ }
this.revalidate();
}
@@ -349,13 +360,16 @@ public class DefaultTreeView extends View {
DefaultMutableTreeNode metadataNode = new DefaultMutableTreeNode(
"static-metadata");
Metadata staticMetadata = new Metadata();
- if (graph.getInheritedStaticMetadata(state) != null)
+ if (graph.getInheritedStaticMetadata(state) != null) {
staticMetadata.replaceMetadata(graph.getInheritedStaticMetadata(state));
- if (graph.getModel().getStaticMetadata() != null)
+ }
+ if (graph.getModel().getStaticMetadata() != null) {
staticMetadata.replaceMetadata(graph.getModel().getStaticMetadata());
+ }
this.addMetadataNodes(metadataNode, staticMetadata);
- if (!metadataNode.isLeaf())
+ if (!metadataNode.isLeaf()) {
node.add(metadataNode);
+ }
if (graph.getPreConditions() != null) {
DefaultMutableTreeNode preConditions = new DefaultMutableTreeNode(
@@ -377,9 +391,11 @@ public class DefaultTreeView extends View {
}
node.add(postConditions);
}
- for (ModelGraph child : graph.getChildren())
- if (!GuiUtils.isDummyNode(child.getModel()))
+ for (ModelGraph child : graph.getChildren()) {
+ if (!GuiUtils.isDummyNode(child.getModel())) {
node.add(this.buildTree(child, state));
+ }
+ }
return node;
}
@@ -424,10 +440,11 @@ public class DefaultTreeView extends View {
// node.getUserObject().equals("post-conditions"))) {
ModelGraph graph = state.getSelected();
if (Boolean.parseBoolean(state
- .getFirstPropertyValue(EXPAND_PRECONDITIONS)))
+ .getFirstPropertyValue(EXPAND_PRECONDITIONS))) {
graphToFocus = graph.getPreConditions();
- else
+ } else {
graphToFocus = graph.getPostConditions();
+ }
} else if (node.getUserObject() instanceof ModelGraph) {
graphToFocus = (ModelGraph) node.getUserObject();
}
@@ -454,11 +471,13 @@ public class DefaultTreeView extends View {
ModelGraph graph = state.getSelected();
ModelGraph parent = graph.getParent();
if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) {
- if (parent.getChildren().remove(graph))
+ if (parent.getChildren().remove(graph)) {
parent.getChildren().add(0, graph);
+ }
} else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) {
- if (parent.getChildren().remove(graph))
+ if (parent.getChildren().remove(graph)) {
parent.getChildren().add(graph);
+ }
} else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) {
int index = parent.getChildren().indexOf(graph);
if (index != -1) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
index f998e76..a73c698 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GlobalConfigView.java
@@ -69,8 +69,9 @@ public class GlobalConfigView extends View {
public void refreshView(ViewState state) {
Rectangle visibleRect = null;
- if (this.tree != null)
+ if (this.tree != null) {
visibleRect = this.tree.getVisibleRect();
+ }
DefaultMutableTreeNode root = new DefaultMutableTreeNode("GlobalConfig");
@@ -79,8 +80,9 @@ public class GlobalConfigView extends View {
&& globalConfig.keySet().equals(
state.getGlobalConfigGroups().keySet())
&& globalConfig.values().equals(
- state.getGlobalConfigGroups().values()))
+ state.getGlobalConfigGroups().values())) {
return;
+ }
this.removeAll();
@@ -205,8 +207,9 @@ public class GlobalConfigView extends View {
this.add(tabbedPane, BorderLayout.CENTER);
- if (visibleRect != null)
+ if (visibleRect != null) {
this.tree.scrollRectToVisible(visibleRect);
+ }
this.revalidate();
}
[05/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java b/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
index 22c58d0..13f902e 100755
--- a/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
+++ b/grid/src/main/java/org/apache/oodt/grid/QueryServlet.java
@@ -86,7 +86,9 @@ public abstract class QueryServlet extends GridServlet {
public void doPost(HttpServletRequest req, HttpServletResponse res) throws IOException, ServletException {
try {
XMLQuery query = getQuery(req, res); // Get the query
- if (query == null) return; // No query? My favorite case, right here!
+ if (query == null) {
+ return; // No query? My favorite case, right here!
+ }
Configuration config = getConfiguration(); // Get the current configuration.
updateProperties(config); // Using it, update the system properties
@@ -129,18 +131,28 @@ public abstract class QueryServlet extends GridServlet {
String xmlq = req.getParameter("xmlq"); // Grab any xmlq
String q = req.getParameter("q"); // Grab any q
String unp = req.getParameter("unp"); // And grab any unp (pronounced "unp")
- if (xmlq == null) xmlq = ""; // No xmlq? Use epsilon
- if (q == null) q = ""; // No q? Use lambda
- if (unp == null) unp = ""; // Use some other greek letter for empty str
+ if (xmlq == null) {
+ xmlq = ""; // No xmlq? Use epsilon
+ }
+ if (q == null) {
+ q = ""; // No q? Use lambda
+ }
+ if (unp == null) {
+ unp = ""; // Use some other greek letter for empty str
+ }
String[] mimes = req.getParameterValues("mime"); // Grab any mimes
- if (mimes == null) mimes = EMPTY_STRING_ARRAY; // None? Use empty array
+ if (mimes == null) {
+ mimes = EMPTY_STRING_ARRAY; // None? Use empty array
+ }
- if (xmlq.length() > 0) try { // Was there an xmlq?
- return new XMLQuery(xmlq); // Use it in its entirety, ignoring the rest
- } catch (SAXException ex) { // Can't parse it?
- res.sendError(HttpServletResponse.SC_BAD_REQUEST, // Then that's a bad ...
- "cannot parse xmlq: " + ex.getMessage()); // ... request, which I hate
- return null; // so flag it with a null
+ if (xmlq.length() > 0) {
+ try { // Was there an xmlq?
+ return new XMLQuery(xmlq); // Use it in its entirety, ignoring the rest
+ } catch (SAXException ex) { // Can't parse it?
+ res.sendError(HttpServletResponse.SC_BAD_REQUEST, // Then that's a bad ...
+ "cannot parse xmlq: " + ex.getMessage()); // ... request, which I hate
+ return null; // so flag it with a null
+ }
} else if (q.length() > 0) { // Was there a q?
boolean unparsed = "true".equals(unp); // If so, was there also an unp?
return new XMLQuery(q, "wgq", "Web Grid Query", // Use it to make an XMLQuery
@@ -182,7 +194,9 @@ public abstract class QueryServlet extends GridServlet {
for (Iterator i = handlers.iterator(); i.hasNext();) { // Now, for each handler
InstantiedHandler handler = (InstantiedHandler) i.next(); // Grab the handler
if (!servers.contains(handler.getServer())) // Does its server still exist?
- i.remove(); // If not, remove the handler
+ {
+ i.remove(); // If not, remove the handler
+ }
}
}
@@ -193,7 +207,9 @@ public abstract class QueryServlet extends GridServlet {
*/
private synchronized void updateProperties(Configuration config) {
if (properties != null) { // Any old properties?
- if (properties.equals(config.getProperties())) return; // Yes, any changes? No? Then done.
+ if (properties.equals(config.getProperties())) {
+ return; // Yes, any changes? No? Then done.
+ }
for (Object o : properties.keySet()) {
System.getProperties().remove(o); // and remove it.
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/grid/src/main/java/org/apache/oodt/grid/Server.java
----------------------------------------------------------------------
diff --git a/grid/src/main/java/org/apache/oodt/grid/Server.java b/grid/src/main/java/org/apache/oodt/grid/Server.java
index e4299a6..84185e1 100755
--- a/grid/src/main/java/org/apache/oodt/grid/Server.java
+++ b/grid/src/main/java/org/apache/oodt/grid/Server.java
@@ -84,9 +84,9 @@ public abstract class Server implements Serializable {
InstantiationException, IllegalAccessException {
List urlList = configuration.getCodeBases();
Class clazz;
- if (urlList.isEmpty())
+ if (urlList.isEmpty()) {
clazz = Class.forName(className);
- else {
+ } else {
URL[] urls = (URL[]) urlList.toArray(new URL[urlList.size()]);
URLClassLoader loader = new URLClassLoader(urls, getClass()
.getClassLoader());
@@ -117,8 +117,9 @@ public abstract class Server implements Serializable {
}
public boolean equals(Object obj) {
- if (obj == this)
+ if (obj == this) {
return true;
+ }
if (obj instanceof Server) {
Server rhs = (Server) obj;
return className.equals(rhs.className);
@@ -146,12 +147,13 @@ public abstract class Server implements Serializable {
String className = elem.getAttribute("className");
// Replace with a factory some day...
- if ("product".equals(type))
+ if ("product".equals(type)) {
return new ProductServer(configuration, className);
- else if ("profile".equals(type))
+ } else if ("profile".equals(type)) {
return new ProfileServer(configuration, className);
- else
+ } else {
throw new SAXException("unknown server type `" + type + "'");
+ }
}
/** Configuration. */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/AbstractMetExtractor.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/AbstractMetExtractor.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/AbstractMetExtractor.java
index 05a9b52..49f44c8 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/AbstractMetExtractor.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/AbstractMetExtractor.java
@@ -68,8 +68,9 @@ public abstract class AbstractMetExtractor implements MetExtractor {
* @see org.apache.oodt.cas.metadata.MetExtractor#extractMetadata(java.io.File)
*/
public Metadata extractMetadata(File f) throws MetExtractionException {
- if (f == null || !f.exists())
+ if (f == null || !f.exists()) {
throw new MetExtractionException("File '" + f + "' does not exist");
+ }
return this.extrMetadata(this.safeGetCanonicalFile(f));
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
index 62d3c9a..6dfcd6f 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/Metadata.java
@@ -56,16 +56,18 @@ public class Metadata {
* Metadata to add metadata from
*/
public void addMetadata(Metadata metadata) {
- for (String key : metadata.getAllKeys())
+ for (String key : metadata.getAllKeys()) {
this.addMetadata(key, metadata.getAllMetadata(key));
+ }
}
public void addMetadata(String group, Metadata metadata) {
if (group == null) {
this.addMetadata(metadata);
} else {
- for (String key : metadata.getAllKeys())
+ for (String key : metadata.getAllKeys()) {
this.addMetadata(group + "/" + key, metadata.getAllMetadata(key));
+ }
}
}
@@ -75,16 +77,18 @@ public class Metadata {
* @param metadata
*/
public void replaceMetadata(Metadata metadata) {
- for (String key : metadata.getAllKeys())
+ for (String key : metadata.getAllKeys()) {
this.replaceMetadata(key, metadata.getAllMetadata(key));
+ }
}
public void replaceMetadata(String group, Metadata metadata) {
if (group == null) {
this.replaceMetadata(metadata);
} else {
- for (String key : metadata.getAllKeys())
+ for (String key : metadata.getAllKeys()) {
this.replaceMetadata(group + "/" + key, metadata.getAllMetadata(key));
+ }
}
}
@@ -145,10 +149,11 @@ public class Metadata {
public void removeMetadata(String key) {
Group removeGroup = this.getGroup(key, false);
if (removeGroup != null && removeGroup.hasValues()) {
- if (removeGroup.getChildren().size() > 0)
+ if (removeGroup.getChildren().size() > 0) {
removeGroup.clearValues();
- else
+ } else {
removeGroup.getParent().removeChild(removeGroup.getName());
+ }
}
}
@@ -158,8 +163,9 @@ public class Metadata {
*/
public void removeMetadataGroup(String group) {
Group removeGroup = this.getGroup(group, false);
- if (removeGroup != null && removeGroup.getChildren().size() > 0)
+ if (removeGroup != null && removeGroup.getChildren().size() > 0) {
removeGroup.getParent().removeChild(removeGroup.getName());
+ }
}
/**
@@ -196,8 +202,9 @@ public class Metadata {
public Metadata getSubMetadata(String group) {
Metadata m = new Metadata();
Group newRoot = this.getGroup(group, false);
- if (newRoot != null)
+ if (newRoot != null) {
m.root.addChildren(newRoot.clone().getChildren());
+ }
return m;
}
@@ -210,10 +217,11 @@ public class Metadata {
*/
public String getMetadata(String key) {
Group group = this.getGroup(key, false);
- if (group != null)
+ if (group != null) {
return group.getValue();
- else
+ } else {
return null;
+ }
}
/**
@@ -225,10 +233,11 @@ public class Metadata {
*/
public List<String> getAllMetadata(String key) {
Group group = this.getGroup(key, false);
- if (group != null)
+ if (group != null) {
return new Vector<String>(group.getValues());
- else
+ } else {
return null;
+ }
}
/**
@@ -240,10 +249,11 @@ public class Metadata {
*/
public List<String> getKeys(String group) {
Group foundGroup = this.getGroup(group);
- if (foundGroup != null)
+ if (foundGroup != null) {
return this.getKeys(foundGroup);
- else
+ } else {
return new Vector<String>();
+ }
}
/**
@@ -257,9 +267,11 @@ public class Metadata {
protected List<String> getKeys(Group group) {
Vector<String> keys = new Vector<String>();
- for (Group child : group.getChildren())
- if (child.hasValues())
+ for (Group child : group.getChildren()) {
+ if (child.hasValues()) {
keys.add(child.getFullPath());
+ }
+ }
return keys;
}
@@ -272,10 +284,11 @@ public class Metadata {
*/
public List<String> getAllKeys(String group) {
Group foundGroup = this.getGroup(group);
- if (foundGroup != null)
+ if (foundGroup != null) {
return this.getAllKeys(foundGroup);
- else
+ } else {
return new Vector<String>();
+ }
}
/**
@@ -290,8 +303,9 @@ public class Metadata {
protected List<String> getAllKeys(Group group) {
Vector<String> keys = new Vector<String>();
for (Group child : group.getChildren()) {
- if (child.hasValues())
+ if (child.hasValues()) {
keys.add(child.getFullPath());
+ }
keys.addAll(this.getAllKeys(child));
}
return keys;
@@ -308,8 +322,9 @@ public class Metadata {
stack.add(this.root);
while (!stack.empty()) {
Group curGroup = stack.pop();
- if (curGroup.getName().equals(key) && curGroup.hasValues())
- keys.add(curGroup.getFullPath());
+ if (curGroup.getName().equals(key) && curGroup.hasValues()) {
+ keys.add(curGroup.getFullPath());
+ }
stack.addAll(curGroup.getChildren());
}
return keys;
@@ -322,8 +337,9 @@ public class Metadata {
*/
public List<String> getValues() {
Vector<String> values = new Vector<String>();
- for (String key : this.getKeys())
+ for (String key : this.getKeys()) {
values.addAll(this.getAllMetadata(key));
+ }
return values;
}
@@ -336,8 +352,9 @@ public class Metadata {
*/
public List<String> getValues(String group) {
Vector<String> values = new Vector<String>();
- for (String key : this.getKeys(group))
+ for (String key : this.getKeys(group)) {
values.addAll(this.getAllMetadata(key));
+ }
return values;
}
@@ -348,8 +365,9 @@ public class Metadata {
*/
public List<String> getAllValues() {
Vector<String> values = new Vector<String>();
- for (String key : this.getAllKeys())
+ for (String key : this.getAllKeys()) {
values.addAll(this.getAllMetadata(key));
+ }
return values;
}
@@ -362,8 +380,9 @@ public class Metadata {
*/
public List<String> getAllValues(String group) {
Vector<String> values = new Vector<String>();
- for (String key : this.getAllKeys(group))
+ for (String key : this.getAllKeys(group)) {
values.addAll(this.getAllMetadata(key));
+ }
return values;
}
@@ -413,8 +432,9 @@ public class Metadata {
protected List<String> getGroups(Group group) {
Vector<String> groupNames = new Vector<String>();
- for (Group child : group.getChildren())
+ for (Group child : group.getChildren()) {
groupNames.add(child.getName());
+ }
return groupNames;
}
@@ -423,16 +443,18 @@ public class Metadata {
}
protected Group getGroup(String key, boolean create) {
- if (key == null)
+ if (key == null) {
return this.root;
+ }
StringTokenizer tokenizer = new StringTokenizer(key, "/");
Group curGroup = this.root;
while (tokenizer.hasMoreTokens()) {
String groupName = tokenizer.nextToken();
Group childGroup = curGroup.getChild(groupName);
if (childGroup == null) {
- if (!create)
+ if (!create) {
return null;
+ }
childGroup = new Group(groupName);
curGroup.addChild(childGroup);
}
@@ -465,10 +487,11 @@ public class Metadata {
}
public String getFullPath() {
- if (this.parent != null && !this.parent.getName().equals(ROOT_GROUP_NAME))
+ if (this.parent != null && !this.parent.getName().equals(ROOT_GROUP_NAME)) {
return this.parent.getFullPath() + "/" + this.name;
- else
+ } else {
return this.name;
+ }
}
public Group getParent() {
@@ -502,10 +525,11 @@ public class Metadata {
}
public String getValue() {
- if (this.hasValues())
+ if (this.hasValues()) {
return this.values.get(0);
- else
+ } else {
return null;
+ }
}
public List<String> getValues() {
@@ -518,8 +542,9 @@ public class Metadata {
}
public void addChildren(List<Group> children) {
- for (Group child : children)
+ for (Group child : children) {
this.addChild(child);
+ }
}
public List<Group> getChildren() {
@@ -538,8 +563,9 @@ public class Metadata {
public Group clone() {
Group clone = new Group(this.name);
clone.setValues(this.values);
- for (Group child : this.children.values())
+ for (Group child : this.children.values()) {
clone.addChild(child.clone());
+ }
return clone;
}
@@ -552,8 +578,9 @@ public class Metadata {
public Hashtable<String, Object> getHashtable() {
Hashtable<String, Object> table = new Hashtable<String, Object>();
- for (String key : this.getAllKeys())
+ for (String key : this.getAllKeys()) {
table.put(key, this.getAllMetadata(key));
+ }
return table;
}
@@ -561,9 +588,11 @@ public class Metadata {
if (obj instanceof Metadata) {
Metadata compMet = (Metadata) obj;
if (this.getKeys().equals(compMet.getKeys())) {
- for (String key : this.getKeys())
- if (!this.getAllMetadata(key).equals(compMet.getAllMetadata(key)))
+ for (String key : this.getKeys()) {
+ if (!this.getAllMetadata(key).equals(compMet.getAllMetadata(key))) {
return false;
+ }
+ }
return true;
} else {
return false;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java
index a47c8be..f7827df 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/SerializableMetadata.java
@@ -77,8 +77,9 @@ public class SerializableMetadata extends Metadata implements Serializable {
public SerializableMetadata(String xmlEncoding, boolean useCDATA)
throws InstantiationException {
super();
- if (xmlEncoding == null)
+ if (xmlEncoding == null) {
throw new InstantiationException("xmlEncoding cannot be null");
+ }
this.xmlEncoding = xmlEncoding;
this.useCDATA = useCDATA;
}
@@ -177,10 +178,11 @@ public class SerializableMetadata extends Metadata implements Serializable {
for (String key : this.getAllKeys()) {
Element metadataElem = document.createElement("keyval");
Element keyElem = document.createElement("key");
- if (this.useCDATA)
+ if (this.useCDATA) {
keyElem.appendChild(document.createCDATASection(key));
- else
+ } else {
keyElem.appendChild(document.createTextNode(URLEncoder.encode(key, this.xmlEncoding)));
+ }
metadataElem.appendChild(keyElem);
@@ -192,12 +194,13 @@ public class SerializableMetadata extends Metadata implements Serializable {
throw new Exception("Attempt to write null value "
+ "for property: [" + key + "]: val: [null]");
}
- if (this.useCDATA)
+ if (this.useCDATA) {
valElem.appendChild(document
- .createCDATASection(value));
- else
+ .createCDATASection(value));
+ } else {
valElem.appendChild(document.createTextNode(URLEncoder
- .encode(value, this.xmlEncoding)));
+ .encode(value, this.xmlEncoding)));
+ }
metadataElem.appendChild(valElem);
}
root.appendChild(metadataElem);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java
index 8bc749c..128e376 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternConfigReader.java
@@ -63,8 +63,9 @@ public final class ExternConfigReader implements MetExtractorConfigReader,
.getAttribute(WORKING_DIR_ATTR)));
String metFileExt = PathUtils.replaceEnvVariables(execElement
.getAttribute(MET_FILE_EXT_ATTR));
- if (!metFileExt.equals(""))
- config.setMetFileExt(metFileExt);
+ if (!metFileExt.equals("")) {
+ config.setMetFileExt(metFileExt);
+ }
Element binPathElem = XMLUtils.getFirstElement(
EXTRACTOR_BIN_PATH_TAG, execElement);
String binPath = XMLUtils.getSimpleElementText(binPathElem);
@@ -91,19 +92,21 @@ public final class ExternConfigReader implements MetExtractorConfigReader,
String argStr;
if (Boolean.valueOf(
argElem.getAttribute(IS_DATA_FILE_ATTR)
- .toLowerCase()))
- argStr = DATA_FILE_PLACE_HOLDER;
- else if (Boolean.valueOf(
+ .toLowerCase())) {
+ argStr = DATA_FILE_PLACE_HOLDER;
+ } else if (Boolean.valueOf(
argElem.getAttribute(IS_MET_FILE_ATTR)
- .toLowerCase()))
- argStr = MET_FILE_PLACE_HOLDER;
- else
- argStr = XMLUtils.getSimpleElementText(argElem);
+ .toLowerCase())) {
+ argStr = MET_FILE_PLACE_HOLDER;
+ } else {
+ argStr = XMLUtils.getSimpleElementText(argElem);
+ }
String appendExt;
if (!(appendExt = argElem.getAttribute(APPEND_EXT_ATTR))
- .equals(""))
- argStr += "." + appendExt;
+ .equals("")) {
+ argStr += "." + appendExt;
+ }
if (Boolean.valueOf(
argElem.getAttribute(ENV_REPLACE_ATTR))) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternMetExtractor.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternMetExtractor.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternMetExtractor.java
index 238d1e9..084b243 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternMetExtractor.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/ExternMetExtractor.java
@@ -66,8 +66,9 @@ public class ExternMetExtractor extends CmdLineMetExtractor implements
// determine working directory
String workingDirPath = ((ExternalMetExtractorConfig) this.config)
.getWorkingDirPath();
- if (workingDirPath == null || workingDirPath.equals(""))
- workingDirPath = file.getParentFile().getAbsolutePath();
+ if (workingDirPath == null || workingDirPath.equals("")) {
+ workingDirPath = file.getParentFile().getAbsolutePath();
+ }
File workingDir = new File(workingDirPath);
// determine met file path
@@ -81,16 +82,18 @@ public class ExternMetExtractor extends CmdLineMetExtractor implements
commandLineList.add(((ExternalMetExtractorConfig) this.config)
.getExtractorBinPath());
if (((ExternalMetExtractorConfig) this.config).getArgList() != null
- && ((ExternalMetExtractorConfig) this.config).getArgList().length > 0)
- commandLineList.addAll(Arrays
- .asList(((ExternalMetExtractorConfig) this.config)
- .getArgList()));
+ && ((ExternalMetExtractorConfig) this.config).getArgList().length > 0) {
+ commandLineList.addAll(Arrays
+ .asList(((ExternalMetExtractorConfig) this.config)
+ .getArgList()));
+ }
String[] commandLineArgs = new String[commandLineList.size()];
- for (int i = 0; i < commandLineList.size(); i++)
- commandLineArgs[i] = StringUtils.replace(StringUtils.replace(
- (String) commandLineList.get(i), MET_FILE_PLACE_HOLDER,
- metFilePath), DATA_FILE_PLACE_HOLDER, file
- .getAbsolutePath());
+ for (int i = 0; i < commandLineList.size(); i++) {
+ commandLineArgs[i] = StringUtils.replace(StringUtils.replace(
+ (String) commandLineList.get(i), MET_FILE_PLACE_HOLDER,
+ metFilePath), DATA_FILE_PLACE_HOLDER, file
+ .getAbsolutePath());
+ }
// generate metadata file
LOG.log(Level.INFO, "Generating met file for product file: ["
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/FilenameTokenConfig.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/FilenameTokenConfig.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/FilenameTokenConfig.java
index 815023d..01c7cc1 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/FilenameTokenConfig.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/FilenameTokenConfig.java
@@ -85,8 +85,9 @@ public class FilenameTokenConfig implements MetExtractorConfig {
PGEGroup substrOffsetGroup = this.conf.getPgeSpecificGroups().get(
SUBSTRING_OFFSET_GROUP);
Metadata met = new Metadata();
- if (substrOffsetGroup == null)
+ if (substrOffsetGroup == null) {
return met;
+ }
String filename = file.getName();
for (PGEVector vec : substrOffsetGroup.getVectors().values()) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/MetReaderExtractor.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/MetReaderExtractor.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/MetReaderExtractor.java
index fd6ce2f..a9a9875 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/MetReaderExtractor.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/extractors/MetReaderExtractor.java
@@ -78,11 +78,12 @@ public class MetReaderExtractor extends CmdLineMetExtractor {
// .met file
// for the given product file
String extension = this.metFileExt;
- if (this.config != null)
- extension = ((MetReaderConfig) this.config)
- .getProperty(
- "org.apache.oodt.cas.metadata.extractors.MetReader.metFileExt",
- this.metFileExt);
+ if (this.config != null) {
+ extension = ((MetReaderConfig) this.config)
+ .getProperty(
+ "org.apache.oodt.cas.metadata.extractors.MetReader.metFileExt",
+ this.metFileExt);
+ }
String metFileFullPath = file.getAbsolutePath() + "." + extension;
LOG.log(Level.INFO, "Reading metadata from " + metFileFullPath);
// now read the met file and return it
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/MimeTypeComparator.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/MimeTypeComparator.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/MimeTypeComparator.java
index f57af04..9a05ce3 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/MimeTypeComparator.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/MimeTypeComparator.java
@@ -52,10 +52,11 @@ public class MimeTypeComparator extends PreConditionComparator<String> {
throws PreconditionComparatorException {
try {
String tikaMimeType = this.mimeTypeUtils.getMimeType(product);
- if (tikaMimeType == null && useMagic)
+ if (tikaMimeType == null && useMagic) {
tikaMimeType = this.mimeTypeUtils
- .getMimeTypeByMagic(MimeTypeUtils
- .readMagicHeader(new FileInputStream(product)));
+ .getMimeTypeByMagic(MimeTypeUtils
+ .readMagicHeader(new FileInputStream(product)));
+ }
return tikaMimeType.compareTo(mimeType);
} catch (Throwable e) {
e.printStackTrace();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreConditionComparator.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreConditionComparator.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreConditionComparator.java
index 66dfd66..04995fd 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreConditionComparator.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/PreConditionComparator.java
@@ -63,9 +63,10 @@ public abstract class PreConditionComparator<CompareType> implements SpringSetId
public boolean passes(File product) {
try {
- if (fileExtension != null)
+ if (fileExtension != null) {
product = new File(product.getAbsolutePath() + "."
- + this.fileExtension);
+ + this.fileExtension);
+ }
return eval(this.type, this.performCheck(product, this.compareItem));
} catch (Exception e) {
return false;
@@ -100,14 +101,15 @@ public abstract class PreConditionComparator<CompareType> implements SpringSetId
private static boolean eval(String opKey, int preconditionResult)
throws MetExtractionException {
opKey = opKey.toUpperCase();
- if (preconditionResult == 0)
+ if (preconditionResult == 0) {
return EQUAL_TO.equals(opKey);
- else if (preconditionResult > 0)
+ } else if (preconditionResult > 0) {
return NOT_EQUAL_TO.equals(opKey) || GREATER_THAN.equals(opKey);
- else if (preconditionResult < 0)
+ } else if (preconditionResult < 0) {
return NOT_EQUAL_TO.equals(opKey) || LESS_THAN.equals(opKey);
- else
+ } else {
throw new MetExtractionException("evalType is not a valid type");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/RegExExcludeComparator.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/RegExExcludeComparator.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/RegExExcludeComparator.java
index bb39ab1..69fba01 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/RegExExcludeComparator.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/preconditions/RegExExcludeComparator.java
@@ -41,8 +41,9 @@ public class RegExExcludeComparator extends PreConditionComparator<String> {
if (compareItem != null
&& !compareItem.trim().equals("")
&& Pattern.matches(compareItem.toLowerCase(), file
- .getAbsolutePath().toLowerCase()))
- return 0;
+ .getAbsolutePath().toLowerCase())) {
+ return 0;
+ }
return 1;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/util/MimeTypeUtils.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/MimeTypeUtils.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/MimeTypeUtils.java
index 51bba2a..d078082 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/MimeTypeUtils.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/MimeTypeUtils.java
@@ -104,8 +104,9 @@ public final class MimeTypeUtils {
* mime type.
*/
public static String cleanMimeType(String origType) {
- if (origType == null)
+ if (origType == null) {
return null;
+ }
// take the origType and split it on ';'
String[] tokenizedMimeType = origType.split(SEPARATOR);
@@ -310,10 +311,11 @@ public final class MimeTypeUtils {
public String getSuperTypeForMimeType(String mimeType) {
try {
MediaType mediaType = this.mimeTypes.getMediaTypeRegistry().getSupertype(this.mimeTypes.forName(mimeType).getType());
- if (mediaType != null)
- return mediaType.getType() + "/" + mediaType.getSubtype();
- else
- return null;
+ if (mediaType != null) {
+ return mediaType.getType() + "/" + mediaType.getSubtype();
+ } else {
+ return null;
+ }
}catch (Exception e) {
LOG.log(Level.WARNING, "Failed to get super-type for mimetype "
+ mimeType + " : " + e.getMessage());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java
----------------------------------------------------------------------
diff --git a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java
index b10d906..f70e29f 100644
--- a/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java
+++ b/metadata/src/main/java/org/apache/oodt/cas/metadata/util/PathUtils.java
@@ -71,9 +71,11 @@ public final class PathUtils {
&& metadata.getMetadata(data.getFieldName()) != null) {
List valList = metadata.getAllMetadata(data.getFieldName());
var = (String) valList.get(0);
- if (expand)
- for (int j = 1; j < valList.size(); j++)
+ if (expand) {
+ for (int j = 1; j < valList.size(); j++) {
var += DELIMITER + (String) valList.get(j);
+ }
+ }
} else {
var = EnvUtilities.getEnv(data.getFieldName());
}
@@ -131,17 +133,19 @@ public final class PathUtils {
dotIndex), metadata).replaceAll(
"[\\+\\s]", ""));
gc.add(GregorianCalendar.DAY_OF_YEAR, rollDays);
- } else
+ } else {
throw new CasMetadataException(
- "Malformed dynamic date replacement specified (no dot separator) - '"
- + dateString + "'");
+ "Malformed dynamic date replacement specified (no dot separator) - '"
+ + dateString + "'");
+ }
}
// determine type and make the appropriate replacement
String[] splitDate = dateString.split("\\.");
- if (splitDate.length < 2)
+ if (splitDate.length < 2) {
throw new CasMetadataException("No date type specified - '" + dateString
- + "'");
+ + "'");
+ }
String dateType = splitDate[1].replaceAll("[\\[\\]\\s]", "");
String replacement;
if (dateType.equals("DAY")) {
@@ -203,18 +207,19 @@ public final class PathUtils {
Date date = new SimpleDateFormat(dateFormat).parse(dateString);
Calendar calendar = (Calendar) Calendar.getInstance().clone();
calendar.setTime(date);
- if (addUnits.equals("hr") || addUnits.equals("hour"))
- calendar.add(Calendar.HOUR_OF_DAY, addAmount);
- else if (addUnits.equals("min") || addUnits.equals("minute"))
- calendar.add(Calendar.MINUTE, addAmount);
- else if (addUnits.equals("sec") || addUnits.equals("second"))
- calendar.add(Calendar.SECOND, addAmount);
- else if (addUnits.equals("day"))
- calendar.add(Calendar.DAY_OF_YEAR, addAmount);
- else if (addUnits.equals("mo") || addUnits.equals("month"))
- calendar.add(Calendar.MONTH, addAmount);
- else if (addUnits.equals("yr") || addUnits.equals("year"))
- calendar.add(Calendar.YEAR, addAmount);
+ if (addUnits.equals("hr") || addUnits.equals("hour")) {
+ calendar.add(Calendar.HOUR_OF_DAY, addAmount);
+ } else if (addUnits.equals("min") || addUnits.equals("minute")) {
+ calendar.add(Calendar.MINUTE, addAmount);
+ } else if (addUnits.equals("sec") || addUnits.equals("second")) {
+ calendar.add(Calendar.SECOND, addAmount);
+ } else if (addUnits.equals("day")) {
+ calendar.add(Calendar.DAY_OF_YEAR, addAmount);
+ } else if (addUnits.equals("mo") || addUnits.equals("month")) {
+ calendar.add(Calendar.MONTH, addAmount);
+ } else if (addUnits.equals("yr") || addUnits.equals("year")) {
+ calendar.add(Calendar.YEAR, addAmount);
+ }
String newDateString = new SimpleDateFormat(dateFormat).format(calendar.getTime());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
index ff22071..e0ac86d 100644
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
+++ b/opendapps/src/main/java/org/apache/oodt/opendapps/DatasetExtractor.java
@@ -81,12 +81,13 @@ public class DatasetExtractor {
public List<String> getDapUrls() {
List<String> urls = null;
- if (this.q.contains(FINDALL))
+ if (this.q.contains(FINDALL)) {
urls = this.allUrls;
- else if (this.q.contains(FINDSOME))
+ } else if (this.q.contains(FINDSOME)) {
urls = this.getFindSome();
- else if (this.q.contains(FINDQUERY))
+ } else if (this.q.contains(FINDQUERY)) {
urls = this.getFindQuery();
+ }
return urls;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java b/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
index ef1da78..0292660 100644
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
+++ b/opendapps/src/main/java/org/apache/oodt/opendapps/OpendapProfileElementExtractor.java
@@ -67,9 +67,15 @@ public class OpendapProfileElementExtractor {
attTable = das.getAttributeTable(varname);
// make variable names case insensitive
- if(attTable == null) attTable = das.getAttributeTable(varname.toLowerCase());
- if(attTable == null) attTable = das.getAttributeTable(varname.toUpperCase());
- if(attTable == null) throw new NoSuchAttributeException("Att table for ["+varname+"] is null!");
+ if(attTable == null) {
+ attTable = das.getAttributeTable(varname.toLowerCase());
+ }
+ if(attTable == null) {
+ attTable = das.getAttributeTable(varname.toUpperCase());
+ }
+ if(attTable == null) {
+ throw new NoSuchAttributeException("Att table for [" + varname + "] is null!");
+ }
} catch (NoSuchAttributeException e) {
e.printStackTrace();
LOG.log(Level.WARNING, "Error extracting attribute table for element: ["
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
index 8451807..1996381 100644
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
+++ b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileChecker.java
@@ -102,7 +102,9 @@ public class ProfileChecker {
private static boolean checkResourceAttribute(String name, String value, boolean mandatory, StringBuilder sb) {
sb.append("\n\tResource Attribute '").append(name).append("' = ");
if (!StringUtils.hasText(value) || value.equalsIgnoreCase("null")) {
- if (mandatory) return false; // bad value
+ if (mandatory) {
+ return false; // bad value
+ }
} else {
sb.append(value);
}
@@ -133,19 +135,27 @@ public class ProfileChecker {
boolean first = true;
for (String value : values) {
if (!StringUtils.hasText(value) || value.equalsIgnoreCase("null")) {
- if (mandatory) ok = false; // invalid value for this profile element
+ if (mandatory) {
+ ok = false; // invalid value for this profile element
+ }
} else {
- if (!first) sb.append(", ");
+ if (!first) {
+ sb.append(", ");
+ }
sb.append(value);
first = false;
}
}
} else {
- if (mandatory) ok = false; // no values found for this profile element
+ if (mandatory) {
+ ok = false; // no values found for this profile element
+ }
}
} else {
- if (mandatory) ok = false; // no profile element found
+ if (mandatory) {
+ ok = false; // no profile element found
+ }
}
return ok;
@@ -163,7 +173,9 @@ public class ProfileChecker {
for (String resLocation : resLocations) {
String[] parts = resLocation.split("\\|"); // regular expression of ProfileUtils.CHAR
- if (parts[1].equals(mimeType)) return parts[0];
+ if (parts[1].equals(mimeType)) {
+ return parts[0];
+ }
}
// resource location not found
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
----------------------------------------------------------------------
diff --git a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
index d795dbc..c17b274 100644
--- a/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
+++ b/opendapps/src/main/java/org/apache/oodt/opendapps/util/ProfileUtils.java
@@ -277,7 +277,9 @@ public class ProfileUtils {
}
}
// only save profile elements with one or more values
- if (epe.getValues().size()>0) profElements.put(name, epe);
+ if (epe.getValues().size()>0) {
+ profElements.put(name, epe);
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java b/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
index 4d86e04..31e21f8 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/listing/ListingConf.java
@@ -61,8 +61,9 @@ public class ListingConf {
} catch (PGEConfigFileException e) {
throw new InstantiationException(e.getMessage());
} finally {
- if (this.conf == null)
+ if (this.conf == null) {
throw new InstantiationException("Configuration is null!");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
index f57b7da..bb10f27 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTree.java
@@ -39,8 +39,9 @@ public class PedigreeTree {
public int getNumLevels() {
if (root != null) {
return traverse(root, 0) + 1;
- } else
+ } else {
return 0;
+ }
}
public PedigreeTreeNode getRoot() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
index 481671d..f3dd71d 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/pedigree/PedigreeTreeNode.java
@@ -65,8 +65,9 @@ public class PedigreeTreeNode {
}
public int getNumChildren() {
- if (this.children == null)
+ if (this.children == null) {
return 0;
+ }
return this.children.size();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java b/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
index 1bf259b..40c24b8 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/query/AbstractPCSQuery.java
@@ -52,8 +52,9 @@ public abstract class AbstractPCSQuery implements PCSQuery {
*/
protected String getElemId(String elemName) {
Element elem = fm.safeGetElementByName(elemName);
- if (elem == null)
+ if (elem == null) {
return null;
+ }
return elem.getElementId();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java b/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
index bfea4b4..14c8eb7 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/tools/PCSHealthMonitor.java
@@ -294,8 +294,9 @@ public final class PCSHealthMonitor implements CoreMetKeys,
private List getProductHealth() {
if (getFmUp()) {
return this.fm.safeGetTopNProducts(TOP_N_PRODUCTS);
- } else
+ } else {
return new Vector();
+ }
}
private List getJobStatusHealth() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java
----------------------------------------------------------------------
diff --git a/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java b/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java
index 67db072..efbe3c1 100644
--- a/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java
+++ b/pcs/core/src/main/java/org/apache/oodt/pcs/util/WorkflowManagerUtils.java
@@ -73,8 +73,9 @@ public class WorkflowManagerUtils {
}
public List<WorkflowInstance> safeGetWorkflowInstances() {
- if (!isConnected())
+ if (!isConnected()) {
return Collections.EMPTY_LIST;
+ }
try {
return this.client.getWorkflowInstances();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java
----------------------------------------------------------------------
diff --git a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java
index b4cb93e..9012fb2 100644
--- a/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java
+++ b/pcs/input/src/main/java/org/apache/oodt/pcs/input/PGEGroup.java
@@ -155,57 +155,65 @@ public class PGEGroup {
public PGEScalar getScalar(String name) {
if (this.scalars != null) {
return this.scalars.get(name);
- } else
+ } else {
return null;
+ }
}
public PGEVector getVector(String name) {
if (this.vectors != null) {
return this.vectors.get(name);
- } else
+ } else {
return null;
+ }
}
public PGEMatrix getMatrix(String name) {
if (this.matrixs != null) {
return this.matrixs.get(name);
- } else
+ } else {
return null;
+ }
}
public PGEGroup getGroup(String name) {
if (this.groups != null) {
return this.groups.get(name);
- } else
+ } else {
return null;
+ }
}
public int getNumScalars() {
if (this.scalars != null) {
return this.scalars.size();
- } else
+ } else {
return 0;
+ }
}
public int getNumVectors() {
if (this.vectors != null) {
return this.vectors.size();
- } else
+ } else {
return 0;
+ }
}
public int getNumMatrixs() {
if (this.matrixs != null) {
return this.matrixs.size();
- } else
+ } else {
return 0;
+ }
}
public int getNumGroups() {
if (this.groups != null) {
return this.groups.size();
- } else
+ } else {
return 0;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
----------------------------------------------------------------------
diff --git a/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java b/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
index cb43eef..3478dc2 100644
--- a/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
+++ b/pcs/services/src/main/java/org/apache/oodt/pcs/services/HealthResource.java
@@ -221,8 +221,9 @@ public class HealthResource extends PCSService {
.getProductTypeId()));
p.setProductReferences(fm.safeGetProductReferences(p));
Metadata prodMet = fm.safeGetMetadata(p);
- if (prodMet == null)
+ if (prodMet == null) {
prodMet = new Metadata();
+ }
Map<String, Object> fileOutput = new HashMap<String, Object>();
fileOutput.put("filepath", fm.getFilePath(p));
fileOutput.put("receivedTime", prodMet.getMetadata("CAS."
@@ -253,9 +254,10 @@ public class HealthResource extends PCSService {
break;
}
}
- if (!found)
+ if (!found) {
throw new ResourceNotFoundException(
"No ingest crawler found with name: [" + crawlerName[0] + "]");
+ }
} else {
for (CrawlerHealth ch : (List<CrawlerHealth>) (List<?>) report
.getCrawlerHealthStatus()) {
@@ -278,10 +280,11 @@ public class HealthResource extends PCSService {
break;
}
}
- if (!found)
+ if (!found) {
throw new ResourceNotFoundException(
"Unable to find any jobs with associated state: [" + jobState[0]
- + "]");
+ + "]");
+ }
} else {
for (JobHealthStatus js : (List<JobHealthStatus>) (List<?>) report
.getJobHealthStatus()) {
@@ -322,9 +325,10 @@ public class HealthResource extends PCSService {
break;
}
}
- if (!found)
+ if (!found) {
throw new ResourceNotFoundException(
"Unable to find any crawlers with name: [" + crawlerName[0] + "]");
+ }
} else {
for (CrawlerStatus cs : (List<CrawlerStatus>) (List<?>) report
.getCrawlerStatus()) {
@@ -355,11 +359,13 @@ public class HealthResource extends PCSService {
stubs.add(this.encodeDaemonStatus(bStatus));
}
daemonOutput.put("stubs", stubs);
- } else
+ } else {
throw new ResourceNotFoundException(
"Resource Manager not running so no batch stubs to check.");
- } else
+ }
+ } else {
throw new ResourceNotFoundException("Daemon not found");
+ }
} else {
daemonOutput.put("fm", this.encodeDaemonStatus(report.getFmStatus()));
daemonOutput.put("wm", this.encodeDaemonStatus(report.getWmStatus()));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pcs/services/src/main/java/org/apache/oodt/pcs/services/PedigreeResource.java
----------------------------------------------------------------------
diff --git a/pcs/services/src/main/java/org/apache/oodt/pcs/services/PedigreeResource.java b/pcs/services/src/main/java/org/apache/oodt/pcs/services/PedigreeResource.java
index b8b3eb0..3f5e979 100644
--- a/pcs/services/src/main/java/org/apache/oodt/pcs/services/PedigreeResource.java
+++ b/pcs/services/src/main/java/org/apache/oodt/pcs/services/PedigreeResource.java
@@ -97,10 +97,12 @@ public class PedigreeResource extends PCSService {
private String encodePedigreeAsJson(PedigreeTree up, PedigreeTree down) {
Map<String, Object> output = new HashMap<String, Object>();
- if (up != null)
+ if (up != null) {
output.put("upstream", this.encodePedigreeTreeAsJson(up.getRoot()));
- if (down != null)
+ }
+ if (down != null) {
output.put("downstream", this.encodePedigreeTreeAsJson(down.getRoot()));
+ }
JSONObject json = new JSONObject();
json.put("pedigree", output);
return json.toString();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
index bef0be2..1cca03e 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/PGETaskInstance.java
@@ -459,9 +459,10 @@ public class PGETaskInstance implements WorkflowTaskInstance {
}
}
}
- if (outputMetadata.getAllKeys().size() > 0)
- this.writeFromMetadata(outputMetadata, createdFile.getAbsolutePath()
- + "." + this.pgeMetadata.getMetadata(MET_FILE_EXT));
+ if (outputMetadata.getAllKeys().size() > 0) {
+ this.writeFromMetadata(outputMetadata, createdFile.getAbsolutePath()
+ + "." + this.pgeMetadata.getMetadata(MET_FILE_EXT));
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pge/src/main/java/org/apache/oodt/cas/pge/metadata/PgeMetadata.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/metadata/PgeMetadata.java b/pge/src/main/java/org/apache/oodt/cas/pge/metadata/PgeMetadata.java
index 34e0c24..017911b 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/metadata/PgeMetadata.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/metadata/PgeMetadata.java
@@ -298,8 +298,9 @@ public class PgeMetadata {
Validate.notNull(key, "key cannot be null");
List<String> keyPath = Lists.newArrayList();
- while (keyLinkMap.containsKey(key))
+ while (keyLinkMap.containsKey(key)) {
keyPath.add(key = keyLinkMap.get(key));
+ }
return keyPath;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java b/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
index 0bdc74c..4e0dc4c 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/util/XmlHelper.java
@@ -443,17 +443,19 @@ public class XmlHelper {
try {
while ((value = PathUtils
.doDynamicReplacement(value, inputMetadata)).contains("[")
- && envReplaceRecur)
- ;
+ && envReplaceRecur) {
+ ;
+ }
if (value.toUpperCase().matches(
- "^\\s*SQL\\s*\\(.*\\)\\s*\\{.*\\}\\s*$"))
- value = QueryUtils
- .getQueryResultsAsString(new XmlRpcFileManagerClient(
- new URL(inputMetadata
- .getMetadata(QUERY_FILE_MANAGER_URL
- .getName())))
- .complexQuery(SqlParser
- .parseSqlQueryMethod(value)));
+ "^\\s*SQL\\s*\\(.*\\)\\s*\\{.*\\}\\s*$")) {
+ value = QueryUtils
+ .getQueryResultsAsString(new XmlRpcFileManagerClient(
+ new URL(inputMetadata
+ .getMetadata(QUERY_FILE_MANAGER_URL
+ .getName())))
+ .complexQuery(SqlParser
+ .parseSqlQueryMethod(value)));
+ }
return value;
} catch (Exception e) {
throw new PGEException("Failed to parse value: " + value, e);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
index cbdd74a..e7225c6 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/MetadataKeyReplacerTemplateWriter.java
@@ -69,8 +69,9 @@ public class MetadataKeyReplacerTemplateWriter extends
if (metadata.isMultiValued(key)) {
List<String> values = metadata.getAllMetadata(key);
replaceVal = StringUtils.join(values, separator);
- } else
+ } else {
replaceVal = metadata.getMetadata(key);
+ }
processedTemplate = processedTemplate.replaceAll("\\$" + key, replaceVal);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
----------------------------------------------------------------------
diff --git a/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java b/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
index e664379..f5fa039 100644
--- a/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
+++ b/pge/src/main/java/org/apache/oodt/cas/pge/writers/metlist/MetadataListPcsMetFileWriter.java
@@ -63,21 +63,25 @@ public class MetadataListPcsMetFileWriter extends PcsMetFileWriter {
for (int i = 0; i < metadataNodeList.getLength(); i++) {
Element metadataElement = (Element) metadataNodeList.item(i);
String key = metadataElement.getAttribute(KEY_ATTR);
- if (key.equals(""))
- key = PathUtils.doDynamicReplacement(metadataElement.getAttribute(KEY_GEN_ATTR), inputMetadata);
+ if (key.equals("")) {
+ key = PathUtils.doDynamicReplacement(metadataElement.getAttribute(KEY_GEN_ATTR), inputMetadata);
+ }
String val = metadataElement.getAttribute(VAL_ATTR);
- if (val.equals(""))
- val = metadataElement.getTextContent();
+ if (val.equals("")) {
+ val = metadataElement.getTextContent();
+ }
if (val != null && !val.equals("")) {
- if (!metadataElement.getAttribute(ENV_REPLACE_ATTR).toLowerCase().equals("false"))
- val = PathUtils.doDynamicReplacement(val, inputMetadata);
+ if (!metadataElement.getAttribute(ENV_REPLACE_ATTR).toLowerCase().equals("false")) {
+ val = PathUtils.doDynamicReplacement(val, inputMetadata);
+ }
String[] vals;
if (metadataElement.getAttribute(SPLIT_ATTR).toLowerCase().equals("false")) {
vals = new String[] { val };
} else {
String delimiter = metadataElement.getAttribute("delimiter");
- if (delimiter == null || delimiter.equals(""))
- delimiter = ",";
+ if (delimiter == null || delimiter.equals("")) {
+ delimiter = ",";
+ }
vals = (val + delimiter).split(delimiter);
}
metadata.replaceMetadata(key, Arrays.asList(vals));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
index 3159996..1c839d2 100644
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
+++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
@@ -80,9 +80,10 @@ public abstract class AbstractCrawlLister implements OFSNListHandler {
protected File[] crawlFiles(File dirRoot, boolean recur,
boolean crawlForDirs) {
- if (dirRoot == null || ((!dirRoot.exists())))
+ if (dirRoot == null || ((!dirRoot.exists()))) {
throw new IllegalArgumentException("dir root: [" + dirRoot
- + "] is null or non existant!");
+ + "] is null or non existant!");
+ }
List<File> fileList = new Vector<File>();
@@ -104,10 +105,11 @@ public abstract class AbstractCrawlLister implements OFSNListHandler {
if (recur) {
File[] subdirs = dir.listFiles(DIR_FILTER);
- if (subdirs != null)
+ if (subdirs != null) {
for (File subdir : subdirs) {
stack.push(subdir);
}
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
index 3b5ffbe..89bfdb5 100644
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
+++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/OFSNFileHandlerConfiguration.java
@@ -57,15 +57,17 @@ public class OFSNFileHandlerConfiguration {
public String getHandlerType(String handlerName) {
if (this.handlerTable.containsKey(handlerName)) {
return this.handlerTable.get(handlerName).getType();
- } else
+ } else {
return null;
+ }
}
public String getHandlerClass(String handlerName) {
if (this.handlerTable.containsKey(handlerName)) {
return this.handlerTable.get(handlerName).getClassName();
- } else
+ } else {
return null;
+ }
}
public List<OFSNHandlerConfig> getHandlerConfigs() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
index bd119d6..20944f3 100644
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
+++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/URLGetHandler.java
@@ -77,41 +77,41 @@ public class URLGetHandler extends AbstractCrawlLister implements OFSNGetHandler
public void configure(Properties prop) {
if (prop != null) {
- if (prop.getProperty(PROD_SERVER_HOSTNAME) != null)
- this.prodServerHostname = prop.getProperty(PROD_SERVER_HOSTNAME);
- else {
+ if (prop.getProperty(PROD_SERVER_HOSTNAME) != null) {
+ this.prodServerHostname = prop.getProperty(PROD_SERVER_HOSTNAME);
+ } else {
LOG.warning("Configuration property ["+PROD_SERVER_HOSTNAME+"] not specified, using default");
this.prodServerHostname = DEFAULT_PROD_SERVER_HOSTNAME;
}
LOG.info("Property ["+PROD_SERVER_HOSTNAME+"] set with value ["+this.prodServerHostname+"]");
- if (prop.getProperty(PROD_SERVER_PORT) != null)
- this.prodServerPort = prop.getProperty(PROD_SERVER_PORT);
- else {
+ if (prop.getProperty(PROD_SERVER_PORT) != null) {
+ this.prodServerPort = prop.getProperty(PROD_SERVER_PORT);
+ } else {
LOG.warning("Configuration property ["+PROD_SERVER_PORT+"] not specified, using default");
this.prodServerPort = DEFAULT_PROD_SERVER_PORT;
}
LOG.info("Property ["+PROD_SERVER_PORT+"] set with value ["+this.prodServerPort+"]");
- if (prop.getProperty(PROD_SERVER_CONTEXT) != null)
- this.prodServerContext = prop.getProperty(PROD_SERVER_CONTEXT);
- else {
+ if (prop.getProperty(PROD_SERVER_CONTEXT) != null) {
+ this.prodServerContext = prop.getProperty(PROD_SERVER_CONTEXT);
+ } else {
LOG.warning("Configuration property ["+PROD_SERVER_CONTEXT+"] not specified, using default");
this.prodServerContext = DEFAULT_PROD_SERVER_CONTEXT;
}
LOG.info("Property ["+PROD_SERVER_CONTEXT+"] set with value ["+this.prodServerContext+"]");
- if (prop.getProperty(PRODUCT_ROOT) != null)
- this.productRoot = prop.getProperty(PRODUCT_ROOT);
- else {
+ if (prop.getProperty(PRODUCT_ROOT) != null) {
+ this.productRoot = prop.getProperty(PRODUCT_ROOT);
+ } else {
LOG.warning("Configuration property ["+PRODUCT_ROOT+"] not specified, using default");
this.productRoot = DEFAULT_PRODUCT_ROOT;
}
LOG.info("Property ["+PRODUCT_ROOT+"] set with value ["+this.productRoot+"]");
- if (prop.getProperty(RETURN_TYPE) != null)
- this.returnType = prop.getProperty(RETURN_TYPE);
- else {
+ if (prop.getProperty(RETURN_TYPE) != null) {
+ this.returnType = prop.getProperty(RETURN_TYPE);
+ } else {
LOG.warning("Configuration property ["+RETURN_TYPE+"] not specified, using default");
this.returnType = DEFAULT_RETURN_TYPE;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java b/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
index 36c03b8..fba28c8 100644
--- a/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
+++ b/product/src/main/java/org/apache/oodt/xmlquery/ChunkedProductInputStream.java
@@ -61,9 +61,13 @@ final class ChunkedProductInputStream extends InputStream {
*/
public int read() throws IOException {
checkOpen(); // Make sure the stream's open
- if (eof) throw new IOException("End of file"); // Already reached EOF? You lose.
+ if (eof) {
+ throw new IOException("End of file"); // Already reached EOF? You lose.
+ }
fetchBlock(); // Get a block.
- if (eof) return -1; // No more blocks? Signal EOF.
+ if (eof) {
+ return -1; // No more blocks? Signal EOF.
+ }
return block[blockIndex++]; // Yield next byte (promoted) from block.
}
@@ -81,14 +85,20 @@ final class ChunkedProductInputStream extends InputStream {
*/
public int read(byte[] b, int offset, int length) throws IOException {
checkOpen(); // Check if open
- if (offset < 0 || offset > b.length || length < 0 || (offset + length) > b.length || (offset + length) < 0)
- throw new IllegalArgumentException("Illegal offset=" + offset + "/length=" + length
- + " for byte array of length " + b.length);
- else if (length == 0) // Want zero?
- return 0; // Then you get zero
- if (eof) throw new IOException("End of file"); // Already reached EOF? You lose.
+ if (offset < 0 || offset > b.length || length < 0 || (offset + length) > b.length || (offset + length) < 0) {
+ throw new IllegalArgumentException("Illegal offset=" + offset + "/length=" + length
+ + " for byte array of length " + b.length);
+ } else if (length == 0) // Want zero?
+ {
+ return 0; // Then you get zero
+ }
+ if (eof) {
+ throw new IOException("End of file"); // Already reached EOF? You lose.
+ }
fetchBlock(); // Get a block.
- if (eof) return -1; // No more blocks? Signal EOF.
+ if (eof) {
+ return -1; // No more blocks? Signal EOF.
+ }
int amount = Math.min(length, block.length - blockIndex); // Return requested amount or whatever's left
System.arraycopy(block, blockIndex, b, offset, amount); // Transfer
blockIndex += amount; // Advance
@@ -101,18 +111,20 @@ final class ChunkedProductInputStream extends InputStream {
* @throws IOException if an error occurs.
*/
private void fetchBlock() throws IOException {
- if (block == null || blockIndex == block.length) try { // No block, or current block exhausted?
- if (productIndex == size) { // No more blocks left to get?
- block = null; // Drop current block
- eof = true; // Signal EOF
- } else { // Otherwise there are more blocks
- int x=(int)Math.min(BLOCK_SIZE, size - productIndex); // Can only fetch so much
- block = retriever.retrieveChunk(id, productIndex, x); // Get x's worth of data
- blockIndex = 0; // Start at block's beginning
- productIndex += block.length; // Advance product index by block size
+ if (block == null || blockIndex == block.length) {
+ try { // No block, or current block exhausted?
+ if (productIndex == size) { // No more blocks left to get?
+ block = null; // Drop current block
+ eof = true; // Signal EOF
+ } else { // Otherwise there are more blocks
+ int x = (int) Math.min(BLOCK_SIZE, size - productIndex); // Can only fetch so much
+ block = retriever.retrieveChunk(id, productIndex, x); // Get x's worth of data
+ blockIndex = 0; // Start at block's beginning
+ productIndex += block.length; // Advance product index by block size
}
- } catch (ProductException ex) {
+ } catch (ProductException ex) {
throw new IOException(ex.getMessage());
+ }
}
}
@@ -171,7 +183,9 @@ final class ChunkedProductInputStream extends InputStream {
* @throws IOException if the stream's closed.
*/
private void checkOpen() throws IOException {
- if (open) return;
+ if (open) {
+ return;
+ }
throw new IOException("Stream closed");
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java b/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
index e05414e..316650d 100644
--- a/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
+++ b/product/src/main/java/org/apache/oodt/xmlquery/LargeResult.java
@@ -92,9 +92,10 @@ public class LargeResult extends Result {
Object value = null;
InputStream in = null;
try {
- if (size > Integer.MAX_VALUE)
- throw new IllegalStateException("Cannot use getValue() for this product, result is too large; "
- + "use LargeResult.getInputStream instead");
+ if (size > Integer.MAX_VALUE) {
+ throw new IllegalStateException("Cannot use getValue() for this product, result is too large; "
+ + "use LargeResult.getInputStream instead");
+ }
int sizeToRead = (int) size;
byte[] buf = new byte[sizeToRead];
int index = 0;
@@ -103,7 +104,9 @@ public class LargeResult extends Result {
while ((num = in.read(buf, index, sizeToRead)) != -1) {
index += num;
sizeToRead -= num;
- if (sizeToRead == 0) break;
+ if (sizeToRead == 0) {
+ break;
+ }
}
// OK, this sucks. Sucks sucks sucks. Look, getValue is not to
@@ -117,9 +120,12 @@ public class LargeResult extends Result {
} catch (IOException ex) {
throw new IllegalStateException("Unexpected IOException: " + ex.getMessage());
} finally {
- if (in != null) try {
+ if (in != null) {
+ try {
in.close();
- } catch (IOException ignore) {}
+ } catch (IOException ignore) {
+ }
+ }
}
return value;
}
@@ -148,10 +154,11 @@ public class LargeResult extends Result {
* @return The MIME type.
*/
private static String transformMimeType(Result result) {
- if ("application/vnd.jpl.large-product".equals(result.mimeType))
- return (String) result.value;
- else
- return result.mimeType + " 0";
+ if ("application/vnd.jpl.large-product".equals(result.mimeType)) {
+ return (String) result.value;
+ } else {
+ return result.mimeType + " 0";
+ }
}
/** Serial version unique ID. */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
index c80f628..42304a6 100644
--- a/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
+++ b/profile/src/main/java/org/apache/oodt/profile/EnumeratedProfileElement.java
@@ -64,8 +64,9 @@ public class EnumeratedProfileElement extends ProfileElement {
public EnumeratedProfileElement(Profile profile, String name, String id, String desc, String type, String unit,
List<?> synonyms, boolean obligation, int maxOccurrence, String comment, List<?> values) {
super(profile, name, id, desc, type, unit, synonyms, obligation, maxOccurrence, comment);
- if (values.contains(null))
- throw new IllegalArgumentException("Null item in 'values' not allowed for enumerated profile elements");
+ if (values.contains(null)) {
+ throw new IllegalArgumentException("Null item in 'values' not allowed for enumerated profile elements");
+ }
this.values = values;
}
@@ -74,7 +75,9 @@ public class EnumeratedProfileElement extends ProfileElement {
}
protected void addValues(Node node) throws DOMException {
- if (values == null) return;
+ if (values == null) {
+ return;
+ }
for (Object value : values) {
Element e = node.getOwnerDocument().createElement("elemValue");
e.appendChild(node.getOwnerDocument().createCDATASection((String) value));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/Profile.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/Profile.java b/profile/src/main/java/org/apache/oodt/profile/Profile.java
index 255c649..cc0dc16 100644
--- a/profile/src/main/java/org/apache/oodt/profile/Profile.java
+++ b/profile/src/main/java/org/apache/oodt/profile/Profile.java
@@ -71,17 +71,21 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
List<Profile> profiles = new ArrayList<Profile>();
if ("profile".equals(root.getNodeName()))
// The root is a <profile>, so add the single profile to the list.
- profiles.add(factory.createProfile((Element) root));
- else if ("profiles".equals(root.getNodeName())) {
+ {
+ profiles.add(factory.createProfile((Element) root));
+ } else if ("profiles".equals(root.getNodeName())) {
// The root is a <profiles>, so add each <profile> to the list.
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if ("profile".equals(node.getNodeName()))
- profiles.add(factory.createProfile((Element) node));
+ if ("profile".equals(node.getNodeName())) {
+ profiles.add(factory.createProfile((Element) node));
+ }
}
- } else throw new IllegalArgumentException("Expected a <profiles> or <profile> top level element but got "
- + root.getNodeName());
+ } else {
+ throw new IllegalArgumentException("Expected a <profiles> or <profile> top level element but got "
+ + root.getNodeName());
+ }
return profiles;
}
@@ -144,17 +148,18 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
* @param root The <profile> element.
*/
public Profile(Node root, ObjectFactory factory) {
- if (!root.getNodeName().equals("profile"))
- throw new IllegalArgumentException("Construct a Profile from a <profile> element, not a <"
- + root.getNodeName() + ">");
+ if (!root.getNodeName().equals("profile")) {
+ throw new IllegalArgumentException("Construct a Profile from a <profile> element, not a <"
+ + root.getNodeName() + ">");
+ }
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if ("profAttributes".equals(node.getNodeName()))
- profAttr = factory.createProfileAttributes((Element) node);
- else if ("resAttributes".equals(node.getNodeName()))
- resAttr = factory.createResourceAttributes(this, (Element) node);
- else if ("profElement".equals(node.getNodeName())) {
+ if ("profAttributes".equals(node.getNodeName())) {
+ profAttr = factory.createProfileAttributes((Element) node);
+ } else if ("resAttributes".equals(node.getNodeName())) {
+ resAttr = factory.createResourceAttributes(this, (Element) node);
+ } else if ("profElement".equals(node.getNodeName())) {
ProfileElement element = ProfileElement.createProfileElement((Element) node, this, factory);
elements.put(element.getName(), element);
}
@@ -170,7 +175,9 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
public Profile(ProfileAttributes profAttr, ResourceAttributes resAttr) {
this.profAttr = profAttr;
this.resAttr = resAttr;
- if (this.resAttr != null) this.resAttr.profile = this;
+ if (this.resAttr != null) {
+ this.resAttr.profile = this;
+ }
}
public int hashCode() {
@@ -178,8 +185,12 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof Profile)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof Profile)) {
+ return false;
+ }
Profile obj = (Profile) rhs;
return profAttr.equals(obj.profAttr);
}
@@ -307,10 +318,11 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
Element profile = doc.createElement("profile");
profile.appendChild(profAttr.toXML(doc));
profile.appendChild(resAttr.toXML(doc));
- if (withElements)
+ if (withElements) {
for (ProfileElement profileElement : elements.values()) {
profile.appendChild((profileElement).toXML(doc));
}
+ }
return profile;
}
@@ -373,8 +385,9 @@ public class Profile implements Serializable, Cloneable, Comparable<Object>, Doc
BufferedReader reader = new BufferedReader(new FileReader(argv[0]));
char[] buf = new char[512];
int num;
- while ((num = reader.read(buf)) != -1)
- b.append(buf, 0, num);
+ while ((num = reader.read(buf)) != -1) {
+ b.append(buf, 0, num);
+ }
reader.close();
Profile p = new Profile(b.toString());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java b/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
index fca45dd..c79e5f6 100644
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
+++ b/profile/src/main/java/org/apache/oodt/profile/ProfileAttributes.java
@@ -56,24 +56,25 @@ public class ProfileAttributes implements Serializable, Cloneable, Comparable, D
NodeList childNodes = root.getChildNodes();
for (int i = 0; i < childNodes.getLength(); ++i) {
Node node = childNodes.item(i);
- if ("profId".equals(node.getNodeName()))
- id = XML.unwrappedText(node);
- else if ("profVersion".equals(node.getNodeName()))
- version = XML.unwrappedText(node);
- else if ("profType".equals(node.getNodeName()))
- type = XML.unwrappedText(node);
- else if ("profStatusId".equals(node.getNodeName()))
- statusID = XML.unwrappedText(node);
- else if ("profSecurityType".equals(node.getNodeName()))
- securityType = XML.unwrappedText(node);
- else if ("profParentId".equals(node.getNodeName()))
- parent = XML.unwrappedText(node);
- else if ("profChildId".equals(node.getNodeName()))
- children.add(XML.unwrappedText(node));
- else if ("profRegAuthority".equals(node.getNodeName()))
- regAuthority = XML.unwrappedText(node);
- else if ("profRevisionNote".equals(node.getNodeName()))
- revisionNotes.add(XML.unwrappedText(node));
+ if ("profId".equals(node.getNodeName())) {
+ id = XML.unwrappedText(node);
+ } else if ("profVersion".equals(node.getNodeName())) {
+ version = XML.unwrappedText(node);
+ } else if ("profType".equals(node.getNodeName())) {
+ type = XML.unwrappedText(node);
+ } else if ("profStatusId".equals(node.getNodeName())) {
+ statusID = XML.unwrappedText(node);
+ } else if ("profSecurityType".equals(node.getNodeName())) {
+ securityType = XML.unwrappedText(node);
+ } else if ("profParentId".equals(node.getNodeName())) {
+ parent = XML.unwrappedText(node);
+ } else if ("profChildId".equals(node.getNodeName())) {
+ children.add(XML.unwrappedText(node));
+ } else if ("profRegAuthority".equals(node.getNodeName())) {
+ regAuthority = XML.unwrappedText(node);
+ } else if ("profRevisionNote".equals(node.getNodeName())) {
+ revisionNotes.add(XML.unwrappedText(node));
+ }
}
}
@@ -108,8 +109,12 @@ public class ProfileAttributes implements Serializable, Cloneable, Comparable, D
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof ProfileAttributes)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof ProfileAttributes)) {
+ return false;
+ }
return ((ProfileAttributes) rhs).id.equals(id);
}
[07/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java b/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java
index bf4b5f5..f2927d9 100644
--- a/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java
+++ b/commons/src/main/java/org/apache/oodt/commons/object/jndi/RMIContext.java
@@ -77,15 +77,18 @@ public class RMIContext implements Context {
* @param environment Its environment, currently unused.
*/
private void initEnv(Hashtable environment) {
- if (environment == null)
- throw new IllegalArgumentException("Nonnull environment required");
+ if (environment == null) {
+ throw new IllegalArgumentException("Nonnull environment required");
+ }
this.environment = (Hashtable) environment.clone();
}
public Object lookup(String name) throws NamingException {
checkName(name);
name = toRMIName(name);
- if (name.length() == 0) return new RMIContext(environment);
+ if (name.length() == 0) {
+ return new RMIContext(environment);
+ }
Registry registry = getRegistry();
try {
return registry.lookup(name);
@@ -157,8 +160,9 @@ public class RMIContext implements Context {
}
public NamingEnumeration list(String name) throws NamingException {
- if (name.length() > 0)
- throw new NotContextException("Subcontexts not supported");
+ if (name.length() > 0) {
+ throw new NotContextException("Subcontexts not supported");
+ }
final Iterator i = getCurrentBindings().iterator();
return new NamingEnumeration() {
@@ -195,8 +199,9 @@ public class RMIContext implements Context {
}
public NamingEnumeration listBindings(String name) throws NamingException {
- if (name.length() > 0)
- throw new NotContextException("Subcontexts not supported");
+ if (name.length() > 0) {
+ throw new NotContextException("Subcontexts not supported");
+ }
final Iterator i = getCurrentBindings().iterator();
return new NamingEnumeration() {
public void close() {}
@@ -270,17 +275,23 @@ public class RMIContext implements Context {
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- if (environment == null) environment = new Hashtable();
+ if (environment == null) {
+ environment = new Hashtable();
+ }
return environment.put(propName, propVal);
}
public Object removeFromEnvironment(String propName) throws NamingException {
- if (environment == null) return null;
+ if (environment == null) {
+ return null;
+ }
return environment.remove(propName);
}
public Hashtable getEnvironment() throws NamingException {
- if (environment == null) return new Hashtable();
+ if (environment == null) {
+ return new Hashtable();
+ }
return (Hashtable) environment.clone();
}
@@ -315,11 +326,15 @@ public class RMIContext implements Context {
* @return rmiregistry name.
*/
private String toRMIName(String name) {
- if (name == null) return "";
- if (name.startsWith("urn:eda:rmi:"))
- return name.substring(12);
- if (name.startsWith("rmi:"))
- return name.substring(4);
+ if (name == null) {
+ return "";
+ }
+ if (name.startsWith("urn:eda:rmi:")) {
+ return name.substring(12);
+ }
+ if (name.startsWith("rmi:")) {
+ return name.substring(4);
+ }
return name;
}
@@ -330,7 +345,9 @@ public class RMIContext implements Context {
* @throws NamingException if an error occurs.
*/
private Registry getRegistry() throws NamingException {
- if (registry != null) return registry;
+ if (registry != null) {
+ return registry;
+ }
try {
String host = environment.containsKey("host")? (String) environment.get("host") : "localhost";
int port = environment.containsKey("port")? (Integer) environment.get("port")
@@ -354,12 +371,15 @@ public class RMIContext implements Context {
* @throws InvalidNameException If <var>name</var>'s not an RMI object context name.
*/
private void checkName(String name) throws InvalidNameException {
- if (name == null)
- throw new IllegalArgumentException("Can't check a null name");
- if (name.length() == 0)
- throw new InvalidNameException("Name's length is zero");
- if (!name.startsWith("urn:eda:rmi:"))
- throw new InvalidNameException("Not an RMI name; try urn:eda:rmi:yadda-yadda");
+ if (name == null) {
+ throw new IllegalArgumentException("Can't check a null name");
+ }
+ if (name.length() == 0) {
+ throw new InvalidNameException("Name's length is zero");
+ }
+ if (!name.startsWith("urn:eda:rmi:")) {
+ throw new InvalidNameException("Not an RMI name; try urn:eda:rmi:yadda-yadda");
+ }
}
/** Context's environment; currently unused. */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/pagination/PaginationUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/pagination/PaginationUtils.java b/commons/src/main/java/org/apache/oodt/commons/pagination/PaginationUtils.java
index 927748b..597a294 100644
--- a/commons/src/main/java/org/apache/oodt/commons/pagination/PaginationUtils.java
+++ b/commons/src/main/java/org/apache/oodt/commons/pagination/PaginationUtils.java
@@ -82,22 +82,25 @@ public final class PaginationUtils {
final int totalSize = originalList.size();
int endIndex = startIndex + pageSize;
- if (endIndex > totalSize)
+ if (endIndex > totalSize) {
endIndex = totalSize;
+ }
return originalList.subList(startIndex, endIndex);
}
public static int getTotalPage(List originalList, int pageSize) {
- if (originalList == null || originalList.size() <= 0)
+ if (originalList == null || originalList.size() <= 0) {
return 0;
+ }
final int totalSize = originalList.size();
return ((totalSize - 1) / pageSize) + 1;
}
public static int getTotalPage(int numTotal, int pageSize) {
- if (numTotal <= 0)
+ if (numTotal <= 0) {
return 0;
+ }
return ((numTotal - 1) / pageSize) + 1;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/spring/postprocessor/SetIdBeanPostProcessor.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/spring/postprocessor/SetIdBeanPostProcessor.java b/commons/src/main/java/org/apache/oodt/commons/spring/postprocessor/SetIdBeanPostProcessor.java
index 0a3189e..0247f6c 100755
--- a/commons/src/main/java/org/apache/oodt/commons/spring/postprocessor/SetIdBeanPostProcessor.java
+++ b/commons/src/main/java/org/apache/oodt/commons/spring/postprocessor/SetIdBeanPostProcessor.java
@@ -36,8 +36,9 @@ public class SetIdBeanPostProcessor implements BeanPostProcessor {
public Object postProcessAfterInitialization(Object bean, String beanName)
throws BeansException {
- if (bean instanceof SpringSetIdInjectionType)
- ((SpringSetIdInjectionType) bean).setId(beanName);
+ if (bean instanceof SpringSetIdInjectionType) {
+ ((SpringSetIdInjectionType) bean).setId(beanName);
+ }
return bean;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/Base64.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/Base64.java b/commons/src/main/java/org/apache/oodt/commons/util/Base64.java
index fb1c7b3..5f4654d 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/Base64.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/Base64.java
@@ -61,13 +61,19 @@ public class Base64 {
* @return Base-64 encoded <var>data</var>
*/
public static byte[] encode(final byte[] data, int offset, int length) {
- if (data == null) return null;
- if (offset < 0 || offset > data.length)
- throw new IndexOutOfBoundsException("Can't encode at index " + offset + " which is beyond array bounds 0.."
- + data.length);
- if (length < 0) throw new IllegalArgumentException("Can't encode a negative amount of data");
- if (offset + length > data.length)
- throw new IndexOutOfBoundsException("Can't encode beyond right edge of array");
+ if (data == null) {
+ return null;
+ }
+ if (offset < 0 || offset > data.length) {
+ throw new IndexOutOfBoundsException("Can't encode at index " + offset + " which is beyond array bounds 0.."
+ + data.length);
+ }
+ if (length < 0) {
+ throw new IllegalArgumentException("Can't encode a negative amount of data");
+ }
+ if (offset + length > data.length) {
+ throw new IndexOutOfBoundsException("Can't encode beyond right edge of array");
+ }
int i, j;
byte dest[] = new byte[((length+2)/3)*4];
@@ -86,21 +92,30 @@ public class Base64 {
if (i < offset + length - 1) {
dest[j++] = (byte) ((data[i+1] >>> 4) & 017 | (data[i] << 4) & 077);
dest[j++] = (byte) ((data[i+1] << 2) & 077);
- } else
- dest[j++] = (byte) ((data[i] << 4) & 077);
+ } else {
+ dest[j++] = (byte) ((data[i] << 4) & 077);
+ }
}
// Now, map those onto base 64 printable ASCII.
for (i = 0; i <j; i++) {
- if (dest[i] < 26) dest[i] = (byte)(dest[i] + 'A');
- else if (dest[i] < 52) dest[i] = (byte)(dest[i] + 'a'-26);
- else if (dest[i] < 62) dest[i] = (byte)(dest[i] + '0'-52);
- else if (dest[i] < 63) dest[i] = (byte) '+';
- else dest[i] = (byte) '/';
+ if (dest[i] < 26) {
+ dest[i] = (byte) (dest[i] + 'A');
+ } else if (dest[i] < 52) {
+ dest[i] = (byte) (dest[i] + 'a' - 26);
+ } else if (dest[i] < 62) {
+ dest[i] = (byte) (dest[i] + '0' - 52);
+ } else if (dest[i] < 63) {
+ dest[i] = (byte) '+';
+ } else {
+ dest[i] = (byte) '/';
+ }
}
// Pad the result with and we're done.
- for (; i < dest.length; i++) dest[i] = (byte) '=';
+ for (; i < dest.length; i++) {
+ dest[i] = (byte) '=';
+ }
return dest;
}
@@ -127,31 +142,42 @@ public class Base64 {
* @return Decoded <var>data</var>.
*/
public static byte[] decode(final byte[] data, int offset, int length) {
- if (data == null) return null;
- if (offset < 0 || offset >= data.length)
- throw new IndexOutOfBoundsException("Can't decode at index " + offset + " which is beyond array bounds 0.."
- + (data.length-1));
- if (length < 0) throw new IllegalArgumentException("Can't decode a negative amount of data");
- if (offset + length > data.length)
- throw new IndexOutOfBoundsException("Can't decode beyond right edge of array");
+ if (data == null) {
+ return null;
+ }
+ if (offset < 0 || offset >= data.length) {
+ throw new IndexOutOfBoundsException("Can't decode at index " + offset + " which is beyond array bounds 0.."
+ + (data.length - 1));
+ }
+ if (length < 0) {
+ throw new IllegalArgumentException("Can't decode a negative amount of data");
+ }
+ if (offset + length > data.length) {
+ throw new IndexOutOfBoundsException("Can't decode beyond right edge of array");
+ }
// Ignore any padding at the end.
int tail = offset + length - 1;
- while (tail >= offset && data[tail] == '=')
- --tail;
+ while (tail >= offset && data[tail] == '=') {
+ --tail;
+ }
byte dest[] = new byte[tail + offset + 1 - length/4];
// First, convert from base-64 ascii to 6 bit bytes.
for (int i = offset; i < offset+length; i++) {
- if (data[i] == '=') data[i] = 0;
- else if (data[i] == '/') data[i] = 63;
- else if (data[i] == '+') data[i] = 62;
- else if (data[i] >= '0' && data[i] <= '9')
- data[i] = (byte)(data[i] - ('0' - 52));
- else if (data[i] >= 'a' && data[i] <= 'z')
- data[i] = (byte)(data[i] - ('a' - 26));
- else if (data[i] >= 'A' && data[i] <= 'Z')
- data[i] = (byte)(data[i] - 'A');
+ if (data[i] == '=') {
+ data[i] = 0;
+ } else if (data[i] == '/') {
+ data[i] = 63;
+ } else if (data[i] == '+') {
+ data[i] = 62;
+ } else if (data[i] >= '0' && data[i] <= '9') {
+ data[i] = (byte) (data[i] - ('0' - 52));
+ } else if (data[i] >= 'a' && data[i] <= 'z') {
+ data[i] = (byte) (data[i] - ('a' - 26));
+ } else if (data[i] >= 'A' && data[i] <= 'Z') {
+ data[i] = (byte) (data[i] - 'A');
+ }
}
// Map those from 4 6-bit byte groups onto 3 8-bit byte groups.
@@ -163,10 +189,12 @@ public class Base64 {
}
// And get the leftover ...
- if (j < dest.length)
- dest[j] = (byte) (((data[i] << 2) & 255) | ((data[i+1] >>> 4) & 003));
- if (++j < dest.length)
- dest[j] = (byte) (((data[i+1] << 4) & 255) | ((data[i+2] >>> 2) & 017));
+ if (j < dest.length) {
+ dest[j] = (byte) (((data[i] << 2) & 255) | ((data[i + 1] >>> 4) & 003));
+ }
+ if (++j < dest.length) {
+ dest[j] = (byte) (((data[i + 1] << 4) & 255) | ((data[i + 2] >>> 2) & 017));
+ }
// That's it.
return dest;
@@ -188,11 +216,11 @@ public class Base64 {
System.exit(1);
}
boolean encode = true;
- if ("encode".equals(argv[0]))
- encode = true;
- else if ("decode".equals(argv[0]))
- encode = false;
- else {
+ if ("encode".equals(argv[0])) {
+ encode = true;
+ } else if ("decode".equals(argv[0])) {
+ encode = false;
+ } else {
System.err.println("Specify either \"encode\" or \"decode\"");
System.exit(1);
}
@@ -208,8 +236,9 @@ public class Base64 {
}
byte[] buf = new byte[512];
int numRead;
- while ((numRead = in.read(buf)) != -1)
- out.write(buf, 0, numRead);
+ while ((numRead = in.read(buf)) != -1) {
+ out.write(buf, 0, numRead);
+ }
in.close();
out.close();
System.exit(0);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java b/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java
index 6ed5e5d..4134f2b 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/CacheMap.java
@@ -71,8 +71,9 @@ public class CacheMap implements Map {
public CacheMap(int capacity) {
// FXN: [ c, C, M := capacity, {}, {} ]
- if (capacity < 0)
- throw new IllegalArgumentException("Can't have a negative size " + capacity + " cache map");
+ if (capacity < 0) {
+ throw new IllegalArgumentException("Can't have a negative size " + capacity + " cache map");
+ }
this.capacity = capacity;
}
@@ -150,8 +151,9 @@ public class CacheMap implements Map {
}
cache.addFirst(key);
- if (cache.size() > capacity)
- map.remove(cache.removeLast());
+ if (cache.size() > capacity) {
+ map.remove(cache.removeLast());
+ }
return null;
}
@@ -159,8 +161,9 @@ public class CacheMap implements Map {
// FXN: [ key in M -> C, M, return value := C - key, M - (key, v), v
// | true -> return value := null ]
- if (!map.containsKey(key))
- return null;
+ if (!map.containsKey(key)) {
+ return null;
+ }
cache.remove(key);
return map.remove(key);
}
@@ -189,8 +192,12 @@ public class CacheMap implements Map {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof CacheMap)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof CacheMap)) {
+ return false;
+ }
CacheMap obj = (CacheMap) rhs;
return obj.cache.equals(cache);
}
@@ -209,7 +216,9 @@ public class CacheMap implements Map {
// FXN: [ C = advance(key, C) ]
boolean present = cache.remove(key);
- if (!present) return;
+ if (!present) {
+ return;
+ }
cache.addFirst(key);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/DOMParser.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/DOMParser.java b/commons/src/main/java/org/apache/oodt/commons/util/DOMParser.java
index 0a9ad8b..b9c3139 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/DOMParser.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/DOMParser.java
@@ -48,8 +48,9 @@ public class DOMParser {
* @return The document.
*/
public Document getDocument() {
- if (document == null)
- throw new IllegalStateException("Must parse something first");
+ if (document == null) {
+ throw new IllegalStateException("Must parse something first");
+ }
return document;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java b/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java
index bc91a10..a70c86b 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/EnterpriseEntityResolver.java
@@ -56,9 +56,9 @@ public class EnterpriseEntityResolver implements EntityResolver {
token.append(ch, start, length);
}
public void endElement(String ns, String name, String qual) {
- if ("pi".equals(qual))
- pi = token.toString().trim();
- else if ("filename".equals(qual)) {
+ if ("pi".equals(qual)) {
+ pi = token.toString().trim();
+ } else if ("filename".equals(qual)) {
entities.put(pi, token.toString().trim());
}
token.delete(0, token.length());
@@ -78,20 +78,26 @@ public class EnterpriseEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
String filename = computeFilename(publicID, systemID);
- if (filename == null) return null;
+ if (filename == null) {
+ return null;
+ }
// Resolve it using class loader first. Any DTD in the toplevel directory
// of any jar present to the application is a potential source.
InputStream in = getClass().getResourceAsStream("/" + filename);
- if (in != null)
- return new InputSource(new BufferedReader(new InputStreamReader(in)));
+ if (in != null) {
+ return new InputSource(new BufferedReader(new InputStreamReader(in)));
+ }
// OK, try the filesystem next. You can control what directories get
// searched by setting the entity.dirs property.
File file = findFile(getEntityRefDirs(System.getProperty("entity.dirs", "")), filename);
- if (file != null) try {
+ if (file != null) {
+ try {
return new InputSource(new BufferedReader(new FileReader(file)));
- } catch (IOException ignore) {}
+ } catch (IOException ignore) {
+ }
+ }
// No luck either way.
return null;
@@ -109,11 +115,14 @@ public class EnterpriseEntityResolver implements EntityResolver {
*/
static String computeFilename(String publicID, String systemID) {
String name = (String) entities.get(publicID);
- if (name == null) try {
+ if (name == null) {
+ try {
URL url = new URL(systemID);
File file = new File(url.getFile());
name = file.getName();
- } catch (MalformedURLException ignore) {}
+ } catch (MalformedURLException ignore) {
+ }
+ }
return name;
}
@@ -125,8 +134,9 @@ public class EnterpriseEntityResolver implements EntityResolver {
*/
static List getEntityRefDirs(String spec) {
List dirs = new ArrayList();
- for (StringTokenizer t = new StringTokenizer(spec, ",;|"); t.hasMoreTokens();)
- dirs.add(t.nextToken());
+ for (StringTokenizer t = new StringTokenizer(spec, ",;|"); t.hasMoreTokens();) {
+ dirs.add(t.nextToken());
+ }
return dirs;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/JDBC_DB.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/JDBC_DB.java b/commons/src/main/java/org/apache/oodt/commons/util/JDBC_DB.java
index 890eac7..4e69691 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/JDBC_DB.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/JDBC_DB.java
@@ -96,17 +96,21 @@ public class JDBC_DB
{
String url, classname;
- if (stmt != null)
- stmt.close();
+ if (stmt != null) {
+ stmt.close();
+ }
- if (rs != null)
- rs.close();
+ if (rs != null) {
+ rs.close();
+ }
- if (keep_connect_open)
- return;
+ if (keep_connect_open) {
+ return;
+ }
- if (connect != null)
- connect.close();
+ if (connect != null) {
+ connect.close();
+ }
rs_meta = null;
@@ -117,8 +121,9 @@ public class JDBC_DB
Properties props = new Properties();
props.put("user", username);
- if (password != null)
- props.put("password", password);
+ if (password != null) {
+ props.put("password", password);
+ }
classname = serverProps.getProperty("org.apache.oodt.commons.util.JDBC_DB.driver", "oracle.jdbc.driver.OracleDriver");
@@ -202,26 +207,32 @@ public class JDBC_DB
*/
sql_command = cmd;
- if (stmt!=null)
- stmt.close();
+ if (stmt!=null) {
+ stmt.close();
+ }
- if (connect == null) openConnection();
+ if (connect == null) {
+ openConnection();
+ }
if (connect == null) {
keep_connect_open = false;
openConnection();
}
- if (connect == null)
- throw new IllegalStateException("Connection is null!!!");
+ if (connect == null) {
+ throw new IllegalStateException("Connection is null!!!");
+ }
if (connect.isClosed()) {
connect = null;
keep_connect_open = false;
openConnection();
}
- if (connect == null)
- throw new IllegalStateException("Connection is still null!!!");
- if (connect.isClosed())
- throw new IllegalStateException("Connection got closed!");
+ if (connect == null) {
+ throw new IllegalStateException("Connection is still null!!!");
+ }
+ if (connect.isClosed()) {
+ throw new IllegalStateException("Connection got closed!");
+ }
stmt = connect.createStatement();
affected = stmt.executeUpdate(sql_command);
@@ -239,26 +250,32 @@ public class JDBC_DB
sql_command = cmd;
- if (stmt!=null)
- stmt.close();
+ if (stmt!=null) {
+ stmt.close();
+ }
- if (connect == null) openConnection();
+ if (connect == null) {
+ openConnection();
+ }
if (connect == null) {
keep_connect_open = false;
openConnection();
}
- if (connect == null)
- throw new IllegalStateException("Connection is null!!!");
+ if (connect == null) {
+ throw new IllegalStateException("Connection is null!!!");
+ }
if (connect.isClosed()) {
connect = null;
keep_connect_open = false;
openConnection();
}
- if (connect == null)
- throw new IllegalStateException("Connection is still null!!!");
- if (connect.isClosed())
- throw new IllegalStateException("Connection got closed!");
+ if (connect == null) {
+ throw new IllegalStateException("Connection is still null!!!");
+ }
+ if (connect.isClosed()) {
+ throw new IllegalStateException("Connection got closed!");
+ }
//long time0 = System.currentTimeMillis();
@@ -267,8 +284,9 @@ public class JDBC_DB
//System.err.println("###### Creating a new statement: " + (time - time0));
//time0 = time;
- if (rs!=null)
- rs.close();
+ if (rs!=null) {
+ rs.close();
+ }
rs = stmt.executeQuery(sql_command);
//time = System.currentTimeMillis();
@@ -294,13 +312,15 @@ public class JDBC_DB
int count;
- if (stmt!=null)
- stmt.close();
+ if (stmt!=null) {
+ stmt.close();
+ }
stmt = connect.createStatement();
- if (rs!=null)
- rs.close();
+ if (rs!=null) {
+ rs.close();
+ }
rs = stmt.executeQuery(sql_command);
@@ -342,8 +362,9 @@ public class JDBC_DB
{
try
{
- if (connect != null)
- connect.rollback();
+ if (connect != null) {
+ connect.rollback();
+ }
}
catch (SQLException ignored)
@@ -410,13 +431,16 @@ public class JDBC_DB
public Connection getConnection() throws SQLException
{
- if (connect == null) openConnection();
+ if (connect == null) {
+ openConnection();
+ }
if (connect == null) {
keep_connect_open = false;
openConnection();
}
- if (connect == null)
- throw new IllegalStateException("getConnection can't get a connection pointer");
+ if (connect == null) {
+ throw new IllegalStateException("getConnection can't get a connection pointer");
+ }
return(connect);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/LogInit.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/LogInit.java b/commons/src/main/java/org/apache/oodt/commons/util/LogInit.java
index 41d86aa..55f13e4 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/LogInit.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/LogInit.java
@@ -66,15 +66,17 @@ public class LogInit {
// Another destination is any user-specified logger.
String userSpecifiedListener = props.getProperty("org.apache.oodt.commons.util.LogInit.listener");
- if (userSpecifiedListener != null)
- mux.addListener((LogListener) Class.forName(userSpecifiedListener).newInstance());
+ if (userSpecifiedListener != null) {
+ mux.addListener((LogListener) Class.forName(userSpecifiedListener).newInstance());
+ }
// Ahead of the multiplexer is the filter.
String categoryList = props.getProperty("org.apache.oodt.commons.util.LogInit.categories", "");
StringTokenizer tokens = new StringTokenizer(categoryList);
Object[] categories = new Object[tokens.countTokens()];
- for (int i = 0; i < categories.length; ++i)
- categories[i] = tokens.nextToken();
+ for (int i = 0; i < categories.length; ++i) {
+ categories[i] = tokens.nextToken();
+ }
EnterpriseLogFilter filter = new EnterpriseLogFilter(mux, true, categories);
Log.addLogListener(filter);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/MemoryLogger.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/MemoryLogger.java b/commons/src/main/java/org/apache/oodt/commons/util/MemoryLogger.java
index 28dbf03..4e0cee1 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/MemoryLogger.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/MemoryLogger.java
@@ -69,13 +69,20 @@ public class MemoryLogger implements LogListener {
* @param size The new maximum cache size.
*/
public void setSize(int size) {
- if (size < 0) throw new IllegalArgumentException("Log cache size can't be negative");
+ if (size < 0) {
+ throw new IllegalArgumentException("Log cache size can't be negative");
+ }
int delta = this.size - size;
this.size = size;
- if (delta <= 0) return;
- if (messages.size() < size) return;
- while (delta-- > 0)
- messages.removeFirst();
+ if (delta <= 0) {
+ return;
+ }
+ if (messages.size() < size) {
+ return;
+ }
+ while (delta-- > 0) {
+ messages.removeFirst();
+ }
}
public void streamStarted(LogEvent ignore) {}
@@ -85,8 +92,9 @@ public class MemoryLogger implements LogListener {
public void messageLogged(LogEvent event) {
messages.add(DateConvert.isoFormat(event.getTimestamp()) + " " + event.getSource() + " " + event.getCategory()
+ ": " + event.getMessage());
- if (messages.size() > size)
- messages.removeFirst();
+ if (messages.size() > size) {
+ messages.removeFirst();
+ }
}
/** The list of messages. */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/Utility.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/Utility.java b/commons/src/main/java/org/apache/oodt/commons/util/Utility.java
index 60a7f6e..e54b9bc 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/Utility.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/Utility.java
@@ -66,9 +66,12 @@ public class Utility {
} catch (IOException ex) {
System.err.println("I/O exception while loading \"" + resourceName + "\": " + ex.getMessage());
} finally {
- if (in != null) try {
+ if (in != null) {
+ try {
in.close();
- } catch (IOException ignore) {}
+ } catch (IOException ignore) {
+ }
+ }
}
}
@@ -82,21 +85,26 @@ public class Utility {
* @return The iterator over unique elements in the <var>list</var>.
*/
public static Iterator parseCommaList(final String list) {
- if (list == null) return new Iterator() {
+ if (list == null) {
+ return new Iterator() {
public boolean hasNext() {
- return false;
+ return false;
}
+
public Object next() {
- throw new java.util.NoSuchElementException("There weren't ANY elements in this iterator, ever");
+ throw new java.util.NoSuchElementException("There weren't ANY elements in this iterator, ever");
}
+
public void remove() {
- throw new UnsupportedOperationException("Can't remove elements from this iterator");
+ throw new UnsupportedOperationException("Can't remove elements from this iterator");
}
- };
+ };
+ }
HashSet set = new HashSet();
StringTokenizer tokens = new StringTokenizer(list, ",");
- while (tokens.hasMoreTokens())
- set.add(tokens.nextToken().trim());
+ while (tokens.hasMoreTokens()) {
+ set.add(tokens.nextToken().trim());
+ }
return set.iterator();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/XML.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/XML.java b/commons/src/main/java/org/apache/oodt/commons/util/XML.java
index 2c862a8..2212c5e 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/XML.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/XML.java
@@ -377,7 +377,9 @@ public class XML {
* @throws DOMException If a DOM error occurs.
*/
public static void addNonNull(Node node, String name, String text) throws DOMException {
- if (text == null) return;
+ if (text == null) {
+ return;
+ }
add(node, name, text);
}
@@ -402,11 +404,17 @@ public class XML {
* @throws DOMException If a DOM error occurs.
*/
public static void add(Node node, String name, String text) throws DOMException {
- if (name == null) return;
- if (node == null) throw new IllegalArgumentException("Can't add to a null node");
+ if (name == null) {
+ return;
+ }
+ if (node == null) {
+ throw new IllegalArgumentException("Can't add to a null node");
+ }
Document doc = node.getOwnerDocument();
Element element = doc.createElement(name);
- if (text != null) element.appendChild(doc.createTextNode(text));
+ if (text != null) {
+ element.appendChild(doc.createTextNode(text));
+ }
node.appendChild(element);
}
@@ -456,7 +464,9 @@ public class XML {
* @return The text in its children, unwrapped.
*/
public static String unwrappedText(Node node) {
- if (node == null) return null;
+ if (node == null) {
+ return null;
+ }
StringBuffer buffer = new StringBuffer();
StringBuilder wrapped = new StringBuilder(text1(node, buffer));
boolean newline = false;
@@ -470,8 +480,9 @@ public class XML {
if (Character.isWhitespace(wrapped.charAt(i))) {
wrapped.deleteCharAt(i);
--i;
- } else
- newline = false;
+ } else {
+ newline = false;
+ }
}
}
return wrapped.toString().trim();
@@ -560,16 +571,19 @@ public class XML {
// reference. Non printables are below ASCII space but not tab or
// line terminator, ASCII delete, or above a certain Unicode
// threshold.
- if ((ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r') || ch > LAST_PRINTABLE || ch == 0xF7)
- result.append("&#").append(Integer.toString(ch)).append(';');
- else {
+ if ((ch < ' ' && ch != '\t' && ch != '\n' && ch != '\r') || ch > LAST_PRINTABLE || ch == 0xF7) {
+ result.append("&#").append(Integer.toString(ch)).append(';');
+ } else {
// If there is a suitable entity reference for this
// character, print it. The list of available entity
// references is almost but not identical between XML and
// HTML.
charRef = getEntityRef(ch);
- if (charRef == null) result.append(ch);
- else result.append('&').append(charRef).append(';');
+ if (charRef == null) {
+ result.append(ch);
+ } else {
+ result.append('&').append(charRef).append(';');
+ }
}
}
return result.toString();
@@ -581,9 +595,9 @@ public class XML {
* @param node Node to search.
*/
private static void findCommentNodes(List list, Node node) {
- if (node.getNodeType() == Node.COMMENT_NODE)
- list.add(node);
- else {
+ if (node.getNodeType() == Node.COMMENT_NODE) {
+ list.add(node);
+ } else {
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
findCommentNodes(list, children.item(i));
@@ -616,10 +630,11 @@ public class XML {
*/
private static String text1(Node node, StringBuffer buffer) {
for (Node ch = node.getFirstChild(); ch != null; ch = ch.getNextSibling()) {
- if (ch.getNodeType() == Node.ELEMENT_NODE || ch.getNodeType() == Node.ENTITY_REFERENCE_NODE)
- buffer.append(text(ch));
- else if (ch.getNodeType() == Node.TEXT_NODE)
- buffer.append(ch.getNodeValue());
+ if (ch.getNodeType() == Node.ELEMENT_NODE || ch.getNodeType() == Node.ENTITY_REFERENCE_NODE) {
+ buffer.append(text(ch));
+ } else if (ch.getNodeType() == Node.TEXT_NODE) {
+ buffer.append(ch.getNodeValue());
+ }
}
return buffer.toString();
}
@@ -633,12 +648,14 @@ public class XML {
* @param node The tree to output.
*/
private static void dump(PrintWriter writer, Node node, int indentAmt) {
- for (int i = 0; i < indentAmt; ++i)
- writer.print(' ');
+ for (int i = 0; i < indentAmt; ++i) {
+ writer.print(' ');
+ }
writer.println(typeOf(node) + "(" + node.getNodeName() + ", " + node.getNodeValue() + ")");
NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i)
- dump(writer, children.item(i), indentAmt + 2);
+ for (int i = 0; i < children.getLength(); ++i) {
+ dump(writer, children.item(i), indentAmt + 2);
+ }
}
/** Return a human-readable representation of the type of the given node.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java
index b2ed7f8..3c2bcc6 100644
--- a/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java
+++ b/commons/src/main/java/org/apache/oodt/commons/util/XMLRPC.java
@@ -77,8 +77,9 @@ public class XMLRPC {
* @throws DOMException If we can't construct the <value>.
*/
private static Element createValueElement(Document doc, Object value) throws DOMException {
- if (value == null)
- throw new IllegalArgumentException("Nulls not supported in XML-RPC");
+ if (value == null) {
+ throw new IllegalArgumentException("Nulls not supported in XML-RPC");
+ }
Element valueElement = doc.createElement("value");
if (value instanceof Integer || value instanceof Short) {
XML.add(valueElement, "int", value.toString());
@@ -119,7 +120,9 @@ public class XMLRPC {
for (Object aCollection : collection) {
dataElement.appendChild(createValueElement(doc, aCollection));
}
- } else throw new IllegalArgumentException(value.getClass().getName() + " not supported in XML-RPC");
+ } else {
+ throw new IllegalArgumentException(value.getClass().getName() + " not supported in XML-RPC");
+ }
return valueElement;
}
@@ -138,8 +141,9 @@ public class XMLRPC {
doc.normalize();
XML.removeComments(doc);
Element methodResponseElement = doc.getDocumentElement();
- if (!"methodResponse".equals(methodResponseElement.getNodeName()))
- throw new SAXException("Not a <methodResponse> document");
+ if (!"methodResponse".equals(methodResponseElement.getNodeName())) {
+ throw new SAXException("Not a <methodResponse> document");
+ }
Node child = methodResponseElement.getFirstChild();
if ("params".equals(child.getNodeName())) {
return parseValue(child.getFirstChild().getFirstChild());
@@ -151,7 +155,9 @@ public class XMLRPC {
} catch (ClassCastException ex) {
throw new SAXException("XML-RPC <fault> invalid");
}
- } else throw new SAXException("XML-RPC response does not contain <params> or <fault>");
+ } else {
+ throw new SAXException("XML-RPC response does not contain <params> or <fault>");
+ }
} catch (SAXException ex) {
throw new IllegalArgumentException(ex.getMessage());
} catch (IOException ex) {
@@ -166,7 +172,9 @@ public class XMLRPC {
*/
private static Object parseValue(Node node) {
String n = node.getNodeName();
- if (!"value".equals(n)) throw new IllegalArgumentException("Expecting a <value>, not a <" + n + ">");
+ if (!"value".equals(n)) {
+ throw new IllegalArgumentException("Expecting a <value>, not a <" + n + ">");
+ }
Node t = node.getFirstChild();
n = t.getNodeName();
@@ -180,9 +188,13 @@ public class XMLRPC {
if ("i4".equals(n) || "int".equals(n)) {
return Integer.valueOf(txt);
} else if ("boolean".equals(n)) {
- if ("1".equals(txt)) return true;
- else if ("0".equals(txt)) return false;
- else throw new IllegalArgumentException(n + " does not contain a 0 or 1");
+ if ("1".equals(txt)) {
+ return true;
+ } else if ("0".equals(txt)) {
+ return false;
+ } else {
+ throw new IllegalArgumentException(n + " does not contain a 0 or 1");
+ }
} else if ("string".equals(n)) {
return txt;
} else if ("double".equals(n)) {
@@ -200,28 +212,35 @@ public class XMLRPC {
NodeList memberNodes = t.getChildNodes();
for (int i = 0; i < memberNodes.getLength(); ++i) {
Node memberNode = memberNodes.item(i);
- if (!"member".equals(memberNode.getNodeName()))
- throw new IllegalArgumentException(n + " contains <" + memberNode.getNodeName()
- + ">, not <member>");
+ if (!"member".equals(memberNode.getNodeName())) {
+ throw new IllegalArgumentException(n + " contains <" + memberNode.getNodeName()
+ + ">, not <member>");
+ }
Node nameNode = memberNode.getFirstChild();
- if (nameNode == null || !"name".equals(nameNode.getNodeName()))
- throw new IllegalArgumentException("<member> missing <name> element");
+ if (nameNode == null || !"name".equals(nameNode.getNodeName())) {
+ throw new IllegalArgumentException("<member> missing <name> element");
+ }
Node valueNode = nameNode.getNextSibling();
- if (valueNode == null || !"value".equals(valueNode.getNodeName()))
- throw new IllegalArgumentException("<member> missing <value> element");
+ if (valueNode == null || !"value".equals(valueNode.getNodeName())) {
+ throw new IllegalArgumentException("<member> missing <value> element");
+ }
m.put(XML.unwrappedText(nameNode), parseValue(valueNode));
}
return m;
} else if ("array".equals(n)) {
Node dataNode = t.getFirstChild();
- if (dataNode == null || !"data".equals(dataNode.getNodeName()))
- throw new IllegalArgumentException("<array> missing <data> element");
+ if (dataNode == null || !"data".equals(dataNode.getNodeName())) {
+ throw new IllegalArgumentException("<array> missing <data> element");
+ }
NodeList children = dataNode.getChildNodes();
List x = new ArrayList(children.getLength());
- for (int i = 0; i < children.getLength(); ++i)
- x.add(parseValue(children.item(i)));
+ for (int i = 0; i < children.getLength(); ++i) {
+ x.add(parseValue(children.item(i)));
+ }
return x;
- } else throw new IllegalArgumentException("Illegal type " + n + " in <value>");
+ } else {
+ throw new IllegalArgumentException("Illegal type " + n + " in <value>");
+ }
}
/** Constructor that causes a runtime exception since this is a utility class.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java b/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java
index 466b374..ba6b791 100644
--- a/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java
+++ b/commons/src/main/java/org/apache/oodt/commons/xml/XMLUtils.java
@@ -139,8 +139,9 @@ public class XMLUtils {
NodeList list = root.getElementsByTagName(name);
if (list.getLength()>0) {
return (Element) list.item(0);
- } else
+ } else {
return null;
+ }
}
public static String getSimpleElementText(Element node, boolean trim) {
@@ -153,8 +154,9 @@ public class XMLUtils {
}
return elemTxt;
- } else
+ } else {
return null;
+ }
}
public static String getSimpleElementText(Element node) {
@@ -166,8 +168,9 @@ public class XMLUtils {
Element elem = getFirstElement(elemName, root);
if (elem != null) {
return getSimpleElementText(elem, trim);
- } else
+ } else {
return null;
+ }
}
public static String getElementText(String elemName, Element root) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/MetExtractorProductCrawler.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/MetExtractorProductCrawler.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/MetExtractorProductCrawler.java
index 9e66c6d..d663e84 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/MetExtractorProductCrawler.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/MetExtractorProductCrawler.java
@@ -60,8 +60,9 @@ public class MetExtractorProductCrawler extends ProductCrawler {
if (this.getPreCondIds() != null) {
for (String preCondId : this.getPreCondIds()) {
if (!((PreConditionComparator<?>) this.getApplicationContext()
- .getBean(preCondId)).passes(product))
- return false;
+ .getBean(preCondId)).passes(product)) {
+ return false;
+ }
}
}
return product.exists() && product.length() > 0;
@@ -89,8 +90,9 @@ public class MetExtractorProductCrawler extends ProductCrawler {
IllegalAccessException, ClassNotFoundException {
this.metExtractor = (MetExtractor) Class.forName(metExtractor)
.newInstance();
- if (metExtractorConfig != null && !metExtractorConfig.equals(""))
- this.metExtractor.setConfigFile(metExtractorConfig);
+ if (metExtractorConfig != null && !metExtractorConfig.equals("")) {
+ this.metExtractor.setConfigFile(metExtractorConfig);
+ }
}
@Required
@@ -98,8 +100,9 @@ public class MetExtractorProductCrawler extends ProductCrawler {
throws MetExtractionException {
this.metExtractorConfig = metExtractorConfig;
if (this.metExtractor != null && metExtractorConfig != null
- && !metExtractorConfig.equals(""))
- this.metExtractor.setConfigFile(metExtractorConfig);
+ && !metExtractorConfig.equals("")) {
+ this.metExtractor.setConfigFile(metExtractorConfig);
+ }
}
public List<String> getPreCondIds() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/action/GroupAction.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/GroupAction.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/GroupAction.java
index 2e70a79..974d5a7 100755
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/GroupAction.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/GroupAction.java
@@ -50,10 +50,11 @@ public class GroupAction extends CrawlerAction {
try {
LOG.info("Performing action (id = " + action.getId()
+ " : description = " + action.getDescription() + ")");
- if (!action.performAction(product, metadata))
+ if (!action.performAction(product, metadata)) {
throw new Exception("Action (id = " + action.getId()
- + " : description = " + action.getDescription()
- + ") returned false");
+ + " : description = " + action.getDescription()
+ + ") returned false");
+ }
} catch (Exception e) {
allSucceeded = false;
LOG.warning("Failed to perform crawler action : " + e.getMessage());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java
index 79b9e73..4baae5e 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MimeTypeCrawlerAction.java
@@ -51,8 +51,9 @@ public class MimeTypeCrawlerAction extends CrawlerAction {
throws CrawlerActionException {
List<String> mimeTypeHierarchy = productMetadata
.getAllMetadata(MIME_TYPES_HIERARCHY);
- if (mimeTypeHierarchy == null)
+ if (mimeTypeHierarchy == null) {
mimeTypeHierarchy = new Vector<String>();
+ }
if (mimeTypes == null || (!Collections.disjoint(mimeTypes,
mimeTypeHierarchy))) {
return this.actionToCall.performAction(product, productMetadata);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
index 42809a0..e1061a3 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/MoveFile.java
@@ -56,13 +56,15 @@ public class MoveFile extends CrawlerAction {
try {
if (mvFile == null) {
mvFile = product.getAbsolutePath();
- if (this.fileExtension != null)
+ if (this.fileExtension != null) {
mvFile += "." + this.fileExtension;
+ }
}
File srcFile = new File(mvFile);
File toFile = new File(toDir + "/" + srcFile.getName());
- if (createToDir)
+ if (createToDir) {
toFile.getParentFile().mkdirs();
+ }
LOG.log(Level.INFO, "Moving file " + srcFile.getAbsolutePath()
+ " to " + toFile.getAbsolutePath());
if(!srcFile.renameTo(toFile)) {//If the file failed to copy
@@ -72,8 +74,9 @@ public class MoveFile extends CrawlerAction {
FileUtils.forceDelete(srcFile); //Need to delete the old file
return true; //File copied on second attempt
}
- else
- return true; //File copied
+ else {
+ return true; //File copied
+ }
} catch (Exception e) {
throw new CrawlerActionException("Failed to move file from " + mvFile
+ " to " + this.toDir + " : " + e.getMessage(), e);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/action/ToggleAction.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/ToggleAction.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/ToggleAction.java
index 3a7fc61..e27d9be 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/action/ToggleAction.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/action/ToggleAction.java
@@ -49,8 +49,9 @@ public class ToggleAction extends CrawlerAction {
&& (currentAction = toggle.getCrawlerAction())
.performAction(product, productMetadata)) {
globalSuccess = true;
- if (this.shortCircuit)
+ if (this.shortCircuit) {
return true;
+ }
}
} catch (Exception e) {
LOG.log(Level.WARNING, "Failed to run toggle action '"
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/option/handler/CrawlerActionInfoHandler.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/option/handler/CrawlerActionInfoHandler.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/option/handler/CrawlerActionInfoHandler.java
index 656e2c2..ddbe378 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/option/handler/CrawlerActionInfoHandler.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/cli/option/handler/CrawlerActionInfoHandler.java
@@ -50,9 +50,10 @@ public class CrawlerActionInfoHandler extends BeanInfoHandler {
ps.println(" Id: " + ca.getId());
ps.println(" Description: " + ca.getDescription());
ps.println(" Phases: " + ca.getPhases());
- if (ca instanceof MimeTypeCrawlerAction)
- ps.println(" MimeTypes: "
- + ((MimeTypeCrawlerAction) ca).getMimeTypes());
+ if (ca instanceof MimeTypeCrawlerAction) {
+ ps.println(" MimeTypes: "
+ + ((MimeTypeCrawlerAction) ca).getMimeTypes());
+ }
ps.println();
}
ps.close();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
index d201d44..9485b29 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/daemon/CrawlDaemonController.java
@@ -209,8 +209,9 @@ public class CrawlDaemonController {
controller.stop();
System.out.println("Crawl Daemon: [" + controller.client.getURL()
+ "]: shutdown successful");
- } else
+ } else {
throw new IllegalArgumentException("Unknown Operation!");
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MetExtractorSpec.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MetExtractorSpec.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MetExtractorSpec.java
index 70f109d..d3a386b 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MetExtractorSpec.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MetExtractorSpec.java
@@ -91,8 +91,9 @@ public class MetExtractorSpec {
ClassNotFoundException, MetExtractionException {
this.metExtractor = (MetExtractor) Class.forName(extractorClassName)
.newInstance();
- if (this.configFile != null)
+ if (this.configFile != null) {
this.metExtractor.setConfigFile(this.configFile);
+ }
}
/**
@@ -103,8 +104,9 @@ public class MetExtractorSpec {
public void setExtractorConfigFile(String extractorConfigFile)
throws MetExtractionException {
this.configFile = extractorConfigFile;
- if (this.configFile != null && this.metExtractor != null)
+ if (this.configFile != null && this.metExtractor != null) {
this.metExtractor.setConfigFile(this.configFile);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java
index 307aa52..d4140a1 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorConfigReader.java
@@ -83,9 +83,10 @@ public final class MimeExtractorConfigReader implements
if (preCondsElem != null) {
NodeList preCondComparators =
preCondsElem.getElementsByTagName(PRECONDITION_COMPARATOR_TAG);
- for (int k = 0; k < preCondComparators.getLength(); k++)
- preCondComparatorIds.add(((Element) preCondComparators
- .item(k)).getAttribute(ID_ATTR));
+ for (int k = 0; k < preCondComparators.getLength(); k++) {
+ preCondComparatorIds.add(((Element) preCondComparators
+ .item(k)).getAttribute(ID_ATTR));
+ }
}
// This seems wrong, so added support for CLASS_ATTR while still
// supporting EXTRACTOR_CLASS_TAG as an attribute for specifying
@@ -150,10 +151,11 @@ public final class MimeExtractorConfigReader implements
NodeList preCondComparators = preCondsElem
.getElementsByTagName(PRECONDITION_COMPARATOR_TAG);
LinkedList<String> preCondComparatorIds = new LinkedList<String>();
- for (int k = 0; k < preCondComparators.getLength(); k++)
- preCondComparatorIds
- .add(((Element) preCondComparators.item(k))
- .getAttribute(ID_ATTR));
+ for (int k = 0; k < preCondComparators.getLength(); k++) {
+ preCondComparatorIds
+ .add(((Element) preCondComparators.item(k))
+ .getAttribute(ID_ATTR));
+ }
spec.setPreConditionComparatorIds(preCondComparatorIds);
}
@@ -203,8 +205,9 @@ public final class MimeExtractorConfigReader implements
Element elem = XMLUtils.getFirstElement(elemName, root);
if (elem != null) {
filePath = elem.getAttribute(FILE_ATTR);
- if (Boolean.valueOf(elem.getAttribute(ENV_REPLACE_ATTR)))
- filePath = PathUtils.replaceEnvVariables(filePath);
+ if (Boolean.valueOf(elem.getAttribute(ENV_REPLACE_ATTR))) {
+ filePath = PathUtils.replaceEnvVariables(filePath);
+ }
}
return filePath;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorRepo.java
----------------------------------------------------------------------
diff --git a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorRepo.java b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorRepo.java
index 068d48f..b6e01f7 100644
--- a/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorRepo.java
+++ b/crawler/src/main/java/org/apache/oodt/cas/crawl/typedetection/MimeExtractorRepo.java
@@ -94,8 +94,9 @@ public class MimeExtractorRepo {
MetExtractorSpec spec) {
List<MetExtractorSpec> specs = this.mimeTypeToMetExtractorSpecsMap
.remove(mimeType);
- if (specs == null)
- specs = new LinkedList<MetExtractorSpec>();
+ if (specs == null) {
+ specs = new LinkedList<MetExtractorSpec>();
+ }
specs.add(spec);
this.mimeTypeToMetExtractorSpecsMap.put(mimeType, specs);
}
@@ -104,8 +105,9 @@ public class MimeExtractorRepo {
List<MetExtractorSpec> specs) {
List<MetExtractorSpec> existingSpecs = this.mimeTypeToMetExtractorSpecsMap
.remove(mimeType);
- if (existingSpecs == null)
- existingSpecs = new LinkedList<MetExtractorSpec>();
+ if (existingSpecs == null) {
+ existingSpecs = new LinkedList<MetExtractorSpec>();
+ }
existingSpecs.addAll(specs);
this.mimeTypeToMetExtractorSpecsMap.put(mimeType, existingSpecs);
}
@@ -115,8 +117,9 @@ public class MimeExtractorRepo {
List<MetExtractorSpec> extractorSpecs = new LinkedList<MetExtractorSpec>();
while (mimeType != null && !mimeType.equals("application/octet-stream")) {
List<MetExtractorSpec> specs = this.mimeTypeToMetExtractorSpecsMap.get(mimeType);
- if (specs != null)
- extractorSpecs.addAll(specs);
+ if (specs != null) {
+ extractorSpecs.addAll(specs);
+ }
mimeType = this.mimeRepo.getSuperTypeForMimeType(mimeType);
}
return !extractorSpecs.isEmpty() ? extractorSpecs : this
@@ -126,9 +129,10 @@ public class MimeExtractorRepo {
public synchronized List<MetExtractorSpec> getExtractorSpecsForFile(
File file) throws IOException {
String mimeType = this.mimeRepo.getMimeType(file);
- if (mimeType == null && magic)
- mimeType = this.mimeRepo.getMimeTypeByMagic(MimeTypeUtils
- .readMagicHeader(new FileInputStream(file)));
+ if (mimeType == null && magic) {
+ mimeType = this.mimeRepo.getMimeTypeByMagic(MimeTypeUtils
+ .readMagicHeader(new FileInputStream(file)));
+ }
return this.getExtractorSpecsForMimeType(mimeType);
}
@@ -169,8 +173,9 @@ public class MimeExtractorRepo {
*/
public void setMagic(boolean magic) {
this.magic = magic;
- if (this.mimeRepo != null)
- this.mimeRepo.setMimeMagic(magic);
+ if (this.mimeRepo != null) {
+ this.mimeRepo.setMimeMagic(magic);
+ }
}
/**
@@ -178,8 +183,9 @@ public class MimeExtractorRepo {
*/
public void setMimeRepoFile(String mimeRepoFile)
throws FileNotFoundException {
- if (mimeRepoFile != null)
- this.mimeRepo = new MimeTypeUtils(mimeRepoFile, this.magic);
+ if (mimeRepoFile != null) {
+ this.mimeRepo = new MimeTypeUtils(mimeRepoFile, this.magic);
+ }
}
public String getMimeType(File file) {
@@ -197,8 +203,9 @@ public class MimeExtractorRepo {
String mimeType = getMimeType(file);
mimeTypes.add(mimeType);
while ((mimeType = this.mimeRepo.getSuperTypeForMimeType(mimeType)) != null
- && !mimeType.equals("application/octet-stream"))
- mimeTypes.add(mimeType);
+ && !mimeType.equals("application/octet-stream")) {
+ mimeTypes.add(mimeType);
+ }
return mimeTypes;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java
----------------------------------------------------------------------
diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java
index fffeb8b..3c43174 100644
--- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java
+++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/IngestionResource.java
@@ -334,8 +334,9 @@ public class IngestionResource extends CurationService {
return -1;
} else if (o1.getCreateDate().equals(o2.getCreateDate())) {
return 0;
- } else
+ } else {
return 1;
+ }
}
});
return taskList;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
----------------------------------------------------------------------
diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
index 1335240..4492850 100644
--- a/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
+++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/service/MetadataResource.java
@@ -732,8 +732,9 @@ public class MetadataResource extends CurationService {
if (catalog==null) {
String catalogFactoryClass = this.context.getInitParameter(CATALOG_FACTORY_CLASS);
// preserve backward compatibility
- if (!StringUtils.hasText(catalogFactoryClass))
- catalogFactoryClass = "org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory";
+ if (!StringUtils.hasText(catalogFactoryClass)) {
+ catalogFactoryClass = "org.apache.oodt.cas.filemgr.catalog.LuceneCatalogFactory";
+ }
catalog = GenericFileManagerObjectFactory.getCatalogServiceFromFactory(catalogFactoryClass);
}
@@ -913,8 +914,9 @@ public class MetadataResource extends CurationService {
try {
for(ProductType type : xmlRepo.getProductTypes()) {
for(Element el : vLayer.getElements(type)) {
- if(el.getElementId().equals(elementId))
- typeids.add(type.getProductTypeId());
+ if(el.getElementId().equals(elementId)) {
+ typeids.add(type.getProductTypeId());
+ }
}
}
} catch (Exception e) {
@@ -941,8 +943,9 @@ public class MetadataResource extends CurationService {
}
}
for(Element el: elements) {
- if(!usedElementIds.containsKey(el.getElementId()))
- vLayer.removeElement(el);
+ if(!usedElementIds.containsKey(el.getElementId())) {
+ vLayer.removeElement(el);
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java
----------------------------------------------------------------------
diff --git a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java
index 3ca26a5..ec0ffc3 100644
--- a/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java
+++ b/curator/services/src/main/java/org/apache/oodt/cas/curation/util/ExtractorConfigWriter.java
@@ -39,8 +39,9 @@ public class ExtractorConfigWriter {
for (Iterator<File> i = config.getConfigFiles().iterator(); i.hasNext();) {
File file = i.next();
files.append(file.toURI());
- if (i.hasNext())
+ if (i.hasNext()) {
files.append(",");
+ }
}
props.setProperty(ExtractorConfig.PROP_CONFIG_FILES, files.toString());
OutputStream os = new FileOutputStream(new File(configDir, "config.properties"));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java
----------------------------------------------------------------------
diff --git a/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java b/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java
index 2decb08..00140a7 100644
--- a/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java
+++ b/curator/webapp/src/main/java/org/apache/oodt/cas/curation/CurationApp.java
@@ -109,10 +109,12 @@ public class CurationApp extends WebApplication {
private Set<String> filterBenchResources(Set<String> bench,
Set<String> local, String localPrefix) {
- if (local == null || (local.size() == 0))
+ if (local == null || (local.size() == 0)) {
return bench;
- if (bench == null || (bench.size() == 0))
+ }
+ if (bench == null || (bench.size() == 0)) {
return bench;
+ }
Set<String> filtered = new HashSet<String>();
for (String bResource : bench) {
String localName = new File(bResource).getName();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
index b37e8aa..327a80a 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
@@ -296,7 +296,9 @@ public class DataSourceCatalog implements Catalog {
// reuse the existing product id if possible, or generate a new UUID string
String productId = product.getProductId();
- if (!StringUtils.hasText(productId)) productId = UUID.randomUUID().toString();
+ if (!StringUtils.hasText(productId)) {
+ productId = UUID.randomUUID().toString();
+ }
// insert product in database
addProductSql = "INSERT INTO products (product_id, product_name, product_structure, product_transfer_status, product_type_id, product_datetime) "
+ "VALUES ('"
@@ -806,7 +808,9 @@ public class DataSourceCatalog implements Catalog {
+ product.getProductType().getName() + "_reference"
+ " WHERE product_id = " + quoteIt(product.getProductId()));
- if(this.orderedValues) getProductRefSql.append(" ORDER BY pkey");
+ if(this.orderedValues) {
+ getProductRefSql.append(" ORDER BY pkey");
+ }
LOG.log(Level.FINE, "getProductReferences: Executing: "
+ getProductRefSql);
@@ -1042,7 +1046,9 @@ public class DataSourceCatalog implements Catalog {
+ product.getProductType().getName() + "_metadata"
+ " WHERE product_id = " + quoteIt(product.getProductId()));
- if(this.orderedValues) metadataSql.append(" ORDER BY pkey");
+ if(this.orderedValues) {
+ metadataSql.append(" ORDER BY pkey");
+ }
LOG.log(Level.FINE, "getMetadata: Executing: " + metadataSql);
rs = statement.executeQuery(metadataSql.toString());
@@ -1124,15 +1130,18 @@ public class DataSourceCatalog implements Catalog {
elementIds.append(" AND (element_id = '")
.append(this.validationLayer.getElementByName(elems.get(0)).getElementId
()).append("'");
- for (int i = 1; i < elems.size(); i++)
- elementIds.append(" OR element_id = '").append(this.validationLayer.getElementByName(elems.get(i))
- .getElementId()).append("'");
+ for (int i = 1; i < elems.size(); i++) {
+ elementIds.append(" OR element_id = '").append(this.validationLayer.getElementByName(elems.get(i))
+ .getElementId()).append("'");
+ }
elementIds.append(")");
}
StringBuilder metadataSql = new StringBuilder("SELECT element_id,metadata_value FROM "
+ product.getProductType().getName() + "_metadata"
+ " WHERE product_id = " + quoteIt(product.getProductId()) + elementIds);
- if(this.orderedValues) metadataSql.append(" ORDER BY pkey");
+ if(this.orderedValues) {
+ metadataSql.append(" ORDER BY pkey");
+ }
LOG.log(Level.FINE, "getMetadata: Executing: " + metadataSql);
rs = statement.executeQuery(metadataSql.toString());
@@ -2096,14 +2105,16 @@ public class DataSourceCatalog implements Catalog {
}else {
sqlQuery.append("(").append(this.getSqlQuery(bqc.getTerms().get(0), type));
String op = bqc.getOperator() == BooleanQueryCriteria.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < bqc.getTerms().size(); i++)
- sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(bqc.getTerms().get(i), type));
+ for (int i = 1; i < bqc.getTerms().size(); i++) {
+ sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(bqc.getTerms().get(i), type));
+ }
sqlQuery.append(")");
}
}else {
String elementIdStr = this.validationLayer.getElementByName(queryCriteria.getElementName()).getElementId();
- if (fieldIdStringFlag)
- elementIdStr = "'" + elementIdStr + "'";
+ if (fieldIdStringFlag) {
+ elementIdStr = "'" + elementIdStr + "'";
+ }
if (!this.productIdString) {
sqlQuery.append("SELECT DISTINCT product_id FROM ").append(type.getName())
.append("_metadata WHERE element_id = ").append(elementIdStr).append(" AND ");
@@ -2119,13 +2130,19 @@ public class DataSourceCatalog implements Catalog {
} else if (queryCriteria instanceof RangeQueryCriteria) {
RangeQueryCriteria rqc = (RangeQueryCriteria) queryCriteria;
String rangeSubQuery = null;
- if (rqc.getStartValue() != null)
- rangeSubQuery = "metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'";
+ if (rqc.getStartValue() != null) {
+ rangeSubQuery =
+ "metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'";
+ }
if (rqc.getEndValue() != null) {
- if (rangeSubQuery == null)
- rangeSubQuery = "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'";
- else
- rangeSubQuery = "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "')";
+ if (rangeSubQuery == null) {
+ rangeSubQuery =
+ "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'";
+ } else {
+ rangeSubQuery =
+ "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'"
+ + rqc.getEndValue() + "')";
+ }
}
sqlQuery.append(rangeSubQuery);
} else {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
index f9ff91d..c09e767 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LenientDataSourceCatalog.java
@@ -222,7 +222,9 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
String metadataSql = "SELECT * FROM "
+ product.getProductType().getName() + "_metadata "
+ "WHERE product_id = '" + product.getProductId()+"'";
- if(this.orderedValues) metadataSql += " ORDER BY pkey" ;
+ if(this.orderedValues) {
+ metadataSql += " ORDER BY pkey";
+ }
LOG.log(Level.FINE, "getMetadata: Executing: " + metadataSql);
rs = statement.executeQuery(metadataSql);
@@ -333,15 +335,19 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
if (getValidationLayer()!=null) {
// validation layer: column "element_id" contains the element identifier (e.g. "urn:oodt:ProductReceivedTime")
elementIds += " AND (element_id = '" + this.getValidationLayer().getElementByName(elems.get(0)).getElementId() + "'";
- for (int i = 1; i < elems.size(); i++)
- elementIds += " OR element_id = '" + this.getValidationLayer().getElementByName(elems.get(i)).getElementId() + "'";
+ for (int i = 1; i < elems.size(); i++) {
+ elementIds +=
+ " OR element_id = '" + this.getValidationLayer().getElementByName(elems.get(i)).getElementId()
+ + "'";
+ }
elementIds += ")";
} else {
// no validation layer: column "element_id" contains the element name (e.g. "CAS.ProductReceivedTime")
elementIds += " AND (element_id = '" + elems.get(0) + "'";
- for (int i = 1; i < elems.size(); i++)
- elementIds += " OR element_id = '" + elems.get(i) + "'";
+ for (int i = 1; i < elems.size(); i++) {
+ elementIds += " OR element_id = '" + elems.get(i) + "'";
+ }
elementIds += ")";
}
@@ -350,7 +356,9 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
String metadataSql = "SELECT element_id,metadata_value FROM "
+ product.getProductType().getName() + "_metadata"
+ " WHERE product_id = " + quoteIt(product.getProductId()) + elementIds;
- if(this.orderedValues) metadataSql += " ORDER BY pkey";
+ if(this.orderedValues) {
+ metadataSql += " ORDER BY pkey";
+ }
LOG.log(Level.FINE, "getMetadata: Executing: " + metadataSql);
rs = statement.executeQuery(metadataSql);
@@ -768,8 +776,9 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
} else {
sqlQuery = "(" + this.getSqlQuery(bqc.getTerms().get(0), type);
String op = bqc.getOperator() == BooleanQueryCriteria.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < bqc.getTerms().size(); i++)
- sqlQuery += ") " + op + " (" + this.getSqlQuery(bqc.getTerms().get(i), type);
+ for (int i = 1; i < bqc.getTerms().size(); i++) {
+ sqlQuery += ") " + op + " (" + this.getSqlQuery(bqc.getTerms().get(i), type);
+ }
sqlQuery += ")";
}
}else {
@@ -778,8 +787,9 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
elementIdStr = this.getValidationLayer().getElementByName(queryCriteria.getElementName()).getElementId();
}
- if (fieldIdStringFlag)
- elementIdStr = "'" + elementIdStr + "'";
+ if (fieldIdStringFlag) {
+ elementIdStr = "'" + elementIdStr + "'";
+ }
if (!this.productIdString) {
sqlQuery = "SELECT DISTINCT product_id FROM " + type.getName() + "_metadata WHERE element_id = " + elementIdStr + " AND ";
} else {
@@ -792,13 +802,19 @@ public class LenientDataSourceCatalog extends DataSourceCatalog {
} else if (queryCriteria instanceof RangeQueryCriteria) {
RangeQueryCriteria rqc = (RangeQueryCriteria) queryCriteria;
String rangeSubQuery = null;
- if (rqc.getStartValue() != null)
- rangeSubQuery = "metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'";
+ if (rqc.getStartValue() != null) {
+ rangeSubQuery =
+ "metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'";
+ }
if (rqc.getEndValue() != null) {
- if (rangeSubQuery == null)
- rangeSubQuery = "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'";
- else
- rangeSubQuery = "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "')";
+ if (rangeSubQuery == null) {
+ rangeSubQuery =
+ "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'";
+ } else {
+ rangeSubQuery =
+ "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc
+ .getEndValue() + "')";
+ }
}
sqlQuery += rangeSubQuery;
} else {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
index f439c4e..465a181 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/LuceneCatalog.java
@@ -448,8 +448,9 @@ public class LuceneCatalog implements Catalog {
Product prod = getProductById(product.getProductId(), true);
if (prod != null) {
return prod.getProductReferences();
- } else
+ } else {
return null;
+ }
}
/*
@@ -602,8 +603,9 @@ public class LuceneCatalog implements Catalog {
Metadata fullMetadata = getMetadata(product);
Metadata reducedMetadata = new Metadata();
for (String element : elements) {
- if (fullMetadata.containsKey(element))
+ if (fullMetadata.containsKey(element)) {
reducedMetadata.replaceMetadata(element, fullMetadata.getAllMetadata(element));
+ }
}
return reducedMetadata;
}
@@ -1057,8 +1059,9 @@ public class LuceneCatalog implements Catalog {
r.setOrigReference(origRefs[i]);
r.setDataStoreReference(dataStoreRefs[i]);
r.setFileSize((Long.parseLong(refLengths[i])));
- if (refMimeTypes != null)
+ if (refMimeTypes != null) {
r.setMimeType(refMimeTypes[i]);
+ }
references.add(r);
}
@@ -1185,10 +1188,12 @@ public class LuceneCatalog implements Catalog {
}
return true;
- } else
+ } else {
return false;
- } else
+ }
+ } else {
return false;
+ }
}
@@ -1210,8 +1215,9 @@ public class LuceneCatalog implements Catalog {
booleanQuery.add(prodTypeTermQuery, BooleanClause.Occur.MUST);
//convert filemgr query into a lucene query
- for (QueryCriteria queryCriteria : query.getCriteria())
+ for (QueryCriteria queryCriteria : query.getCriteria()) {
booleanQuery.add(this.getQuery(queryCriteria), BooleanClause.Occur.MUST);
+ }
LOG.log(Level.FINE, "Querying LuceneCatalog: q: [" + booleanQuery
+ "]");
@@ -1258,8 +1264,9 @@ public class LuceneCatalog implements Catalog {
booleanQuery.add(prodTypeTermQuery, BooleanClause.Occur.MUST);
//convert filemgr query into a lucene query
- for (QueryCriteria queryCriteria : query.getCriteria())
+ for (QueryCriteria queryCriteria : query.getCriteria()) {
booleanQuery.add(this.getQuery(queryCriteria), BooleanClause.Occur.MUST);
+ }
Sort sort = new Sort(new SortField("CAS.ProductReceivedTime",
SortField.STRING, true));
@@ -1343,8 +1350,9 @@ public class LuceneCatalog implements Catalog {
throw new CatalogException("Invalid BooleanQueryCriteria opertor ["
+ ((BooleanQueryCriteria) queryCriteria).getOperator() + "]");
}
- for (QueryCriteria qc : ((BooleanQueryCriteria) queryCriteria).getTerms())
+ for (QueryCriteria qc : ((BooleanQueryCriteria) queryCriteria).getTerms()) {
booleanQuery.add(this.getQuery(qc), occur);
+ }
return booleanQuery;
} else if (queryCriteria instanceof TermQueryCriteria) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/MappedDataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/MappedDataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/MappedDataSourceCatalog.java
index 39f5164..08d3e8c 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/MappedDataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/MappedDataSourceCatalog.java
@@ -219,8 +219,9 @@ public class MappedDataSourceCatalog extends DataSourceCatalog {
protected String getProductTypeTableName(String origName) {
if (typeMap != null && typeMap.containsKey(origName)) {
return typeMap.getProperty(origName);
- } else
+ } else {
return origName;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
index 796bf96..2e9c53b 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/DefaultProductSerializer.java
@@ -277,9 +277,15 @@ public class DefaultProductSerializer implements ProductSerializer {
}
List<String> docs = new ArrayList<String>();
- if (!delFields.isEmpty()) docs.add( toDoc(productId, delFields) );
- if (!setFields.isEmpty()) docs.add( toDoc(productId, setFields) );
- if (!addFields.isEmpty()) docs.add( toDoc(productId, addFields) );
+ if (!delFields.isEmpty()) {
+ docs.add(toDoc(productId, delFields));
+ }
+ if (!setFields.isEmpty()) {
+ docs.add(toDoc(productId, setFields));
+ }
+ if (!addFields.isEmpty()) {
+ docs.add(toDoc(productId, addFields));
+ }
return docs;
}
@@ -403,7 +409,9 @@ public class DefaultProductSerializer implements ProductSerializer {
if (name.startsWith(Parameters.NS)) {
for (int k=0; k<values.getLength(); k++) {
// create this reference
- if (references.size()<=k) references.add(new Reference());
+ if (references.size()<=k) {
+ references.add(new Reference());
+ }
if (name.equals(Parameters.REFERENCE_ORIGINAL)) {
references.get(k).setOrigReference(vals.get(k));
} else if (name.equals(Parameters.REFERENCE_DATASTORE)) {
@@ -449,7 +457,9 @@ public class DefaultProductSerializer implements ProductSerializer {
// CAS root reference
} else if (name.startsWith(Parameters.NS+Parameters.ROOT)) {
- if (rootReference==null) rootReference = new Reference();
+ if (rootReference==null) {
+ rootReference = new Reference();
+ }
if (name.equals(Parameters.ROOT_REFERENCE_ORIGINAL)) {
rootReference.setOrigReference(value);
} else if (name.equals(Parameters.ROOT_REFERENCE_DATASTORE)) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
index 382b9e3..bfaf3cd 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/solr/SolrCatalog.java
@@ -285,8 +285,12 @@ public class SolrCatalog implements Catalog {
queryResponse.setNumFound( qr.getNumFound() );
start = offset+queryResponse.getCompleteProducts().size();
- if (limit<0) limit = queryResponse.getNumFound(); // retrieve ALL results
- if (start>=queryResponse.getNumFound()) break; // don't query any longer
+ if (limit<0) {
+ limit = queryResponse.getNumFound(); // retrieve ALL results
+ }
+ if (start>=queryResponse.getNumFound()) {
+ break; // don't query any longer
+ }
}
@@ -415,7 +419,9 @@ public class SolrCatalog implements Catalog {
public ProductPage getNextPage(ProductType type, ProductPage currentPage) {
int nextPageNumber = currentPage.getPageNum()+1;
- if (nextPageNumber>currentPage.getTotalPages()) throw new RuntimeException("Invalid next page number: "+nextPageNumber);
+ if (nextPageNumber>currentPage.getTotalPages()) {
+ throw new RuntimeException("Invalid next page number: " + nextPageNumber);
+ }
try {
return this.pagedQuery(new Query(), type, currentPage.getPageNum()+1);
@@ -430,7 +436,9 @@ public class SolrCatalog implements Catalog {
public ProductPage getPrevPage(ProductType type, ProductPage currentPage) {
int prevPageNumber = currentPage.getPageNum()-1;
- if (prevPageNumber<=0) throw new RuntimeException("Invalid previous page number: "+prevPageNumber);
+ if (prevPageNumber<=0) {
+ throw new RuntimeException("Invalid previous page number: " + prevPageNumber);
+ }
try {
return this.pagedQuery(new Query(), type, prevPageNumber);
[12/12] oodt git commit: OODT-911 more cleanup
Posted by ma...@apache.org.
OODT-911 more cleanup
Project: http://git-wip-us.apache.org/repos/asf/oodt/repo
Commit: http://git-wip-us.apache.org/repos/asf/oodt/commit/35d3b221
Tree: http://git-wip-us.apache.org/repos/asf/oodt/tree/35d3b221
Diff: http://git-wip-us.apache.org/repos/asf/oodt/diff/35d3b221
Branch: refs/heads/master
Commit: 35d3b2219a8412ecc0c80d53ff0304644e07d22a
Parents: abd7164
Author: Tom Barber <to...@analytical-labs.com>
Authored: Sun Nov 1 00:40:38 2015 +0000
Committer: Tom Barber <to...@analytical-labs.com>
Committed: Sun Nov 1 00:40:38 2015 +0000
----------------------------------------------------------------------
.../catalog/mapping/InMemoryIngestMapper.java | 2 +-
.../oodt/cas/catalog/page/CatalogReceipt.java | 22 +++++++---
.../oodt/commons/activity/ActivityTracker.java | 7 +--
.../cas/filemgr/catalog/DataSourceCatalog.java | 46 +++++++-------------
.../handlers/ofsn/AbstractCrawlLister.java | 6 +--
5 files changed, 37 insertions(+), 46 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
index 92daa04..525ea07 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/InMemoryIngestMapper.java
@@ -33,7 +33,7 @@ public class InMemoryIngestMapper extends DataSourceIngestMapper {
public InMemoryIngestMapper(String user, String pass, String driver,
String jdbcUrl, String tablesFile) throws IOException {
super(user, pass, driver, jdbcUrl);
- SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.dataSource);
+ SqlScript coreSchemaScript = new SqlScript(new File(tablesFile).getAbsolutePath(), this.getDataSource());
coreSchemaScript.loadScript();
coreSchemaScript.execute();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
index 417390a..3f9c195 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/CatalogReceipt.java
@@ -17,10 +17,11 @@
package org.apache.oodt.cas.catalog.page;
//JDK imports
+import org.apache.oodt.cas.catalog.struct.TransactionId;
+
import java.util.Date;
//OODT imports
-import org.apache.oodt.cas.catalog.struct.TransactionId;
/**
* @author bfoster
@@ -29,9 +30,9 @@ import org.apache.oodt.cas.catalog.struct.TransactionId;
*/
public class CatalogReceipt {
- protected TransactionId<?> transactionId;
- protected Date transactionDate;
- protected String catalogId;
+ private TransactionId<?> transactionId;
+ private Date transactionDate;
+ private String catalogId;
public CatalogReceipt(IngestReceipt ingestReceipt, String catalogId) {
this.transactionId = ingestReceipt.getCatalogTransactionId();
@@ -67,5 +68,16 @@ public class CatalogReceipt {
public String toString() {
return ("{CatalogReceipt(tID=" + this.transactionId + ",tDate=" + this.transactionDate + ",catID=" + this.catalogId + ")}");
}
-
+
+ public void setTransactionId(TransactionId<?> transactionId) {
+ this.transactionId = transactionId;
+ }
+
+ public void setTransactionDate(Date transactionDate) {
+ this.transactionDate = transactionDate;
+ }
+
+ public void setCatalogId(String catalogId) {
+ this.catalogId = catalogId;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
index ad14341..8850330 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
@@ -69,11 +69,8 @@ public class ActivityTracker {
}
if (factories.isEmpty()) {
factory = new NullActivityFactory();
- } else if (factories.size() == 1) {
- factory = (ActivityFactory) factories.get(0);
- } else {
- factory = new CompositeActivityFactory(factories);
- }
+ } else factory =
+ factories.size() == 1 ? (ActivityFactory) factories.get(0) : new CompositeActivityFactory(factories);
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
----------------------------------------------------------------------
diff --git a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
index 327a80a..8d99122 100644
--- a/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
+++ b/filemgr/src/main/java/org/apache/oodt/cas/filemgr/catalog/DataSourceCatalog.java
@@ -255,12 +255,9 @@ public class DataSourceCatalog implements Catalog {
String addProductSql;
String productTypeIdStr;
- if (fieldIdStringFlag) {
- productTypeIdStr = "'"
- + product.getProductType().getProductTypeId() + "'";
- } else {
- productTypeIdStr = product.getProductType().getProductTypeId();
- }
+ productTypeIdStr = fieldIdStringFlag ? "'"
+ + product.getProductType().getProductTypeId() + "'"
+ : product.getProductType().getProductTypeId();
if (!productIdString) {
@@ -964,11 +961,7 @@ public class DataSourceCatalog implements Catalog {
String getProductSql;
String productTypeIdStr;
- if (fieldIdStringFlag) {
- productTypeIdStr = "'" + type.getProductTypeId() + "'";
- } else {
- productTypeIdStr = type.getProductTypeId();
- }
+ productTypeIdStr = fieldIdStringFlag ? "'" + type.getProductTypeId() + "'" : type.getProductTypeId();
getProductSql = "SELECT products.* " + "FROM products "
+ "WHERE products.product_type_id = " + productTypeIdStr;
@@ -1705,12 +1698,10 @@ public class DataSourceCatalog implements Catalog {
String elementIdStr;
- if (fieldIdStringFlag) {
- elementIdStr =
- "'" + this.validationLayer.getElementByName(criteria.getElementName()).getElementId() + "'";
- } else {
- elementIdStr = this.validationLayer.getElementByName(criteria.getElementName()).getElementId();
- }
+ elementIdStr =
+ fieldIdStringFlag ? "'" + this.validationLayer.getElementByName(criteria.getElementName())
+ .getElementId() + "'"
+ : this.validationLayer.getElementByName(criteria.getElementName()).getElementId();
StringBuilder clause = new StringBuilder();
@@ -2135,14 +2126,13 @@ public class DataSourceCatalog implements Catalog {
"metadata_value" + (rqc.getInclusive() ? " >= " : " > ") + "'" + rqc.getStartValue() + "'";
}
if (rqc.getEndValue() != null) {
- if (rangeSubQuery == null) {
- rangeSubQuery =
- "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc.getEndValue() + "'";
- } else {
- rangeSubQuery =
- "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'"
- + rqc.getEndValue() + "')";
- }
+ rangeSubQuery =
+ rangeSubQuery == null ? "metadata_value" + (rqc.getInclusive() ? " <= " : " < ") + "'" + rqc
+ .getEndValue() + "'"
+ : "(" + rangeSubQuery + " AND metadata_value" + (rqc.getInclusive() ? " <= "
+ : " < ")
+ + "'"
+ + rqc.getEndValue() + "')";
}
sqlQuery.append(rangeSubQuery);
} else {
@@ -2237,11 +2227,7 @@ public class DataSourceCatalog implements Catalog {
* @return the quoted productId
*/
protected String quoteIt(String productId) {
- if (this.productIdString) {
- return "'"+productId+"'";
- } else {
- return productId;
- }
+ return this.productIdString ? "'" + productId + "'" : productId;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/35d3b221/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
----------------------------------------------------------------------
diff --git a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
index 1c839d2..b855988 100644
--- a/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
+++ b/product/src/main/java/org/apache/oodt/product/handlers/ofsn/AbstractCrawlLister.java
@@ -95,11 +95,7 @@ public abstract class AbstractCrawlLister implements OFSNListHandler {
LOG.log(Level.INFO, "OFSN: Crawling " + dir);
File[] productFiles;
- if (crawlForDirs) {
- productFiles = dir.listFiles(DIR_FILTER);
- } else {
- productFiles = dir.listFiles(FILE_FILTER);
- }
+ productFiles = crawlForDirs ? dir.listFiles(DIR_FILTER) : dir.listFiles(FILE_FILTER);
Collections.addAll(fileList, productFiles);
[08/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/Configuration.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/Configuration.java b/commons/src/main/java/org/apache/oodt/commons/Configuration.java
index eb44cbd..d57265c 100644
--- a/commons/src/main/java/org/apache/oodt/commons/Configuration.java
+++ b/commons/src/main/java/org/apache/oodt/commons/Configuration.java
@@ -73,7 +73,9 @@ public class Configuration {
*/
public static Configuration getConfiguration() throws IOException, SAXException {
// Got one? Use it.
- if (configuration != null) return configuration;
+ if (configuration != null) {
+ return configuration;
+ }
URL url;
@@ -88,7 +90,9 @@ public class Configuration {
String filename = System.getProperty("org.apache.oodt.commons.Configuration.file");
if (filename != null) {
file = new File(filename);
- if (!file.exists()) throw new IOException("File " + file + " not found");
+ if (!file.exists()) {
+ throw new IOException("File " + file + " not found");
+ }
} else {
List candidates = new ArrayList();
@@ -124,9 +128,10 @@ public class Configuration {
break;
}
}
- if (found && file == alt)
- System.err.println("WARNING: Using older config file " + alt + "; rename to "
- + homedirfile + " as soon as possible.");
+ if (found && file == alt) {
+ System.err.println("WARNING: Using older config file " + alt + "; rename to "
+ + homedirfile + " as soon as possible.");
+ }
if (!found) {
return getEmptyConfiguration();
}
@@ -149,16 +154,18 @@ public class Configuration {
*/
public static Configuration getConfiguration(URL configFileUrl) throws SAXException, IOException {
synchronized (Configuration.class) {
- if (configuration == null)
- configuration = new Configuration(configFileUrl);
+ if (configuration == null) {
+ configuration = new Configuration(configFileUrl);
+ }
}
return configuration;
}
private static Configuration getEmptyConfiguration() {
synchronized (Configuration.class) {
- if (configuration == null)
- configuration = new Configuration();
+ if (configuration == null) {
+ configuration = new Configuration();
+ }
}
return configuration;
}
@@ -173,7 +180,9 @@ public class Configuration {
*/
public static Configuration getConfigurationWithoutException() {
// Got one? Use it. Do this out of a try block for performance.
- if (configuration != null) return configuration;
+ if (configuration != null) {
+ return configuration;
+ }
// Try to get it.
try {
@@ -215,7 +224,9 @@ public class Configuration {
Configuration(InputSource inputSource) throws IOException, SAXException {
String systemID = inputSource.getSystemId();
- if (systemID == null) inputSource.setSystemId("file:/unknown");
+ if (systemID == null) {
+ inputSource.setSystemId("file:/unknown");
+ }
// Get the document
DOMParser parser = XML.createDOMParser();
@@ -238,8 +249,9 @@ public class Configuration {
document.normalize();
// See if this really is a <configuration> document.
- if (!document.getDocumentElement().getNodeName().equals("configuration"))
- throw new SAXException("Configuration " + inputSource.getSystemId() + " is not a <configuration> document");
+ if (!document.getDocumentElement().getNodeName().equals("configuration")) {
+ throw new SAXException("Configuration " + inputSource.getSystemId() + " is not a <configuration> document");
+ }
NodeList list = document.getDocumentElement().getChildNodes();
for (int eachChild = 0; eachChild < list.getLength(); ++eachChild) {
@@ -248,27 +260,31 @@ public class Configuration {
NodeList children = childNode.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if ("host".equals(node.getNodeName()))
- webHost = XML.unwrappedText(node);
- else if ("port".equals(node.getNodeName()))
- webPort = XML.unwrappedText(node);
- else if ("dir".equals(node.getNodeName()))
- webServerDocumentDirectory = new File(XML.unwrappedText(node));
+ if ("host".equals(node.getNodeName())) {
+ webHost = XML.unwrappedText(node);
+ } else if ("port".equals(node.getNodeName())) {
+ webPort = XML.unwrappedText(node);
+ } else if ("dir".equals(node.getNodeName())) {
+ webServerDocumentDirectory = new File(XML.unwrappedText(node));
+ }
}
properties.setProperty("org.apache.oodt.commons.Configuration.webServer.baseURL", getWebServerBaseURL());
- if (webServerDocumentDirectory == null)
- webServerDocumentDirectory = new File(System.getProperty("user.home", "/")
- + "/dev/htdocs");
+ if (webServerDocumentDirectory == null) {
+ webServerDocumentDirectory = new File(System.getProperty("user.home", "/")
+ + "/dev/htdocs");
+ }
} else if (childNode.getNodeName().equals("nameServer")) {
Element nameServerNode = (Element) childNode;
String nameServerStateFrequencyString = nameServerNode.getAttribute("stateFrequency");
- if (nameServerStateFrequencyString == null || nameServerStateFrequencyString.length() == 0)
- nameServerStateFrequency = 0;
- else try {
+ if (nameServerStateFrequencyString == null || nameServerStateFrequencyString.length() == 0) {
+ nameServerStateFrequency = 0;
+ } else {
+ try {
nameServerStateFrequency = Integer.parseInt(nameServerStateFrequencyString);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException ex) {
throw new SAXException("Illegal nun-numeric value \"" + nameServerStateFrequencyString
- + "\" for stateFrequency attribute");
+ + "\" for stateFrequency attribute");
+ }
}
if (childNode.getFirstChild().getNodeName().equals("rir")) {
nameServerUsingRIRProtocol = true;
@@ -283,14 +299,15 @@ public class Configuration {
NodeList children = childNode.getFirstChild().getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if (node.getNodeName().equals("version"))
- nameServerVersion = XML.unwrappedText(node);
- else if (node.getNodeName().equals("host"))
- nameServerHost = XML.unwrappedText(node);
- else if (node.getNodeName().equals("port"))
- nameServerPort = XML.unwrappedText(node);
- else if (node.getNodeName().equals("objectKey"))
- nameServerObjectKey = XML.unwrappedText(node);
+ if (node.getNodeName().equals("version")) {
+ nameServerVersion = XML.unwrappedText(node);
+ } else if (node.getNodeName().equals("host")) {
+ nameServerHost = XML.unwrappedText(node);
+ } else if (node.getNodeName().equals("port")) {
+ nameServerPort = XML.unwrappedText(node);
+ } else if (node.getNodeName().equals("objectKey")) {
+ nameServerObjectKey = XML.unwrappedText(node);
+ }
}
}
} else if (childNode.getNodeName().equals("xml")) {
@@ -300,11 +317,13 @@ public class Configuration {
if ("entityRef".equals(xmlNode.getNodeName())) {
NodeList dirNodes = xmlNode.getChildNodes();
StringBuilder refDirs = new StringBuilder(System.getProperty(ENTITY_DIRS_PROP, ""));
- for (int j = 0; j < dirNodes.getLength(); ++j)
- refDirs.append(',').append(XML.unwrappedText(dirNodes.item(j)));
- if (refDirs.length() > 0)
- System.setProperty(ENTITY_DIRS_PROP, refDirs.charAt(0) == ','?
- refDirs.substring(1) : refDirs.toString());
+ for (int j = 0; j < dirNodes.getLength(); ++j) {
+ refDirs.append(',').append(XML.unwrappedText(dirNodes.item(j)));
+ }
+ if (refDirs.length() > 0) {
+ System.setProperty(ENTITY_DIRS_PROP, refDirs.charAt(0) == ',' ?
+ refDirs.substring(1) : refDirs.toString());
+ }
}
}
} else if ("serverMgr".equals(childNode.getNodeName())) {
@@ -377,18 +396,22 @@ public class Configuration {
if (nameServerUsingRIRProtocol) {
Element rirNode = document.createElement("rir");
nameServerNode.appendChild(rirNode);
- if (nameServerObjectKey != null)
- XML.add(rirNode, "objectKey", nameServerObjectKey);
+ if (nameServerObjectKey != null) {
+ XML.add(rirNode, "objectKey", nameServerObjectKey);
+ }
} else {
Element iiopNode = document.createElement("iiop");
nameServerNode.appendChild(iiopNode);
- if (nameServerVersion != null)
- XML.add(iiopNode, "version", nameServerVersion);
+ if (nameServerVersion != null) {
+ XML.add(iiopNode, "version", nameServerVersion);
+ }
XML.add(iiopNode, "host", nameServerHost);
- if (nameServerPort != null)
- XML.add(iiopNode, "port", nameServerPort);
- if (nameServerObjectKey != null)
- XML.add(iiopNode, "objectKey", nameServerObjectKey);
+ if (nameServerPort != null) {
+ XML.add(iiopNode, "port", nameServerPort);
+ }
+ if (nameServerObjectKey != null) {
+ XML.add(iiopNode, "objectKey", nameServerObjectKey);
+ }
}
// <xml><entityRef><dir>...
@@ -408,8 +431,9 @@ public class Configuration {
}
// Global <properties>...</properties>
- if (properties.size() > 0)
- dumpProperties(properties, configurationNode);
+ if (properties.size() > 0) {
+ dumpProperties(properties, configurationNode);
+ }
// <programs>...
if (execServers.size() > 0) {
@@ -482,8 +506,9 @@ public class Configuration {
ExecServerConfig execServerConfig = null;
for (Iterator i = execServers.iterator(); i.hasNext() && execServerConfig == null;) {
ExecServerConfig exec = (ExecServerConfig) i.next();
- if (objectKey.equals(exec.getObjectKey()))
- execServerConfig = exec;
+ if (objectKey.equals(exec.getObjectKey())) {
+ execServerConfig = exec;
+ }
}
return execServerConfig;
}
@@ -495,8 +520,11 @@ public class Configuration {
public String getWebServerBaseURL() {
String proto = System.getProperty(WEB_PROTOCOL_PROPERTY);
if (proto == null) {
- if ("443".equals(webPort)) proto = "https";
- else proto = "http";
+ if ("443".equals(webPort)) {
+ proto = "https";
+ } else {
+ proto = "http";
+ }
}
return proto + "://" + webHost + ":" + webPort;
}
@@ -541,9 +569,10 @@ public class Configuration {
public Context getObjectContext() throws NamingException {
Context c;
final String className = (String) contextEnvironment.get(javax.naming.Context.INITIAL_CONTEXT_FACTORY);
- if (className == null)
- c = new InitialContext(contextEnvironment);
- else try {
+ if (className == null) {
+ c = new InitialContext(contextEnvironment);
+ } else {
+ try {
// Work around iPlanet bug. JNDI uses the thread's context class
// loader to load the initial context factory class. For some
// reason, that loader fails to find things in iPlanet's
@@ -557,15 +586,17 @@ public class Configuration {
InitialContextThread thread = new InitialContextThread(loader);
thread.start();
try {
- thread.join();
+ thread.join();
} catch (InterruptedException ex) {
- throw new NoInitialContextException("Initial context thread interrupted: " + ex.getMessage());
+ throw new NoInitialContextException("Initial context thread interrupted: " + ex.getMessage());
}
c = thread.getContext();
- if (c == null)
- throw thread.getException();
- } catch (ClassNotFoundException ex) {
+ if (c == null) {
+ throw thread.getException();
+ }
+ } catch (ClassNotFoundException ex) {
throw new NoInitialContextException("Class " + className + " not found");
+ }
}
return c;
}
@@ -576,8 +607,9 @@ public class Configuration {
*/
public List getEntityRefDirs() {
List dirs = new ArrayList();
- for (StringTokenizer t = new StringTokenizer(System.getProperty(ENTITY_DIRS_PROP, ""), ",;|"); t.hasMoreTokens();)
- dirs.add(t.nextToken());
+ for (StringTokenizer t = new StringTokenizer(System.getProperty(ENTITY_DIRS_PROP, ""), ",;|"); t.hasMoreTokens();) {
+ dirs.add(t.nextToken());
+ }
return dirs;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/ConfigurationEntityResolver.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/ConfigurationEntityResolver.java b/commons/src/main/java/org/apache/oodt/commons/ConfigurationEntityResolver.java
index cc784dc..f5c35c1 100644
--- a/commons/src/main/java/org/apache/oodt/commons/ConfigurationEntityResolver.java
+++ b/commons/src/main/java/org/apache/oodt/commons/ConfigurationEntityResolver.java
@@ -34,8 +34,9 @@ import org.xml.sax.SAXException;
*/
class ConfigurationEntityResolver implements EntityResolver {
public InputSource resolveEntity(String publicID, String systemID) throws SAXException, IOException {
- if (Configuration.DTD_FPI.equals(publicID) || Configuration.DTD_OLD_FPI.equals(publicID))
- return new InputSource(Configuration.class.getResourceAsStream("Configuration.dtd"));
+ if (Configuration.DTD_FPI.equals(publicID) || Configuration.DTD_OLD_FPI.equals(publicID)) {
+ return new InputSource(Configuration.class.getResourceAsStream("Configuration.dtd"));
+ }
return null;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/ExecServer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/ExecServer.java b/commons/src/main/java/org/apache/oodt/commons/ExecServer.java
index 3a03290..3a84c30 100644
--- a/commons/src/main/java/org/apache/oodt/commons/ExecServer.java
+++ b/commons/src/main/java/org/apache/oodt/commons/ExecServer.java
@@ -134,9 +134,12 @@ public class ExecServer {
});
// We're done here.
- for (;;) try {
+ for (;;) {
+ try {
Thread.currentThread().join();
- } catch (InterruptedException ignore) {}
+ } catch (InterruptedException ignore) {
+ }
+ }
} catch (IOException ex) {
System.err.println("I/O error during initialization: " + ex.getMessage());
ex.printStackTrace();
@@ -283,8 +286,9 @@ public class ExecServer {
// Remove all the log messages from the document.
NodeList children = logElement.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i)
- logElement.removeChild(children.item(i));
+ for (int i = 0; i < children.getLength(); ++i) {
+ logElement.removeChild(children.item(i));
+ }
// Return the serialized form, which included the log messages.
System.err.println(rc);
@@ -352,12 +356,15 @@ public class ExecServer {
private void shutdown0() {
// Unbind.
- if (!Boolean.getBoolean(DISABLE_BINDING)) try {
+ if (!Boolean.getBoolean(DISABLE_BINDING)) {
+ try {
binder.stopBinding();
Context objectContext = configuration.getObjectContext();
objectContext.unbind(getName());
objectContext.close();
- } catch (NamingException ignore) {}
+ } catch (NamingException ignore) {
+ }
+ }
// Kill the ORB. YEAH! KILL IT, KILL IT, KIIIIIIIIIIIIIIL IIIIIIIIT!!!!!!!1
try {
@@ -381,17 +388,20 @@ public class ExecServer {
keepBinding = true;
}
public void run() {
- while (shouldKeepBinding()) try {
+ while (shouldKeepBinding()) {
+ try {
Context objectContext = configuration.getObjectContext();
objectContext.rebind(name, server.getServant());
objectContext.close();
- } catch (Throwable ex) {
+ } catch (Throwable ex) {
System.err.println("Exception binding at " + new Date() + "; will keep trying...");
ex.printStackTrace();
- } finally {
+ } finally {
try {
- Thread.sleep(REBIND_PERIOD);
- } catch (InterruptedException ignore) {}
+ Thread.sleep(REBIND_PERIOD);
+ } catch (InterruptedException ignore) {
+ }
+ }
}
}
public synchronized void stopBinding() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/ExecServerConfig.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/ExecServerConfig.java b/commons/src/main/java/org/apache/oodt/commons/ExecServerConfig.java
index 53085c8..ae0dc94 100644
--- a/commons/src/main/java/org/apache/oodt/commons/ExecServerConfig.java
+++ b/commons/src/main/java/org/apache/oodt/commons/ExecServerConfig.java
@@ -62,11 +62,13 @@ public class ExecServerConfig extends Executable implements Documentable {
for (int i = 2; i < children.getLength(); ++i) {
Node child = children.item(i);
String name = child.getNodeName();
- if ("host".equals(name))
- preferredHost = InetAddress.getByName(XML.unwrappedText(children.item(2)));
- else if ("properties".equals(name))
- Configuration.loadProperties(child, properties);
- else throw new SAXException("Unknown node " + name + " in exec server XML");
+ if ("host".equals(name)) {
+ preferredHost = InetAddress.getByName(XML.unwrappedText(children.item(2)));
+ } else if ("properties".equals(name)) {
+ Configuration.loadProperties(child, properties);
+ } else {
+ throw new SAXException("Unknown node " + name + " in exec server XML");
+ }
}
}
@@ -133,8 +135,12 @@ public class ExecServerConfig extends Executable implements Documentable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof ExecServerConfig)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof ExecServerConfig)) {
+ return false;
+ }
ExecServerConfig obj = (ExecServerConfig) rhs;
return className.equals(obj.className) && objectKey.equals(obj.objectKey) && properties.equals(obj.properties);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/Executable.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/Executable.java b/commons/src/main/java/org/apache/oodt/commons/Executable.java
index 44f1287..6af49f8 100644
--- a/commons/src/main/java/org/apache/oodt/commons/Executable.java
+++ b/commons/src/main/java/org/apache/oodt/commons/Executable.java
@@ -90,8 +90,9 @@ public abstract class Executable {
}.start();
// Spin until the process field is set.
- while (process == null)
- Thread.yield();
+ while (process == null) {
+ Thread.yield();
+ }
}
/** Wait for the process to terminate.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/MultiServer.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java b/commons/src/main/java/org/apache/oodt/commons/MultiServer.java
index f320bd4..d47accd 100644
--- a/commons/src/main/java/org/apache/oodt/commons/MultiServer.java
+++ b/commons/src/main/java/org/apache/oodt/commons/MultiServer.java
@@ -140,10 +140,12 @@ public class MultiServer {
String config = System.getProperty("org.apache.oodt.commons.MultiServer.config", System.getProperty("MultiServer.config",
System.getProperty("multiserver.config", System.getProperty("config"))));
if (config == null) {
- if (argv.length != 1)
- throw new IllegalStateException("No org.apache.oodt.commons.MultiServer.config property or config URL argument");
- else
- config = argv[0];
+ if (argv.length != 1) {
+ throw new IllegalStateException(
+ "No org.apache.oodt.commons.MultiServer.config property or config URL argument");
+ } else {
+ config = argv[0];
+ }
}
StringReader reader = new StringReader(CONFIG);
@@ -164,7 +166,9 @@ public class MultiServer {
ExecServer.runInitializers();
try {
LogInit.init(System.getProperties(), getAppName());
- if (servers.isEmpty()) throw new IllegalStateException("No servers defined in config");
+ if (servers.isEmpty()) {
+ throw new IllegalStateException("No servers defined in config");
+ }
Runtime.getRuntime().addShutdownHook(new Thread() {
public void run() {
@@ -179,9 +183,12 @@ public class MultiServer {
} catch (Throwable ignore) {}
System.exit(1);
}
- for (;;) try {
+ for (;;) {
+ try {
Thread.currentThread().join();
- } catch (InterruptedException ignore) {}
+ } catch (InterruptedException ignore) {
+ }
+ }
}
/**
@@ -209,7 +216,9 @@ public class MultiServer {
Document doc = builder.parse(is);
Element root = doc.getDocumentElement();
appName = root.getAttribute("id");
- if (appName == null) throw new SAXException("id attribute missing from multiserver element");
+ if (appName == null) {
+ throw new SAXException("id attribute missing from multiserver element");
+ }
// Set properties
NodeList children = root.getChildNodes();
@@ -234,24 +243,32 @@ public class MultiServer {
for (int i = 0; i < serverNodes.getLength(); ++i) {
Element serverElem = (Element) serverNodes.item(i);
String name = serverElem.getAttribute("id");
- if (name == null) throw new SAXException("id attribute missing from server element");
+ if (name == null) {
+ throw new SAXException("id attribute missing from server element");
+ }
String className = serverElem.getAttribute("class");
- if (className == null) throw new SAXException("class attribute missing from server element");
+ if (className == null) {
+ throw new SAXException("class attribute missing from server element");
+ }
String bindKind = serverElem.getAttribute("bind");
- if (bindKind == null) throw new SAXException("bind attribute missing from server element");
+ if (bindKind == null) {
+ throw new SAXException("bind attribute missing from server element");
+ }
Server server;
- if ("true".equals(bindKind))
- server = new BindingServer(name, className);
- else if ("false".equals(bindKind))
- server = new NonbindingServer(name, className);
- else if ("rebind".equals(bindKind))
- server = new RebindingServer(name, className);
- else try {
+ if ("true".equals(bindKind)) {
+ server = new BindingServer(name, className);
+ } else if ("false".equals(bindKind)) {
+ server = new NonbindingServer(name, className);
+ } else if ("rebind".equals(bindKind)) {
+ server = new RebindingServer(name, className);
+ } else {
+ try {
long period = Long.parseLong(bindKind);
server = new AutobindingServer(name, className, period);
- } catch (NumberFormatException ex) {
+ } catch (NumberFormatException ex) {
throw new SAXException("Expected true, false, rebind, or auto for bind attribute but got `"
- + bindKind + "'");
+ + bindKind + "'");
+ }
}
servers.put(name, server);
}
@@ -545,7 +562,9 @@ public class MultiServer {
* @throws NamingException if an error occurs.
*/
public void stop() throws NamingException {
- if (binder != null) binder.cancel();
+ if (binder != null) {
+ binder.cancel();
+ }
context.unbind(name);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java b/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java
index 2a36a0f..39610f2 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/Activity.java
@@ -47,7 +47,9 @@ public abstract class Activity {
* @param id New ID.
*/
public void setID(String id) {
- if (id == null) throw new IllegalArgumentException("ID required");
+ if (id == null) {
+ throw new IllegalArgumentException("ID required");
+ }
this.id = id;
}
@@ -65,7 +67,9 @@ public abstract class Activity {
* further incidents may be logged after calling this method.
*/
public synchronized void stop() {
- if (!started) return;
+ if (!started) {
+ return;
+ }
this.started = false;
log(new ActivityStopped());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
index 4af6812..ad14341 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/ActivityTracker.java
@@ -67,12 +67,13 @@ public class ActivityTracker {
Class factoryClass = Class.forName(factoryName);
factories.add(factoryClass.newInstance());
}
- if (factories.isEmpty())
- factory = new NullActivityFactory();
- else if (factories.size() == 1)
- factory = (ActivityFactory) factories.get(0);
- else
- factory = new CompositeActivityFactory(factories);
+ if (factories.isEmpty()) {
+ factory = new NullActivityFactory();
+ } else if (factories.size() == 1) {
+ factory = (ActivityFactory) factories.get(0);
+ } else {
+ factory = new CompositeActivityFactory(factories);
+ }
}
/**
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/CompositeActivity.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/CompositeActivity.java b/commons/src/main/java/org/apache/oodt/commons/activity/CompositeActivity.java
index c0c3c8b..494202e 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/CompositeActivity.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/CompositeActivity.java
@@ -32,8 +32,9 @@ public class CompositeActivity extends Activity {
* @param activities a {@link Collection} of {@link Activity} instances.
*/
public CompositeActivity(Collection activities) {
- if (activities == null)
- throw new IllegalArgumentException("Activities collection required");
+ if (activities == null) {
+ throw new IllegalArgumentException("Activities collection required");
+ }
for (Object activity : activities) {
if (!(activity instanceof Activity)) {
throw new IllegalArgumentException("Non-Activity in activities collection");
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java
index 7903797..dd95806 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/DatagramLoggingActivityFactory.java
@@ -53,9 +53,11 @@ public class DatagramLoggingActivityFactory implements ActivityFactory {
System.getProperty("activity.host", ""));
port = Integer.getInteger("org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.port",
Integer.getInteger("activity.port", 4556));
- if (hostname.length() == 0)
- throw new IllegalStateException("System property `org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.host'"
- + " (or simply `activity.host') not defined or is empty");
+ if (hostname.length() == 0) {
+ throw new IllegalStateException(
+ "System property `org.apache.oodt.commons.activity.DatagramLoggingActivityFactory.host'"
+ + " (or simply `activity.host') not defined or is empty");
+ }
try {
host = InetAddress.getByName(hostname);
socket = new DatagramSocket();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/History.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/History.java b/commons/src/main/java/org/apache/oodt/commons/activity/History.java
index 7267338..0042d3b 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/History.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/History.java
@@ -68,24 +68,31 @@ final class History {
* @param incident an {@link Incident} value.
*/
synchronized void addIncident(Incident incident) {
- if (!incident.getActivityID().equals(id))
- throw new IllegalArgumentException("Incident's activity ID " + incident.getActivityID()
- + " doesn't match History's ID " + id);
- if (incidents == null) return;
+ if (!incident.getActivityID().equals(id)) {
+ throw new IllegalArgumentException("Incident's activity ID " + incident.getActivityID()
+ + " doesn't match History's ID " + id);
+ }
+ if (incidents == null) {
+ return;
+ }
incidents.add(incident);
- if (expireHistoryTask != null)
- expireHistoryTask.cancel();
- if (incident instanceof ActivityStopped)
- commit();
- else if (closeHistoryTask == null)
- scheduleExpiration();
+ if (expireHistoryTask != null) {
+ expireHistoryTask.cancel();
+ }
+ if (incident instanceof ActivityStopped) {
+ commit();
+ } else if (closeHistoryTask == null) {
+ scheduleExpiration();
+ }
}
/**
* Commit this history by starting the commit-to-close timer.
*/
private void commit() {
- if (closeHistoryTask != null) return;
+ if (closeHistoryTask != null) {
+ return;
+ }
TIMER.schedule(closeHistoryTask = new CloseHistoryTask(), closeTime);
}
@@ -132,7 +139,9 @@ final class History {
// current expiration task is this task, then we're clear
// to commit the history, and any incidents that arrive
// won't reset it.
- if (expireHistoryTask == this) commit();
+ if (expireHistoryTask == this) {
+ commit();
+ }
}
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java b/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java
index ff1d062..e6da1c8 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/Incident.java
@@ -69,8 +69,12 @@ public class Incident implements Serializable, Comparable {
* @return True if incidents are equal.
*/
public boolean equals(Object obj) {
- if (obj == this) return true;
- if (!(obj instanceof Incident)) return false;
+ if (obj == this) {
+ return true;
+ }
+ if (!(obj instanceof Incident)) {
+ return false;
+ }
Incident rhs = (Incident) obj;
return ((id == null && rhs.id == null) || id.equals(rhs.id)) && time.equals(rhs.time);
}
@@ -86,10 +90,11 @@ public class Incident implements Serializable, Comparable {
Incident rhs = (Incident) obj;
int idComp = id == null && rhs.id != null ? -1 : id == null ? 0 : rhs.id == null ? 1
: id.compareTo(rhs.id);
- if (idComp == 0)
- return time.compareTo(rhs.time);
- else
- return idComp;
+ if (idComp == 0) {
+ return time.compareTo(rhs.time);
+ } else {
+ return idComp;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/activity/SQLDatabaseRetrieval.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/activity/SQLDatabaseRetrieval.java b/commons/src/main/java/org/apache/oodt/commons/activity/SQLDatabaseRetrieval.java
index 3d1197f..e9a414b 100644
--- a/commons/src/main/java/org/apache/oodt/commons/activity/SQLDatabaseRetrieval.java
+++ b/commons/src/main/java/org/apache/oodt/commons/activity/SQLDatabaseRetrieval.java
@@ -158,8 +158,12 @@ public class SQLDatabaseRetrieval implements Retrieval {
}
finally {
try {
- if (stmt != null) stmt.close();
- if (conn != null) conn.close();
+ if (stmt != null) {
+ stmt.close();
+ }
+ if (conn != null) {
+ conn.close();
+ }
}
catch (SQLException ignored) {}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java b/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
index ee3f9bf..8a5ea8e 100644
--- a/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
+++ b/commons/src/main/java/org/apache/oodt/commons/database/SqlScript.java
@@ -114,8 +114,9 @@ public class SqlScript {
boolean queryEnds;
while ((line = reader.readLine()) != null) {
- if (isComment(line))
+ if (isComment(line)) {
continue;
+ }
queryEnds = checkStatementEnds(line);
query.append(line);
if (queryEnds) {
@@ -161,8 +162,9 @@ public class SqlScript {
}
private boolean isComment(String line) {
- if ((line != null) && (line.length() > 0))
+ if ((line != null) && (line.length() > 0)) {
return (line.charAt(0) == '#');
+ }
return false;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java b/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java
index ad854ed..ed2e9cc 100644
--- a/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java
+++ b/commons/src/main/java/org/apache/oodt/commons/date/DateUtils.java
@@ -101,8 +101,9 @@ public class DateUtils {
public static int getLeapSecsForDate(Calendar utcCal) throws CommonsException {
long timeInMillis = utcCal.getTimeInMillis();
for (int i = dateAndLeapSecs.length - 1; i >= 0; i--) {
- if (dateAndLeapSecs[i][IndexType.DATE.index] < timeInMillis)
+ if (dateAndLeapSecs[i][IndexType.DATE.index] < timeInMillis) {
return (int) dateAndLeapSecs[i][IndexType.LEAP_SECS.index];
+ }
}
throw new CommonsException("No Leap Second found for given date!");
}
@@ -218,8 +219,9 @@ public class DateUtils {
}else {
epochDiffInMilli = epoch.getTimeInMillis() - julianEpoch.getTimeInMillis() ;
}
- if (cal.getTimeZone().getID().equals("TAI"))
+ if (cal.getTimeZone().getID().equals("TAI")) {
epochDiffInMilli += getLeapSecsForDate(epoch) * 1000;
+ }
long milliseconds = cal.getTimeInMillis();
return milliseconds - epochDiffInMilli;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java b/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
index 3979f32..a8a6d35 100644
--- a/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
+++ b/commons/src/main/java/org/apache/oodt/commons/exec/EnvUtilities.java
@@ -67,8 +67,9 @@ public final class EnvUtilities {
*/
public static Properties getEnv() {
Properties envProps = new Properties();
- for (Map.Entry<String, String> entry : System.getenv().entrySet())
+ for (Map.Entry<String, String> entry : System.getenv().entrySet()) {
envProps.setProperty(entry.getKey(), entry.getValue());
+ }
return envProps;
}
@@ -103,18 +104,21 @@ public final class EnvUtilities {
+ e.getMessage());
} finally {
try {
- if (p.getErrorStream() != null)
+ if (p.getErrorStream() != null) {
p.getErrorStream().close();
+ }
} catch (Exception ignored) {
}
try {
- if (p.getInputStream() != null)
+ if (p.getInputStream() != null) {
p.getInputStream().close();
+ }
} catch (Exception ignored) {
}
try {
- if (p.getOutputStream() != null)
+ if (p.getOutputStream() != null) {
p.getOutputStream().close();
+ }
} catch (Exception ignored) {
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java b/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java
index 6429cfe..5da1f94 100644
--- a/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java
+++ b/commons/src/main/java/org/apache/oodt/commons/exec/ExecHelper.java
@@ -294,8 +294,9 @@ public final class ExecHelper {
*/
public static ExecHelper execUsingShell(String command, String charset)
throws IOException {
- if (command == null)
- throw new NullPointerException();
+ if (command == null) {
+ throw new NullPointerException();
+ }
String[] cmdarray;
String os = System.getProperty("os.name");
if (os.equals("Windows 95") || os.equals("Windows 98")
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java b/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java
index 8ddf691..6c7d286 100644
--- a/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java
+++ b/commons/src/main/java/org/apache/oodt/commons/exec/StreamGobbler.java
@@ -63,18 +63,21 @@ public class StreamGobbler extends Thread {
public void run() {
try {
PrintWriter pw = null;
- if (os != null)
+ if (os != null) {
pw = new PrintWriter(os);
+ }
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
String line;
while ((line = br.readLine()) != null && this.running) {
- if (pw != null)
+ if (pw != null) {
pw.println(this.type + ": " + line);
+ }
}
- if (pw != null)
+ if (pw != null) {
pw.flush();
+ }
} catch (IOException ioe) {
LOG.log(Level.FINEST, "StreamGobbler failed while gobbling : " + ioe.getMessage(), ioe);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java b/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
index a2a9822..ec6413f 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/ObjectTimeEvent.java
@@ -49,8 +49,9 @@ public class ObjectTimeEvent<objType> extends TimeEvent {
if (obj instanceof ObjectTimeEvent) {
ObjectTimeEvent<?> ote = (ObjectTimeEvent<?>) obj;
return super.equals(obj) && this.timeObj.equals(ote.timeObj);
- } else
+ } else {
return false;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
index 3d5f372..d4a73d0 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEvent.java
@@ -74,8 +74,9 @@ public class TimeEvent implements Comparable<TimeEvent> {
if (obj instanceof TimeEvent) {
TimeEvent te = (TimeEvent) obj;
return te.startTime == this.startTime && te.endTime == this.endTime;
- } else
+ } else {
return false;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
index 9321741..c0d33a9 100644
--- a/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
+++ b/commons/src/main/java/org/apache/oodt/commons/filter/TimeEventWeightedHash.java
@@ -63,8 +63,9 @@ public class TimeEventWeightedHash {
TimeEventWeightedHash hash = new TimeEventWeightedHash();
hash.epsilon = epsilon;
events = TimeEvent.getTimeOrderedEvents(events);
- for (TimeEvent event : events)
- hash.addEvent(event);
+ for (TimeEvent event : events) {
+ hash.addEvent(event);
+ }
return hash;
}
@@ -84,8 +85,9 @@ public class TimeEventWeightedHash {
MyLinkedHashSet<TimeEventNode> parentNodes = this.findParents(newEvent);
MyLinkedHashSet<TimeEventNode> childrenNodes = this.findChildren(newEvent, parentNodes);
- if (childrenNodes.size() == 0)
+ if (childrenNodes.size() == 0) {
leafNodes.add(newEventNode);
+ }
newEventNode.addParents(parentNodes);
newEventNode.addChildren(childrenNodes);
@@ -111,8 +113,9 @@ public class TimeEventWeightedHash {
}
}
//if all children where not possible parents, then curPPN must be parent
- if (!ppnListChanged)
+ if (!ppnListChanged) {
parentNodes.add(curPPN);
+ }
//get next curPPN
possibleParentNodes.remove(curPPN);
@@ -155,8 +158,9 @@ public class TimeEventWeightedHash {
for (TimeEventNode ten : this.leafNodes) {
if (ten.getPathWeight() > max.getPathWeight()
|| (ten.getPathWeight() == max.getPathWeight()
- && ten.getPathPriorityWeight() > max.getPathPriorityWeight()))
+ && ten.getPathPriorityWeight() > max.getPathPriorityWeight())) {
max = ten;
+ }
}
WeightedNode root = new WeightedNode(max.getTimeEvent());
TimeEventNode curTEN = max.greatestWieghtedParent;
@@ -182,8 +186,9 @@ public class TimeEventWeightedHash {
@Override
public boolean add(E ten) {
boolean wasAdded;
- if (wasAdded = super.add(ten))
+ if (wasAdded = super.add(ten)) {
listSet.add(ten);
+ }
return wasAdded;
}
@@ -191,8 +196,9 @@ public class TimeEventWeightedHash {
public boolean addAll(Collection<? extends E> collection) {
boolean setChanged = false;
for (E ten : collection) {
- if (this.add(ten))
+ if (this.add(ten)) {
setChanged = true;
+ }
}
return setChanged;
}
@@ -202,25 +208,28 @@ public class TimeEventWeightedHash {
if (super.remove(ten)) {
this.listSet.remove(ten);
return true;
- }else
+ }else {
return false;
+ }
}
@Override
public boolean removeAll(Collection<?> collection) {
boolean setChanged = false;
for (Object obj : collection) {
- if (this.remove(obj))
+ if (this.remove(obj)) {
setChanged = true;
+ }
}
return setChanged;
}
public E get(int index) {
- if (this.listSet.size() > index)
+ if (this.listSet.size() > index) {
return this.listSet.get(index);
- else
+ } else {
return null;
+ }
}
public List<E> getList() {
@@ -246,19 +255,21 @@ public class TimeEventWeightedHash {
}
public long getPathWeight() {
- if (this.greatestWieghtedParent != null)
+ if (this.greatestWieghtedParent != null) {
return te.getDuration()
- + this.greatestWieghtedParent.getPathWeight();
- else
+ + this.greatestWieghtedParent.getPathWeight();
+ } else {
return te.getDuration();
+ }
}
public double getPathPriorityWeight() {
- if (this.greatestWieghtedParent != null)
+ if (this.greatestWieghtedParent != null) {
return te.getPriority()
- + this.greatestWieghtedParent.getPathPriorityWeight();
- else
+ + this.greatestWieghtedParent.getPathPriorityWeight();
+ } else {
return te.getPriority();
+ }
}
public TimeEvent getTimeEvent() {
@@ -288,8 +299,9 @@ public class TimeEventWeightedHash {
long pPaW = parent.getPathWeight();
double gwpPiW = child.greatestWieghtedParent.getPathPriorityWeight();
double pPiW = parent.getPathPriorityWeight();
- if (pPaW > gwpPaW || (pPaW == gwpPaW && pPiW > gwpPiW))
+ if (pPaW > gwpPaW || (pPaW == gwpPaW && pPiW > gwpPiW)) {
child.greatestWieghtedParent = parent;
+ }
}
}
@@ -298,13 +310,15 @@ public class TimeEventWeightedHash {
}
public void addChildren(Collection<TimeEventNode> children) {
- for (TimeEventNode child : children)
+ for (TimeEventNode child : children) {
this.addChild(child);
+ }
}
public void addParents(Collection<TimeEventNode> parents) {
- for (TimeEventNode parent : parents)
+ for (TimeEventNode parent : parents) {
this.addParent(parent);
+ }
}
public MyLinkedHashSet<TimeEventNode> getChildren() {
@@ -319,8 +333,9 @@ public class TimeEventWeightedHash {
if (obj instanceof TimeEventNode) {
TimeEventNode ten = (TimeEventNode) obj;
return this.te.equals(ten.te);
- } else
+ } else {
return false;
+ }
}
public String toString() {
@@ -344,8 +359,9 @@ public class TimeEventWeightedHash {
private void setChild(WeightedNode child) {
this.child = child;
- if (child != null)
+ if (child != null) {
this.pathWeight = this.te.getDuration() + child.getPathWeight();
+ }
}
public TimeEvent getTimeEvent() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/Base64DecodingInputStream.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/Base64DecodingInputStream.java b/commons/src/main/java/org/apache/oodt/commons/io/Base64DecodingInputStream.java
index 4cd3c3d..a6c951c 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/Base64DecodingInputStream.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/Base64DecodingInputStream.java
@@ -44,7 +44,9 @@ public class Base64DecodingInputStream extends FilterInputStream {
* @throws IOException If an I/O error occurs.
*/
public int read() throws IOException {
- if (in == null) throw new IOException("Can't read from a closed stream");
+ if (in == null) {
+ throw new IOException("Can't read from a closed stream");
+ }
// If we've used up the decoded data buffer, read 4 more bytes and decode 'em.
if (buffer == null || index == buffer.length) {
@@ -56,8 +58,11 @@ public class Base64DecodingInputStream extends FilterInputStream {
while (toRead > 0) {
actuallyGot = in.read(streamBuf, atIndex, toRead);
if (actuallyGot == -1) {
- if (firstRead) return -1;
- else break;
+ if (firstRead) {
+ return -1;
+ } else {
+ break;
+ }
}
firstRead = false;
atIndex += actuallyGot;
@@ -85,23 +90,35 @@ public class Base64DecodingInputStream extends FilterInputStream {
* @throws IOException If an I/O error occurs.
*/
public int read(byte[] b, int offset, int length) throws IOException {
- if (b == null) throw new IllegalArgumentException("Can't read data into a null array");
- if (offset < 0 || offset >= b.length)
- throw new IndexOutOfBoundsException("Can't read data into an array with indexes 0.." + (b.length-1)
- + " at index " + offset);
- if (length < 0) throw new IllegalArgumentException("Can't read a negative amount of data");
- if (offset + length > b.length)
- throw new IndexOutOfBoundsException("Can't read data past the right edge of an array");
- if (in == null) throw new IOException("Can't read from a closed stream");
+ if (b == null) {
+ throw new IllegalArgumentException("Can't read data into a null array");
+ }
+ if (offset < 0 || offset >= b.length) {
+ throw new IndexOutOfBoundsException("Can't read data into an array with indexes 0.." + (b.length - 1)
+ + " at index " + offset);
+ }
+ if (length < 0) {
+ throw new IllegalArgumentException("Can't read a negative amount of data");
+ }
+ if (offset + length > b.length) {
+ throw new IndexOutOfBoundsException("Can't read data past the right edge of an array");
+ }
+ if (in == null) {
+ throw new IOException("Can't read from a closed stream");
+ }
int c = read();
- if (c == -1) return -1;
+ if (c == -1) {
+ return -1;
+ }
b[offset] = (byte) c;
int i = 1;
try {
for (; i < length; ++i) {
c = read();
- if (c == -1) break;
+ if (c == -1) {
+ break;
+ }
b[offset + i] = (byte) c;
}
} catch (IOException ignore) {}
@@ -117,10 +134,14 @@ public class Base64DecodingInputStream extends FilterInputStream {
* @throws IOException If an I/O error occurs.
*/
public long skip(long n) throws IOException {
- if (in == null) throw new IOException("Can't skip past data on a closed stream");
+ if (in == null) {
+ throw new IOException("Can't skip past data on a closed stream");
+ }
int actuallySkipped = 0;
while (n > 0) {
- if (read() == -1) return actuallySkipped;
+ if (read() == -1) {
+ return actuallySkipped;
+ }
--n;
++actuallySkipped;
}
@@ -134,9 +155,12 @@ public class Base64DecodingInputStream extends FilterInputStream {
* @throws IOException If an I/O error occurs.
*/
public int available() throws IOException {
- if (in == null) throw new IOException("Can't see how many bytes are available on a closed stream");
- if (buffer != null && index < buffer.length)
- return buffer.length - index;
+ if (in == null) {
+ throw new IOException("Can't see how many bytes are available on a closed stream");
+ }
+ if (buffer != null && index < buffer.length) {
+ return buffer.length - index;
+ }
return in.available() >= 4? 1 : 0;
}
@@ -145,7 +169,9 @@ public class Base64DecodingInputStream extends FilterInputStream {
* @throws IOException If an I/O error occurs.
*/
public void close() throws IOException {
- if (in == null) throw new IOException("Can't close a closed stream");
+ if (in == null) {
+ throw new IOException("Can't close a closed stream");
+ }
in.close();
in = null;
buffer = null;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/Base64EncodingOutputStream.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/Base64EncodingOutputStream.java b/commons/src/main/java/org/apache/oodt/commons/io/Base64EncodingOutputStream.java
index 0841313..6b062fc 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/Base64EncodingOutputStream.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/Base64EncodingOutputStream.java
@@ -44,10 +44,13 @@ public class Base64EncodingOutputStream extends FilterOutputStream {
* @throws IOException If an I/O error occurs.
*/
public void write(int b) throws IOException {
- if (buffer == null)
- throw new IOException("Can't write onto a closed stream");
+ if (buffer == null) {
+ throw new IOException("Can't write onto a closed stream");
+ }
buffer[index++] = (byte) b;
- if (index == buffer.length) shipout();
+ if (index == buffer.length) {
+ shipout();
+ }
}
/** Write a bunch of bytes.
@@ -60,15 +63,22 @@ public class Base64EncodingOutputStream extends FilterOutputStream {
* @throws IOException If an I/O error occurs.
*/
public void write(byte[] b, int offset, int length) throws IOException {
- if (b == null) throw new IllegalArgumentException("Can't write a null array");
- if (offset < 0 || offset >= b.length)
- throw new IndexOutOfBoundsException("Can't get bytes at " + offset + " in array with indexes 0.."
- + (b.length - 1));
- if (length < 0) throw new IllegalArgumentException("Can't write a negative amount of bytes");
- if (offset + length > b.length)
- throw new IndexOutOfBoundsException("Can't get bytes beyond edge of array");
- if (buffer == null)
- throw new IOException("Can't write onto a closed stream");
+ if (b == null) {
+ throw new IllegalArgumentException("Can't write a null array");
+ }
+ if (offset < 0 || offset >= b.length) {
+ throw new IndexOutOfBoundsException("Can't get bytes at " + offset + " in array with indexes 0.."
+ + (b.length - 1));
+ }
+ if (length < 0) {
+ throw new IllegalArgumentException("Can't write a negative amount of bytes");
+ }
+ if (offset + length > b.length) {
+ throw new IndexOutOfBoundsException("Can't get bytes beyond edge of array");
+ }
+ if (buffer == null) {
+ throw new IOException("Can't write onto a closed stream");
+ }
while (length > 0) {
int avail = buffer.length - index;
int amount = avail < length? avail : length;
@@ -76,7 +86,9 @@ public class Base64EncodingOutputStream extends FilterOutputStream {
index += amount;
offset += amount;
length -= amount;
- if (index == buffer.length) shipout();
+ if (index == buffer.length) {
+ shipout();
+ }
}
}
@@ -88,8 +100,9 @@ public class Base64EncodingOutputStream extends FilterOutputStream {
* @throws IOException If an I/O error occurs.
*/
public void flush() throws IOException {
- if (buffer == null)
- throw new IOException("Can't flush a closed stream");
+ if (buffer == null) {
+ throw new IOException("Can't flush a closed stream");
+ }
shipout();
out.flush();
}
@@ -102,8 +115,9 @@ public class Base64EncodingOutputStream extends FilterOutputStream {
* @throws IOException If an I/O error occurs.
*/
public void close() throws IOException {
- if (buffer == null)
- throw new IOException("Can't close an already closed stream");
+ if (buffer == null) {
+ throw new IOException("Can't close an already closed stream");
+ }
flush();
out.close();
out = null;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/FixedBufferOutputStream.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/FixedBufferOutputStream.java b/commons/src/main/java/org/apache/oodt/commons/io/FixedBufferOutputStream.java
index 4c6217e..ba311e2 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/FixedBufferOutputStream.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/FixedBufferOutputStream.java
@@ -31,7 +31,9 @@ public class FixedBufferOutputStream extends OutputStream {
* @param n Size of the buffer.
*/
public FixedBufferOutputStream(int n) {
- if (n < 0) throw new IllegalArgumentException("Buffer size must be nonnegative");
+ if (n < 0) {
+ throw new IllegalArgumentException("Buffer size must be nonnegative");
+ }
buffer = new byte[n];
length = n;
size = 0;
@@ -40,10 +42,12 @@ public class FixedBufferOutputStream extends OutputStream {
public void write(int b) throws IOException {
checkIfClosed();
- if (length == 0) return;
- if (size < length)
- buffer[size++] = (byte) b;
- else {
+ if (length == 0) {
+ return;
+ }
+ if (size < length) {
+ buffer[size++] = (byte) b;
+ } else {
buffer[start] = (byte) b;
start = (start + 1) % length;
}
@@ -51,8 +55,9 @@ public class FixedBufferOutputStream extends OutputStream {
public void write(byte[] a, int off, int len) throws IOException {
checkIfClosed();
- if (a == null) throw new NullPointerException("Can't write from a null array");
- else if ((off < 0) || (off > a.length) || (len < 0) || ((off + len) > a.length) || ((off + len) < 0)) {
+ if (a == null) {
+ throw new NullPointerException("Can't write from a null array");
+ } else if ((off < 0) || (off > a.length) || (len < 0) || ((off + len) > a.length) || ((off + len) < 0)) {
throw new IndexOutOfBoundsException("Offset " + off + " and length " + len + " not within array bounds");
} else if (len == 0) {
return;
@@ -69,8 +74,9 @@ public class FixedBufferOutputStream extends OutputStream {
if (remaining > 0) {
System.arraycopy(a, off + insertionLength, buffer, 0, remaining);
start = remaining;
- } else if (capacity == 0)
- start = insertionIndex + insertionLength;
+ } else if (capacity == 0) {
+ start = insertionIndex + insertionLength;
+ }
size = Math.min(length, size + len);
}
@@ -102,7 +108,9 @@ public class FixedBufferOutputStream extends OutputStream {
* @throws IOException If this stream has been closed.
*/
private void checkIfClosed() throws IOException {
- if (start == -1) throw new IOException("Can't write to closed stream");
+ if (start == -1) {
+ throw new IOException("Can't write to closed stream");
+ }
}
/** Length of the buffer. */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/Log.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/Log.java b/commons/src/main/java/org/apache/oodt/commons/io/Log.java
index cb4ee3b..2aa711c 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/Log.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/Log.java
@@ -108,10 +108,11 @@ public class Log {
* @return A writer with which you can log messages.
*/
public static LogWriter get() {
- if (lastWriter != null && !lastWriter.isFlushed())
- return lastWriter;
- else
- return get(new Date(), getDefaultSource(), getDefaultCategory());
+ if (lastWriter != null && !lastWriter.isFlushed()) {
+ return lastWriter;
+ } else {
+ return get(new Date(), getDefaultSource(), getDefaultCategory());
+ }
}
/** Get a writer to log messages.
@@ -154,8 +155,9 @@ public class Log {
LogEvent event = null;
for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
// Lazily create the event.
- if (event == null)
- event = new LogEvent(stream, timestamp, source);
+ if (event == null) {
+ event = new LogEvent(stream, timestamp, source);
+ }
((LogListener) e.nextElement()).streamStarted(event);
}
}
@@ -170,8 +172,9 @@ public class Log {
LogEvent event = null;
for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
// Lazily create the event.
- if (event == null)
- event = new LogEvent(stream);
+ if (event == null) {
+ event = new LogEvent(stream);
+ }
((LogListener) e.nextElement()).streamStopped(event);
}
}
@@ -190,8 +193,9 @@ public class Log {
LogEvent event = null;
for (Enumeration e = listeners.elements(); e.hasMoreElements();) {
// Lazily create the event.
- if (event == null)
- event = new LogEvent(timestamp, source, category, message);
+ if (event == null) {
+ event = new LogEvent(timestamp, source, category, message);
+ }
((LogListener) e.nextElement()).messageLogged(event);
}
}
@@ -203,8 +207,9 @@ public class Log {
* @param source The new default source label.
*/
public static void setDefaultSource(String source) {
- if (source == null)
- throw new IllegalArgumentException("Can't set a null default source");
+ if (source == null) {
+ throw new IllegalArgumentException("Can't set a null default source");
+ }
defaultSource = source;
}
@@ -223,8 +228,9 @@ public class Log {
* @param category The new default category object.
*/
public static void setDefaultCategory(Object category) {
- if (category == null)
- throw new IllegalArgumentException("Can't set a null default category");
+ if (category == null) {
+ throw new IllegalArgumentException("Can't set a null default category");
+ }
defaultCategory = category;
}
@@ -244,8 +250,9 @@ public class Log {
* @param listener The listener to add.
*/
public static void addLogListener(LogListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Can't add a null log listener");
+ if (listener == null) {
+ throw new IllegalArgumentException("Can't add a null log listener");
+ }
listeners.addElement(listener);
}
@@ -256,8 +263,9 @@ public class Log {
* @param listener The listener to remove.
*/
public static void removeLogListener(LogListener listener) {
- if (listener == null)
- throw new IllegalArgumentException("Can't remove a null log listener");
+ if (listener == null) {
+ throw new IllegalArgumentException("Can't remove a null log listener");
+ }
listeners.removeElement(listener);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/LogFilter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/LogFilter.java b/commons/src/main/java/org/apache/oodt/commons/io/LogFilter.java
index 9e5d085..0eb17e7 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/LogFilter.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/LogFilter.java
@@ -50,11 +50,14 @@ public class LogFilter implements LogListener {
* is false).
*/
public LogFilter(LogListener listener, boolean passThrough, Object[] categories) {
- if (listener == null)
- throw new IllegalArgumentException("Can't filter messages to a null listener");
+ if (listener == null) {
+ throw new IllegalArgumentException("Can't filter messages to a null listener");
+ }
this.listener = listener;
this.passThrough = passThrough;
- if (categories == null) return;
+ if (categories == null) {
+ return;
+ }
for (Object category : categories) {
this.categories.put(category, DUMMY);
}
@@ -116,8 +119,9 @@ public class LogFilter implements LogListener {
*/
public void messageLogged(LogEvent event) {
boolean found = categories.containsKey(event.getCategory());
- if ((passThrough && !found) || (!passThrough && found))
- listener.messageLogged(event);
+ if ((passThrough && !found) || (!passThrough && found)) {
+ listener.messageLogged(event);
+ }
}
/** Ignore this event.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java b/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java
index 6dc1439..d6d89ee 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/LogWriter.java
@@ -58,7 +58,9 @@ public class LogWriter extends java.io.Writer {
* @param c The character to write.
*/
public void write(int c) {
- if (buf == null) return;
+ if (buf == null) {
+ return;
+ }
buf.append((char) c);
}
@@ -71,10 +73,13 @@ public class LogWriter extends java.io.Writer {
* @param length How many characters to write.
*/
public void write(char[] array, int offset, int length) {
- if (buf == null || length == 0) return;
- if (offset < 0 || offset > array.length || length < 0 || (offset+length) > array.length || (offset+length) < 0)
- throw new IndexOutOfBoundsException("Can't write " + length + " characters at " + offset
- + " from array whose length is " + array.length);
+ if (buf == null || length == 0) {
+ return;
+ }
+ if (offset < 0 || offset > array.length || length < 0 || (offset+length) > array.length || (offset+length) < 0) {
+ throw new IndexOutOfBoundsException("Can't write " + length + " characters at " + offset
+ + " from array whose length is " + array.length);
+ }
buf.append(array, offset, length);
}
@@ -98,7 +103,9 @@ public class LogWriter extends java.io.Writer {
* @param length How many characters to write.
*/
public void write(String string, int offset, int length) {
- if (buf == null || length == 0) return;
+ if (buf == null || length == 0) {
+ return;
+ }
buf.append(string.substring(offset, offset + length));
}
@@ -117,7 +124,9 @@ public class LogWriter extends java.io.Writer {
* This sends any text sent to the writer on its way to the logging facility, and beyond.
*/
public void flush() {
- if (buf == null) return;
+ if (buf == null) {
+ return;
+ }
Log.logMessage(timestamp, source, category, buf.toString());
buf.setLength(0);
flushed = true;
@@ -203,7 +212,9 @@ public class LogWriter extends java.io.Writer {
* @param s The <code>String</code> to print.
*/
public void print(String s) {
- if (s == null) s = "null";
+ if (s == null) {
+ s = "null";
+ }
write(s);
}
@@ -312,9 +323,9 @@ public class LogWriter extends java.io.Writer {
}
public void println(Throwable t) {
- if (t == null)
- println("Null throwable");
- else {
+ if (t == null) {
+ println("Null throwable");
+ } else {
StackTraceElement[] frames = t.getStackTrace();
println(t.getClass().getName() + ":");
for (StackTraceElement frame : frames) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/NullInputStream.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/NullInputStream.java b/commons/src/main/java/org/apache/oodt/commons/io/NullInputStream.java
index dae6dab..9cd61a9 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/NullInputStream.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/NullInputStream.java
@@ -54,7 +54,9 @@ public final class NullInputStream extends InputStream {
* @throws IOException If we're not open.
*/
private void checkOpen() throws IOException {
- if (!open) throw new IOException("Stream closed");
+ if (!open) {
+ throw new IOException("Stream closed");
+ }
}
/** Is the stream open? */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/NullOutputStream.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/NullOutputStream.java b/commons/src/main/java/org/apache/oodt/commons/io/NullOutputStream.java
index d7a332d..0ae65ec 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/NullOutputStream.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/NullOutputStream.java
@@ -47,12 +47,13 @@ public class NullOutputStream extends OutputStream {
* @throws IOException If the stream is closed.
*/
public void write(byte[] a, int offset, int length) throws IOException {
- if (a == null)
- throw new NullPointerException("Can't write a null array");
- else if ((offset < 0) || (offset > a.length) || (length < 0) || ((offset + length) > a.length)
- || ((offset + length) < 0))
- throw new IndexOutOfBoundsException("Offset " + offset + " and length " + length
- + " not in array of length " + a.length);
+ if (a == null) {
+ throw new NullPointerException("Can't write a null array");
+ } else if ((offset < 0) || (offset > a.length) || (length < 0) || ((offset + length) > a.length)
+ || ((offset + length) < 0)) {
+ throw new IndexOutOfBoundsException("Offset " + offset + " and length " + length
+ + " not in array of length " + a.length);
+ }
checkOpen();
}
@@ -78,7 +79,9 @@ public class NullOutputStream extends OutputStream {
* @throws IOException If we're not open.
*/
private void checkOpen() throws IOException {
- if (!open) throw new IOException("Stream closed");
+ if (!open) {
+ throw new IOException("Stream closed");
+ }
}
/** Is the output stream open? */
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/io/WriterLogger.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/io/WriterLogger.java b/commons/src/main/java/org/apache/oodt/commons/io/WriterLogger.java
index 1ce6f6f..4ce802c 100644
--- a/commons/src/main/java/org/apache/oodt/commons/io/WriterLogger.java
+++ b/commons/src/main/java/org/apache/oodt/commons/io/WriterLogger.java
@@ -68,8 +68,9 @@ public class WriterLogger implements LogListener {
* logged. If false, don't call flush.
*/
public WriterLogger(Writer writer, boolean autoFlush) {
- if (writer == null)
- throw new IllegalArgumentException("Can't write to a null writer");
+ if (writer == null) {
+ throw new IllegalArgumentException("Can't write to a null writer");
+ }
this.writer = writer;
this.autoFlush = autoFlush;
this.lineSep = System.getProperty("line.separator", "\n");
@@ -81,7 +82,9 @@ public class WriterLogger implements LogListener {
* are ignored and not written.
*/
public final void close() {
- if (writer == null) return;
+ if (writer == null) {
+ return;
+ }
try {
writer.close();
} catch (IOException ignore) {}
@@ -96,11 +99,15 @@ public class WriterLogger implements LogListener {
* @param event The event describing the message that was logged.
*/
public final void messageLogged(LogEvent event) {
- if (writer == null) return;
+ if (writer == null) {
+ return;
+ }
try {
writer.write(formatMessage(event.getTimestamp(), (String) event.getSource(), event.getCategory(),
event.getMessage()) + lineSep);
- if (autoFlush) writer.flush();
+ if (autoFlush) {
+ writer.flush();
+ }
} catch (IOException ignore) {}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/object/jndi/HTTPContext.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/object/jndi/HTTPContext.java b/commons/src/main/java/org/apache/oodt/commons/object/jndi/HTTPContext.java
index d164f99..b4a5cad 100644
--- a/commons/src/main/java/org/apache/oodt/commons/object/jndi/HTTPContext.java
+++ b/commons/src/main/java/org/apache/oodt/commons/object/jndi/HTTPContext.java
@@ -42,8 +42,9 @@ public class HTTPContext implements Context {
* @param environment Its environment, currently unused.
*/
public HTTPContext(Hashtable environment) {
- if (environment == null)
- throw new IllegalArgumentException("Nonnull environment required; don't know why, but it is");
+ if (environment == null) {
+ throw new IllegalArgumentException("Nonnull environment required; don't know why, but it is");
+ }
this.environment = (Hashtable) environment.clone();
}
@@ -97,8 +98,9 @@ public class HTTPContext implements Context {
}
public NamingEnumeration list(String name) throws NamingException {
- if (name.length() > 0)
- throw new NotContextException("Subcontexts not supported");
+ if (name.length() > 0) {
+ throw new NotContextException("Subcontexts not supported");
+ }
return new NamingEnumeration() {
public void close() {}
@@ -122,8 +124,9 @@ public class HTTPContext implements Context {
}
public NamingEnumeration listBindings(String name) throws NamingException {
- if (name.length() > 0)
- throw new NotContextException("Subcontexts not supported");
+ if (name.length() > 0) {
+ throw new NotContextException("Subcontexts not supported");
+ }
return new NamingEnumeration() {
public void close() {}
public boolean hasMore() {
@@ -189,17 +192,23 @@ public class HTTPContext implements Context {
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- if (environment == null) environment = new Hashtable();
+ if (environment == null) {
+ environment = new Hashtable();
+ }
return environment.put(propName, propVal);
}
public Object removeFromEnvironment(String propName) throws NamingException {
- if (environment == null) return null;
+ if (environment == null) {
+ return null;
+ }
return environment.remove(propName);
}
public Hashtable getEnvironment() throws NamingException {
- if (environment == null) return new Hashtable();
+ if (environment == null) {
+ return new Hashtable();
+ }
return (Hashtable) environment.clone();
}
@@ -218,12 +227,15 @@ public class HTTPContext implements Context {
* @throws InvalidNameException If <var>name</var>'s not an RMI object context name.
*/
protected void checkName(String name) throws InvalidNameException {
- if (name == null)
- throw new IllegalArgumentException("Can't check a null name");
- if (name.length() == 0)
- throw new InvalidNameException("Name's length is zero");
- if (name.startsWith("http:") || name.startsWith("https:"))
- return;
+ if (name == null) {
+ throw new IllegalArgumentException("Can't check a null name");
+ }
+ if (name.length() == 0) {
+ throw new InvalidNameException("Name's length is zero");
+ }
+ if (name.startsWith("http:") || name.startsWith("https:")) {
+ return;
+ }
throw new InvalidNameException("Not an HTTP name; try http://some.host/some-context/...");
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/commons/src/main/java/org/apache/oodt/commons/object/jndi/ObjectContext.java
----------------------------------------------------------------------
diff --git a/commons/src/main/java/org/apache/oodt/commons/object/jndi/ObjectContext.java b/commons/src/main/java/org/apache/oodt/commons/object/jndi/ObjectContext.java
index 9785694..a1518bf 100644
--- a/commons/src/main/java/org/apache/oodt/commons/object/jndi/ObjectContext.java
+++ b/commons/src/main/java/org/apache/oodt/commons/object/jndi/ObjectContext.java
@@ -63,12 +63,14 @@ class ObjectContext implements Context {
} catch (Throwable ignored) {}
String registryList = (String) (environment != null ? environment.get("rmiregistries") : null);
- if (registryList != null) for (Iterator i = Utility.parseCommaList(registryList); i.hasNext();) {
+ if (registryList != null) {
+ for (Iterator i = Utility.parseCommaList(registryList); i.hasNext(); ) {
Hashtable rmiEnv = (Hashtable) this.environment.clone();
URI uri = URI.create((String) i.next());
rmiEnv.put("host", uri.getHost());
rmiEnv.put("port", uri.getPort());
contexts.add(new RMIContext(rmiEnv));
+ }
}
Hashtable httpEnv = (Hashtable) this.environment.clone();
@@ -76,17 +78,19 @@ class ObjectContext implements Context {
String className = null;
for (Iterator i = org.apache.oodt.commons.util.Utility.parseCommaList(System.getProperty("org.apache.oodt.commons.object.contexts", ""));
- i.hasNext();) try {
+ i.hasNext();) {
+ try {
className = (String) i.next();
Class clazz = Class.forName(className);
contexts.add(clazz.newInstance());
- } catch (ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ex) {
System.err.println("Ignoring not-found context class `" + className + "': " + ex.getMessage());
- } catch (InstantiationException ex) {
+ } catch (InstantiationException ex) {
System.err.println("Ignoring non-instantiable context class `" + className + "': " + ex.getMessage());
- } catch (IllegalAccessException ex) {
+ } catch (IllegalAccessException ex) {
System.err.println("Ignoring context class `" + className + "' with non-accessible no-args c'tor: "
- + ex.getMessage());
+ + ex.getMessage());
+ }
}
installAliases();
@@ -116,12 +120,18 @@ class ObjectContext implements Context {
* @throws NamingException if an error occurs.
*/
public Object lookup(String name) throws NamingException {
- if (name == null) throw new IllegalArgumentException("Name required");
- if (name.length() == 0) return this;
+ if (name == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+ if (name.length() == 0) {
+ return this;
+ }
// Let alias redirection do its magic
String alias = aliases.getProperty(name);
- if (alias != null) name = alias;
+ if (alias != null) {
+ name = alias;
+ }
for (Object context : contexts) {
Context c = (Context) context;
@@ -140,18 +150,24 @@ class ObjectContext implements Context {
}
public synchronized void bind(String name, Object obj) throws NamingException {
- if (name == null) throw new IllegalArgumentException("Name required");
- if (name.length() == 0) throw new InvalidNameException("Cannot bind object named after context");
+ if (name == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+ if (name.length() == 0) {
+ throw new InvalidNameException("Cannot bind object named after context");
+ }
// If it's an alias name, stop here.
- if (aliases.containsKey(name))
- throw new NameAlreadyBoundException("Name \"" + name + "\" already bound as an aliased name");
+ if (aliases.containsKey(name)) {
+ throw new NameAlreadyBoundException("Name \"" + name + "\" already bound as an aliased name");
+ }
// Make sure it isn't bound anywhere
for (NamingEnumeration e = list(""); e.hasMore();) {
NameClassPair nameClassPair = (NameClassPair) e.next();
- if (name.equals(nameClassPair.getName()))
- throw new NameAlreadyBoundException("Name \"" + name + "\" already bound by a managed subcontext");
+ if (name.equals(nameClassPair.getName())) {
+ throw new NameAlreadyBoundException("Name \"" + name + "\" already bound by a managed subcontext");
+ }
}
doRebind(name, obj);
}
@@ -162,12 +178,17 @@ class ObjectContext implements Context {
/** {@inheritDoc} */
public synchronized void rebind(String name, Object obj) throws NamingException {
- if (name == null) throw new IllegalArgumentException("Name required");
- if (name.length() == 0) throw new InvalidNameException("Cannot rebind object named after context");
+ if (name == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+ if (name.length() == 0) {
+ throw new InvalidNameException("Cannot rebind object named after context");
+ }
// If it's an alias name, remove the alias
- if (aliases.containsKey(name))
- aliases.remove(name);
+ if (aliases.containsKey(name)) {
+ aliases.remove(name);
+ }
doRebind(name, obj);
}
@@ -189,7 +210,9 @@ class ObjectContext implements Context {
} catch (NamingException ignored) {
}
}
- if (!bound) throw new InvalidNameException("Name \"" + name + "\" not compatible with any managed subcontext");
+ if (!bound) {
+ throw new InvalidNameException("Name \"" + name + "\" not compatible with any managed subcontext");
+ }
}
public void rebind(Name name, Object obj) throws NamingException {
@@ -197,8 +220,12 @@ class ObjectContext implements Context {
}
public void unbind(String name) throws NamingException {
- if (name == null) throw new IllegalArgumentException("Name required");
- if (name.length() == 0) throw new InvalidNameException("Cannot unbind object named after context");
+ if (name == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+ if (name.length() == 0) {
+ throw new InvalidNameException("Cannot unbind object named after context");
+ }
// See if it's an aliased name
if (aliases.containsKey(name)) {
@@ -215,7 +242,9 @@ class ObjectContext implements Context {
} catch (NamingException ignore) {
}
}
- if (!unbound) throw new InvalidNameException("Name \"" + name + "\" not compatible with any managed subcontext");
+ if (!unbound) {
+ throw new InvalidNameException("Name \"" + name + "\" not compatible with any managed subcontext");
+ }
}
public void unbind(Name name) throws NamingException {
@@ -223,10 +252,12 @@ class ObjectContext implements Context {
}
public void rename(String oldName, String newName) throws NamingException {
- if (oldName == null || newName == null)
- throw new IllegalArgumentException("Name required");
- if (oldName.length() == 0 || newName.length() == 0)
- throw new InvalidNameException("Cannot rename object named after context");
+ if (oldName == null || newName == null) {
+ throw new IllegalArgumentException("Name required");
+ }
+ if (oldName.length() == 0 || newName.length() == 0) {
+ throw new InvalidNameException("Cannot rename object named after context");
+ }
// See if it's an aliased name
String oldValue = (String) aliases.remove(oldName);
@@ -244,7 +275,9 @@ class ObjectContext implements Context {
} catch (NamingException ignore) {
}
}
- if (!renamed) throw new InvalidNameException("Names not compatible with any managed subcontext");
+ if (!renamed) {
+ throw new InvalidNameException("Names not compatible with any managed subcontext");
+ }
}
public void rename(Name oldName, Name newName) throws NamingException {
@@ -258,13 +291,16 @@ class ObjectContext implements Context {
= eachContext.hasNext()? ((Context) eachContext.next()).list(name) : null;
private boolean open = true;
public Object next() throws NamingException {
- if (!open) throw new NamingException("closed");
- if (enumeration != null && enumeration.hasMore())
- return enumeration.next();
- else if (eachContext.hasNext()) {
+ if (!open) {
+ throw new NamingException("closed");
+ }
+ if (enumeration != null && enumeration.hasMore()) {
+ return enumeration.next();
+ } else if (eachContext.hasNext()) {
enumeration = ((Context) eachContext.next()).list(name);
- if (enumeration.hasMore())
- return enumeration.next();
+ if (enumeration.hasMore()) {
+ return enumeration.next();
+ }
}
throw new NoSuchElementException("No more objects in context");
}
@@ -276,12 +312,14 @@ class ObjectContext implements Context {
return rc;
}
public boolean hasMore() throws NamingException {
- if (!open) return false;
- if (enumeration == null)
- return false;
- else if (enumeration.hasMore())
- return true;
- else if (eachContext.hasNext()) {
+ if (!open) {
+ return false;
+ }
+ if (enumeration == null) {
+ return false;
+ } else if (enumeration.hasMore()) {
+ return true;
+ } else if (eachContext.hasNext()) {
enumeration = ((Context) eachContext.next()).list(name);
return hasMore();
}
@@ -296,8 +334,9 @@ class ObjectContext implements Context {
}
public void close() throws NamingException {
open = false;
- if (enumeration != null)
- enumeration.close();
+ if (enumeration != null) {
+ enumeration.close();
+ }
}
};
}
@@ -313,13 +352,16 @@ class ObjectContext implements Context {
= eachContext.hasNext()? ((Context) eachContext.next()).listBindings(name) : null;
private boolean open = true;
public Object next() throws NamingException {
- if (!open) throw new NamingException("closed");
- if (enumeration != null && enumeration.hasMore())
- return enumeration.next();
- else if (eachContext.hasNext()) {
+ if (!open) {
+ throw new NamingException("closed");
+ }
+ if (enumeration != null && enumeration.hasMore()) {
+ return enumeration.next();
+ } else if (eachContext.hasNext()) {
enumeration = ((Context) eachContext.next()).listBindings(name);
- if (enumeration.hasMore())
- return enumeration.next();
+ if (enumeration.hasMore()) {
+ return enumeration.next();
+ }
}
throw new NoSuchElementException("No more objects in context");
}
@@ -331,12 +373,14 @@ class ObjectContext implements Context {
return rc;
}
public boolean hasMore() throws NamingException {
- if (!open) return false;
- if (enumeration == null)
- return false;
- else if (enumeration.hasMore())
- return true;
- else if (eachContext.hasNext()) {
+ if (!open) {
+ return false;
+ }
+ if (enumeration == null) {
+ return false;
+ } else if (enumeration.hasMore()) {
+ return true;
+ } else if (eachContext.hasNext()) {
enumeration = ((Context) eachContext.next()).listBindings(name);
return hasMore();
}
@@ -351,8 +395,9 @@ class ObjectContext implements Context {
}
public void close() throws NamingException {
open = false;
- if (enumeration != null)
- enumeration.close();
+ if (enumeration != null) {
+ enumeration.close();
+ }
}
};
}
@@ -405,17 +450,23 @@ class ObjectContext implements Context {
}
public Object addToEnvironment(String propName, Object propVal) throws NamingException {
- if (environment == null) environment = new Hashtable();
+ if (environment == null) {
+ environment = new Hashtable();
+ }
return environment.put(propName, propVal);
}
public Object removeFromEnvironment(String propName) throws NamingException {
- if (environment == null) return null;
+ if (environment == null) {
+ return null;
+ }
return environment.remove(propName);
}
public Hashtable getEnvironment() throws NamingException {
- if (environment == null) return new Hashtable();
+ if (environment == null) {
+ return new Hashtable();
+ }
return (Hashtable) environment.clone();
}
@@ -444,9 +495,12 @@ class ObjectContext implements Context {
throw new IllegalStateException("Cannot handle I/O exception reading alias file " + aliasFileName
+ ": " + ex.getMessage());
} finally {
- if (in != null) try {
+ if (in != null) {
+ try {
in.close();
- } catch (IOException ignore) {}
+ } catch (IOException ignore) {
+ }
+ }
}
}
}
[10/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
index 210dee3..0059fba 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/GraphView.java
@@ -144,12 +144,14 @@ public class GraphView extends DefaultTreeView {
this.myGraphListener = new MyGraphListener(state);
Rectangle visible = null;
- if (jgraph != null)
+ if (jgraph != null) {
visible = jgraph.getVisibleRect();
+ }
Cursor cursor = null;
- if (jgraph != null)
+ if (jgraph != null) {
cursor = jgraph.getCursor();
+ }
this.edgeMap = new HashMap<String, Pair>();
@@ -158,18 +160,22 @@ public class GraphView extends DefaultTreeView {
m_jgAdapter = new JungJGraphModelAdapter(directedGraph);
jgraph = new JGraph(m_jgAdapter);
- for (MouseListener ml : jgraph.getMouseListeners())
+ for (MouseListener ml : jgraph.getMouseListeners()) {
jgraph.removeMouseListener(ml);
- for (MouseMotionListener ml : jgraph.getMouseMotionListeners())
+ }
+ for (MouseMotionListener ml : jgraph.getMouseMotionListeners()) {
jgraph.removeMouseMotionListener(ml);
- for (MouseWheelListener ml : jgraph.getMouseWheelListeners())
+ }
+ for (MouseWheelListener ml : jgraph.getMouseWheelListeners()) {
jgraph.removeMouseWheelListener(ml);
+ }
jgraph.setBackground(Color.white);
jgraph.setAntiAliased(true);
jgraph.setMoveable(false);
String scale = state.getFirstPropertyValue(SCALE);
- if (scale == null)
+ if (scale == null) {
state.setProperty(SCALE, scale = "1.0");
+ }
jgraph.setScale(Double.parseDouble(scale));
DragSource dragSource = DragSource.getDefaultDragSource();
@@ -193,18 +199,19 @@ public class GraphView extends DefaultTreeView {
((ModelNode) ((DefaultGraphCell) moveCell)
.getUserObject()).getId());
- if (state.getMode() == View.Mode.MOVE)
+ if (state.getMode() == View.Mode.MOVE) {
moveCell = GraphView.this.m_jgAdapter
.getVertexCell((moveGraph = moveGraph.getRootParent())
.getModel());
- else if (GuiUtils.isDummyNode(moveGraph.getModel()))
+ } else if (GuiUtils.isDummyNode(moveGraph.getModel())) {
moveCell = GraphView.this.m_jgAdapter
.getVertexCell((moveGraph = moveGraph.getParent())
.getModel());
- else if (moveGraph.getModel().isRef()) {
+ } else if (moveGraph.getModel().isRef()) {
while (moveGraph.getParent() != null
- && moveGraph.getParent().getModel().isRef())
+ && moveGraph.getParent().getModel().isRef()) {
moveGraph = moveGraph.getParent();
+ }
moveCell = GraphView.this.m_jgAdapter
.getVertexCell(moveGraph.getModel());
}
@@ -229,10 +236,11 @@ public class GraphView extends DefaultTreeView {
public Object getTransferData(DataFlavor flavor)
throws UnsupportedFlavorException, IOException {
if (flavor.getHumanPresentableName().equals(
- DefaultGraphCell.class.getSimpleName()))
+ DefaultGraphCell.class.getSimpleName())) {
return this;
- else
+ } else {
throw new UnsupportedFlavorException(flavor);
+ }
}
public DataFlavor[] getTransferDataFlavors() {
@@ -253,8 +261,9 @@ public class GraphView extends DefaultTreeView {
public void dragDropEnd(DragSourceDropEvent dsde) {
System.out.println("DRAG END!!!!");
- if (moveCell == null)
+ if (moveCell == null) {
return;
+ }
Point dropPoint = new Point(dsde.getX()
- jgraph.getLocationOnScreen().x, dsde.getY()
- jgraph.getLocationOnScreen().y);
@@ -265,13 +274,15 @@ public class GraphView extends DefaultTreeView {
state.getGraphs(),
((ModelNode) endCell.getUserObject()).getId());
if (!endGraph.getModel().isParentType()
- || GuiUtils.isSubGraph(moveGraph, endGraph))
+ || GuiUtils.isSubGraph(moveGraph, endGraph)) {
return;
- if (moveGraph.getParent() == null)
+ }
+ if (moveGraph.getParent() == null) {
state.removeGraph(moveGraph);
- else
+ } else {
GuiUtils.removeNode(state.getGraphs(),
moveGraph.getModel());
+ }
GraphView.this.removeShift(state, moveGraph);
GuiUtils.addChild(state.getGraphs(), endGraph
.getModel().getId(), moveGraph);
@@ -352,12 +363,13 @@ public class GraphView extends DefaultTreeView {
- jgraph.getLocationOnScreen().x,
dsde.getY()
- jgraph.getLocationOnScreen().y);
- if (mouseOverCell != null)
+ if (mouseOverCell != null) {
mouseOverGraph = GuiUtils.find(state
.getGraphs(), ((ModelNode) mouseOverCell
.getUserObject()).getId());
- else
+ } else {
mouseOverGraph = null;
+ }
}
if (mouseOverGraph != null) {
if (GuiUtils.isDummyNode(mouseOverGraph
@@ -365,14 +377,16 @@ public class GraphView extends DefaultTreeView {
mouseOverGraph = mouseOverGraph.getParent();
} else {
while (mouseOverGraph != null
- && mouseOverGraph.getModel().isRef())
+ && mouseOverGraph.getModel().isRef()) {
mouseOverGraph = mouseOverGraph.getParent();
+ }
}
- if (mouseOverGraph != null)
+ if (mouseOverGraph != null) {
mouseOverCell = GraphView.this.m_jgAdapter
.getVertexCell(mouseOverGraph.getModel());
- else
+ } else {
mouseOverCell = null;
+ }
}
GraphView.this.jgraph
.setSelectionCells(new Object[] { mouseOverCell });
@@ -393,12 +407,14 @@ public class GraphView extends DefaultTreeView {
List<Line> lines = GuiUtils.findLines(state.getGraphs());
for (Line line : lines) {
- if (!this.directedGraph.containsVertex(line.getFromModel()))
+ if (!this.directedGraph.containsVertex(line.getFromModel())) {
this.directedGraph.addVertex(line.getFromModel());
+ }
if (line.getToModel() != null) {
- if (!this.directedGraph.containsVertex(line.getToModel()))
+ if (!this.directedGraph.containsVertex(line.getToModel())) {
this.directedGraph.addVertex(line.getToModel());
+ }
IdentifiableEdge edge = new IdentifiableEdge(line.getFromModel(), line.getToModel());
directedGraph.addEdge(edge, line.getFromModel(), line.getToModel());
this.edgeMap.put(edge.id, new Pair(line.getFromModel() != null ? line
@@ -423,8 +439,9 @@ public class GraphView extends DefaultTreeView {
}
String edgeDisplayMode = state.getFirstPropertyValue(EDGE_DISPLAY_MODE);
- if (edgeDisplayMode == null)
+ if (edgeDisplayMode == null) {
state.setProperty(EDGE_DISPLAY_MODE, edgeDisplayMode = WORKFLOW_MODE);
+ }
if (edgeDisplayMode.equals(WORKFLOW_MODE)) {
this.edgeMap = new HashMap<String, Pair>();
removeAllEdges(this.directedGraph);
@@ -443,12 +460,14 @@ public class GraphView extends DefaultTreeView {
if (graph != null) {
DefaultGraphCell cell = this.m_jgAdapter
.getVertexCell(graph.getModel());
- if (cell != null)
+ if (cell != null) {
this.jgraph.setSelectionCells(new Object[] { cell });
- else
+ } else {
this.jgraph.setSelectionCells(new Object[] {});
- } else
+ }
+ } else {
this.jgraph.setSelectionCells(new Object[] {});
+ }
} else {
this.jgraph.setSelectionCells(new Object[] {});
}
@@ -467,8 +486,9 @@ public class GraphView extends DefaultTreeView {
this.jgraph.scrollRectToVisible(visible);
}
- if (cursor != null)
+ if (cursor != null) {
this.jgraph.setCursor(cursor);
+ }
this.revalidate();
}
@@ -498,9 +518,10 @@ public class GraphView extends DefaultTreeView {
ArrayList<Point2D.Double> newPoints = new ArrayList<Point2D.Double>();
Point shift = this.getShift(state, (DefaultGraphCell) entry.getKey(),
nested);
- for (Point2D.Double point : points)
+ for (Point2D.Double point : points) {
newPoints
.add(new Point2D.Double(point.x + shift.x, point.y + shift.y));
+ }
((Map<Object, Object>) entry.getValue()).put("points", newPoints);
} else if (entry.getKey() instanceof DefaultGraphCell) {
DefaultGraphCell cell = (DefaultGraphCell) entry.getKey();
@@ -525,8 +546,9 @@ public class GraphView extends DefaultTreeView {
changed = false;
for (int i = 0; i < state.getGraphs().size(); i++) {
ModelGraph currentGraph = state.getGraphs().get(i);
- if (this.ensureNoInternalOverlap(currentGraph, nested))
+ if (this.ensureNoInternalOverlap(currentGraph, nested)) {
changed = true;
+ }
DefaultGraphCell currentCell = this.m_jgAdapter
.getVertexCell(currentGraph.getModel());
Rectangle2D currentBounds = (Rectangle2D) ((Map) nested
@@ -537,8 +559,9 @@ public class GraphView extends DefaultTreeView {
(int) (currentBounds.getY() + currentShift.getY()),
(int) currentBounds.getWidth(), (int) currentBounds.getHeight());
for (int j = 0; j < state.getGraphs().size(); j++) {
- if (i == j)
+ if (i == j) {
continue;
+ }
ModelGraph graph = state.getGraphs().get(j);
DefaultGraphCell cell = this.m_jgAdapter.getVertexCell(graph
.getModel());
@@ -617,11 +640,12 @@ public class GraphView extends DefaultTreeView {
.get(child1Cell)).get(GraphConstants.BOUNDS);
Rectangle2D child2Bounds = (Rectangle2D) ((Map) nested
.get(child2Cell)).get(GraphConstants.BOUNDS);
- if (graph.getModel().getExecutionType().equals("parallel"))
+ if (graph.getModel().getExecutionType().equals("parallel")) {
return Double.compare(child1Bounds.getMaxY(),
child2Bounds.getMaxY());
- else
+ } else {
return Double.compare(child1Bounds.getX(), child2Bounds.getX());
+ }
}
});
@@ -631,8 +655,9 @@ public class GraphView extends DefaultTreeView {
.get(GraphConstants.BOUNDS);
for (int i = 1; i < sortedChildren.size(); i++) {
ModelGraph child2 = sortedChildren.get(i);
- if (ensureNoInternalOverlap(child2, nested))
+ if (ensureNoInternalOverlap(child2, nested)) {
changed = true;
+ }
DefaultGraphCell child2Cell = this.m_jgAdapter.getVertexCell(child2
.getModel());
for (int j = i - 1; j >= 0; j--) {
@@ -690,8 +715,9 @@ public class GraphView extends DefaultTreeView {
private void addGroups(List<ModelGraph> modelGraphs, Map nested,
ViewState state) {
- for (ModelGraph modelGraph : modelGraphs)
+ for (ModelGraph modelGraph : modelGraphs) {
this.addGroups(modelGraph, nested, state);
+ }
}
private DefaultGraphCell addGroups(ModelGraph modelGraph, Map nested,
@@ -709,25 +735,31 @@ public class GraphView extends DefaultTreeView {
DefaultGraphCell curCell = addGroups(child, nested, state);
Rectangle2D bounds = (Rectangle2D) ((Map<Object, Object>) nested
.get(curCell)).get("bounds");
- if (bounds.getX() < top_x)
+ if (bounds.getX() < top_x) {
top_x = bounds.getX();
- if (bounds.getY() < top_y)
+ }
+ if (bounds.getY() < top_y) {
top_y = bounds.getY();
- if (bounds.getMaxX() > bottom_x)
+ }
+ if (bounds.getMaxX() > bottom_x) {
bottom_x = bounds.getMaxX();
- if (bounds.getMaxY() > bottom_y)
+ }
+ if (bounds.getMaxY() > bottom_y) {
bottom_y = bounds.getMaxY();
+ }
}
map.put(GraphConstants.BOUNDS, new AttributeMap.SerializableRectangle2D(
top_x - 5, top_y - 20, bottom_x - top_x + 10, bottom_y - top_y + 25));
map.put(GraphConstants.FOREGROUND, Color.black);
- if (modelGraph.getModel().isRef())
+ if (modelGraph.getModel().isRef()) {
map.put(GraphConstants.BACKGROUND, Color.lightGray);
- else
+ } else {
map.put(GraphConstants.BACKGROUND, Color.white);
- if (modelGraph.isExcused())
+ }
+ if (modelGraph.isExcused()) {
map.put(GraphConstants.GRADIENTCOLOR, Color.gray);
+ }
map.put(GraphConstants.HORIZONTAL_ALIGNMENT, SwingConstants.LEFT);
map.put(GraphConstants.VERTICAL_ALIGNMENT, SwingConstants.TOP);
map.put(GraphConstants.BORDER, new LineBorder(modelGraph.getModel()
@@ -740,18 +772,20 @@ public class GraphView extends DefaultTreeView {
.getModel());
((Map<Object, Object>) nested.get(cell)).put(GraphConstants.FOREGROUND,
Color.black);
- if (modelGraph.isExcused())
+ if (modelGraph.isExcused()) {
((Map<Object, Object>) nested.get(cell)).put(
GraphConstants.GRADIENTCOLOR, Color.gray);
- else
+ } else {
((Map<Object, Object>) nested.get(cell)).put(
GraphConstants.GRADIENTCOLOR, Color.white);
- if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef())
+ }
+ if (!((ModelNode) ((DefaultGraphCell) cell).getUserObject()).isRef()) {
((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
modelGraph.getModel().getColor());
- else
+ } else {
((Map<Object, Object>) nested.get(cell)).put(GraphConstants.BACKGROUND,
Color.lightGray);
+ }
return cell;
}
@@ -810,12 +844,14 @@ public class GraphView extends DefaultTreeView {
} else {
while (mouseOverGraph != null
&& mouseOverGraph.getParent() != null
- && mouseOverGraph.getParent().getModel().isRef())
+ && mouseOverGraph.getParent().getModel().isRef()) {
mouseOverGraph = mouseOverGraph.getParent();
+ }
}
- if (mouseOverGraph != null)
+ if (mouseOverGraph != null) {
mouseOverCell = GraphView.this.m_jgAdapter
.getVertexCell(mouseOverGraph.getModel());
+ }
}
state.setSelected(mouseOverGraph);
} else {
@@ -845,12 +881,15 @@ public class GraphView extends DefaultTreeView {
ModelGraph graph = GuiUtils.find(state.getGraphs(),
((ModelNode) ((DefaultGraphCell) cell).getUserObject())
.getId());
- if (graph.getModel().isRef())
+ if (graph.getModel().isRef()) {
while (graph.getParent() != null
- && graph.getParent().getModel().isRef())
+ && graph.getParent().getModel().isRef()) {
graph = graph.getParent();
- if (GuiUtils.isDummyNode(graph.getModel()))
+ }
+ }
+ if (GuiUtils.isDummyNode(graph.getModel())) {
graph = graph.getParent();
+ }
state.setSelected(graph);
GraphView.this.notifyListeners();
}
@@ -929,8 +968,9 @@ public class GraphView extends DefaultTreeView {
if (cell instanceof DefaultGraphCell) {
ModelGraph graph = GuiUtils.find(state.getGraphs(),
((ModelNode) ((DefaultGraphCell) cell).getUserObject()).getId());
- if (graph != null)
+ if (graph != null) {
graph.addChild(newGraph);
+ }
}
} else {
state.addGraph(newGraph);
@@ -964,11 +1004,12 @@ public class GraphView extends DefaultTreeView {
}
ModelGraph parent = GuiUtils.findRoot(state.getGraphs(), graph);
Point shiftPoint = null;
- if (state.containsProperty(parent.getModel().getId() + "/Shift"))
+ if (state.containsProperty(parent.getModel().getId() + "/Shift")) {
shiftPoint = new Point(Integer.parseInt(state
.getFirstPropertyValue(parent.getModel().getId() + "/Shift/x")),
Integer.parseInt(state.getFirstPropertyValue(parent.getModel()
- .getId() + "/Shift/y")));
+ .getId() + "/Shift/y")));
+ }
if (shiftPoint == null) {
shiftPoint = new Point(100, 100);
this.setShift(state, parent, shiftPoint);
@@ -1017,8 +1058,9 @@ public class GraphView extends DefaultTreeView {
.isCondition()));
} else {
boolean isCondition = false;
- if (state.getGraphs().size() > 0)
+ if (state.getGraphs().size() > 0) {
isCondition = state.getGraphs().get(0).isCondition();
+ }
viewReferrencedWorkflow.setEnabled(false);
taskItem.setEnabled(!isCondition);
condItem.setEnabled(isCondition);
@@ -1066,11 +1108,13 @@ public class GraphView extends DefaultTreeView {
ModelGraph graph = state.getSelected();
ModelGraph parent = graph.getParent();
if (e.getActionCommand().equals(TO_FRONT_ITEM_NAME)) {
- if (parent.getChildren().remove(graph))
+ if (parent.getChildren().remove(graph)) {
parent.getChildren().add(0, graph);
+ }
} else if (e.getActionCommand().equals(TO_BACK_ITEM_NAME)) {
- if (parent.getChildren().remove(graph))
+ if (parent.getChildren().remove(graph)) {
parent.getChildren().add(graph);
+ }
} else if (e.getActionCommand().equals(FORWARD_ITEM_NAME)) {
int index = parent.getChildren().indexOf(graph);
if (index != -1) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
index e5a28cf..3f7bd5f 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/perspective/view/impl/TreeProjectView.java
@@ -66,13 +66,15 @@ public class TreeProjectView extends MultiStateView {
this.selectedState = activeState;
DefaultMutableTreeNode selected = null;
DefaultMutableTreeNode root = new DefaultMutableTreeNode("Projects");
- for (ViewState state : states)
+ for (ViewState state : states) {
if (selectedState != null
- && state.getFile().equals(selectedState.getFile()))
+ && state.getFile().equals(selectedState.getFile())) {
root.add(selected = new DefaultMutableTreeNode(state.getFile()
- .getName()));
- else
+ .getName()));
+ } else {
root.add(new DefaultMutableTreeNode(state.getFile().getName()));
+ }
+ }
tree = new JTree(root);
tree.setEditable(true);
@@ -104,10 +106,11 @@ public class TreeProjectView extends MultiStateView {
for (ViewState state : states) {
if (state.getFile().getName().equals(stateName)) {
selectedState = state;
- if (e.getClickCount() == 2)
+ if (e.getClickCount() == 2) {
TreeProjectView.this
.notifyListeners(new ViewChange.NEW_ACTIVE_STATE(
selectedState, TreeProjectView.this));
+ }
break;
}
}
@@ -128,12 +131,13 @@ public class TreeProjectView extends MultiStateView {
}
});
- if (selected != null)
+ if (selected != null) {
tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
selected }));
- else if (states.size() > 0)
+ } else if (states.size() > 0) {
tree.setSelectionPath(new TreePath(new DefaultMutableTreeNode[] { root,
(DefaultMutableTreeNode) root.getChildAt(0) }));
+ }
tree.setRootVisible(false);
this.setBorder(new EtchedBorder());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
index c73a2d7..4e471bf 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/Tool.java
@@ -75,11 +75,12 @@ public abstract class Tool extends JPanel {
public void setSelected(boolean selected) {
if (image != null) {
Tool.this.removeAll();
- if (this.selected = selected)
+ if (this.selected = selected) {
Tool.this.add(new JLabel(new ImageIcon(selectedImage)),
BorderLayout.CENTER);
- else
+ } else {
Tool.this.add(new JLabel(new ImageIcon(image)), BorderLayout.CENTER);
+ }
Tool.this.revalidate();
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
index 6fac807..1f0d943 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/toolbox/ToolBox.java
@@ -62,9 +62,11 @@ public class ToolBox extends JPanel {
public void setSelected(Tool selectedTool) {
this.selectedTool = selectedTool;
this.selectedTool.setSelected(true);
- for (Tool tool : tools)
- if (!this.selectedTool.equals(tool))
+ for (Tool tool : tools) {
+ if (!this.selectedTool.equals(tool)) {
tool.setSelected(false);
+ }
+ }
}
public Tool getSelected() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
index 44e4f85..2faffb3 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/GuiUtils.java
@@ -45,17 +45,24 @@ public class GuiUtils {
protected static AtomicInteger dummyUntitledIter = new AtomicInteger(0);
public static boolean isSubGraph(ModelGraph graph, ModelGraph subGraph) {
- if (graph.equals(subGraph))
+ if (graph.equals(subGraph)) {
return true;
- for (ModelGraph child : graph.getChildren())
- if (isSubGraph(child, subGraph))
+ }
+ for (ModelGraph child : graph.getChildren()) {
+ if (isSubGraph(child, subGraph)) {
return true;
- if (graph.getPreConditions() != null)
- if (isSubGraph(graph.getPreConditions(), subGraph))
+ }
+ }
+ if (graph.getPreConditions() != null) {
+ if (isSubGraph(graph.getPreConditions(), subGraph)) {
return true;
- if (graph.getPostConditions() != null)
- if (isSubGraph(graph.getPostConditions(), subGraph))
+ }
+ }
+ if (graph.getPostConditions() != null) {
+ if (isSubGraph(graph.getPostConditions(), subGraph)) {
return true;
+ }
+ }
return false;
}
@@ -75,8 +82,9 @@ public class GuiUtils {
public static void addChild(List<ModelGraph> graphs, String parentId,
ModelGraph child) {
ModelGraph parent = find(graphs, parentId);
- if (parent != null)
+ if (parent != null) {
parent.addChild(child);
+ }
}
public static List<ModelGraph> findRootGraphs(List<ModelGraph> graphs) {
@@ -112,8 +120,9 @@ public class GuiUtils {
return rootGraph;
} else if (graph.getParent() != null) {
ModelGraph root = findRoot(rootGraphs, graph.getParent());
- if (root != null)
+ if (root != null) {
return root;
+ }
}
}
return null;
@@ -123,8 +132,9 @@ public class GuiUtils {
Vector<ModelGraph> foundGraphs = new Vector<ModelGraph>();
for (String id : ids) {
ModelGraph graph = find(graphs, id);
- if (graph != null)
+ if (graph != null) {
foundGraphs.add(graph);
+ }
}
return foundGraphs;
}
@@ -132,8 +142,9 @@ public class GuiUtils {
public static ModelGraph find(List<ModelGraph> graphs, String id) {
for (ModelGraph graph : graphs) {
ModelGraph found = graph.recursiveFind(id);
- if (found != null)
+ if (found != null) {
return found;
+ }
}
return null;
}
@@ -144,8 +155,9 @@ public class GuiUtils {
return graphs.remove(i);
} else {
ModelGraph graph = removeNode(graphs.get(i), node);
- if (graph != null)
+ if (graph != null) {
return graph;
+ }
}
}
return null;
@@ -161,10 +173,12 @@ public class GuiUtils {
return curGraph;
} else {
stack.addAll(curGraph.getChildren());
- if (curGraph.getPreConditions() != null)
+ if (curGraph.getPreConditions() != null) {
stack.add(curGraph.getPreConditions());
- if (curGraph.getPostConditions() != null)
+ }
+ if (curGraph.getPostConditions() != null) {
stack.add(curGraph.getPostConditions());
+ }
}
}
return null;
@@ -172,8 +186,9 @@ public class GuiUtils {
public static List<Line> findSequentialLines(List<ModelGraph> graphs) {
Vector<Line> lines = new Vector<Line>();
- for (ModelGraph graph : graphs)
+ for (ModelGraph graph : graphs) {
lines.addAll(findSequentialLines(graph));
+ }
return lines;
}
@@ -185,9 +200,10 @@ public class GuiUtils {
while (!stack.empty()) {
ModelGraph curGraph = stack.pop();
if (curGraph.getModel().getExecutionType().equals("sequential")) {
- for (int i = 0; i < curGraph.getChildren().size() - 1; i++)
+ for (int i = 0; i < curGraph.getChildren().size() - 1; i++) {
lines.add(new Line(curGraph.getChildren().get(i).getModel(),
curGraph.getChildren().get(i + 1).getModel()));
+ }
}
stack.addAll(curGraph.getChildren());
}
@@ -197,8 +213,9 @@ public class GuiUtils {
public static List<Line> findLines(final List<ModelGraph> graphs) {
Vector<Line> lines = new Vector<Line>();
- for (ModelGraph graph : graphs)
+ for (ModelGraph graph : graphs) {
lines.addAll(findLines(graph));
+ }
return lines;
}
@@ -211,8 +228,9 @@ public class GuiUtils {
ModelGraph curGraph = graphs.pop();
if (curGraph.getModel().isParentType()) {
- if (curGraph.getChildren().size() == 0)
+ if (curGraph.getChildren().size() == 0) {
curGraph.addChild(new ModelGraph(createDummyNode()));
+ }
List<Line> relaventLines = getRelaventLines(lines, curGraph
.getModel().getId());
@@ -222,43 +240,49 @@ public class GuiUtils {
.equals("sequential")) {
lines.remove(index);
if (curGraph.getChildren().size() > 0) {
- if (relaventLine.getFromModel().equals(curGraph.getModel()))
+ if (relaventLine.getFromModel().equals(curGraph.getModel())) {
lines.add(new Line(curGraph.getChildren()
- .get(curGraph.getChildren().size() - 1).getModel(),
+ .get(curGraph.getChildren().size() - 1).getModel(),
relaventLine.getToModel()));
- else
+ } else {
lines.add(new Line(relaventLine.getFromModel(), curGraph
.getChildren().get(0).getModel()));
+ }
}
} else if (curGraph.getModel().getExecutionType().toLowerCase()
.equals("parallel")) {
lines.remove(index);
- if (relaventLine.getFromModel().equals(curGraph.getModel()))
- for (ModelGraph child : curGraph.getChildren())
+ if (relaventLine.getFromModel().equals(curGraph.getModel())) {
+ for (ModelGraph child : curGraph.getChildren()) {
lines.add(new Line(child.getModel(), relaventLine
.getToModel()));
- else
- for (ModelGraph child : curGraph.getChildren())
+ }
+ } else {
+ for (ModelGraph child : curGraph.getChildren()) {
lines.add(new Line(relaventLine.getFromModel(), child
.getModel()));
+ }
+ }
}
}
if (curGraph.getModel().getExecutionType().toLowerCase()
.equals("sequential")) {
for (int i = 0; i < curGraph.getChildren().size(); i++) {
- if (i == curGraph.getChildren().size() - 1)
+ if (i == curGraph.getChildren().size() - 1) {
lines.add(new Line(curGraph.getChildren().get(i).getModel(),
null));
- else
+ } else {
lines.add(new Line(curGraph.getChildren().get(i).getModel(),
curGraph.getChildren().get(i + 1).getModel()));
+ }
}
} else if (curGraph.getModel().getExecutionType().toLowerCase()
.equals("parallel")) {
- for (int i = 0; i < curGraph.getChildren().size(); i++)
+ for (int i = 0; i < curGraph.getChildren().size(); i++) {
lines
.add(new Line(curGraph.getChildren().get(i).getModel(), null));
+ }
}
graphs.addAll(curGraph.getChildren());
}
@@ -299,44 +323,54 @@ public class GuiUtils {
public static Line getLine(List<Line> lines, ModelNode fromModel,
ModelNode toModel) {
- for (Line line : lines)
+ for (Line line : lines) {
if (line.getFromModel().equals(fromModel)
- && line.getToModel().equals(toModel))
+ && line.getToModel().equals(toModel)) {
return line;
+ }
+ }
return null;
}
public static List<Line> getRelaventLines(List<Line> lines, String id) {
List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines)
+ for (Line line : lines) {
if ((line.getFromModel() != null && line.getFromModel().getId()
- .equals(id))
- || (line.getToModel() != null && line.getToModel().getId().equals(id)))
+ .equals(id))
+ || (line.getToModel() != null && line.getToModel().getId().equals(id))) {
relaventLines.add(line);
+ }
+ }
return relaventLines;
}
public static List<Line> getChildrenLines(List<Line> lines, String id) {
List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines)
- if (line.getFromModel().getId().equals(id))
+ for (Line line : lines) {
+ if (line.getFromModel().getId().equals(id)) {
relaventLines.add(line);
+ }
+ }
return relaventLines;
}
public static List<Line> getParentLines(List<Line> lines, String id) {
List<Line> relaventLines = new Vector<Line>();
- for (Line line : lines)
- if (line.getToModel().getId().equals(id))
+ for (Line line : lines) {
+ if (line.getToModel().getId().equals(id)) {
relaventLines.add(line);
+ }
+ }
return relaventLines;
}
public static List<Line> getStartingLines(List<Line> lines) {
Vector<Line> startingLines = new Vector<Line>();
- for (Line line : lines)
- if (getParentLines(lines, line.getFromModel().getId()).size() == 0)
+ for (Line line : lines) {
+ if (getParentLines(lines, line.getFromModel().getId()).size() == 0) {
startingLines.add(line);
+ }
+ }
return startingLines;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
----------------------------------------------------------------------
diff --git a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
index 5f4c80a..6e9796b 100644
--- a/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
+++ b/app/weditor/src/main/java/org/apache/oodt/cas/workflow/gui/util/Line.java
@@ -49,17 +49,18 @@ public class Line {
public boolean equals(Object obj) {
if (obj instanceof Line) {
- if (this.fromModel == null && this.toModel == null)
+ if (this.fromModel == null && this.toModel == null) {
return ((Line) obj).fromModel == null && ((Line) obj).toModel == null;
- else if (this.fromModel == null)
+ } else if (this.fromModel == null) {
return ((Line) obj).fromModel == null
- && ((Line) obj).toModel.equals(this.toModel);
- else if (this.toModel == null)
+ && ((Line) obj).toModel.equals(this.toModel);
+ } else if (this.toModel == null) {
return ((Line) obj).fromModel.equals(this.fromModel)
- && ((Line) obj).toModel == null;
- else
+ && ((Line) obj).toModel == null;
+ } else {
return ((Line) obj).fromModel.equals(this.fromModel)
- && ((Line) obj).toModel.equals(this.toModel);
+ && ((Line) obj).toModel.equals(this.toModel);
+ }
} else {
return false;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
index 0585045..caff615 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/PagedQueryCliAction.java
@@ -38,10 +38,10 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException;
*/
public class PagedQueryCliAction extends CatalogServiceCliAction {
- protected int pageNum = -1;
- protected int pageSize = -1;
- protected String query;
- protected Set<String> catalogIds;
+ private int pageNum = -1;
+ private int pageSize = -1;
+ private String query;
+ private Set<String> catalogIds;
public void execute(ActionMessagePrinter printer)
throws CmdLineActionException {
@@ -93,4 +93,24 @@ public class PagedQueryCliAction extends CatalogServiceCliAction {
public void setCatalogIds(List<String> catalogIds) {
this.catalogIds = new HashSet<String>(catalogIds);
}
+
+ public int getPageNum() {
+ return pageNum;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public Set<String> getCatalogIds() {
+ return catalogIds;
+ }
+
+ public void setCatalogIds(Set<String> catalogIds) {
+ this.catalogIds = catalogIds;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
index 66f58d5..de9b59e 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/QueryCliAction.java
@@ -38,8 +38,8 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException;
*/
public class QueryCliAction extends CatalogServiceCliAction {
- protected String query;
- protected Set<String> catalogIds;
+ private String query;
+ private Set<String> catalogIds;
@Override
public void execute(ActionMessagePrinter printer)
@@ -80,4 +80,16 @@ public class QueryCliAction extends CatalogServiceCliAction {
public void setCatalogIds(List<String> catalogIds) {
this.catalogIds = new HashSet<String>(catalogIds);
}
+
+ public String getQuery() {
+ return query;
+ }
+
+ public Set<String> getCatalogIds() {
+ return catalogIds;
+ }
+
+ public void setCatalogIds(Set<String> catalogIds) {
+ this.catalogIds = catalogIds;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
index 5933682..b62a535 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedPagedQueryCliAction.java
@@ -40,11 +40,11 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException;
*/
public class ReducedPagedQueryCliAction extends CatalogServiceCliAction {
- protected int pageNum = -1;
- protected int pageSize = -1;
- protected String query;
- protected Set<String> catalogIds;
- protected List<String> termNames;
+ private int pageNum = -1;
+ private int pageSize = -1;
+ private String query;
+ private Set<String> catalogIds;
+ private List<String> termNames;
@Override
public void execute(ActionMessagePrinter printer)
@@ -102,4 +102,33 @@ public class ReducedPagedQueryCliAction extends CatalogServiceCliAction {
public void setReducedTerms(List<String> termNames) {
this.termNames = termNames;
}
+
+ public int getPageNum() {
+ return pageNum;
+ }
+
+ public int getPageSize() {
+ return pageSize;
+ }
+
+ public String getQuery() {
+ return query;
+ }
+
+ public Set<String> getCatalogIds() {
+ return catalogIds;
+ }
+
+ public void setCatalogIds(Set<String> catalogIds) {
+ this.catalogIds = catalogIds;
+ }
+
+ public List<String> getTermNames() {
+ return termNames;
+ }
+
+ public void setTermNames(List<String> termNames) {
+ this.termNames = termNames;
+ }
}
+
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
index 4411950..dd42147 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/cli/action/ReducedQueryCliAction.java
@@ -40,9 +40,9 @@ import org.apache.oodt.cas.cli.exception.CmdLineActionException;
*/
public class ReducedQueryCliAction extends CatalogServiceCliAction {
- protected String query;
- protected Set<String> catalogIds;
- protected List<String> termNames;
+ private String query;
+ private Set<String> catalogIds;
+ private List<String> termNames;
@Override
public void execute(ActionMessagePrinter printer)
@@ -87,4 +87,24 @@ public class ReducedQueryCliAction extends CatalogServiceCliAction {
public void setReducedTerms(List<String> termNames) {
this.termNames = termNames;
}
+
+ public String getQuery() {
+ return query;
+ }
+
+ public Set<String> getCatalogIds() {
+ return catalogIds;
+ }
+
+ public void setCatalogIds(Set<String> catalogIds) {
+ this.catalogIds = catalogIds;
+ }
+
+ public List<String> getTermNames() {
+ return termNames;
+ }
+
+ public void setTermNames(List<String> termNames) {
+ this.termNames = termNames;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
index 25ea22b..a17bfab 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/DataSourceIngestMapper.java
@@ -48,7 +48,7 @@ import org.apache.oodt.commons.date.DateUtils;
*/
public class DataSourceIngestMapper implements IngestMapper {
- protected DataSource dataSource;
+ private DataSource dataSource;
public DataSourceIngestMapper(String user, String pass, String driver,
String jdbcUrl) {
@@ -131,8 +131,10 @@ public class DataSourceIngestMapper implements IngestMapper {
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT CAT_SERV_TRANS_ID,CAT_SERV_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_TRANS_ID = '"+ catalogTransactionId + "' AND CATALOG_ID = '" + catalogId + "'");
- while(rs.next())
- return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_SERV_TRANS_ID"));
+ while(rs.next()) {
+ return ((TransactionIdFactory) Class.forName(rs.getString("CAT_SERV_TRANS_FACTORY")).newInstance())
+ .createTransactionId(rs.getString("CAT_SERV_TRANS_ID"));
+ }
return null;
}catch (Exception e) {
@@ -161,8 +163,10 @@ public class DataSourceIngestMapper implements IngestMapper {
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT CAT_TRANS_ID,CAT_TRANS_FACTORY FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "' AND CATALOG_ID = '" + catalogId + "'");
- while(rs.next())
- return ((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_TRANS_ID"));
+ while(rs.next()) {
+ return ((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance())
+ .createTransactionId(rs.getString("CAT_TRANS_ID"));
+ }
return null;
}catch (Exception e) {
@@ -192,8 +196,9 @@ public class DataSourceIngestMapper implements IngestMapper {
rs = stmt.executeQuery("SELECT CATALOG_ID FROM CatalogServiceMapper WHERE CAT_SERV_TRANS_ID = '"+ catalogServiceTransactionId + "'");
Set<String> catalogIds = new HashSet<String>();
- while(rs.next())
- catalogIds.add(rs.getString("CATALOG_ID"));
+ while(rs.next()) {
+ catalogIds.add(rs.getString("CATALOG_ID"));
+ }
return catalogIds;
}catch (Exception e) {
@@ -228,8 +233,10 @@ public class DataSourceIngestMapper implements IngestMapper {
+ "WHERE r >= " + ((indexPager.getPageSize() * indexPager.getPageNum()) + 1));
Set<TransactionId<?>> transactionIds = new HashSet<TransactionId<?>>();
- while(rs.next())
- transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance()).createTransactionId(rs.getString("CAT_TRANS_ID")));
+ while(rs.next()) {
+ transactionIds.add(((TransactionIdFactory) Class.forName(rs.getString("CAT_TRANS_FACTORY")).newInstance())
+ .createTransactionId(rs.getString("CAT_TRANS_ID")));
+ }
return transactionIds;
}catch (Exception e) {
@@ -339,4 +346,11 @@ public class DataSourceIngestMapper implements IngestMapper {
}
}
+ public DataSource getDataSource() {
+ return dataSource;
+ }
+
+ public void setDataSource(DataSource dataSource) {
+ this.dataSource = dataSource;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
index 872b7d7..dff1437 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/mapping/MemoryBasedIngestMapper.java
@@ -17,6 +17,12 @@
package org.apache.oodt.cas.catalog.mapping;
//JDK imports
+import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
+import org.apache.oodt.cas.catalog.page.CatalogReceipt;
+import org.apache.oodt.cas.catalog.page.IndexPager;
+import org.apache.oodt.cas.catalog.struct.TransactionId;
+import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
+
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -26,11 +32,6 @@ import java.util.logging.Level;
import java.util.logging.Logger;
//OODT imports
-import org.apache.oodt.cas.catalog.exception.CatalogRepositoryException;
-import org.apache.oodt.cas.catalog.page.CatalogReceipt;
-import org.apache.oodt.cas.catalog.page.IndexPager;
-import org.apache.oodt.cas.catalog.struct.TransactionId;
-import org.apache.oodt.cas.catalog.struct.TransactionIdFactory;
/**
* @author bfoster
@@ -87,10 +88,13 @@ public class MemoryBasedIngestMapper implements IngestMapper {
throws CatalogRepositoryException {
TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
.get(catalogServiceTransactionId.toString());
- if (mapping != null)
- for (CatalogReceipt receipt : mapping.getCatalogReceipts())
- if (receipt.getCatalogId().equals(catalogId))
- return receipt.getTransactionId();
+ if (mapping != null) {
+ for (CatalogReceipt receipt : mapping.getCatalogReceipts()) {
+ if (receipt.getCatalogId().equals(catalogId)) {
+ return receipt.getTransactionId();
+ }
+ }
+ }
return null;
}
@@ -105,9 +109,12 @@ public class MemoryBasedIngestMapper implements IngestMapper {
String catalogId) throws CatalogRepositoryException {
Set<TransactionId<?>> catalogTransactionIds = new HashSet<TransactionId<?>>();
List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogId);
- if (catalogReceipts != null)
- for (int i = indexPager.getPageNum() * indexPager.getPageSize(); i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++)
- catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId());
+ if (catalogReceipts != null) {
+ for (int i = indexPager.getPageNum() * indexPager.getPageSize();
+ i < catalogReceipts.size() && i < (indexPager.getPageNum() + 1) * indexPager.getPageSize(); i++) {
+ catalogTransactionIds.add(catalogReceipts.get(i).getTransactionId());
+ }
+ }
return catalogTransactionIds;
}
@@ -121,8 +128,9 @@ public class MemoryBasedIngestMapper implements IngestMapper {
if (catalogReceipts != null) {
for (CatalogReceipt catalogReceipt : catalogReceipts) {
TransactionIdMapping mapping = this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()));
- if (mapping != null)
- mapping.getCatalogReceipts().remove(catalogReceipt);
+ if (mapping != null) {
+ mapping.getCatalogReceipts().remove(catalogReceipt);
+ }
}
}
}
@@ -135,11 +143,13 @@ public class MemoryBasedIngestMapper implements IngestMapper {
TransactionId<?> catalogServiceTransactionId)
throws CatalogRepositoryException {
TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.remove(catalogServiceTransactionId.toString());
- if (mapping != null)
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
- this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt);
- this.catalogInfoKeyMapping.remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()));
- }
+ if (mapping != null) {
+ for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
+ this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId()).remove(catalogReceipt);
+ this.catalogInfoKeyMapping
+ .remove(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()));
+ }
+ }
}
/*
@@ -186,15 +196,17 @@ public class MemoryBasedIngestMapper implements IngestMapper {
throws CatalogRepositoryException {
TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
.get(catalogServiceTransactionId.toString());
- if (mapping == null)
- mapping = new TransactionIdMapping(catalogServiceTransactionId);
+ if (mapping == null) {
+ mapping = new TransactionIdMapping(catalogServiceTransactionId);
+ }
mapping.addCatalogReceipt(catalogReceipt);
this.catalogServiceTransactionIdKeyMapping.put(
catalogServiceTransactionId.toString(), mapping);
this.catalogInfoKeyMapping.put(generateKey(catalogReceipt.getTransactionId().toString(), catalogReceipt.getCatalogId()), mapping);
List<CatalogReceipt> catalogReceipts = this.catalogIdToCatalogReceiptMapping.get(catalogReceipt.getCatalogId());
- if (catalogReceipts == null)
- catalogReceipts = new Vector<CatalogReceipt>();
+ if (catalogReceipts == null) {
+ catalogReceipts = new Vector<CatalogReceipt>();
+ }
catalogReceipts.add(catalogReceipt);
this.catalogIdToCatalogReceiptMapping.put(catalogReceipt.getCatalogId(), catalogReceipts);
}
@@ -212,8 +224,9 @@ public class MemoryBasedIngestMapper implements IngestMapper {
HashSet<String> catalogs = new HashSet<String>();
TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping
.get(catalogServiceTransactionId.toString());
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts())
- catalogs.add(catalogReceipt.getCatalogId());
+ for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
+ catalogs.add(catalogReceipt.getCatalogId());
+ }
return catalogs;
}
@@ -221,9 +234,11 @@ public class MemoryBasedIngestMapper implements IngestMapper {
TransactionId<?> catalogServiceTransactionId, String catalogId)
throws CatalogRepositoryException {
TransactionIdMapping mapping = this.catalogServiceTransactionIdKeyMapping.get(catalogServiceTransactionId);
- for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts())
- if (catalogReceipt.getCatalogId().equals(catalogId))
- return catalogReceipt;
+ for (CatalogReceipt catalogReceipt : mapping.getCatalogReceipts()) {
+ if (catalogReceipt.getCatalogId().equals(catalogId)) {
+ return catalogReceipt;
+ }
+ }
return null;
}
@@ -231,10 +246,10 @@ public class MemoryBasedIngestMapper implements IngestMapper {
return catalogTransactionId + ":" + catalogId;
}
- private class TransactionIdMapping {
+ private static class TransactionIdMapping {
private TransactionId<?> catalogServiceTransactionId;
- List<CatalogReceipt> catalogReceipts;
+ private List<CatalogReceipt> catalogReceipts;
public TransactionIdMapping(TransactionId<?> catalogServiceTransactionId) {
this.catalogServiceTransactionId = catalogServiceTransactionId;
@@ -253,39 +268,9 @@ public class MemoryBasedIngestMapper implements IngestMapper {
return catalogServiceTransactionId;
}
+ public void setCatalogReceipts(List<CatalogReceipt> catalogReceipts) {
+ this.catalogReceipts = catalogReceipts;
+ }
}
-// private class CatalogInfo {
-//
-// private String catalogId;
-// private TransactionId<?> catalogTransactionId;
-//
-// public CatalogInfo(String catalogId,
-// TransactionId<?> catalogTransactionId) {
-// this.catalogId = catalogId;
-// this.catalogTransactionId = catalogTransactionId;
-// }
-//
-// public String getCatalogUrn() {
-// return this.catalogId;
-// }
-//
-// public TransactionId<?> getCatalogTransactionId() {
-// return this.catalogTransactionId;
-// }
-//
-// public boolean equals(Object obj) {
-// if (obj instanceof CatalogInfo) {
-// return this.toString().equals(obj.toString());
-// }else {
-// return false;
-// }
-// }
-//
-// public String toString() {
-// return this.catalogId + ":" + this.catalogTransactionId;
-// }
-//
-// }
-
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
index 4ba61a3..9c9045a 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/IndexPager.java
@@ -65,8 +65,9 @@ public class IndexPager {
}
public void incrementPageNumber() {
- if (this.pageNum + 1 <= this.totalPages)
- this.pageNum++;
+ if (this.pageNum + 1 <= this.totalPages) {
+ this.pageNum++;
+ }
}
public boolean isLastPage() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
index ddfffd3..af0f0f3 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/PageInfo.java
@@ -31,10 +31,11 @@ public class PageInfo {
public PageInfo(int pageSize, int pageNum) {
this.pageSize = pageSize;
- if (pageNum < 1)
- this.pageNum = 1;
- else
- this.pageNum = pageNum;
+ if (pageNum < 1) {
+ this.pageNum = 1;
+ } else {
+ this.pageNum = pageNum;
+ }
}
public int getPageSize() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
index d7f65da..59ff1f5 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/QueryPager.java
@@ -47,10 +47,12 @@ public class QueryPager extends IndexPager {
public void setPageInfo(PageInfo pageInfo) {
this.pageSize = Math.max(pageInfo.getPageSize(), 0);
this.totalPages = this.caculateTotalPages();
- if (this.totalPages == 0)
- this.pageNum = 0;
- else
- this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages) ? this.totalPages : pageInfo.getPageNum();
+ if (this.totalPages == 0) {
+ this.pageNum = 0;
+ } else {
+ this.pageNum = (pageInfo.getPageNum() == PageInfo.LAST_PAGE || pageInfo.getPageNum() >= this.totalPages)
+ ? this.totalPages : pageInfo.getPageNum();
+ }
}
public List<TransactionReceipt> getTransactionReceipts() {
@@ -59,9 +61,12 @@ public class QueryPager extends IndexPager {
public List<TransactionReceipt> getCurrentPage() {
List<TransactionReceipt> currentPage = new Vector<TransactionReceipt>();
- if (this.pageNum > 0)
- for (int i = (this.getPageNum() - 1) * this.getPageSize(); i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++)
- currentPage.add(receipts.get(i));
+ if (this.pageNum > 0) {
+ for (int i = (this.getPageNum() - 1) * this.getPageSize();
+ i < receipts.size() && i < this.getPageNum() * this.getPageSize(); i++) {
+ currentPage.add(receipts.get(i));
+ }
+ }
return currentPage;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
index f8e4848..9dfa440 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/page/TransactionReceipt.java
@@ -48,10 +48,11 @@ public class TransactionReceipt {
this.catalogReceipts = new Vector<CatalogReceipt>(catalogReceipts);
for (CatalogReceipt catalogReceipt : catalogReceipts) {
this.catalogIds.add(catalogReceipt.getCatalogId());
- if (this.transactionDate == null)
- this.transactionDate = catalogReceipt.getTransactionDate();
- else if (this.transactionDate.before(catalogReceipt.getTransactionDate()))
- this.transactionDate = catalogReceipt.getTransactionDate();
+ if (this.transactionDate == null) {
+ this.transactionDate = catalogReceipt.getTransactionDate();
+ } else if (this.transactionDate.before(catalogReceipt.getTransactionDate())) {
+ this.transactionDate = catalogReceipt.getTransactionDate();
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
index f294e01..049e821 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/ComparisonQueryExpression.java
@@ -35,20 +35,21 @@ public class ComparisonQueryExpression extends TermQueryExpression {
}
public static Operator getOperatorBySign(String sign) {
- if (EQUAL_TO.value.equals(sign))
- return EQUAL_TO;
- else if (LESS_THAN_EQUAL_TO.value.equals(sign))
- return LESS_THAN_EQUAL_TO;
- else if (GREATER_THAN_EQUAL_TO.value.equals(sign))
- return GREATER_THAN_EQUAL_TO;
- else if (LESS_THAN.value.equals(sign))
- return LESS_THAN;
- else if (GREATER_THAN.value.equals(sign))
- return GREATER_THAN;
- else if (LIKE.value.equals(sign))
- return LIKE;
- else
- throw new IllegalArgumentException("Not matching operator for '" + sign + "'");
+ if (EQUAL_TO.value.equals(sign)) {
+ return EQUAL_TO;
+ } else if (LESS_THAN_EQUAL_TO.value.equals(sign)) {
+ return LESS_THAN_EQUAL_TO;
+ } else if (GREATER_THAN_EQUAL_TO.value.equals(sign)) {
+ return GREATER_THAN_EQUAL_TO;
+ } else if (LESS_THAN.value.equals(sign)) {
+ return LESS_THAN;
+ } else if (GREATER_THAN.value.equals(sign)) {
+ return GREATER_THAN;
+ } else if (LIKE.value.equals(sign)) {
+ return LIKE;
+ } else {
+ throw new IllegalArgumentException("Not matching operator for '" + sign + "'");
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
index a39f263..544ef35 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/CustomQueryExpression.java
@@ -39,10 +39,11 @@ public class CustomQueryExpression extends QueryExpression {
public CustomQueryExpression(String name, Properties properties) {
super();
this.name = name;
- if (properties != null)
- this.properties = properties;
- else
- this.properties = new Properties();
+ if (properties != null) {
+ this.properties = properties;
+ } else {
+ this.properties = new Properties();
+ }
}
public String getName() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
index b7b58a6..01142a4 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/FreeTextQueryExpression.java
@@ -64,8 +64,9 @@ public class FreeTextQueryExpression extends TermQueryExpression {
List<String> values = new Vector<String>();
while (tok.hasMoreElements()) {
token = tok.nextToken();
- if (!noiseWordHash.contains(token))
- values.add(token);
+ if (!noiseWordHash.contains(token)) {
+ values.add(token);
+ }
}
if (values.size() > 0) {
values.addAll(this.term.getValues());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
index df16b6b..1a1fdac 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/QueryLogicalGroup.java
@@ -108,8 +108,9 @@ public class QueryLogicalGroup extends QueryExpression {
QueryLogicalGroup qlGroup = new QueryLogicalGroup();
qlGroup.setBucketNames(this.getBucketNames());
qlGroup.setOperator(this.operator);
- for (QueryExpression qe : this.queryExpressions)
- qlGroup.addExpression(qe.clone());
+ for (QueryExpression qe : this.queryExpressions) {
+ qlGroup.addExpression(qe.clone());
+ }
return qlGroup;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
index 29caf00..0802a9f 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/MetadataTimeEventQueryFilter.java
@@ -76,8 +76,9 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent>
}
public void setConverter(VersionConverter converter) {
- if (converter != null)
+ if (converter != null) {
this.converter = converter;
+ }
}
@Override
@@ -85,13 +86,15 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent>
List<MetadataTimeEvent> timeEvents = new Vector<MetadataTimeEvent>();
for (TransactionalMetadata transactionalMetadata : metadataList) {
double priority = 0;
- if (this.getPriorityMetKey() != null)
- priority = Double.parseDouble(transactionalMetadata.getMetadata().getMetadata(this.priorityMetKey));
+ if (this.getPriorityMetKey() != null) {
+ priority = Double.parseDouble(transactionalMetadata.getMetadata().getMetadata(this.priorityMetKey));
+ }
long startTime = Long.parseLong(transactionalMetadata.getMetadata().getMetadata(this.startDateTimeMetKey));
String endTimeString = transactionalMetadata.getMetadata().getMetadata(this.endDateTimeMetKey);
long endTime = startTime;
- if (endTimeString != null)
- endTime = Long.parseLong(endTimeString);
+ if (endTimeString != null) {
+ endTime = Long.parseLong(endTimeString);
+ }
timeEvents.add(new MetadataTimeEvent(startTime, endTime, priority, transactionalMetadata));
}
return Collections.unmodifiableList(timeEvents);
@@ -100,8 +103,9 @@ public class MetadataTimeEventQueryFilter extends QueryFilter<MetadataTimeEvent>
@Override
protected List<TransactionalMetadata> filterTypeToMetadata(List<MetadataTimeEvent> filterObjects) {
List<TransactionalMetadata> metadataList = new Vector<TransactionalMetadata>();
- for (MetadataTimeEvent timeEvent : filterObjects)
- metadataList.add(timeEvent.getTimeObject());
+ for (MetadataTimeEvent timeEvent : filterObjects) {
+ metadataList.add(timeEvent.getTimeObject());
+ }
return Collections.unmodifiableList(metadataList);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
index 80a649d..855454b 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/filter/time/conv/AsciiSortableVersionConverter.java
@@ -30,8 +30,9 @@ public class AsciiSortableVersionConverter implements VersionConverter {
public double convertToPriority(String version) {
double priority = 0;
char[] versionCharArray = version.toCharArray();
- for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--)
+ for (int i = 0, j = versionCharArray.length - 1; i < versionCharArray.length; i++, j--) {
priority += (((int) versionCharArray[i]) * Math.pow(10, j));
+ }
return priority;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
index a4ce38b..c892ccf 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/ParseException.java
@@ -107,7 +107,9 @@ public class ParseException extends Exception {
retval.append("Encountered \"");
Token tok = currentToken.next;
for (int i = 0; i < maxSize; i++) {
- if (i != 0) retval.append(" ");
+ if (i != 0) {
+ retval.append(" ");
+ }
if (tok.kind == 0) {
retval.append(tokenImage[0]);
break;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
index 73d8198..cd001a4 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/QueryParserTokenManager.java
@@ -15,8 +15,9 @@ private int jjStopStringLiteralDfa_0(int pos, long active0)
jjmatchedKind = 23;
return 16;
}
- if ((active0 & 0x80L) != 0L)
+ if ((active0 & 0x80L) != 0L) {
return 10;
+ }
return -1;
case 1:
if ((active0 & 0x18000L) != 0L)
@@ -41,8 +42,9 @@ private int jjStopStringLiteralDfa_0(int pos, long active0)
jjmatchedPos = 3;
return 16;
}
- if ((active0 & 0x10000L) != 0L)
+ if ((active0 & 0x10000L) != 0L) {
return 16;
+ }
return -1;
case 4:
if ((active0 & 0x8000L) != 0L)
@@ -165,16 +167,18 @@ private int jjMoveStringLiteralDfa1_0(long active0)
switch(curChar)
{
case 10:
- if ((active0 & 0x8L) != 0L)
+ if ((active0 & 0x8L) != 0L) {
return jjStopAtPos(1, 3);
+ }
break;
case 61:
- if ((active0 & 0x40000L) != 0L)
+ if ((active0 & 0x40000L) != 0L) {
return jjStopAtPos(1, 18);
- else if ((active0 & 0x80000L) != 0L)
+ } else if ((active0 & 0x80000L) != 0L) {
return jjStopAtPos(1, 19);
- else if ((active0 & 0x200000L) != 0L)
+ } else if ((active0 & 0x200000L) != 0L) {
return jjStopAtPos(1, 21);
+ }
break;
case 65:
return jjMoveStringLiteralDfa2_0(active0, 0x20L);
@@ -191,8 +195,9 @@ private int jjMoveStringLiteralDfa1_0(long active0)
}
private int jjMoveStringLiteralDfa2_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(0, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(0, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(1, active0);
@@ -215,8 +220,9 @@ private int jjMoveStringLiteralDfa2_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa3_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(1, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(1, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(2, active0);
@@ -225,14 +231,16 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0)
switch(curChar)
{
case 32:
- if ((active0 & 0x40L) != 0L)
+ if ((active0 & 0x40L) != 0L) {
return jjStopAtPos(3, 6);
+ }
break;
case 68:
return jjMoveStringLiteralDfa4_0(active0, 0x20L);
case 101:
- if ((active0 & 0x10000L) != 0L)
+ if ((active0 & 0x10000L) != 0L) {
return jjStartNfaWithStates_0(3, 16, 16);
+ }
break;
case 107:
return jjMoveStringLiteralDfa4_0(active0, 0x8000L);
@@ -243,8 +251,9 @@ private int jjMoveStringLiteralDfa3_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa4_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(2, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(2, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(3, active0);
@@ -253,8 +262,9 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0)
switch(curChar)
{
case 32:
- if ((active0 & 0x20L) != 0L)
+ if ((active0 & 0x20L) != 0L) {
return jjStopAtPos(4, 5);
+ }
break;
case 101:
return jjMoveStringLiteralDfa5_0(active0, 0x8000L);
@@ -265,8 +275,9 @@ private int jjMoveStringLiteralDfa4_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa5_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(3, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(3, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(4, active0);
@@ -283,8 +294,9 @@ private int jjMoveStringLiteralDfa5_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa6_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(4, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(4, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(5, active0);
@@ -301,8 +313,9 @@ private int jjMoveStringLiteralDfa6_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa7_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(5, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(5, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(6, active0);
@@ -319,8 +332,9 @@ private int jjMoveStringLiteralDfa7_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa8_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(6, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(6, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(7, active0);
@@ -337,8 +351,9 @@ private int jjMoveStringLiteralDfa8_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa9_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(7, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(7, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(8, active0);
@@ -355,8 +370,9 @@ private int jjMoveStringLiteralDfa9_0(long old0, long active0)
}
private int jjMoveStringLiteralDfa10_0(long old0, long active0)
{
- if (((active0 &= old0)) == 0L)
- return jjStartNfa_0(8, old0);
+ if (((active0 &= old0)) == 0L) {
+ return jjStartNfa_0(8, old0);
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) {
jjStopStringLiteralDfa_0(9, active0);
@@ -365,8 +381,9 @@ private int jjMoveStringLiteralDfa10_0(long old0, long active0)
switch(curChar)
{
case 115:
- if ((active0 & 0x8000L) != 0L)
+ if ((active0 & 0x8000L) != 0L) {
return jjStartNfaWithStates_0(10, 15, 16);
+ }
break;
default :
break;
@@ -413,8 +430,9 @@ private int jjMoveNfa_0(int startState, int curPos)
int j, kind = 0x7fffffff;
for (;;)
{
- if (++jjround == 0x7fffffff)
+ if (++jjround == 0x7fffffff) {
ReInitRounds();
+ }
if (curChar < 64)
{
long l = 1L << curChar;
@@ -423,59 +441,73 @@ private int jjMoveNfa_0(int startState, int curPos)
switch(jjstateSet[--i])
{
case 10:
- if ((0xd7ffe77a00000000L & l) != 0L)
+ if ((0xd7ffe77a00000000L & l) != 0L) {
jjCheckNAddStates(0, 2);
+ }
break;
case 16:
case 5:
- if ((0x7ffe00000000000L & l) == 0L)
+ if ((0x7ffe00000000000L & l) == 0L) {
break;
- if (kind > 23)
+ }
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAdd(5);
break;
case 3:
- if (curChar == 39)
+ if (curChar == 39) {
jjAddStates(3, 4);
+ }
break;
case 0:
- if (curChar == 58)
+ if (curChar == 58) {
jjstateSet[jjnewStateCnt++] = 1;
+ }
break;
case 2:
- if ((0x7ffe00000000000L & l) == 0L)
+ if ((0x7ffe00000000000L & l) == 0L) {
break;
- if (kind > 17)
+ }
+ if (kind > 17) {
kind = 17;
+ }
jjstateSet[jjnewStateCnt++] = 2;
break;
case 8:
- if ((0x7ffe00000000000L & l) != 0L)
+ if ((0x7ffe00000000000L & l) != 0L) {
jjCheckNAddTwoStates(8, 9);
+ }
break;
case 9:
- if (curChar == 39 && kind > 24)
+ if (curChar == 39 && kind > 24) {
kind = 24;
+ }
break;
case 11:
- if (curChar == 32)
+ if (curChar == 32) {
jjAddStates(5, 6);
+ }
break;
case 12:
- if ((0x7ffe00000000000L & l) != 0L)
+ if ((0x7ffe00000000000L & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 13:
- if ((0xd7ffe77a00000000L & l) != 0L)
+ if ((0xd7ffe77a00000000L & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 14:
- if ((0xd000877a00000000L & l) != 0L)
+ if ((0xd000877a00000000L & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 15:
- if ((0xd7ffe77a00000000L & l) != 0L)
+ if ((0xd7ffe77a00000000L & l) != 0L) {
jjCheckNAddStates(10, 13);
+ }
break;
default : break;
}
@@ -489,86 +521,106 @@ private int jjMoveNfa_0(int startState, int curPos)
switch(jjstateSet[--i])
{
case 10:
- if ((0x6fffffffffffffffL & l) != 0L)
+ if ((0x6fffffffffffffffL & l) != 0L) {
jjCheckNAddStates(0, 2);
- if ((0x7fffffe07fffffeL & l) != 0L)
+ }
+ if ((0x7fffffe07fffffeL & l) != 0L) {
jjCheckNAddStates(14, 16);
+ }
break;
case 16:
if ((0x7fffffe87fffffeL & l) != 0L)
{
- if (kind > 23)
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAdd(5);
}
if ((0x7fffffe07fffffeL & l) != 0L)
{
- if (kind > 23)
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAddTwoStates(4, 5);
}
break;
case 3:
if ((0x7fffffe07fffffeL & l) != 0L)
{
- if (kind > 23)
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAddTwoStates(4, 5);
}
- if (curChar == 112)
+ if (curChar == 112) {
jjstateSet[jjnewStateCnt++] = 0;
+ }
break;
case 1:
- if ((0x7fffffe07fffffeL & l) == 0L)
+ if ((0x7fffffe07fffffeL & l) == 0L) {
break;
- if (kind > 17)
+ }
+ if (kind > 17) {
kind = 17;
+ }
jjCheckNAddTwoStates(1, 2);
break;
case 2:
- if ((0x7fffffe87fffffeL & l) == 0L)
+ if ((0x7fffffe87fffffeL & l) == 0L) {
break;
- if (kind > 17)
+ }
+ if (kind > 17) {
kind = 17;
+ }
jjCheckNAdd(2);
break;
case 4:
- if ((0x7fffffe07fffffeL & l) == 0L)
+ if ((0x7fffffe07fffffeL & l) == 0L) {
break;
- if (kind > 23)
+ }
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAddTwoStates(4, 5);
break;
case 5:
- if ((0x7fffffe87fffffeL & l) == 0L)
+ if ((0x7fffffe87fffffeL & l) == 0L) {
break;
- if (kind > 23)
+ }
+ if (kind > 23) {
kind = 23;
+ }
jjCheckNAdd(5);
break;
case 7:
- if ((0x7fffffe07fffffeL & l) != 0L)
+ if ((0x7fffffe07fffffeL & l) != 0L) {
jjCheckNAddStates(14, 16);
+ }
break;
case 8:
- if ((0x7fffffe87fffffeL & l) != 0L)
+ if ((0x7fffffe87fffffeL & l) != 0L) {
jjCheckNAddTwoStates(8, 9);
+ }
break;
case 12:
- if ((0x7fffffe87fffffeL & l) != 0L)
+ if ((0x7fffffe87fffffeL & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 13:
- if ((0x6fffffffffffffffL & l) != 0L)
+ if ((0x6fffffffffffffffL & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 14:
- if ((0x6800000178000001L & l) != 0L)
+ if ((0x6800000178000001L & l) != 0L) {
jjCheckNAddStates(7, 9);
+ }
break;
case 15:
- if ((0x6fffffffffffffffL & l) != 0L)
+ if ((0x6fffffffffffffffL & l) != 0L) {
jjCheckNAddStates(10, 13);
+ }
break;
default : break;
}
@@ -593,8 +645,9 @@ private int jjMoveNfa_0(int startState, int curPos)
kind = 0x7fffffff;
}
++curPos;
- if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt)))
+ if ((i = jjnewStateCnt) == (startsAt = 16 - (jjnewStateCnt = startsAt))) {
return curPos;
+ }
try { curChar = input_stream.readChar(); }
catch(java.io.IOException e) { return curPos; }
}
@@ -622,8 +675,9 @@ private final int[] jjrounds = new int[16];
private final int[] jjstateSet = new int[32];
protected char curChar;
public QueryParserTokenManager(SimpleCharStream stream){
- if (SimpleCharStream.staticFlag)
+ if (SimpleCharStream.staticFlag) {
throw new Error("ERROR: Cannot use a static CharStream class with a non-static lexical analyzer.");
+ }
input_stream = stream;
}
public QueryParserTokenManager(SimpleCharStream stream, int lexState){
@@ -641,8 +695,9 @@ private void ReInitRounds()
{
int i;
jjround = 0x80000001;
- for (i = 16; i-- > 0;)
+ for (i = 16; i-- > 0;) {
jjrounds[i] = 0x80000000;
+ }
}
public void ReInit(SimpleCharStream stream, int lexState)
{
@@ -651,10 +706,12 @@ public void ReInit(SimpleCharStream stream, int lexState)
}
public void SwitchTo(int lexState)
{
- if (lexState >= 1 || lexState < 0)
- throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.", TokenMgrError.INVALID_LEXICAL_STATE);
- else
+ if (lexState >= 1 || lexState < 0) {
+ throw new TokenMgrError("Error: Ignoring invalid lexical state : " + lexState + ". State unchanged.",
+ TokenMgrError.INVALID_LEXICAL_STATE);
+ } else {
curLexState = lexState;
+ }
}
protected Token jjFillToken()
@@ -699,8 +756,9 @@ public Token getNextToken()
}
try { input_stream.backup(0);
- while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L)
+ while (curChar <= 10 && (0x400L & (1L << curChar)) != 0L) {
curChar = input_stream.BeginToken();
+ }
}
catch (java.io.IOException e1) { continue EOFLoop; }
jjmatchedKind = 0x7fffffff;
@@ -708,8 +766,9 @@ public Token getNextToken()
curPos = jjMoveStringLiteralDfa0_0();
if (jjmatchedKind != 0x7fffffff)
{
- if (jjmatchedPos + 1 < curPos)
+ if (jjmatchedPos + 1 < curPos) {
input_stream.backup(curPos - jjmatchedPos - 1);
+ }
if ((jjtoToken[jjmatchedKind >> 6] & (1L << (jjmatchedKind & 077))) != 0L)
{
matchedToken = jjFillToken();
@@ -732,8 +791,9 @@ public Token getNextToken()
error_line++;
error_column = 0;
}
- else
+ else {
error_column++;
+ }
}
if (!EOFSeen) {
input_stream.backup(1);
[02/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
index 22668aa..679787d 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorBuilder.java
@@ -97,12 +97,15 @@ public class WorkflowProcessorBuilder {
WorkflowInstance.class });
WorkflowProcessor wp = clazzConstructor.newInstance(this.lifecycleManager,
this.workflowInstance);
- if (this.id != null)
+ if (this.id != null) {
wp.getWorkflowInstance().setId(id);
- if (this.priority != -1)
+ }
+ if (this.priority != -1) {
wp.getWorkflowInstance().setPriority(Priority.getPriority(priority));
- if (this.subProcessors != null)
+ }
+ if (this.subProcessors != null) {
wp.setSubProcessors(subProcessors);
+ }
if (this.workflowInstance != null){
wp.setWorkflowInstance(workflowInstance);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
index 29a6743..ceecc13 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorHelper.java
@@ -79,15 +79,19 @@ public class WorkflowProcessorHelper {
// properties
// =
// " + processor.getStaticMetadata().asHashtable() + "]");
- if (skeleton.getPreConditions() != null)
+ if (skeleton.getPreConditions() != null) {
stringModel.append(indent).append("{PreCond:").append(indent).append(" ")
.append(toString(skeleton.getPreConditions(), indent + " ")).append("}");
- if (skeleton.getPostConditions() != null)
+ }
+ if (skeleton.getPostConditions() != null) {
stringModel.append(indent).append("{PostCond:").append(indent).append(" ")
.append(toString(skeleton.getPostConditions(), indent + " ")).append("}");
- if (skeleton.getSubProcessors() != null)
- for (WorkflowProcessor subProcessor : skeleton.getSubProcessors())
+ }
+ if (skeleton.getSubProcessors() != null) {
+ for (WorkflowProcessor subProcessor : skeleton.getSubProcessors()) {
stringModel.append(indent).append(toString(subProcessor, indent + " "));
+ }
+ }
return stringModel.toString();
}
@@ -115,16 +119,18 @@ public class WorkflowProcessorHelper {
",")).append("'\n");
stringModel.append(" - static metadata = \n");
for (String key : skeleton.getWorkflowInstance().getSharedContext()
- .getAllKeys())
+ .getAllKeys()) {
stringModel.append(" + ").append(key).append(" -> '")
.append(StringUtils.join(skeleton.getWorkflowInstance().getSharedContext()
.getAllMetadata(key), ",")).append("'\n");
+ }
stringModel.append(" - dynamic metadata = \n");
for (String key : skeleton.getWorkflowInstance().getSharedContext()
- .getAllKeys())
+ .getAllKeys()) {
stringModel.append(" + ").append(key).append(" -> '")
.append(StringUtils.join(skeleton.getWorkflowInstance().getSharedContext()
.getAllMetadata(key), ",")).append("'\n");
+ }
return stringModel.toString();
}
@@ -159,12 +165,14 @@ public class WorkflowProcessorHelper {
// need them in the PackagedWorkflowRepository, so not sure what they do.
// wp.setExcusedSubProcessorIds(model.getGraph().getExcusedSubProcessorIds());
wp.getWorkflowInstance().setId(instanceId);
- if (model.getPreConditions() != null)
+ if (model.getPreConditions() != null) {
wp.setPreConditions(buildProcessor(instanceId, model,
modelToProcessorMap, true));
- if (model.getPostConditions() != null)
+ }
+ if (model.getPostConditions() != null) {
wp.setPostConditions(buildProcessor(instanceId, model,
modelToProcessorMap, false));
+ }
wp.getWorkflowInstance().setPriority(Priority.getDefault());
wp.setMinReqSuccessfulSubProcessors(Integer.parseInt(model.getGraph()
.getMinReqSuccessfulSubProcessors()));
@@ -172,24 +180,28 @@ public class WorkflowProcessorHelper {
wp.getWorkflowInstance().setState(
wLifecycle.createState("Loaded",
wLifecycle.getStageForWorkflow("Loaded").getName(), ""));
- if (wp instanceof TaskProcessor)
+ if (wp instanceof TaskProcessor) {
((TaskProcessor) wp)
.setInstanceClass((Class<? extends WorkflowTaskInstance>) Class
.forName(model.getGraph().getTask().getTaskInstanceClassName()));
+ }
return wp;
}
public WorkflowProcessor findSkeleton(WorkflowProcessor skeleton,
String modelId) {
if (skeleton.getWorkflowInstance().getParentChildWorkflow().getGraph()
- .getModelId().equals(modelId))
+ .getModelId().equals(modelId)) {
return skeleton;
+ }
WorkflowProcessor found = findSkeleton(skeleton.getSubProcessors(), modelId);
if (found == null) {
- if (skeleton.getPreConditions() != null)
+ if (skeleton.getPreConditions() != null) {
found = findSkeleton(skeleton.getPreConditions(), modelId);
- if (found == null && skeleton.getPostConditions() != null)
+ }
+ if (found == null && skeleton.getPostConditions() != null) {
found = findSkeleton(skeleton.getPostConditions(), modelId);
+ }
}
return found;
}
@@ -202,8 +214,9 @@ public class WorkflowProcessorHelper {
return skeleton;
} else {
skeleton = findSkeleton(skeleton, modelId);
- if (skeleton != null)
+ if (skeleton != null) {
return skeleton;
+ }
}
}
return null;
@@ -211,14 +224,17 @@ public class WorkflowProcessorHelper {
public WorkflowProcessor findProcessor(WorkflowProcessor wp, String modelId) {
if (wp.getWorkflowInstance().getParentChildWorkflow().getId()
- .equals(modelId))
+ .equals(modelId)) {
return wp;
+ }
WorkflowProcessor found = findProcessor(wp.getSubProcessors(), modelId);
if (found == null) {
- if (wp.getPreConditions() != null)
+ if (wp.getPreConditions() != null) {
found = findProcessor(wp.getPreConditions(), modelId);
- if (found == null && wp.getPostConditions() != null)
+ }
+ if (found == null && wp.getPostConditions() != null) {
found = findProcessor(wp.getPostConditions(), modelId);
+ }
}
return found;
}
@@ -230,8 +246,9 @@ public class WorkflowProcessorHelper {
return processor;
} else {
processor = findProcessor(processor, modelId);
- if (processor != null)
+ if (processor != null) {
return processor;
+ }
}
}
return null;
@@ -249,10 +266,12 @@ public class WorkflowProcessorHelper {
*/
public boolean allProcessorsSameCategory(
List<WorkflowProcessor> workflowProcessors, String categoryName) {
- for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ for (WorkflowProcessor workflowProcessor : workflowProcessors) {
if (!workflowProcessor.getWorkflowInstance().getState().getCategory()
- .getName().equals(categoryName))
+ .getName().equals(categoryName)) {
return false;
+ }
+ }
return true;
}
@@ -312,12 +331,15 @@ public class WorkflowProcessorHelper {
if (currentOption.getSubProcessors().isEmpty()) {
tasks.add(currentOption);
} else {
- if (currentOption.getPreConditions() != null)
+ if (currentOption.getPreConditions() != null) {
options.add(currentOption.getPreConditions());
- if (currentOption.getPostConditions() != null)
+ }
+ if (currentOption.getPostConditions() != null) {
options.add(currentOption.getPostConditions());
- for (WorkflowProcessor ps : currentOption.getSubProcessors())
+ }
+ for (WorkflowProcessor ps : currentOption.getSubProcessors()) {
options.add(ps);
+ }
}
}
return tasks;
@@ -325,10 +347,12 @@ public class WorkflowProcessorHelper {
public boolean containsCategory(List<WorkflowProcessor> workflowProcessors,
String categoryName) {
- for (WorkflowProcessor workflowProcessor : workflowProcessors)
+ for (WorkflowProcessor workflowProcessor : workflowProcessors) {
if (workflowProcessor.getWorkflowInstance().getState().getCategory()
- .getName().equals(categoryName))
+ .getName().equals(categoryName)) {
return true;
+ }
+ }
return false;
}
@@ -342,8 +366,9 @@ public class WorkflowProcessorHelper {
} catch (Exception ignored) {
}
}
- if (host == null)
+ if (host == null) {
return "Unknown";
+ }
return host;
}
@@ -352,8 +377,9 @@ public class WorkflowProcessorHelper {
&& processor.getWorkflowInstance().getParentChildWorkflow() != null) {
return processor.getLifecycleManager().getLifecycleForWorkflow(
processor.getWorkflowInstance().getParentChildWorkflow());
- } else
+ } else {
return processor.getLifecycleManager().getDefaultLifecycle();
+ }
}
private WorkflowLifecycle getLifecycle(ParentChildWorkflow model) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
index b594604..3588fe3 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/processor/WorkflowProcessorQueue.java
@@ -96,8 +96,9 @@ public class WorkflowProcessorQueue {
+ "] into WorkflowProcessor: Message: " + e.getMessage());
continue;
}
- if (processor != null)
+ if (processor != null) {
processors.add(processor);
+ }
}
}
@@ -420,7 +421,9 @@ public class WorkflowProcessorQueue {
private synchronized WorkflowTask toConditionTask(WorkflowCondition cond){
String taskId = cond.getConditionId()+"-task"; // TODO: this is incompat with DataSourceWorkflowRepository
WorkflowTask condTask = safeGetTaskById(taskId);
- if(condTask != null) return condTask;
+ if(condTask != null) {
+ return condTask;
+ }
condTask = new WorkflowTask();
condTask.setTaskId(taskId);
condTask.setTaskInstanceClassName(ConditionTaskInstance.class.getCanonicalName());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java
index 0b8b092..d5ad499 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AbstractEngineRunnerBase.java
@@ -65,9 +65,10 @@ public abstract class AbstractEngineRunnerBase extends EngineRunner {
taskProcessor.getWorkflowInstance().getParentChildWorkflow().getGraph().getTask() != null) {
return taskProcessor.getWorkflowInstance().getParentChildWorkflow()
.getGraph().getTask();
- } else
+ } else {
return taskProcessor.getWorkflowInstance().getParentChildWorkflow()
- .getTasks().get(0);
+ .getTasks().get(0);
+ }
}
protected WorkflowLifecycle getLifecycle(TaskProcessor taskProcessor) {
@@ -75,7 +76,9 @@ public abstract class AbstractEngineRunnerBase extends EngineRunner {
}
protected synchronized void persist(WorkflowInstance instance) {
- if(instRep == null) return;
+ if(instRep == null) {
+ return;
+ }
try {
if (instance.getId() == null || (instance.getId().equals(""))) {
// we have to persist it by adding it
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AsynchronousLocalEngineRunner.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AsynchronousLocalEngineRunner.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AsynchronousLocalEngineRunner.java
index 1306685..d8e96c1 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AsynchronousLocalEngineRunner.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/AsynchronousLocalEngineRunner.java
@@ -131,10 +131,11 @@ public class AsynchronousLocalEngineRunner extends AbstractEngineRunnerBase {
*/
@Override
public void shutdown() {
- for (Thread worker : this.workerMap.values())
+ for (Thread worker : this.workerMap.values()) {
if (worker != null) {
worker.interrupt();
}
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/ResourceRunner.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/ResourceRunner.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/ResourceRunner.java
index 1f5267a..7ef7c94 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/ResourceRunner.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/engine/runner/ResourceRunner.java
@@ -145,10 +145,12 @@ public class ResourceRunner extends AbstractEngineRunnerBase implements CoreMetK
LOG.log(Level.WARNING, "Attempt to kill " + "current resmgr job: ["
+ this.currentJobId + "]: failed");
return false;
- } else
+ } else {
return true;
- } else
+ }
+ } else {
return false;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/CheckForMetadataKeys.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/CheckForMetadataKeys.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/CheckForMetadataKeys.java
index 100f9eb..9fcd271 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/CheckForMetadataKeys.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/CheckForMetadataKeys.java
@@ -28,8 +28,9 @@ public class CheckForMetadataKeys implements WorkflowConditionInstance {
String[] reqMetKeys = (config.getProperty("reqMetKeys") + ",")
.split(",");
for (String reqMetKey : reqMetKeys) {
- if (!metadata.containsKey(reqMetKey))
- return false;
+ if (!metadata.containsKey(reqMetKey)) {
+ return false;
+ }
}
return true;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/LongCondition.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/LongCondition.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/LongCondition.java
index 1f3c5a9..6bf82e0 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/LongCondition.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/examples/LongCondition.java
@@ -57,7 +57,9 @@ public class LongCondition implements WorkflowConditionInstance {
timesFalse++;
return false;
}
- else return true;
+ else {
+ return true;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycle.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycle.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycle.java
index 1978697..5c82ba8 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycle.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycle.java
@@ -178,8 +178,9 @@ public class WorkflowLifecycle {
}
return null;
- } else
+ } else {
return null;
+ }
}
/**
@@ -219,8 +220,9 @@ public class WorkflowLifecycle {
if (this.getStages() != null) {
for (WorkflowLifecycleStage stage : (SortedSet<WorkflowLifecycleStage>) this
.getStages()) {
- if (category != null && !stage.getName().equals(category))
+ if (category != null && !stage.getName().equals(category)) {
continue;
+ }
if (stage.getStates() != null) {
for (WorkflowState state : (List<WorkflowState>) stage.getStates()) {
if (state.getName().equals(stateName)) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleManager.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleManager.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleManager.java
index 287a8ba..9350e5a 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleManager.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowLifecycleManager.java
@@ -70,8 +70,9 @@ public class WorkflowLifecycleManager {
WorkflowLifecycleStage stage = getStage(inst);
if (stage != null) {
return stage.getOrder();
- } else
+ } else {
return -1;
+ }
}
/**
@@ -90,8 +91,9 @@ public class WorkflowLifecycleManager {
WorkflowLifecycle lifecycle = getLifecycleForWorkflow(workflow);
if (lifecycle != null) {
return lifecycle.getStages().size();
- } else
+ } else {
return -1;
+ }
}
/**
@@ -111,8 +113,9 @@ public class WorkflowLifecycleManager {
if (lifecycle != null) {
return lifecycle.getStageForWorkflow(inst
.getStatus());
- } else
+ } else {
return null;
+ }
}
/**
@@ -195,8 +198,9 @@ public class WorkflowLifecycleManager {
}
return defaultLifecycle;
- } else
+ } else {
return null;
+ }
}
/**
@@ -221,8 +225,9 @@ public class WorkflowLifecycleManager {
inst.getState().getCategory().getName().equals("done")))
&& currStageNum == getNumStages(inst.getWorkflow())) {
return currStageNum;
- } else
+ } else {
return currStageNum - 1;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
index c90d242..1f0d5ac 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/lifecycle/WorkflowState.java
@@ -70,10 +70,11 @@ public class WorkflowState {
}
public boolean equals(Object obj) {
- if (obj instanceof WorkflowState)
- return ((WorkflowState) obj).getName().equals(this.getName());
- else
- return false;
+ if (obj instanceof WorkflowState) {
+ return ((WorkflowState) obj).getName().equals(this.getName());
+ } else {
+ return false;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
index 195c7b3..0da8cc8 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/DataSourceWorkflowRepository.java
@@ -1722,8 +1722,9 @@ public class DataSourceWorkflowRepository implements WorkflowRepository {
}
private boolean hasTaskId(List<WorkflowTask> tasks, String id) {
- if (tasks == null || (tasks.size() == 0))
+ if (tasks == null || (tasks.size() == 0)) {
return false;
+ }
for (WorkflowTask task : tasks) {
if (task.getTaskId().equals(id)) {
@@ -1735,8 +1736,9 @@ public class DataSourceWorkflowRepository implements WorkflowRepository {
}
private boolean hasConditionId(List<WorkflowCondition> conds, String id) {
- if (conds == null || (conds.size() == 0))
+ if (conds == null || (conds.size() == 0)) {
return false;
+ }
for (WorkflowCondition cond : conds) {
if (cond.getConditionId().equals(id)) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
index f24f785..d2ce28f 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/PackagedWorkflowRepository.java
@@ -164,8 +164,9 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
Workflow w = this.getWorkflowByName(workflowName);
if (w != null) {
return w.getTasks();
- } else
+ } else {
return Collections.emptyList();
+ }
}
/*
@@ -180,8 +181,9 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
List<ParentChildWorkflow> workflows = this.eventWorkflowMap.get(eventName);
if (workflows != null && workflows.size() > 0) {
return workflows;
- } else
+ } else {
return Collections.emptyList();
+ }
}
/*
@@ -213,8 +215,9 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
public List getConditionsByTaskId(String taskId) throws RepositoryException {
if (this.tasks.get(taskId) != null) {
return this.tasks.get(taskId).getConditions();
- } else
+ } else {
return Collections.emptyList();
+ }
}
/*
@@ -363,10 +366,11 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
@Override
public List<WorkflowCondition> getConditionsByWorkflowId(String workflowId)
throws RepositoryException {
- if (!this.workflows.containsKey(workflowId))
+ if (!this.workflows.containsKey(workflowId)) {
throw new RepositoryException(
"Attempt to obtain conditions for a workflow: " + "[" + workflowId
- + "] that does not exist!");
+ + "] that does not exist!");
+ }
return this.workflows.get(workflowId).getConditions();
}
@@ -392,8 +396,9 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
try {
parser = factory.newDocumentBuilder();
List<Element> rootElements = new Vector<Element>();
- for (File file : files)
+ for (File file : files) {
rootElements.add(parser.parse(file).getDocumentElement());
+ }
for (Element root : rootElements) {
Metadata staticMetadata = new Metadata();
loadConfiguration(rootElements, root, staticMetadata);
@@ -461,9 +466,10 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
this.eventWorkflowMap.get(workflow.getId()).add(w);
}
}
- } else
+ } else {
throw new WorkflowException("Unsupported execution type: ["
- + workflow.getGraph().getExecutionType() + "]");
+ + workflow.getGraph().getExecutionType() + "]");
+ }
}
}
@@ -550,13 +556,15 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
if (curChild.getNodeName().equals("configuration")) {
Metadata curMetadata = new Metadata();
- if (!((Element) curChild).getAttribute("extends").equals(""))
+ if (!((Element) curChild).getAttribute("extends").equals("")) {
for (String extension : ((Element) curChild).getAttribute("extends")
- .split(","))
+ .split(",")) {
curMetadata
.replaceMetadata(globalConfGroups.containsKey(extension) ? globalConfGroups
.get(extension) : this.loadConfGroup(rootElements,
extension, globalConfGroups));
+ }
+ }
curMetadata.replaceMetadata(XmlStructFactory
.getConfigurationAsMetadata(curChild));
NamedNodeMap attrMap = curChild.getAttributes();
@@ -592,8 +600,9 @@ public class PackagedWorkflowRepository implements WorkflowRepository {
for (int i = 0; i < nodes.getLength(); i++) {
Node node = nodes.item(i);
String name = ((Element) node).getAttribute("name");
- if (name.equals(group))
+ if (name.equals(group)) {
return XmlStructFactory.getConfigurationAsMetadata(node);
+ }
}
}
throw new WorkflowException("Configuration group '" + group + "' not defined!");
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
index 354fcc3..ea348bf 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/repository/XMLWorkflowRepository.java
@@ -241,8 +241,9 @@ public class XMLWorkflowRepository implements WorkflowRepository {
WorkflowTask t = (WorkflowTask) taskMap.get(taskId);
if (t != null) {
return t.getConditions();
- } else
- return null;
+ } else {
+ return null;
+ }
}
/*
@@ -327,9 +328,11 @@ public class XMLWorkflowRepository implements WorkflowRepository {
@Override
public List<WorkflowCondition> getConditionsByWorkflowId(String workflowId)
throws RepositoryException {
- if(!workflowMap.containsKey(workflowId)) throw new
- RepositoryException("Attempt to obtain conditions for a workflow: " +
- "["+workflowId+"] that does not exist!");
+ if(!workflowMap.containsKey(workflowId)) {
+ throw new
+ RepositoryException("Attempt to obtain conditions for a workflow: " +
+ "[" + workflowId + "] that does not exist!");
+ }
return ((Workflow) workflowMap.get(workflowId)).getConditions();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
index 862f447..871db47 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Graph.java
@@ -109,9 +109,10 @@ public class Graph {
this.executionType = graphElem.getNodeName();
}
- if (!processorIds.contains(this.executionType))
+ if (!processorIds.contains(this.executionType)) {
throw new WorkflowException("Unsupported execution type id '"
- + this.executionType + "'");
+ + this.executionType + "'");
+ }
if (!checkValue(this.modelId) && !checkValue(this.modelIdRef)) {
this.modelId = UUID.randomUUID().toString();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
index fea1851..6552e83 100755
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/Priority.java
@@ -87,17 +87,17 @@ public abstract class Priority implements Comparable<Priority> {
}
public static Priority getPriority(final double priority) {
- if (priority == LOW.getValue())
+ if (priority == LOW.getValue()) {
return LOW;
- else if (priority == MEDIUM_LOW.getValue())
+ } else if (priority == MEDIUM_LOW.getValue()) {
return MEDIUM_LOW;
- else if (priority == MEDIUM.getValue())
+ } else if (priority == MEDIUM.getValue()) {
return MEDIUM;
- else if (priority == MEDIUM_HIGH.getValue())
+ } else if (priority == MEDIUM_HIGH.getValue()) {
return MEDIUM_HIGH;
- else if (priority == HIGH.getValue())
+ } else if (priority == HIGH.getValue()) {
return HIGH;
- else
+ } else {
return new Priority() {
public double getValue() {
return priority;
@@ -107,6 +107,7 @@ public abstract class Priority implements Comparable<Priority> {
return "CUSTOM";
}
};
+ }
}
@Override
@@ -116,10 +117,11 @@ public abstract class Priority implements Comparable<Priority> {
@Override
public boolean equals(Object obj) {
- if (obj instanceof Priority)
+ if (obj instanceof Priority) {
return new Double(this.getValue()).equals(((Priority) obj).getValue());
- else
+ } else {
return false;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/TaskJobInput.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/TaskJobInput.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/TaskJobInput.java
index 6653e61..5ced9d4 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/TaskJobInput.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/TaskJobInput.java
@@ -183,9 +183,12 @@ public class TaskJobInput implements JobInput {
throw ex;
} catch (Exception ignore) {
} finally {
- if (in != null) try {
- in.close();
- } catch (IOException ignore) {}
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ignore) {
+ }
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
index ecf58db..e91c602 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/structs/WorkflowInstance.java
@@ -168,8 +168,9 @@ public class WorkflowInstance {
if (workflow != null && workflow instanceof ParentChildWorkflow) {
this.workflow = (ParentChildWorkflow) workflow;
} else {
- if (workflow == null)
+ if (workflow == null) {
workflow = new Workflow();
+ }
this.workflow = new ParentChildWorkflow(workflow);
}
}
@@ -437,7 +438,9 @@ public class WorkflowInstance {
return null;
}
- else return null;
+ else {
+ return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
index dc54a70..f499061 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManager.java
@@ -98,8 +98,9 @@ public class XmlRpcWorkflowManager {
webServer.shutdown();
webServer = null;
return true;
- } else
- return false;
+ } else {
+ return false;
+ }
}
public boolean refreshRepository() {
@@ -109,17 +110,19 @@ public class XmlRpcWorkflowManager {
public String executeDynamicWorkflow(Vector<String> taskIds, Hashtable metadata)
throws RepositoryException, EngineException {
- if (taskIds == null || (taskIds.size() == 0))
+ if (taskIds == null || (taskIds.size() == 0)) {
throw new RepositoryException(
"Must specify task identifiers to build dynamic workflows!");
+ }
Workflow dynamicWorkflow = new Workflow();
for (String taskId : taskIds) {
WorkflowTask task = this.repo.getWorkflowTaskById(taskId);
- if (task == null)
+ if (task == null) {
throw new RepositoryException("Dynamic workflow task: [" + taskId
- + "] is not defined!");
+ + "] is not defined!");
+ }
dynamicWorkflow.getTasks().add(task);
}
@@ -165,10 +168,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
public Hashtable getNextPage(Hashtable currentPage) {
@@ -180,10 +184,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
public Hashtable getPrevPage(Hashtable currentPage) {
@@ -195,10 +200,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
public Hashtable getLastPage() {
@@ -207,10 +213,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
public Hashtable paginateWorkflowInstances(int pageNum, String status)
@@ -220,10 +227,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
@@ -234,10 +242,11 @@ public class XmlRpcWorkflowManager {
if (page != null) {
populateWorkflows(page.getPageWorkflows());
return XmlRpcStructFactory.getXmlRpcWorkflowInstancePage(page);
- } else
- return XmlRpcStructFactory
- .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
- .blankPage());
+ } else {
+ return XmlRpcStructFactory
+ .getXmlRpcWorkflowInstancePage(WorkflowInstancePage
+ .blankPage());
+ }
}
public Hashtable getWorkflowInstanceMetadata(String wInstId) {
@@ -307,8 +316,9 @@ public class XmlRpcWorkflowManager {
}
}
return true;
- } else
- return false;
+ } else {
+ return false;
+ }
}
public Hashtable getWorkflowInstanceById(String wInstId) {
@@ -463,8 +473,9 @@ public class XmlRpcWorkflowManager {
"Exception getting workflow instances from workflow engine: Message: "
+ e.getMessage());
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
public Vector getWorkflows() throws RepositoryException {
@@ -491,8 +502,9 @@ public class XmlRpcWorkflowManager {
+ e.getMessage());
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
@@ -605,11 +617,12 @@ public class XmlRpcWorkflowManager {
loadProperties();
new XmlRpcWorkflowManager(portNum);
- for (;;)
- try {
- Thread.currentThread().join();
- } catch (InterruptedException ignore) {
- }
+ for (;;) {
+ try {
+ Thread.currentThread().join();
+ } catch (InterruptedException ignore) {
+ }
+ }
}
public static void loadProperties() throws IOException {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
index e535525..1e759de 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/system/XmlRpcWorkflowManagerClient.java
@@ -412,8 +412,9 @@ public class XmlRpcWorkflowManagerClient {
}
return workflows;
- } else
- return null;
+ } else {
+ return null;
+ }
}
@@ -458,8 +459,9 @@ public class XmlRpcWorkflowManagerClient {
instsUnpacked.add(inst);
}
return instsUnpacked;
- } else
- return null;
+ } else {
+ return null;
+ }
}
@@ -480,8 +482,9 @@ public class XmlRpcWorkflowManagerClient {
instsUnpacked.add(inst);
}
return instsUnpacked;
- } else
+ } else {
return null;
+ }
}
public static void main(String[] args) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
index b3b4d5a..123afb0 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/DbStructFactory.java
@@ -94,8 +94,9 @@ public final class DbStructFactory {
task.setOrder(rs.getInt("task_order"));
}*/
return task;
- } else
+ } else {
return null;
+ }
}
public static WorkflowCondition getWorkflowCondition(ResultSet rs,
@@ -115,8 +116,9 @@ public final class DbStructFactory {
condition.setOrder(rs.getInt("condition_order"));
}*/
return condition;
- } else
+ } else {
return null;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
index 3a6f474..cf7e1aa 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/GenericWorkflowObjectFactory.java
@@ -188,8 +188,9 @@ public final class GenericWorkflowObjectFactory {
+ className + ": cannot instantiate!");
return null;
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
/**
@@ -249,8 +250,9 @@ public final class GenericWorkflowObjectFactory {
+ className + ": cannot instantiate!");
return null;
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
/**
@@ -293,8 +295,9 @@ public final class GenericWorkflowObjectFactory {
+ className + ": cannot instantiate!");
return null;
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
/**
@@ -336,8 +339,9 @@ public final class GenericWorkflowObjectFactory {
+ className + ": cannot instantiate!");
return null;
}
- } else
- return null;
+ } else {
+ return null;
+ }
}
public static PrioritySorter getPrioritySorterFromClassName(String className){
@@ -365,7 +369,9 @@ public final class GenericWorkflowObjectFactory {
return null;
}
}
- else return null;
+ else {
+ return null;
+ }
}
public static List copyWorkflows(List workflows){
@@ -379,7 +385,9 @@ public final class GenericWorkflowObjectFactory {
return newWorkflows;
}
- else return null;
+ else {
+ return null;
+ }
}
/**
@@ -427,7 +435,9 @@ public final class GenericWorkflowObjectFactory {
return newTaskList;
}
- else return null;
+ else {
+ return null;
+ }
}
public static WorkflowTask copyTask(WorkflowTask t){
@@ -461,7 +471,9 @@ public final class GenericWorkflowObjectFactory {
return newConditionList;
}
- else return null;
+ else {
+ return null;
+ }
}
public static WorkflowCondition copyCondition(WorkflowCondition c){
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
----------------------------------------------------------------------
diff --git a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
index 4216fef..5e9704d 100644
--- a/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
+++ b/workflow/src/main/java/org/apache/oodt/cas/workflow/util/XmlStructFactory.java
@@ -87,10 +87,12 @@ public final class XmlStructFactory {
Element taskElem = getFirstElement("tasks", workflowRoot);
Element conditionsElem = getFirstElement("conditions", workflowRoot);
- if (taskElem != null)
+ if (taskElem != null) {
workflow.setTasks(getTasks(taskElem, tasks));
- if (conditionsElem != null)
+ }
+ if (conditionsElem != null) {
workflow.setConditions(getConditions(conditionsElem, conditions));
+ }
return workflow;
}
@@ -240,13 +242,15 @@ public final class XmlStructFactory {
String envReplace = property.getAttribute("envReplace");
String name = property.getAttribute("name");
String value = property.getAttribute("value");
- if (Boolean.parseBoolean(envReplace))
+ if (Boolean.parseBoolean(envReplace)) {
value = PathUtils.doDynamicReplacement(value);
+ }
List<String> values = new Vector<String>();
- if (delim.length() > 0)
+ if (delim.length() > 0) {
values.addAll(Arrays.asList(value.split("\\" + delim)));
- else
+ } else {
values.add(value);
+ }
curMetadata.replaceMetadata(name, values);
}
}
@@ -320,15 +324,17 @@ public final class XmlStructFactory {
NodeList list = root.getElementsByTagName(name);
if (list.getLength()>0) {
return (Element) list.item(0);
- } else
+ } else {
return null;
+ }
}
private static String getSimpleElementText(Element node) {
if (node.getChildNodes().item(0) instanceof Text) {
return node.getChildNodes().item(0).getNodeValue();
- } else
+ } else {
return null;
+ }
}
private static String getElementText(String elemName, Element root) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
index 345c02d..317950d 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingField.java
@@ -239,10 +239,12 @@ public class MappingField {
*/
public String getLocalName() {
String dbColName = getName();
- if (getDbName() != null && !getDbName().isEmpty())
+ if (getDbName() != null && !getDbName().isEmpty()) {
dbColName = getDbName();
- if (getTableName() == null || getTableName().isEmpty())
+ }
+ if (getTableName() == null || getTableName().isEmpty()) {
return dbColName;
+ }
return getTableName() + "." + dbColName;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
index fb0e9c5..cf7ab3a 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/mapping/MappingReader.java
@@ -100,8 +100,9 @@ public final class MappingReader implements MappingReaderMetKeys {
for (int i = 0; i < tableNodes.getLength(); i++) {
Element tableElem = (Element) tableNodes.item(i);
DatabaseTable tbl = readTable(tableElem);
- if (tbl.getDefaultTableJoin() == null || tbl.getDefaultTableJoin().isEmpty())
+ if (tbl.getDefaultTableJoin() == null || tbl.getDefaultTableJoin().isEmpty()) {
tbl.setDefaultTableJoin(map.getDefaultTable());
+ }
map.addTable(tbl.getName(), tbl);
}
}
@@ -124,8 +125,9 @@ public final class MappingReader implements MappingReaderMetKeys {
if (fldNodes != null && fldNodes.getLength() > 0) {
for (int i = 0; i < fldNodes.getLength(); i++) {
MappingField fld = readField((Element) fldNodes.item(i));
- if (fld.getTableName() == null || fld.getTableName().isEmpty())
+ if (fld.getTableName() == null || fld.getTableName().isEmpty()) {
fld.setTableName(map.getDefaultTable());
+ }
map.addField(fld.getName(), fld);
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java b/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
index 9f27c94..8cfd80a 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/product/XMLPSProductHandler.java
@@ -150,8 +150,9 @@ public class XMLPSProductHandler implements QueryHandler {
protected List<QueryElement> getElemNamesFromQueryElemSet(
List<QueryElement> origSet) {
- if (origSet == null || (origSet.size() == 0))
+ if (origSet == null || (origSet.size() == 0)) {
return Collections.emptyList();
+ }
List<QueryElement> newSet = new Vector<QueryElement>();
@@ -170,8 +171,9 @@ public class XMLPSProductHandler implements QueryHandler {
protected List<QueryElement> getConstElemNamesFromQueryElemSet(
List<QueryElement> origSet) {
- if (origSet == null || (origSet.size() == 0))
+ if (origSet == null || (origSet.size() == 0)) {
return Collections.emptyList();
+ }
List<QueryElement> newSet = new Vector<QueryElement>();
@@ -258,8 +260,9 @@ public class XMLPSProductHandler implements QueryHandler {
}
private String toSQLSelectColumns(List<QueryElement> elems) {
- if (elems == null || (elems.size() == 0))
+ if (elems == null || (elems.size() == 0)) {
return null;
+ }
StringBuilder buf = new StringBuilder();
for (QueryElement qe : elems) {
@@ -316,8 +319,9 @@ public class XMLPSProductHandler implements QueryHandler {
&& fld.getFuncs().size() > 0) {
// the next query element should be
// XMLQueryHelper.ROLE_LITERAL
- if (!i.hasNext())
+ if (!i.hasNext()) {
break;
+ }
QueryElement litElem = i.next();
if (!litElem.getRole().equals(XMLQueryHelper.ROLE_LITERAL)) {
throw new XmlpsException("next query element not "
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
index 5b5e27a..9e59747 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/HandlerQueryParser.java
@@ -59,8 +59,9 @@ public class HandlerQueryParser implements ParseConstants {
if (!queryStack.empty()) {
qe = (QueryElement) queryStack.pop();
- } else
+ } else {
return null;
+ }
if (qe.getRole().equalsIgnoreCase(XMLQUERY_LOGOP)) {
@@ -69,8 +70,9 @@ public class HandlerQueryParser implements ParseConstants {
return new AndExpression(parse(queryStack, map), parse(queryStack, map));
} else if (logOpType.equalsIgnoreCase(XMLQUERY_OR)) {
return new OrExpression(parse(queryStack, map), parse(queryStack, map));
- } else
+ } else {
return null;
+ }
} else if (qe.getRole().equalsIgnoreCase(XMLQUERY_RELOP)) {
String relOpType = qe.getValue();
@@ -103,13 +105,15 @@ public class HandlerQueryParser implements ParseConstants {
return new LessThanExpression(lhsVal, new Literal(rhsVal));
} else if (relOpType.equalsIgnoreCase(XMLQUERY_LESS_THAN_OR_EQUAL_TO)) {
return new LessThanEqualsExpression(lhsVal, new Literal(rhsVal));
- } else
+ } else {
return null;
+ }
} else if (qe.getRole().equalsIgnoreCase(XMLQUERY_LITERAL)) {
return new Literal(qe.getValue());
- } else
+ } else {
return null;
+ }
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
index 7c97c2a..2f91b9c 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/queryparser/WildcardLiteral.java
@@ -40,7 +40,9 @@ public class WildcardLiteral extends Literal {
if(val.startsWith("'")){
return "'%"+val.substring(1, val.length()-1)+"%'";
}
- else return "%" + val + "%";
+ else {
+ return "%" + val + "%";
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
index 800dae7..0f92082 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResult.java
@@ -73,8 +73,9 @@ public class CDEResult extends Result {
@Override
public InputStream getInputStream() throws IOException {
- if (rs == null || con == null)
+ if (rs == null || con == null) {
throw new IOException("InputStream not ready, ResultSet or Connection is null!");
+ }
return new CDEResultInputStream(this);
}
@@ -84,17 +85,20 @@ public class CDEResult extends Result {
}
public void close() throws SQLException {
- if (rs != null)
+ if (rs != null) {
rs.close();
- if (con != null)
+ }
+ if (con != null) {
con.close();
+ }
}
public String getNextRowAsString() throws SQLException {
if (rs.next()) {
CDERow row = createCDERow();
- if (mapping != null)
+ if (mapping != null) {
applyMappingFuncs(row);
+ }
if (this.constValues != null && ((this.orderedFields == null) || (this.orderedFields.size() == 0))){
addConstValues(row);
}
@@ -136,7 +140,9 @@ public class CDEResult extends Result {
}
}
}
- else row.getVals().addAll(orderedDbVals);
+ else {
+ row.getVals().addAll(orderedDbVals);
+ }
return row;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
----------------------------------------------------------------------
diff --git a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
index 2198afe..4d358aa 100644
--- a/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
+++ b/xmlps/src/main/java/org/apache/oodt/xmlps/structs/CDEResultInputStream.java
@@ -36,15 +36,17 @@ class CDEResultInputStream extends InputStream {
s = res.getNextRowAsString();
} catch (SQLException ignored) {
}
- if (rowStream != null)
+ if (rowStream != null) {
rowStream.close();
+ }
rowStream = s == null ? null : new ByteArrayInputStream(s.getBytes("UTF-8"));
return rowStream != null;
}
private boolean ensureOpen() throws IOException {
- if (rowStream == null || rowStream.available() <= 0)
+ if (rowStream == null || rowStream.available() <= 0) {
return fetchNextRow();
+ }
return true;
}
@@ -55,8 +57,9 @@ class CDEResultInputStream extends InputStream {
@Override
public int read(byte[] b, int off, int len) throws IOException {
- if (!ensureOpen())
+ if (!ensureOpen()) {
return -1;
+ }
if ((off < 0) || (off > b.length) || (len < 0) || ((off + len) > b.length)
|| ((off + len) < 0)) {
@@ -69,8 +72,9 @@ class CDEResultInputStream extends InputStream {
int n = rowStream.read(b, off, len);
total += n;
while (n != -1 && total < len) {
- if (!fetchNextRow())
+ if (!fetchNextRow()) {
return total;
+ }
n = rowStream.read(b, off + total, len - total);
total += n;
}
@@ -79,8 +83,9 @@ class CDEResultInputStream extends InputStream {
@Override
public void close() throws IOException {
- if (rowStream != null)
+ if (rowStream != null) {
rowStream.close();
+ }
rowStream = null;
try {
@@ -92,8 +97,9 @@ class CDEResultInputStream extends InputStream {
@Override
public synchronized int available() throws IOException {
- if (rowStream == null)
+ if (rowStream == null) {
return 0;
+ }
return rowStream.available();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
index 6b2146b..356b468 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ByteArrayCodec.java
@@ -42,11 +42,14 @@ class ByteArrayCodec implements Codec {
public Object decode(Node node) {
String encodedValue;
- if (node.getFirstChild() != null && node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)
- encodedValue = node.getFirstChild().getNodeValue();
- else
- encodedValue = XML.text(node);
- if (encodedValue.length() <= 0) return new byte[0];
+ if (node.getFirstChild() != null && node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
+ encodedValue = node.getFirstChild().getNodeValue();
+ } else {
+ encodedValue = XML.text(node);
+ }
+ if (encodedValue.length() <= 0) {
+ return new byte[0];
+ }
return Base64.decode(encodedValue.getBytes());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
index b74b238..0aedbda 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CodecFactory.java
@@ -38,16 +38,18 @@ class CodecFactory {
*/
public static Codec createCodec(String className) {
Codec codec = (Codec) codecs.get(className);
- if (codec == null) try {
+ if (codec == null) {
+ try {
Class clazz = Class.forName(className);
codec = (Codec) clazz.newInstance();
codecs.put(className, codec);
- } catch (ClassNotFoundException ex) {
+ } catch (ClassNotFoundException ex) {
throw new RuntimeException("Class \"" + className + "\" not found");
- } catch (InstantiationException ex) {
+ } catch (InstantiationException ex) {
throw new RuntimeException("Class \"" + className + "\" is abstract or is an interface");
- } catch (IllegalAccessException ex) {
+ } catch (IllegalAccessException ex) {
throw new RuntimeException("Class \"" + className + "\" doesn't have public no-args constructor");
+ }
}
return codec;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
index c314915..2563890 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedObjectCodec.java
@@ -63,10 +63,11 @@ class CompressedObjectCodec implements Codec {
public Object decode(Node node) throws ClassNotFoundException, InvalidClassException, StreamCorruptedException,
OptionalDataException {
String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)
- encodedValue = node.getFirstChild().getNodeValue();
- else
- encodedValue = XML.text(node);
+ if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
+ encodedValue = node.getFirstChild().getNodeValue();
+ } else {
+ encodedValue = XML.text(node);
+ }
Object rc = null;
try {
ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
index f77be48..de26113 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/CompressedStringCodec.java
@@ -54,10 +54,11 @@ class CompressedStringCodec implements Codec {
public Object decode(Node node) {
String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)
- encodedValue = node.getFirstChild().getNodeValue();
- else
- encodedValue = XML.text(node);
+ if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
+ encodedValue = node.getFirstChild().getNodeValue();
+ } else {
+ encodedValue = XML.text(node);
+ }
String rc = null;
try {
ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
@@ -66,8 +67,9 @@ class CompressedStringCodec implements Codec {
StringBuilder b = new StringBuilder();
int numRead;
byte[] buf = new byte[1024];
- while ((numRead = gzip.read(buf)) != -1)
- b.append(new String(buf, 0, numRead));
+ while ((numRead = gzip.read(buf)) != -1) {
+ b.append(new String(buf, 0, numRead));
+ }
gzip.close();
rc = b.toString();
} catch (IOException ignored) {}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
index abc666b..f148425 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Header.java
@@ -43,8 +43,9 @@ public class Header implements Serializable, Cloneable, Documentable {
* @return A list of <code>Header</code>s.
*/
public static List createHeaders(Node root) {
- if (!"resultHeader".equals(root.getNodeName()))
- throw new IllegalArgumentException("Expected <resultHeader> but got <" + root.getNodeName() + ">");
+ if (!"resultHeader".equals(root.getNodeName())) {
+ throw new IllegalArgumentException("Expected <resultHeader> but got <" + root.getNodeName() + ">");
+ }
NodeList children = root.getChildNodes();
List rc = new ArrayList();
for (int i = 0; i < children.getLength(); ++i){
@@ -92,18 +93,20 @@ public class Header implements Serializable, Cloneable, Documentable {
* @param node The DOM node, which must be a <headerElement> element.
*/
public Header(Node node) {
- if (!"headerElement".equals(node.getNodeName()))
- throw new IllegalArgumentException("Header must be constructed from <headerElement> node, not <"
- + node.getNodeName() + ">");
+ if (!"headerElement".equals(node.getNodeName())) {
+ throw new IllegalArgumentException("Header must be constructed from <headerElement> node, not <"
+ + node.getNodeName() + ">");
+ }
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
- if ("elemName".equals(child.getNodeName()))
- name = XML.unwrappedText(child);
- else if ("elemType".equals(child.getNodeName()))
- type = XML.unwrappedText(child);
- else if ("elemUnit".equals(child.getNodeName()))
- unit = XML.unwrappedText(child);
+ if ("elemName".equals(child.getNodeName())) {
+ name = XML.unwrappedText(child);
+ } else if ("elemType".equals(child.getNodeName())) {
+ type = XML.unwrappedText(child);
+ } else if ("elemUnit".equals(child.getNodeName())) {
+ unit = XML.unwrappedText(child);
+ }
}
}
@@ -168,8 +171,12 @@ public class Header implements Serializable, Cloneable, Documentable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof Header)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof Header)) {
+ return false;
+ }
Header obj = (Header) rhs;
return name.equals(obj.name) && ((type == null && obj.type == null) || type.equals(obj.type))
&& ((unit == null && obj.unit == null) || unit.equals(obj.unit));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
index 0024b63..02723d8 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/ObjectCodec.java
@@ -60,10 +60,11 @@ class ObjectCodec implements Codec {
public Object decode(Node node) throws ClassNotFoundException, InvalidClassException, StreamCorruptedException,
OptionalDataException {
String encodedValue;
- if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE)
- encodedValue = node.getFirstChild().getNodeValue();
- else
- encodedValue = XML.text(node);
+ if (node.getFirstChild().getNodeType() == Node.CDATA_SECTION_NODE) {
+ encodedValue = node.getFirstChild().getNodeValue();
+ } else {
+ encodedValue = XML.text(node);
+ }
Object rc = null;
try {
ByteArrayInputStream byteArray = new ByteArrayInputStream(encodedValue.getBytes());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
index 2e583f1..7529f5f 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryElement.java
@@ -50,16 +50,18 @@ public class QueryElement implements Serializable, Cloneable, Documentable {
}
public QueryElement(Node node) {
- if (!"queryElement".equals(node.getNodeName()))
- throw new IllegalArgumentException("Query element must be constructed from <queryElement> node, not <"
- + node.getNodeName() + ">");
+ if (!"queryElement".equals(node.getNodeName())) {
+ throw new IllegalArgumentException("Query element must be constructed from <queryElement> node, not <"
+ + node.getNodeName() + ">");
+ }
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
- if ("tokenRole".equals(child.getNodeName()))
- role = XML.unwrappedText(child);
- else if ("tokenValue".equals(child.getNodeName()))
- value = XML.unwrappedText(child);
+ if ("tokenRole".equals(child.getNodeName())) {
+ role = XML.unwrappedText(child);
+ } else if ("tokenValue".equals(child.getNodeName())) {
+ value = XML.unwrappedText(child);
+ }
}
}
@@ -84,7 +86,9 @@ public class QueryElement implements Serializable, Cloneable, Documentable {
* @param role The new role this element plays.
*/
public void setRole(String role) {
- if (role == null) role = "UNKNOWN";
+ if (role == null) {
+ role = "UNKNOWN";
+ }
this.role = role;
}
@@ -93,7 +97,9 @@ public class QueryElement implements Serializable, Cloneable, Documentable {
* @param value The new value of this element.
*/
public void setValue(String value) {
- if (value == null) value = "UNKNOWN";
+ if (value == null) {
+ value = "UNKNOWN";
+ }
this.value = value;
}
@@ -105,8 +111,12 @@ public class QueryElement implements Serializable, Cloneable, Documentable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof QueryElement)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof QueryElement)) {
+ return false;
+ }
QueryElement obj = (QueryElement) rhs;
return role.equals(obj.role) && value.equals(obj.value);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
index ce26d70..e6407ef 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryHeader.java
@@ -68,32 +68,34 @@ public class QueryHeader implements Serializable, Cloneable, Documentable {
* @param node The <queryAttributes> node.
*/
public QueryHeader(Node node) {
- if (!"queryAttributes".equals(node.getNodeName()))
- throw new IllegalArgumentException("QueryHeader must be constructed from <queryAttributes> node, not <"
- + node.getNodeName() + ">");
+ if (!"queryAttributes".equals(node.getNodeName())) {
+ throw new IllegalArgumentException("QueryHeader must be constructed from <queryAttributes> node, not <"
+ + node.getNodeName() + ">");
+ }
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
- if ("queryId".equals(child.getNodeName()))
- id = XML.unwrappedText(child);
- else if ("queryTitle".equals(child.getNodeName()))
- title = XML.unwrappedText(child);
- else if ("queryDesc".equals(child.getNodeName()))
- description = XML.unwrappedText(child);
- else if ("queryType".equals(child.getNodeName()))
- type = XML.unwrappedText(child);
- else if ("queryStatusId".equals(child.getNodeName()))
- statusID = XML.unwrappedText(child);
- else if ("querySecurityType".equals(child.getNodeName()))
- securityType = XML.unwrappedText(child);
- else if ("queryParentId".equals(child.getNodeName()))
- ; // ignore
- else if ("queryChildId".equals(child.getNodeName()))
- ; // ignore
- else if ("queryRevisionNote".equals(child.getNodeName()))
- revisionNote = XML.unwrappedText(child);
- else if ("queryDataDictId".equals(child.getNodeName()))
- dataDictID = XML.unwrappedText(child);
+ if ("queryId".equals(child.getNodeName())) {
+ id = XML.unwrappedText(child);
+ } else if ("queryTitle".equals(child.getNodeName())) {
+ title = XML.unwrappedText(child);
+ } else if ("queryDesc".equals(child.getNodeName())) {
+ description = XML.unwrappedText(child);
+ } else if ("queryType".equals(child.getNodeName())) {
+ type = XML.unwrappedText(child);
+ } else if ("queryStatusId".equals(child.getNodeName())) {
+ statusID = XML.unwrappedText(child);
+ } else if ("querySecurityType".equals(child.getNodeName())) {
+ securityType = XML.unwrappedText(child);
+ } else if ("queryParentId".equals(child.getNodeName())) {
+ ; // ignore
+ } else if ("queryChildId".equals(child.getNodeName())) {
+ ; // ignore
+ } else if ("queryRevisionNote".equals(child.getNodeName())) {
+ revisionNote = XML.unwrappedText(child);
+ } else if ("queryDataDictId".equals(child.getNodeName())) {
+ dataDictID = XML.unwrappedText(child);
+ }
}
}
@@ -253,8 +255,12 @@ public class QueryHeader implements Serializable, Cloneable, Documentable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof QueryHeader)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof QueryHeader)) {
+ return false;
+ }
QueryHeader obj = (QueryHeader) rhs;
return getID().equals(obj.getID());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
index 75f9320..595dbc8 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/QueryResult.java
@@ -57,15 +57,17 @@ public class QueryResult implements Serializable, Cloneable, Documentable {
* @param node The <queryResultSet> node.
*/
public QueryResult(Node node) {
- if (!"queryResultSet".equals(node.getNodeName()))
- throw new IllegalArgumentException("QueryResult must be constructed from <queryResultSet> node, not <"
- + node.getNodeName() + ">");
+ if (!"queryResultSet".equals(node.getNodeName())) {
+ throw new IllegalArgumentException("QueryResult must be constructed from <queryResultSet> node, not <"
+ + node.getNodeName() + ">");
+ }
list = new ArrayList();
NodeList children = node.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE && "resultElement".equals(child.getNodeName()))
- list.add(new Result(child));
+ if (child.getNodeType() == Node.ELEMENT_NODE && "resultElement".equals(child.getNodeName())) {
+ list.add(new Result(child));
+ }
}
}
@@ -99,7 +101,9 @@ public class QueryResult implements Serializable, Cloneable, Documentable {
}
public boolean equals(Object obj) {
- if (obj == this) return true;
+ if (obj == this) {
+ return true;
+ }
if (obj instanceof QueryResult) {
QueryResult rhs = (QueryResult) obj;
return list.equals(rhs.list);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/Result.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Result.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Result.java
index b5a2889..eee06c5 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Result.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Result.java
@@ -82,11 +82,13 @@ public class Result implements Serializable, Cloneable, Documentable {
*/
public Result(String id, String mimeType, String profileID, String resourceID, List headers, Object value,
boolean classified, long validity) {
- if (validity < 0 && validity != INFINITE)
- throw new IllegalArgumentException("Validity must be a nonnegative time in milliseconds or "
- + " Result.INFINITE to indicate no expiration");
- if (!codecs.containsKey(mimeType))
- throw new IllegalArgumentException("MIME type \"" + mimeType + "\" unknown");
+ if (validity < 0 && validity != INFINITE) {
+ throw new IllegalArgumentException("Validity must be a nonnegative time in milliseconds or "
+ + " Result.INFINITE to indicate no expiration");
+ }
+ if (!codecs.containsKey(mimeType)) {
+ throw new IllegalArgumentException("MIME type \"" + mimeType + "\" unknown");
+ }
for (Object header : headers) {
if (!(header instanceof Header)) {
throw new IllegalArgumentException("List of headers doesn't contain Header object");
@@ -108,9 +110,10 @@ public class Result implements Serializable, Cloneable, Documentable {
* @param node The DOM node, which must be a <resultElement> element.
*/
public Result(Node node) {
- if (!"resultElement".equals(node.getNodeName()))
- throw new IllegalArgumentException("Result must be constructed from <resultElement> node, not <"
- + node.getNodeName() + ">");
+ if (!"resultElement".equals(node.getNodeName())) {
+ throw new IllegalArgumentException("Result must be constructed from <resultElement> node, not <"
+ + node.getNodeName() + ">");
+ }
Element rootElement = (Element) node;
classified = "true".equals(rootElement.getAttribute("classified"));
validity = Long.parseLong(rootElement.getAttribute("validity"));
@@ -118,21 +121,22 @@ public class Result implements Serializable, Cloneable, Documentable {
String encodedValue = null;
for (int i = 0; i < children.getLength(); ++i) {
Node child = children.item(i);
- if ("resultId".equals(child.getNodeName()))
- id = XML.unwrappedText(child);
- else if ("resultMimeType".equals(child.getNodeName()))
- mimeType = XML.unwrappedText(child);
- else if ("profId".equals(child.getNodeName()))
- profileID = XML.unwrappedText(child);
- else if ("identifier".equals(child.getNodeName()))
- resourceID = XML.unwrappedText(child);
- else if ("resultHeader".equals(child.getNodeName()))
- headers = Header.createHeaders(child);
- else if ("resultValue".equals(child.getNodeName())) {
+ if ("resultId".equals(child.getNodeName())) {
+ id = XML.unwrappedText(child);
+ } else if ("resultMimeType".equals(child.getNodeName())) {
+ mimeType = XML.unwrappedText(child);
+ } else if ("profId".equals(child.getNodeName())) {
+ profileID = XML.unwrappedText(child);
+ } else if ("identifier".equals(child.getNodeName())) {
+ resourceID = XML.unwrappedText(child);
+ } else if ("resultHeader".equals(child.getNodeName())) {
+ headers = Header.createHeaders(child);
+ } else if ("resultValue".equals(child.getNodeName())) {
Codec codec = (Codec) codecs.get(mimeType);
- if (codec == null)
- throw new IllegalArgumentException("Unkown MIME type \"" + mimeType
- + "\" in <resultElement>'s <resultMimeType>");
+ if (codec == null) {
+ throw new IllegalArgumentException("Unkown MIME type \"" + mimeType
+ + "\" in <resultElement>'s <resultMimeType>");
+ }
try {
value = codec.decode(child);
} catch (RuntimeException ex) {
@@ -246,8 +250,10 @@ public class Result implements Serializable, Cloneable, Documentable {
*/
public long getSize() {
Codec codec = (Codec) codecs.get(mimeType);
- if (codec == null) throw new IllegalStateException("No codec available for supposedly valid MIME type \""
- + mimeType + "\"");
+ if (codec == null) {
+ throw new IllegalStateException("No codec available for supposedly valid MIME type \""
+ + mimeType + "\"");
+ }
return codec.sizeOf(value);
}
@@ -266,8 +272,10 @@ public class Result implements Serializable, Cloneable, Documentable {
resultHeader.appendChild(header.toXML(doc));
}
Codec codec = (Codec) codecs.get(mimeType);
- if (codec == null) throw new IllegalStateException("No codec available for supposedly valid MIME type \""
- + mimeType + "\"");
+ if (codec == null) {
+ throw new IllegalStateException("No codec available for supposedly valid MIME type \""
+ + mimeType + "\"");
+ }
root.appendChild(codec.encode(value, doc));
return root;
}
@@ -280,8 +288,10 @@ public class Result implements Serializable, Cloneable, Documentable {
*/
public InputStream getInputStream() throws IOException {
Codec codec = (Codec) codecs.get(mimeType);
- if (codec == null) throw new IllegalStateException("No codec available for allegedly valid MIME type \""
- + mimeType + "\"");
+ if (codec == null) {
+ throw new IllegalStateException("No codec available for allegedly valid MIME type \""
+ + mimeType + "\"");
+ }
return codec.getInputStream(value);
}
@@ -327,8 +337,12 @@ public class Result implements Serializable, Cloneable, Documentable {
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof Result)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof Result)) {
+ return false;
+ }
Result obj = (Result) rhs;
return id.equals(obj.id) && mimeType.equals(obj.mimeType) && profileID.equals(obj.profileID)
&& resourceID.equals(obj.resourceID) && headers.equals(obj.headers) && value.equals(obj.value);
@@ -346,8 +360,12 @@ public class Result implements Serializable, Cloneable, Documentable {
}
public void setRetriever(Retriever retriever) {
- if (retriever == null) throw new IllegalArgumentException("retriever must be non-null");
- if (this.retriever == null) this.retriever = retriever;
+ if (retriever == null) {
+ throw new IllegalArgumentException("retriever must be non-null");
+ }
+ if (this.retriever == null) {
+ this.retriever = retriever;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/xmlquery/src/main/java/org/apache/oodt/xmlquery/Statistic.java
----------------------------------------------------------------------
diff --git a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Statistic.java b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Statistic.java
index fd7a565..2b4dae0 100755
--- a/xmlquery/src/main/java/org/apache/oodt/xmlquery/Statistic.java
+++ b/xmlquery/src/main/java/org/apache/oodt/xmlquery/Statistic.java
@@ -74,11 +74,12 @@ public class Statistic implements java.io.Serializable, Cloneable
if (node instanceof Element)
{
nodeName = node.getNodeName();
- if (nodeName.compareTo("url") == 0)
- url = XML.unwrappedText(node);
- else
- if (nodeName.compareTo("time") == 0)
- time = Long.parseLong(XML.unwrappedText(node));
+ if (nodeName.compareTo("url") == 0) {
+ url = XML.unwrappedText(node);
+ } else
+ if (nodeName.compareTo("time") == 0) {
+ time = Long.parseLong(XML.unwrappedText(node));
+ }
}
}
}
[04/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
index e1420ee..d7fce0f 100644
--- a/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
+++ b/profile/src/main/java/org/apache/oodt/profile/ProfileElement.java
@@ -69,41 +69,45 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
List<String> values = new ArrayList<String>();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if ("elemId".equals(node.getNodeName()))
- id = XML.unwrappedText(node);
- else if ("elemName".equals(node.getNodeName()))
- name = XML.unwrappedText(node);
- else if ("elemDesc".equals(node.getNodeName()))
- desc = XML.unwrappedText(node);
- else if ("elemType".equals(node.getNodeName()))
- type = XML.unwrappedText(node);
- else if ("elemUnit".equals(node.getNodeName()))
- unit = XML.unwrappedText(node);
- else if ("elemEnumFlag".equals(node.getNodeName()))
- ranged = "F".equals(XML.unwrappedText(node));
- else if ("elemSynonym".equals(node.getNodeName()))
- synonyms.add(XML.unwrappedText(node));
- else if ("elemObligation".equals(node.getNodeName())) {
+ if ("elemId".equals(node.getNodeName())) {
+ id = XML.unwrappedText(node);
+ } else if ("elemName".equals(node.getNodeName())) {
+ name = XML.unwrappedText(node);
+ } else if ("elemDesc".equals(node.getNodeName())) {
+ desc = XML.unwrappedText(node);
+ } else if ("elemType".equals(node.getNodeName())) {
+ type = XML.unwrappedText(node);
+ } else if ("elemUnit".equals(node.getNodeName())) {
+ unit = XML.unwrappedText(node);
+ } else if ("elemEnumFlag".equals(node.getNodeName())) {
+ ranged = "F".equals(XML.unwrappedText(node));
+ } else if ("elemSynonym".equals(node.getNodeName())) {
+ synonyms.add(XML.unwrappedText(node));
+ } else if ("elemObligation".equals(node.getNodeName())) {
String value = XML.unwrappedText(node);
obligation = "Required".equals(value) || "T".equals(value);
- } else if ("elemMaxOccurrence".equals(node.getNodeName()))
- try {
- maxOccurrence = Integer.parseInt(XML.unwrappedText(node));
- } catch (NumberFormatException ignore) {}
- else if ("elemComment".equals(node.getNodeName()))
- comments = XML.unwrappedText(node);
- else if ("elemValue".equals(node.getNodeName())) {
+ } else if ("elemMaxOccurrence".equals(node.getNodeName())) {
+ try {
+ maxOccurrence = Integer.parseInt(XML.unwrappedText(node));
+ } catch (NumberFormatException ignore) {
+ }
+ } else if ("elemComment".equals(node.getNodeName())) {
+ comments = XML.unwrappedText(node);
+ } else if ("elemValue".equals(node.getNodeName())) {
values.add(text(node));
- } else if ("elemMinValue".equals(node.getNodeName()))
- try {
- min = XML.unwrappedText(node);
- gotMin = true;
- } catch (NumberFormatException ignore) {}
- else if ("elemMaxValue".equals(node.getNodeName()))
- try {
- max = XML.unwrappedText(node);
- gotMax = true;
- } catch (NumberFormatException ignore) {}
+ } else if ("elemMinValue".equals(node.getNodeName())) {
+ try {
+ min = XML.unwrappedText(node);
+ gotMin = true;
+ } catch (NumberFormatException ignore) {
+ }
+ } else if ("elemMaxValue".equals(node.getNodeName())) {
+ try {
+ max = XML.unwrappedText(node);
+ gotMax = true;
+ } catch (NumberFormatException ignore) {
+ }
+ }
}
if (ranged) {
if (gotMin && gotMax) {
@@ -112,9 +116,10 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
}
return factory.createUnspecifiedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
maxOccurrence, comments);
- } else
- return factory.createEnumeratedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
- maxOccurrence, comments, values);
+ } else {
+ return factory.createEnumeratedProfileElement(profile, name, id, desc, type, unit, synonyms, obligation,
+ maxOccurrence, comments, values);
+ }
}
/**
@@ -158,8 +163,12 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof ProfileElement)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof ProfileElement)) {
+ return false;
+ }
ProfileElement obj = (ProfileElement) rhs;
return profile.equals(obj.profile) && name.equals(obj.name);
}
@@ -178,10 +187,12 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
public int compareTo(Object rhs) {
ProfileElement obj = (ProfileElement) rhs;
- if (profile.compareTo(obj.profile) < 0)
- return -1;
- if (profile.compareTo(obj.profile) == 0)
- return name.compareTo(obj.name);
+ if (profile.compareTo(obj.profile) < 0) {
+ return -1;
+ }
+ if (profile.compareTo(obj.profile) == 0) {
+ return name.compareTo(obj.name);
+ }
return 1;
}
@@ -415,12 +426,16 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
XML.addNonNull(profElement, "elemType", type);
XML.addNonNull(profElement, "elemUnit", unit);
XML.add(profElement, "elemEnumFlag", isEnumerated()? "T" : "F");
- if (withValues) addValues(profElement);
+ if (withValues) {
+ addValues(profElement);
+ }
XML.add(profElement, "elemSynonym", synonyms);
- if (isObligatory())
- XML.add(profElement, "elemObligation","Required");
- if (getMaxOccurrence() >= 0)
- XML.add(profElement, "elemMaxOccurrence", String.valueOf(getMaxOccurrence()));
+ if (isObligatory()) {
+ XML.add(profElement, "elemObligation", "Required");
+ }
+ if (getMaxOccurrence() >= 0) {
+ XML.add(profElement, "elemMaxOccurrence", String.valueOf(getMaxOccurrence()));
+ }
XML.add(profElement, "elemComment", comments);
return profElement;
}
@@ -563,8 +578,9 @@ public abstract class ProfileElement implements Serializable, Cloneable, Compara
return;
}
NodeList children = node.getChildNodes();
- for (int i = 0; i < children.getLength(); ++i)
- text0(b, children.item(i));
+ for (int i = 0; i < children.getLength(); ++i) {
+ text0(b, children.item(i));
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java b/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
index c27ed77..d0b1e55 100644
--- a/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
+++ b/profile/src/main/java/org/apache/oodt/profile/ResourceAttributes.java
@@ -75,44 +75,45 @@ public class ResourceAttributes implements Serializable, Cloneable, Comparable<O
NodeList children = root.getChildNodes();
for (int i = 0; i < children.getLength(); ++i) {
Node node = children.item(i);
- if ("Identifier".equals(node.getNodeName()))
- identifier = XML.unwrappedText(node);
- else if ("Title".equals(node.getNodeName()))
- title = XML.unwrappedText(node);
- else if ("Format".equals(node.getNodeName()))
- formats.add(XML.unwrappedText(node));
- else if ("Description".equals(node.getNodeName()))
- description = XML.unwrappedText(node);
- else if ("Creator".equals(node.getNodeName()))
- creators.add(XML.unwrappedText(node));
- else if ("Subject".equals(node.getNodeName()))
- subjects.add(XML.unwrappedText(node));
- else if ("Publisher".equals(node.getNodeName()))
- publishers.add(XML.unwrappedText(node));
- else if ("Contributor".equals(node.getNodeName()))
- contributors.add(XML.unwrappedText(node));
- else if ("Date".equals(node.getNodeName()))
- dates.add(XML.unwrappedText(node));
- else if ("Type".equals(node.getNodeName()))
- types.add(XML.unwrappedText(node));
- else if ("Source".equals(node.getNodeName()))
- sources.add(XML.unwrappedText(node));
- else if ("Language".equals(node.getNodeName()))
- languages.add(XML.unwrappedText(node));
- else if ("Relation".equals(node.getNodeName()))
- relations.add(XML.unwrappedText(node));
- else if ("Coverage".equals(node.getNodeName()))
- coverages.add(XML.unwrappedText(node));
- else if ("Rights".equals(node.getNodeName()))
- rights.add(XML.unwrappedText(node));
- else if ("resContext".equals(node.getNodeName()))
- contexts.add(XML.unwrappedText(node));
- else if ("resAggregation".equals(node.getNodeName()))
- aggregation = XML.unwrappedText(node);
- else if ("resClass".equals(node.getNodeName()))
- clazz = XML.unwrappedText(node);
- else if ("resLocation".equals(node.getNodeName()))
- locations.add(XML.unwrappedText(node));
+ if ("Identifier".equals(node.getNodeName())) {
+ identifier = XML.unwrappedText(node);
+ } else if ("Title".equals(node.getNodeName())) {
+ title = XML.unwrappedText(node);
+ } else if ("Format".equals(node.getNodeName())) {
+ formats.add(XML.unwrappedText(node));
+ } else if ("Description".equals(node.getNodeName())) {
+ description = XML.unwrappedText(node);
+ } else if ("Creator".equals(node.getNodeName())) {
+ creators.add(XML.unwrappedText(node));
+ } else if ("Subject".equals(node.getNodeName())) {
+ subjects.add(XML.unwrappedText(node));
+ } else if ("Publisher".equals(node.getNodeName())) {
+ publishers.add(XML.unwrappedText(node));
+ } else if ("Contributor".equals(node.getNodeName())) {
+ contributors.add(XML.unwrappedText(node));
+ } else if ("Date".equals(node.getNodeName())) {
+ dates.add(XML.unwrappedText(node));
+ } else if ("Type".equals(node.getNodeName())) {
+ types.add(XML.unwrappedText(node));
+ } else if ("Source".equals(node.getNodeName())) {
+ sources.add(XML.unwrappedText(node));
+ } else if ("Language".equals(node.getNodeName())) {
+ languages.add(XML.unwrappedText(node));
+ } else if ("Relation".equals(node.getNodeName())) {
+ relations.add(XML.unwrappedText(node));
+ } else if ("Coverage".equals(node.getNodeName())) {
+ coverages.add(XML.unwrappedText(node));
+ } else if ("Rights".equals(node.getNodeName())) {
+ rights.add(XML.unwrappedText(node));
+ } else if ("resContext".equals(node.getNodeName())) {
+ contexts.add(XML.unwrappedText(node));
+ } else if ("resAggregation".equals(node.getNodeName())) {
+ aggregation = XML.unwrappedText(node);
+ } else if ("resClass".equals(node.getNodeName())) {
+ clazz = XML.unwrappedText(node);
+ } else if ("resLocation".equals(node.getNodeName())) {
+ locations.add(XML.unwrappedText(node));
+ }
}
}
@@ -176,8 +177,12 @@ public class ResourceAttributes implements Serializable, Cloneable, Comparable<O
}
public boolean equals(Object rhs) {
- if (rhs == this) return true;
- if (rhs == null || !(rhs instanceof ResourceAttributes)) return false;
+ if (rhs == this) {
+ return true;
+ }
+ if (rhs == null || !(rhs instanceof ResourceAttributes)) {
+ return false;
+ }
return ((ResourceAttributes) rhs).identifier.equals(identifier);
}
@@ -230,12 +235,14 @@ public class ResourceAttributes implements Serializable, Cloneable, Comparable<O
public URI getURI() {
String identification;
if (identifier == null || identifier.length() == 0) {
- if (locations.isEmpty())
- identification = null;
- else
- identification = (String) locations.get(0);
- } else
- identification = identifier;
+ if (locations.isEmpty()) {
+ identification = null;
+ } else {
+ identification = (String) locations.get(0);
+ }
+ } else {
+ identification = identifier;
+ }
return identification == null? UNKNOWN_URI : URI.create(identification);
}
@@ -564,10 +571,14 @@ public class ResourceAttributes implements Serializable, Cloneable, Comparable<O
XML.add(root, "Coverage", coverages);
XML.add(root, "Rights", rights);
List<String> contexts = new ArrayList<String>(this.contexts);
- if (contexts.isEmpty()) contexts.add("UNKNOWN");
+ if (contexts.isEmpty()) {
+ contexts.add("UNKNOWN");
+ }
XML.add(root, "resContext", contexts);
XML.addNonNull(root, "resAggregation", aggregation);
- if(clazz==null) clazz="UNKNOWN";
+ if(clazz==null) {
+ clazz = "UNKNOWN";
+ }
XML.addNonNull(root, "resClass", clazz);
XML.add(root, "resLocation", locations);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/Utility.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/Utility.java b/profile/src/main/java/org/apache/oodt/profile/Utility.java
index 0abb44b..86ac062 100644
--- a/profile/src/main/java/org/apache/oodt/profile/Utility.java
+++ b/profile/src/main/java/org/apache/oodt/profile/Utility.java
@@ -52,12 +52,16 @@ class Utility {
static void addProperty(Model model, Resource resource, Property property, Object value, ProfileAttributes profAttr,
URI uri) {
- if (value == null || value.toString().length() == 0) return;
+ if (value == null || value.toString().length() == 0) {
+ return;
+ }
Object obj;
if (value instanceof Collection) {
Collection<?> collection = (Collection<?>) value;
- if (collection.isEmpty()) return;
+ if (collection.isEmpty()) {
+ return;
+ }
Bag bag = model.createBag(uri + "_" + property.getLocalName() + "_bag");
for (Object aCollection : collection) {
bag.add(aCollection);
@@ -104,7 +108,9 @@ class Utility {
}
private static void addPotentiallyNullReifiedStatement(Resource reification, Property property, Object value) {
- if (value == null || value.toString().length() == 0) return;
+ if (value == null || value.toString().length() == 0) {
+ return;
+ }
reification.addProperty(property, value.toString());
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java b/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
index f630417..72be8da 100755
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/DatabaseProfileManager.java
@@ -53,7 +53,9 @@ public abstract class DatabaseProfileManager implements ProfileManager
* @throws DOMException If an error occurs.
*/
private static void add(Node node, String name, String value) throws DOMException {
- if (value == null) return;
+ if (value == null) {
+ return;
+ }
XML.add(node, name, value.trim());
}
@@ -260,7 +262,9 @@ public abstract class DatabaseProfileManager implements ProfileManager
// get connection
String url = props.getProperty("org.apache.oodt.util.JDBC_DB.url", "jdbc:oracle:@");
String database = props.getProperty("org.apache.oodt.util.JDBC_DB.database");
- if(database != null) url += database;
+ if(database != null) {
+ url += database;
+ }
Connection conn = DriverManager.getConnection(url,
props.getProperty("org.apache.oodt.util.JDBC_DB.user"),
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
index d441053..6998c9e 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/ConstantExpression.java
@@ -40,10 +40,11 @@ class ConstantExpression implements WhereExpression {
}
public Result result(SearchableResourceAttributes resAttr, Map elements) {
- if (value)
- return new MatchingResult(new HashSet(elements.values()));
- else
- return FalseResult.INSTANCE;
+ if (value) {
+ return new MatchingResult(new HashSet(elements.values()));
+ } else {
+ return FalseResult.INSTANCE;
+ }
}
public WhereExpression simplify() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
index 8994028..188d47f 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/LightweightProfileServer.java
@@ -91,7 +91,9 @@ final public class LightweightProfileServer implements ProfileHandler {
// Get the list of profiles from the cache, if it's there.
profiles = (List) cache.get(url);
- if (profiles != null) return;
+ if (profiles != null) {
+ return;
+ }
// It wasn't in the cache, so create a parser to parse the file. We only
// deal with correct files, so turn on validation and install an error
@@ -157,7 +159,9 @@ final public class LightweightProfileServer implements ProfileHandler {
* @return a {@link Profile} value.
*/
public Profile get(String profID) {
- if (profID == null) return null;
+ if (profID == null) {
+ return null;
+ }
Profile rc = null;
for (Object profile : profiles) {
Profile p = (Profile) profile;
@@ -221,10 +225,11 @@ final public class LightweightProfileServer implements ProfileHandler {
}
// If there's nothing on the stack, we're given nothing, so give back everything.
- if (stack.size() == 0)
- return new ConstantExpression(true);
- else if (stack.size() > 1)
- throw new IllegalStateException("Imbalanced expression in query");
+ if (stack.size() == 0) {
+ return new ConstantExpression(true);
+ } else if (stack.size() > 1) {
+ throw new IllegalStateException("Imbalanced expression in query");
+ }
// Simplify/optimize the where-expression and return it.
return ((WhereExpression) stack.pop()).simplify();
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
index c046019..51c18d5 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/OperatorExpression.java
@@ -40,8 +40,9 @@ class OperatorExpression implements WhereExpression {
* @param operator What operator to use
*/
public OperatorExpression(String value, String name, String operator) {
- if (Arrays.binarySearch(VALID_OPERATORS, operator) < 0)
- throw new IllegalArgumentException("Invalid operator \"" + operator + "\"");
+ if (Arrays.binarySearch(VALID_OPERATORS, operator) < 0) {
+ throw new IllegalArgumentException("Invalid operator \"" + operator + "\"");
+ }
this.name = name;
this.value = value;
@@ -62,7 +63,9 @@ class OperatorExpression implements WhereExpression {
SearchableProfileElement element = (SearchableProfileElement) elements.get(name);
// Nope. We can only give a false result.
- if (element == null) return FalseResult.INSTANCE;
+ if (element == null) {
+ return FalseResult.INSTANCE;
+ }
// Yep. Ask the element to yield the result.
return element.result(value, operator);
@@ -76,22 +79,23 @@ class OperatorExpression implements WhereExpression {
public WhereExpression negate() {
String negated;
- if (operator.equals("EQ"))
- negated = "NE";
- else if (operator.equals("NE"))
- negated = "EQ";
- else if (operator.equals("LT"))
- negated = "GE";
- else if (operator.equals("GT"))
- negated = "LE";
- else if (operator.equals("LE"))
- negated = "GT";
- else if (operator.equals("LIKE"))
- negated = "NE";
- else if (operator.equals("NOTLIKE"))
- negated = "EQ";
- else
- negated = "LT";
+ if (operator.equals("EQ")) {
+ negated = "NE";
+ } else if (operator.equals("NE")) {
+ negated = "EQ";
+ } else if (operator.equals("LT")) {
+ negated = "GE";
+ } else if (operator.equals("GT")) {
+ negated = "LE";
+ } else if (operator.equals("LE")) {
+ negated = "GT";
+ } else if (operator.equals("LIKE")) {
+ negated = "NE";
+ } else if (operator.equals("NOTLIKE")) {
+ negated = "EQ";
+ } else {
+ negated = "LT";
+ }
return new OperatorExpression(value, name, negated);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
index 67168b0..85f93b6 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableEnumeratedProfileElement.java
@@ -37,11 +37,13 @@ public class SearchableEnumeratedProfileElement extends EnumeratedProfileElement
Result rc = FalseResult.INSTANCE;
if (operator.equals("EQ") || operator.equals("LE") || operator.equals("GE") ||
operator.equals("LIKE")) {
- if (values.contains(value))
- rc = new MatchingResult(this);
+ if (values.contains(value)) {
+ rc = new MatchingResult(this);
+ }
} else if (operator.equals("NE") || operator.equals("NOTLIKE")) {
- if (!values.contains(value))
- rc = new MatchingResult(this);
+ if (!values.contains(value)) {
+ rc = new MatchingResult(this);
+ }
}
return rc;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
index e8ae0f6..b2125f6 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableRangedProfileElement.java
@@ -37,17 +37,29 @@ public class SearchableRangedProfileElement extends RangedProfileElement impleme
Result rc = FalseResult.INSTANCE;
double numeric = Double.parseDouble(value);
if (operator.equals("EQ") || operator.equals("LIKE")) {
- if (Double.parseDouble(min) <= numeric && numeric <= Double.parseDouble(max)) rc = new MatchingResult(this);
+ if (Double.parseDouble(min) <= numeric && numeric <= Double.parseDouble(max)) {
+ rc = new MatchingResult(this);
+ }
} else if (operator.equals("NE") || operator.equals("NOTLIKE")) {
- if (numeric < Double.parseDouble(min) || numeric > Double.parseDouble(max)) rc = new MatchingResult(this);
+ if (numeric < Double.parseDouble(min) || numeric > Double.parseDouble(max)) {
+ rc = new MatchingResult(this);
+ }
} else if (operator.equals("LT")) {
- if (numeric > Double.parseDouble(min)) rc = new MatchingResult(this);
+ if (numeric > Double.parseDouble(min)) {
+ rc = new MatchingResult(this);
+ }
} else if (operator.equals("GT")) {
- if (numeric < Double.parseDouble(max)) rc = new MatchingResult(this);
+ if (numeric < Double.parseDouble(max)) {
+ rc = new MatchingResult(this);
+ }
} else if (operator.equals("LE")) {
- if (numeric >= Double.parseDouble(min)) rc = new MatchingResult(this);
+ if (numeric >= Double.parseDouble(min)) {
+ rc = new MatchingResult(this);
+ }
} else {
- if (numeric <= Double.parseDouble(max)) rc = new MatchingResult(this);
+ if (numeric <= Double.parseDouble(max)) {
+ rc = new MatchingResult(this);
+ }
}
return rc;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
----------------------------------------------------------------------
diff --git a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
index d5fc3a0..77786e1 100644
--- a/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
+++ b/profile/src/main/java/org/apache/oodt/profile/handlers/lightweight/SearchableResourceAttributes.java
@@ -42,80 +42,87 @@ public class SearchableResourceAttributes extends ResourceAttributes {
* @return a <code>Result</code> value.
*/
public Result result(String name, String value, String operator) {
- if ("Identifier".equals(name))
- return computeResult(identifier, value, operator);
- else if ("Title".equals(name))
- return computeResult(title, value, operator);
- else if ("Format".equals(name))
- return computeResult(formats, value, operator);
- else if ("Description".equals(name))
- return computeResult(description, value, operator);
- else if ("Creator".equals(name))
- return computeResult(creators, value, operator);
- else if ("Subject".equals(name))
- return computeResult(subjects, value, operator);
- else if ("Publisher".equals(name))
- return computeResult(publishers, value, operator);
- else if ("Contributor".equals(name))
- return computeResult(contributors, value, operator);
- else if ("Date".equals(name))
- return computeResult(dates, value, operator);
- else if ("Type".equals(name))
- return computeResult(types, value, operator);
- else if ("Source".equals(name))
- return computeResult(sources, value, operator);
- else if ("Language".equals(name))
- return computeResult(languages, value, operator);
- else if ("Relation".equals(name))
- return computeResult(relations, value, operator);
- else if ("Coverage".equals(name))
- return computeResult(coverages, value, operator);
- else if ("Rights".equals(name))
- return computeResult(rights, value, operator);
- else if ("resContext".equals(name))
- return computeResult(contexts, value, operator);
- else if ("resClass".equals(name))
- return computeResult(clazz, value, operator);
- else if ("resLocation".equals(name))
- return computeResult(locations, value, operator);
- else
- throw new IllegalArgumentException("Unknown attribute \"" + name + "\"");
+ if ("Identifier".equals(name)) {
+ return computeResult(identifier, value, operator);
+ } else if ("Title".equals(name)) {
+ return computeResult(title, value, operator);
+ } else if ("Format".equals(name)) {
+ return computeResult(formats, value, operator);
+ } else if ("Description".equals(name)) {
+ return computeResult(description, value, operator);
+ } else if ("Creator".equals(name)) {
+ return computeResult(creators, value, operator);
+ } else if ("Subject".equals(name)) {
+ return computeResult(subjects, value, operator);
+ } else if ("Publisher".equals(name)) {
+ return computeResult(publishers, value, operator);
+ } else if ("Contributor".equals(name)) {
+ return computeResult(contributors, value, operator);
+ } else if ("Date".equals(name)) {
+ return computeResult(dates, value, operator);
+ } else if ("Type".equals(name)) {
+ return computeResult(types, value, operator);
+ } else if ("Source".equals(name)) {
+ return computeResult(sources, value, operator);
+ } else if ("Language".equals(name)) {
+ return computeResult(languages, value, operator);
+ } else if ("Relation".equals(name)) {
+ return computeResult(relations, value, operator);
+ } else if ("Coverage".equals(name)) {
+ return computeResult(coverages, value, operator);
+ } else if ("Rights".equals(name)) {
+ return computeResult(rights, value, operator);
+ } else if ("resContext".equals(name)) {
+ return computeResult(contexts, value, operator);
+ } else if ("resClass".equals(name)) {
+ return computeResult(clazz, value, operator);
+ } else if ("resLocation".equals(name)) {
+ return computeResult(locations, value, operator);
+ } else {
+ throw new IllegalArgumentException("Unknown attribute \"" + name + "\"");
+ }
}
private Result computeResult(String a, String b, String op) {
int c = a.compareTo(b);
boolean t;
- if ("EQ".equals(op) || "LIKE".equals(op))
- t = c == 0;
- else if ("GE".equals(op))
- t = c >= 0;
- else if ("GT".equals(op))
- t = c > 0;
- else if ("LE".equals(op))
- t = c <= 0;
- else if ("LT".equals(op))
- t = c < 0;
- else if ("NE".equals(op) || "NOTLIKE".equals(op))
- t = c != 0;
- else
- throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
- if (t)
- return new MatchingResult(new HashSet(profile.getProfileElements().values()));
- else
- return FalseResult.INSTANCE;
+ if ("EQ".equals(op) || "LIKE".equals(op)) {
+ t = c == 0;
+ } else if ("GE".equals(op)) {
+ t = c >= 0;
+ } else if ("GT".equals(op)) {
+ t = c > 0;
+ } else if ("LE".equals(op)) {
+ t = c <= 0;
+ } else if ("LT".equals(op)) {
+ t = c < 0;
+ } else if ("NE".equals(op) || "NOTLIKE".equals(op)) {
+ t = c != 0;
+ } else {
+ throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
+ }
+ if (t) {
+ return new MatchingResult(new HashSet(profile.getProfileElements().values()));
+ } else {
+ return FalseResult.INSTANCE;
+ }
}
private Result computeResult(List a, String b, String op) {
- if (a == null || a.isEmpty()) return FalseResult.INSTANCE;
+ if (a == null || a.isEmpty()) {
+ return FalseResult.INSTANCE;
+ }
Result f = FalseResult.INSTANCE;
Result t = new MatchingResult(new HashSet(profile.getProfileElements().values()));
Result rc = f;
- if ("EQ".equals(op) || "LIKE".equals(op))
- if (a.contains(b)) rc = t;
- else if ("NE".equals(op) || "NOTLIKE".equals(op))
- if (!a.contains(b)) rc = t;
- else if ("LT".equals(op) || "GT".equals(op) || "LE".equals(op) || "GE".equals(op)) {
+ if ("EQ".equals(op) || "LIKE".equals(op)) {
+ if (a.contains(b)) {
+ rc = t;
+ } else if ("NE".equals(op) || "NOTLIKE".equals(op)) {
+ if (!a.contains(b)) {
+ rc = t;
+ } else if ("LT".equals(op) || "GT".equals(op) || "LE".equals(op) || "GE".equals(op)) {
for (Object anA : a) {
String value = (String) anA;
rc = computeResult(value, b, op);
@@ -123,7 +130,11 @@ public class SearchableResourceAttributes extends ResourceAttributes {
break;
}
}
- } else throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
+ } else {
+ throw new IllegalArgumentException("Unknown relational operator \"" + op + "\"");
+ }
+ }
+ }
return rc;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
----------------------------------------------------------------------
diff --git a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
index f3921c3..b276d14 100644
--- a/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
+++ b/protocol/api/src/main/java/org/apache/oodt/cas/protocol/verify/BasicProtocolVerifier.java
@@ -66,9 +66,10 @@ public class BasicProtocolVerifier implements ProtocolVerifier {
protocol.cdHome();
// Verify again at home directory
- if (home == null || !home.equals(protocol.pwd()))
- throw new ProtocolException(
- "Home directory not the same after cd");
+ if (home == null || !home.equals(protocol.pwd())) {
+ throw new ProtocolException(
+ "Home directory not the same after cd");
+ }
} catch (Exception e) {
LOG.log(Level.SEVERE, "Protocol "
+ protocol.getClass().getCanonicalName()
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
index d55b08b..06663e1 100644
--- a/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
+++ b/protocol/ftp/src/main/java/org/apache/oodt/cas/protocol/ftp/CommonsNetFtpProtocol.java
@@ -168,14 +168,15 @@ public class CommonsNetFtpProtocol implements Protocol {
+ " : " + e.getMessage(), e);
} finally {
// close output stream
- if (os != null)
- try {
- os.close();
- } catch (Exception e) {
- toFile.delete();
- throw new ProtocolException("Failed to close outputstream : "
- + e.getMessage(), e);
- }
+ if (os != null) {
+ try {
+ os.close();
+ } catch (Exception e) {
+ toFile.delete();
+ throw new ProtocolException("Failed to close outputstream : "
+ + e.getMessage(), e);
+ }
+ }
}
}
@@ -196,8 +197,9 @@ public class CommonsNetFtpProtocol implements Protocol {
*/
public void cd(ProtocolFile file) throws ProtocolException {
try {
- if (!ftp.changeWorkingDirectory(file.getPath()))
- throw new Exception("Directory change method returned false");
+ if (!ftp.changeWorkingDirectory(file.getPath())) {
+ throw new Exception("Directory change method returned false");
+ }
} catch (Exception e) {
throw new ProtocolException("Failed to cd to " + file.getPath() + " : "
+ e.getMessage());
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
index dba31cb..1146b19 100644
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
+++ b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/HttpProtocol.java
@@ -70,9 +70,10 @@ public class HttpProtocol implements Protocol {
}
if (!HttpUtils
- .isDirectory(httpFile.getLink(), file.getPath()))
+ .isDirectory(httpFile.getLink(), file.getPath())) {
throw new ProtocolException(file
- + " is not a directory (mime type must be text/html)");
+ + " is not a directory (mime type must be text/html)");
+ }
this.currentFile = httpFile;
} catch (Exception e) {
throw new ProtocolException("Failed to cd to " + file + " : "
@@ -131,18 +132,20 @@ public class HttpProtocol implements Protocol {
throw new ProtocolException("Failed to get file '" + fromFile + "' : "
+ e.getMessage(), e);
} finally {
- if (in != null)
+ if (in != null) {
try {
in.close();
} catch (Exception e) {
// log failure
}
- if (out != null)
+ }
+ if (out != null) {
try {
out.close();
} catch (Exception e) {
// log failure
}
+ }
}
}
@@ -321,14 +324,16 @@ public class HttpProtocol implements Protocol {
public static void main(String[] args) throws Exception {
String urlString = null, downloadToDir = null;
for (int i = 0; i < args.length; i++) {
- if (args[i].equals("--url"))
+ if (args[i].equals("--url")) {
urlString = args[++i];
- else if (args[i].equals("--downloadToDir"))
+ } else if (args[i].equals("--downloadToDir")) {
downloadToDir = args[++i];
+ }
}
- if (urlString == null)
+ if (urlString == null) {
throw new Exception("Must specify a url to download: --url <url>");
+ }
URL url = new URL(urlString);
ProtocolFile urlFile = new HttpFile(url.getPath(), false, url);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
----------------------------------------------------------------------
diff --git a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
index 5788262..9a35934 100644
--- a/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
+++ b/protocol/http/src/main/java/org/apache/oodt/cas/protocol/http/util/HttpUtils.java
@@ -93,8 +93,9 @@ public class HttpUtils {
// Read in link
StringBuilder sb = new StringBuilder("");
- while (scanner.hasNext())
- sb.append(scanner.nextLine());
+ while (scanner.hasNext()) {
+ sb.append(scanner.nextLine());
+ }
return sb.toString();
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
index e5fdf5f..290f3ea 100644
--- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
+++ b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocol.java
@@ -84,11 +84,12 @@ public class ImapsProtocol implements Protocol {
public synchronized void cd(ProtocolFile file) throws ProtocolException {
try {
String remotePath = file.getPath();
- if (remotePath.startsWith("/"))
+ if (remotePath.startsWith("/")) {
remotePath = remotePath.substring(1);
- if (remotePath.trim().equals(""))
+ }
+ if (remotePath.trim().equals("")) {
homeFolder = currentFolder = store.getDefaultFolder();
- else {
+ } else {
homeFolder = currentFolder = store.getFolder(remotePath);
}
} catch (Exception e) {
@@ -158,8 +159,9 @@ public class ImapsProtocol implements Protocol {
}
private synchronized void decrementConnections() {
- if (connectCalls > 0)
+ if (connectCalls > 0) {
connectCalls--;
+ }
}
public synchronized void get(ProtocolFile fromFile, File toFile)
@@ -196,21 +198,24 @@ public class ImapsProtocol implements Protocol {
ps.print("From:");
Address[] senders = message.getFrom();
- for (Address address : senders)
+ for (Address address : senders) {
ps.print(" " + address.toString());
+ }
ps.print("\nTo:");
Set<Address> recipients = new LinkedHashSet<Address>(Arrays.asList(message
.getAllRecipients()));
- for (Address address : recipients)
+ for (Address address : recipients) {
ps.print(" " + address.toString());
+ }
ps.println("\nSubject: " + message.getSubject());
ps.println("----- ~ Message ~ -----");
String content = this.getContentFromHTML(message);
- if (content.equals(""))
+ if (content.equals("")) {
content = this.getContentFromPlainText(message);
+ }
ps.println(content);
ps.close();
@@ -237,8 +242,9 @@ public class ImapsProtocol implements Protocol {
}
// changedDir = false;
} catch (Exception e) {
- if (!currentFolder.getFullName().equals(""))
+ if (!currentFolder.getFullName().equals("")) {
throw new ProtocolException("Failed to ls : " + e.getMessage(), e);
+ }
} finally {
try {
closeFolder(currentFolder);
@@ -266,8 +272,9 @@ public class ImapsProtocol implements Protocol {
}
}
} catch (Exception e) {
- if (!currentFolder.getFullName().equals(""))
+ if (!currentFolder.getFullName().equals("")) {
throw new ProtocolException("Failed to ls : " + e.getMessage(), e);
+ }
} finally {
try {
closeFolder(currentFolder);
@@ -281,8 +288,9 @@ public class ImapsProtocol implements Protocol {
throws ProtocolException {
try {
String pwd = currentFolder.getFullName();
- if (!pwd.equals("") && !pwd.startsWith("/"))
+ if (!pwd.equals("") && !pwd.startsWith("/")) {
pwd = "/" + pwd;
+ }
return new ProtocolFile(pwd, true);
} catch (Exception e) {
throw new ProtocolException("Failed to pwd : " + e.getMessage(), e);
@@ -311,12 +319,14 @@ public class ImapsProtocol implements Protocol {
} else if (p.isMimeType("multipart/*")) {
Multipart mp = (Multipart) p.getContent();
int count = mp.getCount();
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++) {
content.append(getContentFromPlainText(mp.getBodyPart(i)));
+ }
} else {
Object obj = p.getContent();
- if (obj instanceof Part)
+ if (obj instanceof Part) {
content.append(getContentFromPlainText((Part) p.getContent()));
+ }
}
return content.toString().replaceAll(" \\r\\n", "").replaceAll(" \\n", "");
}
@@ -327,8 +337,9 @@ public class ImapsProtocol implements Protocol {
if (p.isMimeType("multipart/*")) {
Multipart mp = (Multipart) p.getContent();
int count = mp.getCount();
- for (int i = 0; i < count; i++)
+ for (int i = 0; i < count; i++) {
content.append(getContentFromHTML(mp.getBodyPart(i)));
+ }
} else if (p.isMimeType("text/html")) {
HtmlParser parser = new HtmlParser();
Metadata met = new Metadata();
@@ -339,8 +350,9 @@ public class ImapsProtocol implements Protocol {
content.append(handler.toString());
} else {
Object obj = p.getContent();
- if (obj instanceof Part)
+ if (obj instanceof Part) {
content.append(getContentFromHTML((Part) p.getContent()));
+ }
}
return content.toString();
}
@@ -362,8 +374,9 @@ public class ImapsProtocol implements Protocol {
}
private synchronized void closeFolder(Folder folder) {
- if (openCalls > 0)
+ if (openCalls > 0) {
openCalls--;
+ }
if (openCalls <= 0) {
try {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
----------------------------------------------------------------------
diff --git a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
index c2fda6a..b3a83b9 100644
--- a/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
+++ b/protocol/imaps/src/main/java/org/apache/oodt/cas/protocol/imaps/ImapsProtocolFactory.java
@@ -30,8 +30,9 @@ public class ImapsProtocolFactory implements ProtocolFactory {
private ImapsProtocol imapsClient;
public ImapsProtocol newInstance() {
- if (this.imapsClient == null)
+ if (this.imapsClient == null) {
this.imapsClient = new ImapsProtocol();
+ }
return this.imapsClient;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
index 790f51b..10a55ed 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/Config.java
@@ -308,8 +308,9 @@ public class Config implements ConfigMetKeys {
this.writeMetFile = Boolean.getBoolean(WRITE_MET_FILE);
String timeoutString = PropertiesUtils.getProperties(
PROTOCOL_TIMEOUT_MS, new String[] { "600000" })[0];
- if (timeoutString == null)
+ if (timeoutString == null) {
timeoutString = "0";
+ }
pi.setDownloadTimeout(Long.parseLong(timeoutString));
pi.setPageSize(Integer.parseInt(PropertiesUtils.getProperties(
PROTOCOL_PAGE_SIZE, new String[] { "8" })[0]));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
index 98a21a9..34966eb 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/DaemonInfo.java
@@ -52,24 +52,29 @@ public class DaemonInfo {
DataFilesInfo dfi) throws ParseException {
this.runOnReboot = runOnReboot;
if (firstRunDateTimeString != null
- && !firstRunDateTimeString.equals(""))
- this.firstRunDateTime = utcFormat.parse(firstRunDateTimeString);
- else
- this.firstRunDateTime = new Date();
- if (period != null && !period.equals(""))
- this.timeIntervalInMilliseconds = Long.parseLong(period.substring(
- 0, period.length() - 1))
- * this.getMillisecondsInMetric((period.charAt(period
- .length() - 1) + "").toLowerCase());
- else
- this.timeIntervalInMilliseconds = -1;
- if (epsilon != null && !epsilon.equals(""))
- this.epsilonInMilliseconds = Long.parseLong(epsilon.substring(0,
- epsilon.length() - 1))
- * this.getMillisecondsInMetric((epsilon.charAt(epsilon
- .length() - 1) + "").toLowerCase());
- else
- this.epsilonInMilliseconds = -1;
+ && !firstRunDateTimeString.equals("")) {
+ this.firstRunDateTime = utcFormat.parse(firstRunDateTimeString);
+ } else {
+ this.firstRunDateTime = new Date();
+ }
+ if (period != null && !period.equals("")) {
+ this.timeIntervalInMilliseconds = Long.parseLong(period.substring(
+ 0, period.length() - 1))
+ * this.getMillisecondsInMetric((period.charAt(period
+ .length() - 1) + "")
+ .toLowerCase());
+ } else {
+ this.timeIntervalInMilliseconds = -1;
+ }
+ if (epsilon != null && !epsilon.equals("")) {
+ this.epsilonInMilliseconds = Long.parseLong(epsilon.substring(0,
+ epsilon.length() - 1))
+ * this.getMillisecondsInMetric((epsilon.charAt(epsilon
+ .length() - 1) + "")
+ .toLowerCase());
+ } else {
+ this.epsilonInMilliseconds = -1;
+ }
this.pfi = pfi;
this.dfi = dfi;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
index ad7aba8..87054dc 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/PropFilesInfo.java
@@ -64,8 +64,9 @@ public class PropFilesInfo {
public LinkedList<File> getDownloadInfoPropFiles() {
LinkedList<File> returnList = new LinkedList<File>();
- for (Entry<File, Parser> entry : this.fileToParserMap.entrySet())
+ for (Entry<File, Parser> entry : this.fileToParserMap.entrySet()) {
returnList.add(entry.getKey());
+ }
return returnList;
}
@@ -81,15 +82,17 @@ public class PropFilesInfo {
public Parser getParserForFile(File propFile) {
Parser parser = this.fileToParserMap == null ? null
: this.fileToParserMap.get(propFile);
- if (parser == null)
+ if (parser == null) {
parser = this.getParserForFilename(propFile.getName());
+ }
return parser;
}
public Parser getParserForFilename(String propFilename) {
for (RegExpAndParser pattern : patterns) {
- if (pattern.isAcceptedByPattern(propFilename))
+ if (pattern.isAcceptedByPattern(propFilename)) {
return pattern.getParser();
+ }
}
return null;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
index 2972d0b..a499021 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/ProtocolInfo.java
@@ -138,10 +138,11 @@ public class ProtocolInfo implements ConfigParserMetKeys {
}
public void setPageSize(int pgSize) {
- if (pgSize != -1)
- this.pgSize = pgSize;
- else
- this.pgSize = Integer.MAX_VALUE;
+ if (pgSize != -1) {
+ this.pgSize = pgSize;
+ } else {
+ this.pgSize = Integer.MAX_VALUE;
+ }
}
public LinkedList<Class<ProtocolFactory>> getProtocolClassesForProtocolType(
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
index aa72487..7806cd5 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/RemoteSpecs.java
@@ -79,8 +79,9 @@ public class RemoteSpecs implements ConfigParserMetKeys {
// check if set to active (skip otherwise)
if (PathUtils.replaceEnvVariables(
((Element) daemonNode).getAttribute(ACTIVE_ATTR))
- .equals("no"))
+ .equals("no")) {
continue;
+ }
DaemonInfo di = null;
@@ -90,11 +91,12 @@ public class RemoteSpecs implements ConfigParserMetKeys {
.getAttribute(ALIAS_ATTR));
RemoteSite dataFilesRemoteSite = this.siteInfo
.getSiteByAlias(siteAlias);
- if (dataFilesRemoteSite == null)
+ if (dataFilesRemoteSite == null) {
throw new ConfigException("Alias '" + siteAlias
+ "' in SiteInfo file '"
+ remoteSpecsFile.getAbsolutePath()
+ "' has not been defined");
+ }
// get RUNINFO element
NodeList runInfoList = ((Element) daemonNode)
@@ -109,8 +111,9 @@ public class RemoteSpecs implements ConfigParserMetKeys {
runOnReboot = (runInfo.getAttribute(RUNONREBOOT_ATTR)
.toLowerCase().equals("yes"));
epsilon = runInfo.getAttribute(EPSILON_ATTR);
- if (epsilon.equals(""))
+ if (epsilon.equals("")) {
epsilon = "0s";
+ }
}
// get PROPINFO elements
@@ -146,12 +149,13 @@ public class RemoteSpecs implements ConfigParserMetKeys {
.replaceEnvVariables(((Element) propFilesNode)
.getAttribute(PARSER_ATTR)))));
}
- } else
+ } else {
throw new ConfigException(
"No propFiles element specified for deamon with alias '"
+ siteAlias + "' in RemoteSpecs file '"
+ remoteSpecsFile.getAbsolutePath()
+ "'");
+ }
// get DOWNLOADINFO element if given
NodeList downloadInfoList = ((Element) propInfoNode)
@@ -175,16 +179,18 @@ public class RemoteSpecs implements ConfigParserMetKeys {
.equals("yes");
RemoteSite propFilesRemoteSite = this.siteInfo
.getSiteByAlias(propFilesAlias);
- if (propFilesRemoteSite == null)
+ if (propFilesRemoteSite == null) {
throw new ConfigException("Alias '"
+ propFilesAlias
+ "' in RemoteSpecs file '"
+ remoteSpecsFile.getAbsolutePath()
+ "' has not been defined");
+ }
String regExp = ((Element) downloadInfo)
.getAttribute(REG_EXP_ATTR);
- if (regExp.equals(""))
+ if (regExp.equals("")) {
regExp = propFilesRegExp;
+ }
NodeList propsList = ((Element) propInfoNode)
.getElementsByTagName(PROP_FILE_TAG);
HashMap<File, Parser> propFileToParserMap = new HashMap<File, Parser>();
@@ -226,11 +232,12 @@ public class RemoteSpecs implements ConfigParserMetKeys {
pfi.setDeleteOnSuccess(deleteOnSuccess);
}
- } else
+ } else {
throw new ConfigException(
"No propInfo element specified for deamon with alias '"
+ siteAlias + "' in RemoteSpecs file '"
+ remoteSpecsFile.getAbsolutePath() + "'");
+ }
// get DATAINFO elements
NodeList dataInfoList = ((Element) daemonNode)
@@ -264,11 +271,12 @@ public class RemoteSpecs implements ConfigParserMetKeys {
dfi = new DataFilesInfo(queryElement, new DownloadInfo(
dataFilesRemoteSite, renamingConv,
deleteFromServer, stagingArea, allowAliasOverride));
- } else
+ } else {
throw new ConfigException(
"No dataInfo element specified for deamon with alias '"
+ siteAlias + "' in RemoteSpecs file '"
+ remoteSpecsFile.getAbsolutePath() + "'");
+ }
daemonInfoList.add(new DaemonInfo(firstRunDateTimeString,
period, epsilon, runOnReboot, pfi, dfi));
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
index 797a1da..8cedd59 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/config/SiteInfo.java
@@ -66,10 +66,11 @@ public class SiteInfo {
LinkedList<RemoteSite> remoteSites = new LinkedList<RemoteSite>();
if (alias != null) {
RemoteSite rs = this.aliasAndRemoteSite.get(alias);
- if (rs != null)
- remoteSites.add(rs);
- else if (url != null && username != null & password != null)
- remoteSites.add(new RemoteSite(alias, url, username, password));
+ if (rs != null) {
+ remoteSites.add(rs);
+ } else if (url != null && username != null & password != null) {
+ remoteSites.add(new RemoteSite(alias, url, username, password));
+ }
} else if (url != null) {
Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
.entrySet();
@@ -80,16 +81,18 @@ public class SiteInfo {
&& (username == null || rs.getUsername().equals(
username))
&& (password == null || rs.getPassword().equals(
- password)))
- remoteSites.add(rs);
+ password))) {
+ remoteSites.add(rs);
+ }
} catch (URISyntaxException e) {
LOG.log(Level.SEVERE, "Could not convert URL to URI Message: "+e.getMessage());
}
}
if (remoteSites.size() == 0) {
- if (username != null && password != null)
- remoteSites.add(new RemoteSite(url.toString(), url,
- username, password));
+ if (username != null && password != null) {
+ remoteSites.add(new RemoteSite(url.toString(), url,
+ username, password));
+ }
}
} else if (username != null) {
Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
@@ -98,16 +101,18 @@ public class SiteInfo {
RemoteSite rs = entry.getValue();
if (rs.getUsername().equals(username)
&& (password == null || rs.getPassword().equals(
- password)))
- remoteSites.add(rs);
+ password))) {
+ remoteSites.add(rs);
+ }
}
} else if (password != null) {
Set<Entry<String, RemoteSite>> set = this.aliasAndRemoteSite
.entrySet();
for (Entry<String, RemoteSite> entry : set) {
RemoteSite rs = entry.getValue();
- if (rs.getPassword().equals(password))
- remoteSites.add(rs);
+ if (rs.getPassword().equals(password)) {
+ remoteSites.add(rs);
+ }
}
}
return remoteSites;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
index 6fd2f72..42c5f6a 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/Daemon.java
@@ -192,8 +192,9 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
if ((timeTilNextRun = Daemon.this.calculateTimeTilNextRun()) != 0
&& !(Daemon.this.beforeToday(daemonInfo
.getFirstRunDateTime()) && daemonInfo
- .runOnReboot()))
+ .runOnReboot())) {
sleep(timeTilNextRun);
+ }
for (keepRunning = true; keepRunning;) {
long startTime = System.currentTimeMillis();
@@ -262,11 +263,11 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
GregorianCalendar gcStartDateTime = new GregorianCalendar();
gcStartDateTime.setTime(daemonInfo.getFirstRunDateTime());
long diff = now.getTimeInMillis() - gcStartDateTime.getTimeInMillis();
- if (Math.abs(diff) <= daemonInfo.getEpsilonInMilliseconds())
+ if (Math.abs(diff) <= daemonInfo.getEpsilonInMilliseconds()) {
return 0;
- else if (diff < 0)
+ } else if (diff < 0) {
return gcStartDateTime.getTimeInMillis() - now.getTimeInMillis();
- else if (daemonInfo.getTimeIntervalInMilliseconds() == 0) {
+ } else if (daemonInfo.getTimeIntervalInMilliseconds() == 0) {
return 0;
} else {
int numOfPeriods = (int) (diff / daemonInfo
@@ -283,13 +284,15 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
}
private void notifyDaemonListenerOfStart() {
- if (this.daemonListener != null)
+ if (this.daemonListener != null) {
this.daemonListener.daemonStarting(this);
+ }
}
private void notifyDaemonListenerOfFinish() {
- if (this.daemonListener != null)
+ if (this.daemonListener != null) {
this.daemonListener.daemonFinished(this);
+ }
}
private void sleep(long length) {
@@ -457,8 +460,9 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
public String getQueryMetadataElementName() {
String element = this.daemonInfo.getDataFilesInfo()
.getQueryMetadataElementName();
- if (element == null || element.equals(""))
+ if (element == null || element.equals("")) {
element = "Filename";
+ }
return this.daemonInfo.getDataFilesInfo().getQueryMetadataElementName();
}
@@ -541,10 +545,11 @@ public class Daemon extends UnicastRemoteObject implements DaemonRmiInterface,
boolean waitForCrawlNotification = false;
for (int i = 0; i < args.length; ++i) {
- if (args[i].equals("--rmiPort"))
+ if (args[i].equals("--rmiPort")) {
rmiPort = Integer.parseInt(args[++i]);
- else if (args[i].equals("--waitForNotification"))
+ } else if (args[i].equals("--waitForNotification")) {
waitForCrawlNotification = true;
+ }
}
LocateRegistry.createRegistry(rmiPort);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
index 88da43f..6c3621d 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonController.java
@@ -197,8 +197,9 @@ public class DaemonController {
} else if (operation.equals("--isRunning")) {
boolean running = controller.isRunning();
System.out.println(running ? "Yes" : "No");
- } else
+ } else {
throw new IllegalArgumentException("Unknown Operation!");
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
index da42f3d..5eb2a61 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonLauncher.java
@@ -130,8 +130,9 @@ public class DaemonLauncher implements DaemonLauncherMBean {
}
private synchronized int getNextDaemonId() {
- while (this.dm.getUsedIDs().contains(++this.nextDaemonId))
+ while (this.dm.getUsedIDs().contains(++this.nextDaemonId)) {
;
+ }
return this.nextDaemonId;
}
@@ -147,8 +148,9 @@ public class DaemonLauncher implements DaemonLauncherMBean {
LOG.log(Level.INFO, "Killing current Daemons . . .");
this.nextDaemonId = 0;
for (Daemon daemon : this.activeDaemonList) {
- if (!daemon.getHasBeenToldToQuit())
+ if (!daemon.getHasBeenToldToQuit()) {
daemon.quit();
+ }
}
activeDaemonList.clear();
}
@@ -169,12 +171,13 @@ public class DaemonLauncher implements DaemonLauncherMBean {
LinkedList<File> sitesFiles = new LinkedList<File>();
for (int i = 0; i < args.length; ++i) {
- if (args[i].equals("--rmiRegistryPort"))
+ if (args[i].equals("--rmiRegistryPort")) {
rmiRegPort = Integer.parseInt(args[++i]);
- else if (args[i].equals("--propertiesFile"))
+ } else if (args[i].equals("--propertiesFile")) {
propertiesFile = new File(args[++i]);
- else if (args[i].equals("--remoteSpecsFile"))
+ } else if (args[i].equals("--remoteSpecsFile")) {
sitesFiles.add(new File(args[++i]));
+ }
}
DaemonLauncher daemonLauncher = new DaemonLauncher(rmiRegPort,
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
index 9e99ab5..04de6dc 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/daemon/DaemonManager.java
@@ -74,10 +74,11 @@ public class DaemonManager implements DaemonListener {
}
public void daemonFinished(Daemon daemon) {
- if (daemon.equals(this.runningDaemon))
+ if (daemon.equals(this.runningDaemon)) {
this.startNextOnWaitingList();
- else
+ } else {
this.waitingList.remove(daemon);
+ }
}
public synchronized HashSet<Integer> getUsedIDs() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
index 7d56680..41e0162 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/expressions/Method.java
@@ -76,8 +76,9 @@ public class Method {
return false;
}
return true;
- } else
+ } else {
return false;
+ }
}
public void addArg(Variable v) {
@@ -113,10 +114,11 @@ public class Method {
// System.out.println("ch = " + ch);
if ((ch <= 'Z' && ch >= 'A')
|| (ch <= 'z' && ch >= 'a')
- || (ch <= '9' && ch >= '0') || ch == '_')
+ || (ch <= '9' && ch >= '0') || ch == '_') {
variable.append(ch);
- else
+ } else {
break;
+ }
}
if (globalVar) {
@@ -138,10 +140,11 @@ public class Method {
int k = i + 1;
for (; k < infixArray.length; k++) {
char ch = infixArray[k];
- if (ch <= '9' && ch >= '0')
+ if (ch <= '9' && ch >= '0') {
variableIntString.append(ch);
- else
+ } else {
break;
+ }
}
output.addLast(new Variable(null, new Integer(
variableIntString.toString())));
@@ -152,10 +155,11 @@ public class Method {
int l = i + 1;
for (; l < infixArray.length; l++) {
char ch = infixArray[l];
- if (ch != '"')
+ if (ch != '"') {
variableString.append(ch);
- else
+ } else {
break;
+ }
}
output
.addLast(new Variable(null, variableString
@@ -178,8 +182,9 @@ public class Method {
case ')':
while (!stack.empty()) {
ValidInput vi = stack.pop();
- if (vi.toString().charAt(0) == '(')
+ if (vi.toString().charAt(0) == '(') {
break;
+ }
output.addLast(vi);
}
break;
@@ -189,8 +194,9 @@ public class Method {
}
}
- while (!stack.empty())
+ while (!stack.empty()) {
output.addLast(stack.pop());
+ }
return output;
} catch (Exception e) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
index 949aab8..38f5ecb 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/FileRestrictions.java
@@ -482,8 +482,9 @@ public class FileRestrictions {
vfDoesNotExist = true;
lastFileIsDir = file.isDir();
file = file.getParentFile();
- if (file == null)
+ if (file == null) {
break;
+ }
}
return !(file == null || (vfDoesNotExist && ((lastFileIsDir && !vf
.allowNewDirs()) || (!lastFileIsDir && !vf.allowNewFiles()))));
@@ -505,11 +506,12 @@ public class FileRestrictions {
LinkedList<String> stringList = new LinkedList<String>();
for (VirtualFile child : children) {
String currentPath = curPath + "/" + child.getRegExp();
- if (!child.isDir())
+ if (!child.isDir()) {
stringList.add(currentPath);
- else
+ } else {
stringList
- .addAll(toStringList(child.getChildren(), currentPath));
+ .addAll(toStringList(child.getChildren(), currentPath));
+ }
}
return stringList;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
index c49f35a..8c30779 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/VirtualFile.java
@@ -79,13 +79,15 @@ public class VirtualFile {
vf.addChild(this);
} else if (st.countTokens() > 0) {
this.regExp = st.nextToken();
- if (path.startsWith("/"))
+ if (path.startsWith("/")) {
VirtualFile.createRootDir().addChild(this);
+ }
} else {
this.copy(VirtualFile.createRootDir());
}
- } else
+ } else {
this.copy(VirtualFile.createRootDir());
+ }
}
public VirtualFile(VirtualFile root, String path, boolean isDir) {
@@ -106,10 +108,12 @@ public class VirtualFile {
}
this.regExp = curRegExp;
vf.addChild(this);
- } else
+ } else {
this.copy(root);
- } else
+ }
+ } else {
this.copy(root);
+ }
}
public static VirtualFile createRootDir() {
@@ -120,8 +124,9 @@ public class VirtualFile {
public VirtualFile getRootDir() {
VirtualFile vf = this;
- while (vf.getParentFile() != null)
+ while (vf.getParentFile() != null) {
vf = vf.getParentFile();
+ }
return vf;
}
@@ -131,8 +136,9 @@ public class VirtualFile {
newFile.children.addAll(vf1.children);
newFile.children.addAll(vf2.children);
return newFile;
- } else
+ } else {
return null;
+ }
}
public void addChild(VirtualFile vf) {
@@ -141,10 +147,11 @@ public class VirtualFile {
vf.isDir);
if (existingChildWithSameName == null) {
children.add(vf);
- if (vf.isDir())
+ if (vf.isDir()) {
allowNewDirs = false;
- else
+ } else {
allowNewFiles = false;
+ }
vf.parent = this;
} else {
vf.copy(existingChildWithSameName);
@@ -160,8 +167,9 @@ public class VirtualFile {
for (VirtualFile vf : children) {
// System.out.println("GETCHILD: " + regExp + " " + vf.regExp);
if ((regExp.equals(vf.regExp) || Pattern.matches(vf.regExp, regExp))
- && vf.isDir == isDirectory)
+ && vf.isDir == isDirectory) {
return vf;
+ }
}
return null;
}
@@ -176,8 +184,9 @@ public class VirtualFile {
while (st.hasMoreTokens()) {
String curRegExp = st.nextToken();
if (st.hasMoreTokens()) {
- if ((vf = vf.getChild(curRegExp, true)) == null)
+ if ((vf = vf.getChild(curRegExp, true)) == null) {
return null;
+ }
} else {
return vf.getChild(curRegExp, isDirectory);
}
@@ -190,8 +199,9 @@ public class VirtualFile {
}
public String getAbsolutePath() {
- if (regExp == null)
+ if (regExp == null) {
return null;
+ }
StringBuilder path = new StringBuilder(this.regExp);
VirtualFile parent = this.parent;
while (parent != null) {
@@ -211,16 +221,18 @@ public class VirtualFile {
public void setNoDirs(boolean noDirs) {
if (this.isDir) {
- if (noDirs)
+ if (noDirs) {
allowNewDirs = false;
+ }
this.noDirs = noDirs;
}
}
public void setNoFiles(boolean noFiles) {
if (this.isDir) {
- if (noFiles)
+ if (noFiles) {
allowNewFiles = false;
+ }
this.noFiles = noFiles;
}
}
@@ -261,8 +273,9 @@ public class VirtualFile {
if (obj instanceof VirtualFile) {
VirtualFile compareFile = (VirtualFile) obj;
if (compareFile.getRegExp().equals(regExp)
- && compareFile.isDir() == this.isDir)
+ && compareFile.isDir() == this.isDir) {
return true;
+ }
}
return false;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
index cc148f5..2ff73a9 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/ClassNoaaEmailParser.java
@@ -51,12 +51,14 @@ public class ClassNoaaEmailParser implements Parser {
VirtualFile root = VirtualFile.createRootDir();
Scanner s = new Scanner(emailFile);
StringBuffer sb = new StringBuffer("");
- while (s.hasNextLine())
- sb.append(s.nextLine()).append("\n");
+ while (s.hasNextLine()) {
+ sb.append(s.nextLine()).append("\n");
+ }
- if (!validEmail(sb.toString()))
- throw new ParserException(
- "Email not a IASI data processed notification email");
+ if (!validEmail(sb.toString())) {
+ throw new ParserException(
+ "Email not a IASI data processed notification email");
+ }
Pattern cdPattern = Pattern.compile("\\s*cd\\s{1,}.{1,}?(?:\\s|$)");
Matcher cdMatcher = cdPattern.matcher(sb);
@@ -108,9 +110,11 @@ public class ClassNoaaEmailParser implements Parser {
String[] containsStrings = (System.getProperties()
.getProperty("org.apache.oodt.cas.pushpull.filerestrictions.parsers.class.noaa.email.parser.contains.exprs")
+ ",").split(",");
- for (String containsString : containsStrings)
- if (!email.contains(containsString))
- return false;
+ for (String containsString : containsStrings) {
+ if (!email.contains(containsString)) {
+ return false;
+ }
+ }
return true;
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
index 55836e6..a6094fc 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/parsers/DirStructXmlParser.java
@@ -144,15 +144,17 @@ public class DirStructXmlParser implements Parser {
if ((ch <= 'Z' && ch >= 'A')
|| (ch <= 'z' && ch >= 'a')
|| (ch <= '9' && ch >= '0')
- || ch == '_')
- variable.append(ch);
- else
- break;
+ || ch == '_') {
+ variable.append(ch);
+ } else {
+ break;
+ }
}
Variable v = GlobalVariables.hashMap.get(variable
.toString());
- if (v == null)
- throw new Exception("No variable defined with name '" + variable.toString() + "'");
+ if (v == null) {
+ throw new Exception("No variable defined with name '" + variable.toString() + "'");
+ }
input = input.replaceFirst("\\$\\{" + variable + "\\}", v.toString());
i = i + v.toString().length();
}
@@ -168,10 +170,11 @@ public class DirStructXmlParser implements Parser {
char ch = input.substring(j, j + 1).charAt(0);
if ((ch <= 'Z' && ch >= 'A')
|| (ch <= 'z' && ch >= 'a')
- || (ch <= '9' && ch >= '0') || ch == '_')
- method.append(ch);
- else
- break;
+ || (ch <= '9' && ch >= '0') || ch == '_') {
+ method.append(ch);
+ } else {
+ break;
+ }
}
if (input.substring(j, j + 1).charAt(0) == '(') {
@@ -261,8 +264,9 @@ public class DirStructXmlParser implements Parser {
// determine if variable is an Integer or a String
if (type.equals("int")) {
variable.setValue(Integer.valueOf(value));
- } else
- variable.setValue(value);
+ } else {
+ variable.setValue(value);
+ }
// store Variable in list of Variables
GlobalVariables.hashMap.put(variable.getName(), variable);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
----------------------------------------------------------------------
diff --git a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
index 6fff6d8..753e09c 100644
--- a/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
+++ b/pushpull/src/main/java/org/apache/oodt/cas/pushpull/filerestrictions/renamingconventions/RenamingConvention.java
@@ -128,10 +128,12 @@ public class RenamingConvention {
private static String replace(String theString,
String theValueToBeReplaced, String whatToReplaceWith) {
- if (theValueToBeReplaced == null || theValueToBeReplaced.equals(""))
+ if (theValueToBeReplaced == null || theValueToBeReplaced.equals("")) {
return theString;
- if (whatToReplaceWith == null)
+ }
+ if (whatToReplaceWith == null) {
whatToReplaceWith = "";
+ }
return theString.replace(theValueToBeReplaced, whatToReplaceWith);
}
[09/12] oodt git commit: OODT-911 make code clearer
Posted by ma...@apache.org.
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
index 3872048..f1ff115 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/query/parser/SimpleCharStream.java
@@ -96,17 +96,19 @@ public class SimpleCharStream
bufpos = maxNextCharInd = 0;
available = tokenBegin;
}
- else if (tokenBegin < 0)
+ else if (tokenBegin < 0) {
bufpos = maxNextCharInd = 0;
- else
+ } else {
ExpandBuff(false);
+ }
}
- else if (available > tokenBegin)
+ else if (available > tokenBegin) {
available = bufsize;
- else if ((tokenBegin - available) < 2048)
+ } else if ((tokenBegin - available) < 2048) {
ExpandBuff(true);
- else
+ } else {
available = tokenBegin;
+ }
}
int i;
@@ -116,14 +118,16 @@ public class SimpleCharStream
inputStream.close();
throw new java.io.IOException();
}
- else
+ else {
maxNextCharInd += i;
+ }
}
catch(java.io.IOException e) {
--bufpos;
backup(0);
- if (tokenBegin == -1)
+ if (tokenBegin == -1) {
tokenBegin = bufpos;
+ }
throw e;
}
}
@@ -154,8 +158,9 @@ public class SimpleCharStream
{
prevCharIsLF = true;
}
- else
+ else {
line += (column = 1);
+ }
}
switch (c)
@@ -185,14 +190,16 @@ public class SimpleCharStream
{
--inBuf;
- if (++bufpos == bufsize)
+ if (++bufpos == bufsize) {
bufpos = 0;
+ }
return buffer[bufpos];
}
- if (++bufpos >= maxNextCharInd)
+ if (++bufpos >= maxNextCharInd) {
FillBuff();
+ }
char c = buffer[bufpos];
@@ -244,8 +251,9 @@ public class SimpleCharStream
public void backup(int amount) {
inBuf += amount;
- if ((bufpos -= amount) < 0)
+ if ((bufpos -= amount) < 0) {
bufpos += bufsize;
+ }
}
/** Constructor. */
@@ -387,11 +395,12 @@ public class SimpleCharStream
/** Get token literal value. */
public String GetImage()
{
- if (bufpos >= tokenBegin)
+ if (bufpos >= tokenBegin) {
return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
- else
+ } else {
return new String(buffer, tokenBegin, bufsize - tokenBegin) +
- new String(buffer, 0, bufpos + 1);
+ new String(buffer, 0, bufpos + 1);
+ }
}
/** Get the suffix. */
@@ -399,9 +408,9 @@ public class SimpleCharStream
{
char[] ret = new char[len];
- if ((bufpos + 1) >= len)
+ if ((bufpos + 1) >= len) {
System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
- else
+ } else
{
System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
len - bufpos - 1);
@@ -455,10 +464,11 @@ public class SimpleCharStream
while (i++ < len)
{
- if (bufline[j = start % bufsize] != bufline[++start % bufsize])
+ if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
bufline[j] = newLine++;
- else
+ } else {
bufline[j] = newLine;
+ }
}
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
index 9d9b757..2220f4e 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/repository/SerializedCatalogRepository.java
@@ -67,10 +67,12 @@ public class SerializedCatalogRepository implements CatalogRepository {
throws CatalogRepositoryException {
LOG.log(Level.INFO, "Deleting Catalog: '" + catalogUrn + "' . . . ");
boolean catalogFileDelete = this.getCatalogFile(catalogUrn).delete();
- if (!catalogFileDelete)
- throw new CatalogRepositoryException("Failed to deserialize catalog '" + catalogUrn + "', delete files returned false");
- else
- LOG.log(Level.INFO, "Successfully deleting Catalog: '" + catalogUrn + "'");
+ if (!catalogFileDelete) {
+ throw new CatalogRepositoryException(
+ "Failed to deserialize catalog '" + catalogUrn + "', delete files returned false");
+ } else {
+ LOG.log(Level.INFO, "Successfully deleting Catalog: '" + catalogUrn + "'");
+ }
}
/*
@@ -125,8 +127,9 @@ public class SerializedCatalogRepository implements CatalogRepository {
try {
//serialize Catalog
new Serializer().serializeObject(catalog, (catalogOut = new FileOutputStream(this.getCatalogFileWorker(catalog.getId()))));
- if (this.getCatalogFile(catalog.getId()).exists())
- FileUtils.copyFile(this.getCatalogFile(catalog.getId()), this.getCatalogFileBkup(catalog.getId()), true);
+ if (this.getCatalogFile(catalog.getId()).exists()) {
+ FileUtils.copyFile(this.getCatalogFile(catalog.getId()), this.getCatalogFileBkup(catalog.getId()), true);
+ }
FileUtils.copyFile(this.getCatalogFileWorker(catalog.getId()), this.getCatalogFile(catalog.getId()), true);
this.getCatalogFileWorker(catalog.getId()).delete();
this.getCatalogFileBkup(catalog.getId()).delete();
@@ -145,8 +148,9 @@ public class SerializedCatalogRepository implements CatalogRepository {
try {
//serialize URLs
new Serializer().serializeObject(urls, (urlsOut = new FileOutputStream(this.getClassLoaderUrlsFileWorker())));
- if (this.getClassLoaderUrlsFile().exists())
- FileUtils.copyFile(this.getClassLoaderUrlsFile(), this.getClassLoaderUrlsFileBkup(), true);
+ if (this.getClassLoaderUrlsFile().exists()) {
+ FileUtils.copyFile(this.getClassLoaderUrlsFile(), this.getClassLoaderUrlsFileBkup(), true);
+ }
FileUtils.copyFile(this.getClassLoaderUrlsFileWorker(), this.getClassLoaderUrlsFile(), true);
this.getClassLoaderUrlsFileWorker().delete();
this.getClassLoaderUrlsFileBkup().delete();
@@ -162,10 +166,12 @@ public class SerializedCatalogRepository implements CatalogRepository {
public List<PluginURL> deserializePluginURLs() throws CatalogRepositoryException {
FileInputStream urlsIn = null;
try {
- if (this.getClassLoaderUrlsFile().exists())
- return new Serializer().deserializeObject(List.class, (urlsIn = new FileInputStream(this.getClassLoaderUrlsFile())));
- else
- return Collections.emptyList();
+ if (this.getClassLoaderUrlsFile().exists()) {
+ return new Serializer()
+ .deserializeObject(List.class, (urlsIn = new FileInputStream(this.getClassLoaderUrlsFile())));
+ } else {
+ return Collections.emptyList();
+ }
}catch (Exception e) {
throw new CatalogRepositoryException("Failed to Deserialized All ClassLoader URLs from '" + this.storageDir + "' : " + e.getMessage(), e);
}finally {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
index e5c8890..9622b18 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelClient.java
@@ -252,8 +252,9 @@ public class XmlRpcCommunicationChannelClient extends AbstractCommunicationChann
is = new FileInputStream(new File(fromUrl.getPath()));
int offset = 0;
int numBytes;
- while ((numBytes = is.read(buf, offset, chunkSize)) != -1)
- this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes);
+ while ((numBytes = is.read(buf, offset, chunkSize)) != -1) {
+ this.transferFile(new File(toURL.getPath()).getAbsolutePath(), buf, offset, numBytes);
+ }
} catch (FileNotFoundException e) {
throw new CatalogException("Transfer URL Failed: "+ e.getMessage(), e);
} catch (IOException e) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
index 4655bf4..d4b92a7 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/server/channel/xmlrpc/XmlRpcCommunicationChannelServer.java
@@ -142,10 +142,11 @@ public class XmlRpcCommunicationChannelServer extends
FileOutputStream fOut = null;
try {
File outFile = new File(filePath);
- if (outFile.exists())
- fOut = new FileOutputStream(outFile, true);
- else
- fOut = new FileOutputStream(outFile, false);
+ if (outFile.exists()) {
+ fOut = new FileOutputStream(outFile, true);
+ } else {
+ fOut = new FileOutputStream(outFile, false);
+ }
fOut.write(fileData, (int) offset, (int) numBytes);
} finally {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
index f3f1835..7e5d934 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/TransactionId.java
@@ -58,12 +58,13 @@ public abstract class TransactionId<NativeType> {
}
public boolean equals(Object obj) {
- if (obj instanceof TransactionId<?>)
- return this.toString().equals(obj.toString());
- else if (obj instanceof String)
- return this.toString().equals((String) obj);
- else
- return false;
+ if (obj instanceof TransactionId<?>) {
+ return this.toString().equals(obj.toString());
+ } else if (obj instanceof String) {
+ return this.toString().equals((String) obj);
+ } else {
+ return false;
+ }
}
protected abstract NativeType fromString(String stringId);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
index 9b7fdb8..b5e8688 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/dictionary/WorkflowManagerDictionary.java
@@ -38,8 +38,9 @@ public class WorkflowManagerDictionary implements Dictionary {
public TermBucket lookup(Metadata metadata) {
if (metadata.getMetadata("ProductType") != null && metadata.getAllMetadata("ProductType").contains("Workflows")) {
TermBucket workflowBucket = new TermBucket("Workflows");
- for (Object key : metadata.getHashtable().keySet())
- workflowBucket.addTerm(new Term((String) key, metadata.getAllMetadata((String) key)));
+ for (Object key : metadata.getHashtable().keySet()) {
+ workflowBucket.addTerm(new Term((String) key, metadata.getAllMetadata((String) key)));
+ }
return workflowBucket;
}else {
return null;
@@ -49,8 +50,9 @@ public class WorkflowManagerDictionary implements Dictionary {
public Metadata reverseLookup(TermBucket termBucket) {
Metadata metadata = new Metadata();
if (termBucket.getName().equals("Workflows")) {
- for (Term term : termBucket.getTerms())
- metadata.addMetadata(term.getName(), term.getValues());
+ for (Term term : termBucket.getTerms()) {
+ metadata.addMetadata(term.getName(), term.getValues());
+ }
}
return metadata;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
index 52e8e78..175419a 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/DataSourceIndex.java
@@ -77,10 +77,11 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
conn = this.dataSource.getConnection();
stmt = conn.createStatement();
rs = stmt.executeQuery("SELECT COUNT(transaction_id) AS numTransIds FROM transactions");
- if (rs.next())
- return rs.getInt("numTransIds");
- else
- throw new Exception("Failed to query for number of transactions");
+ if (rs.next()) {
+ return rs.getInt("numTransIds");
+ } else {
+ throw new Exception("Failed to query for number of transactions");
+ }
}catch (Exception e) {
throw new CatalogIndexException("Failed to get number of transactions : " + e.getMessage(), e);
}finally {
@@ -253,14 +254,22 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
try {
conn = this.dataSource.getConnection();
stmt = conn.createStatement();
- for (TermBucket termBucket : termBuckets)
- for (Term term : termBucket.getTerms())
- for (String value : term.getValues())
- try {
- stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term.getName() + "' AND term_value = '" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "'");
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to delete term: '" + transactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + value + "'");
- }
+ for (TermBucket termBucket : termBuckets) {
+ for (Term term : termBucket.getTerms()) {
+ for (String value : term.getValues()) {
+ try {
+ stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId
+ + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term
+ .getName() + "' AND term_value = '" + (this.useUTF8 ? URLEncoder
+ .encode(value, "UTF8") : value) + "'");
+ } catch (Exception e) {
+ LOG.log(Level.WARNING,
+ "Failed to delete term: '" + transactionId + "','" + termBucket.getName() + "','" + term
+ .getName() + "','" + value + "'");
+ }
+ }
+ }
+ }
conn.commit();
return true;
}catch (Exception e) {
@@ -285,15 +294,24 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
try {
conn = this.dataSource.getConnection();
stmt = conn.createStatement();
- for (TermBucket termBucket : termBuckets)
- for (Term term : termBucket.getTerms())
- for (String value : term.getValues())
- try {
- stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term.getName() + "'");
- stmt.execute("INSERT INTO transaction_terms VALUES ('" + transactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')");
- }catch (Exception e) {
- LOG.log(Level.WARNING, "Failed to ingest term: '" + transactionId + "','" + termBucket.getName() + "','" + term.getName() + "','" + value + "'");
- }
+ for (TermBucket termBucket : termBuckets) {
+ for (Term term : termBucket.getTerms()) {
+ for (String value : term.getValues()) {
+ try {
+ stmt.execute("DELETE FROM transaction_terms WHERE transaction_id = '" + transactionId
+ + "' AND bucket_name = '" + termBucket.getName() + "' AND term_name = '" + term
+ .getName() + "'");
+ stmt.execute(
+ "INSERT INTO transaction_terms VALUES ('" + transactionId + "','" + termBucket.getName() + "','"
+ + term.getName() + "','" + (this.useUTF8 ? URLEncoder.encode(value, "UTF8") : value) + "')");
+ } catch (Exception e) {
+ LOG.log(Level.WARNING,
+ "Failed to ingest term: '" + transactionId + "','" + termBucket.getName() + "','" + term
+ .getName() + "','" + value + "'");
+ }
+ }
+ }
+ }
Calendar calendar = DateUtils.getCurrentLocalTime();
stmt.execute("UPDATE transactions SET transaction_date = '" + DateUtils.toString(calendar) + "' WHERE transaction_id = '" + transactionId + "'");
return new IngestReceipt(transactionId, calendar.getTime());
@@ -327,8 +345,9 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
String termName = rs.getString("term_name");
String termValue = rs.getString("term_value");
TermBucket bucket = termBuckets.get(bucketName);
- if (bucket == null)
- bucket = new TermBucket(bucketName);
+ if (bucket == null) {
+ bucket = new TermBucket(bucketName);
+ }
Term term = new Term(termName, Collections.singletonList((this.useUTF8 ? URLDecoder.decode(termValue, "UTF8") : termValue)));
bucket.addTerm(term);
termBuckets.put(bucketName, bucket);
@@ -355,8 +374,9 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
public Map<TransactionId<?>, List<TermBucket>> getBuckets(
List<TransactionId<?>> transactionIds) throws QueryServiceException {
HashMap<TransactionId<?>, List<TermBucket>> map = new HashMap<TransactionId<?>, List<TermBucket>>();
- for (TransactionId<?> transactionId : transactionIds)
- map.put(transactionId, this.getBuckets(transactionId));
+ for (TransactionId<?> transactionId : transactionIds) {
+ map.put(transactionId, this.getBuckets(transactionId));
+ }
return map;
}
@@ -378,8 +398,12 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
rs = stmt.executeQuery(sqlQuery);
List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- while (rs.next())
- receipts.add(new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")), DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT).getTime()));
+ while (rs.next()) {
+ receipts.add(
+ new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")),
+ DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT)
+ .getTime()));
+ }
return receipts;
}catch (Exception e) {
throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
@@ -410,9 +434,15 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
List<IngestReceipt> receipts = new Vector<IngestReceipt>();
int index = 0;
- while (startIndex > index && rs.next()) index++;
- while (rs.next() && index++ <= endIndex)
- receipts.add(new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")), DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT).getTime()));
+ while (startIndex > index && rs.next()) {
+ index++;
+ }
+ while (rs.next() && index++ <= endIndex) {
+ receipts.add(
+ new IngestReceipt(this.getTransactionIdFactory().createTransactionId(rs.getString("transaction_id")),
+ DateUtils.toCalendar(rs.getString("transaction_date"), DateUtils.FormatType.LOCAL_FORMAT)
+ .getTime()));
+ }
return receipts;
}catch (Exception e) {
throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
@@ -444,8 +474,9 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
rs = stmt.executeQuery(sqlQuery);
int numTransactions = 0;
- while (rs.next())
- numTransactions = rs.getInt("numTransactions");
+ while (rs.next()) {
+ numTransactions = rs.getInt("numTransactions");
+ }
return numTransactions;
}catch (Exception e) {
@@ -468,20 +499,22 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
StringBuilder sqlQuery = new StringBuilder();
StringBuilder bucketNameFilter = new StringBuilder("");
if (queryExpression.getBucketNames() != null) {
- if (queryExpression.getBucketNames().size() == 1)
- bucketNameFilter.append("bucket_name = '").append(queryExpression.getBucketNames().iterator().next())
- .append("' ").append("AND ");
- else if (queryExpression.getBucketNames().size() > 1)
- bucketNameFilter.append("(bucket_name = '")
- .append(StringUtils.join(queryExpression.getBucketNames().iterator(),
- "' OR bucket_name = '")).append("') AND ");
+ if (queryExpression.getBucketNames().size() == 1) {
+ bucketNameFilter.append("bucket_name = '").append(queryExpression.getBucketNames().iterator().next())
+ .append("' ").append("AND ");
+ } else if (queryExpression.getBucketNames().size() > 1) {
+ bucketNameFilter.append("(bucket_name = '")
+ .append(StringUtils.join(queryExpression.getBucketNames().iterator(),
+ "' OR bucket_name = '")).append("') AND ");
+ }
}
if (queryExpression instanceof QueryLogicalGroup) {
QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
sqlQuery.append("(").append(this.getSqlQuery(qlg.getExpressions().get(0)));
String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < qlg.getExpressions().size(); i++)
- sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
+ for (int i = 1; i < qlg.getExpressions().size(); i++) {
+ sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
+ }
sqlQuery.append(")");
}else if (queryExpression instanceof ComparisonQueryExpression){
ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
@@ -507,8 +540,9 @@ public class DataSourceIndex implements Index, IngestService, QueryService {
String value = cqe.getTerm().getValues().get(i);
sqlQuery.append("term_value ").append(operator).append(" '")
.append(this.useUTF8 ? URLEncoder.encode(value, "UTF-8") : value).append("'");
- if ((i + 1) < cqe.getTerm().getValues().size())
- sqlQuery.append(" OR ");
+ if ((i + 1) < cqe.getTerm().getValues().size()) {
+ sqlQuery.append(" OR ");
+ }
}
sqlQuery.append(")");
}else if (queryExpression instanceof NotQueryExpression) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
index c331c1a..23f329f 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/struct/impl/index/WorkflowManagerDataSourceIndex.java
@@ -143,8 +143,9 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
public Map<TransactionId<?>, List<TermBucket>> getBuckets(
List<TransactionId<?>> transactionIds) throws QueryServiceException {
Map<TransactionId<?>, List<TermBucket>> returnMap = new HashMap<TransactionId<?>, List<TermBucket>>();
- for (TransactionId<?> transactionId : transactionIds)
- returnMap.put(transactionId, this.getBuckets(transactionId));
+ for (TransactionId<?> transactionId : transactionIds) {
+ returnMap.put(transactionId, this.getBuckets(transactionId));
+ }
return returnMap;
}
@@ -161,8 +162,11 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
rs = stmt.executeQuery(sqlQuery);
List<IngestReceipt> receipts = new Vector<IngestReceipt>();
- while (rs.next())
- receipts.add(new IngestReceipt(new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")), DateConvert.isoParse(rs.getString("start_date_time"))));
+ while (rs.next()) {
+ receipts.add(new IngestReceipt(
+ new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")),
+ DateConvert.isoParse(rs.getString("start_date_time"))));
+ }
return receipts;
}catch (Exception e) {
throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
@@ -192,9 +196,14 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
List<IngestReceipt> receipts = new Vector<IngestReceipt>();
int index = 0;
- while (startIndex > index && rs.next()) index++;
- while (rs.next() && index++ <= endIndex)
- receipts.add(new IngestReceipt(new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")), DateConvert.isoParse(rs.getString("start_date_time"))));
+ while (startIndex > index && rs.next()) {
+ index++;
+ }
+ while (rs.next() && index++ <= endIndex) {
+ receipts.add(new IngestReceipt(
+ new LongTransactionIdFactory().createTransactionId(rs.getString("workflow_instance_id")),
+ DateConvert.isoParse(rs.getString("start_date_time"))));
+ }
return receipts;
}catch (Exception e) {
throw new QueryServiceException("Failed to query Workflow Instances Database : " + e.getMessage(), e);
@@ -224,8 +233,9 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
rs = stmt.executeQuery(sqlQuery);
int numInstances = 0;
- while (rs.next())
- numInstances = rs.getInt("numInstances");
+ while (rs.next()) {
+ numInstances = rs.getInt("numInstances");
+ }
return numInstances;
} catch (Exception e) {
@@ -254,8 +264,9 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
QueryLogicalGroup qlg = (QueryLogicalGroup) queryExpression;
sqlQuery.append("(").append(this.getSqlQuery(qlg.getExpressions().get(0)));
String op = qlg.getOperator() == QueryLogicalGroup.Operator.AND ? "INTERSECT" : "UNION";
- for (int i = 1; i < qlg.getExpressions().size(); i++)
- sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
+ for (int i = 1; i < qlg.getExpressions().size(); i++) {
+ sqlQuery.append(") ").append(op).append(" (").append(this.getSqlQuery(qlg.getExpressions().get(i)));
+ }
sqlQuery.append(")");
}else if (queryExpression instanceof ComparisonQueryExpression){
ComparisonQueryExpression cqe = (ComparisonQueryExpression) queryExpression;
@@ -281,8 +292,9 @@ public class WorkflowManagerDataSourceIndex implements Index, QueryService {
String value = cqe.getTerm().getValues().get(i);
sqlQuery.append("workflow_met_val ").append(operator).append(" '")
.append(URLEncoder.encode(value, "UTF-8")).append("'");
- if ((i + 1) < cqe.getTerm().getValues().size())
- sqlQuery.append("OR");
+ if ((i + 1) < cqe.getTerm().getValues().size()) {
+ sqlQuery.append("OR");
+ }
}
sqlQuery.append(")");
}else if (queryExpression instanceof NotQueryExpression) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
index 457605c..46253c5 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/Catalog.java
@@ -58,8 +58,9 @@ public class Catalog {
public Catalog(String id, Index index, List<Dictionary> dictionaries, boolean restrictQueryPermissions, boolean restrictIngestPermissions) {
this.id = id;
this.index = index;
- if (dictionaries != null)
- this.dictionaries = new Vector<Dictionary>(dictionaries);
+ if (dictionaries != null) {
+ this.dictionaries = new Vector<Dictionary>(dictionaries);
+ }
this.restrictQueryPermissions = restrictQueryPermissions;
this.restrictIngestPermissions = restrictIngestPermissions;
}
@@ -85,8 +86,9 @@ public class Catalog {
}
public void addDictionary(Dictionary dictionary) {
- if (this.dictionaries == null)
- this.dictionaries = new Vector<Dictionary>();
+ if (this.dictionaries == null) {
+ this.dictionaries = new Vector<Dictionary>();
+ }
this.dictionaries.add(dictionary);
}
@@ -170,10 +172,11 @@ public class Catalog {
if (termBuckets.size() > 0) {
LOG.log(Level.INFO, "Catalog '" + this + "' attemping update metadata for catalog TransactionId [id = '" + transactionId + "']");
IngestReceipt ingestReceipt = ((IngestService) this.index).update(transactionId, termBuckets);
- if (ingestReceipt != null)
- return new CatalogReceipt(ingestReceipt, this.getId());
- else
- return null;
+ if (ingestReceipt != null) {
+ return new CatalogReceipt(ingestReceipt, this.getId());
+ } else {
+ return null;
+ }
}else {
LOG.log(Level.WARNING, "Catalog '" + this + "' did not generate any TermBuckets from Metadata for catalog TransactionId [id = '" + transactionId + "']");
return null;
@@ -226,8 +229,9 @@ public class Catalog {
if (this.isQueriable()) {
QueryService queryService = (QueryService) this.index;
List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (IngestReceipt ingestReceipt : queryService.query(queryExpression))
- catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
+ for (IngestReceipt ingestReceipt : queryService.query(queryExpression)) {
+ catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
+ }
return Collections.unmodifiableList(catalogReceipts);
}else {
LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
@@ -244,8 +248,9 @@ public class Catalog {
if (this.isQueriable()) {
QueryService queryService = (QueryService) this.index;
List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
- for (IngestReceipt ingestReceipt : queryService.query(queryExpression, startIndex, endIndex))
- catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
+ for (IngestReceipt ingestReceipt : queryService.query(queryExpression, startIndex, endIndex)) {
+ catalogReceipts.add(new CatalogReceipt(ingestReceipt, this.getId()));
+ }
return Collections.unmodifiableList(catalogReceipts);
}else {
LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
@@ -290,8 +295,9 @@ public class Catalog {
if (this.isQueriable()) {
QueryService queryService = (QueryService) this.index;
Map<TransactionId<?>, List<TermBucket>> termBucketMap = queryService.getBuckets(transactionIds);
- for (TransactionId<?> transactionId : termBucketMap.keySet())
- metadataMap.put(transactionId, this.getMetadataFromBuckets(termBucketMap.get(transactionId)));
+ for (TransactionId<?> transactionId : termBucketMap.keySet()) {
+ metadataMap.put(transactionId, this.getMetadataFromBuckets(termBucketMap.get(transactionId)));
+ }
}else {
LOG.log(Level.WARNING, "Catalog '" + this + "' is not queriable");
}
@@ -304,9 +310,11 @@ public class Catalog {
public boolean isInterested(QueryExpression queryExpression) throws CatalogException {
try {
if (this.dictionaries != null) {
- for (Dictionary dictionary : this.dictionaries)
- if (dictionary.understands(queryExpression))
- return true;
+ for (Dictionary dictionary : this.dictionaries) {
+ if (dictionary.understands(queryExpression)) {
+ return true;
+ }
+ }
return false;
}else {
return true;
@@ -320,8 +328,9 @@ public class Catalog {
Metadata metadata = new Metadata();
for (TermBucket termBucket : termBuckets) {
if (this.dictionaries != null) {
- for (Dictionary dictionary : this.dictionaries)
- metadata.addMetadata(dictionary.reverseLookup(termBucket));
+ for (Dictionary dictionary : this.dictionaries) {
+ metadata.addMetadata(dictionary.reverseLookup(termBucket));
+ }
}else {
metadata.addMetadata(this.asMetadata(termBuckets));
}
@@ -331,9 +340,11 @@ public class Catalog {
protected Metadata asMetadata(List<TermBucket> termBuckets) {
Metadata m = new Metadata();
- for (TermBucket bucket : termBuckets)
- for (Term term : bucket.getTerms())
- m.addMetadata(term.getName(), term.getValues());
+ for (TermBucket bucket : termBuckets) {
+ for (Term term : bucket.getTerms()) {
+ m.addMetadata(term.getName(), term.getValues());
+ }
+ }
return m;
}
@@ -342,14 +353,16 @@ public class Catalog {
if (this.dictionaries != null) {
for (Dictionary dictionary : this.dictionaries) {
TermBucket termBucket = dictionary.lookup(metadata);
- if (termBucket != null)
- termBuckets.add(termBucket);
+ if (termBucket != null) {
+ termBuckets.add(termBucket);
+ }
}
}else {
LOG.log(Level.WARNING, "Catalog '" + this + "' has no dictionaries defined, attempting to send all Metadata in a default TermBucket");
TermBucket bucket = new TermBucket();
- for (String key : metadata.getAllKeys())
- bucket.addTerm(new Term(key, metadata.getAllMetadata(key)));
+ for (String key : metadata.getAllKeys()) {
+ bucket.addTerm(new Term(key, metadata.getAllMetadata(key)));
+ }
termBuckets.add(bucket);
}
return termBuckets;
@@ -360,12 +373,13 @@ public class Catalog {
}
public boolean equals(Object obj) {
- if (obj instanceof Catalog)
- return ((Catalog) obj).getId().equals(this.getId());
- else if (obj instanceof String)
- return this.getId().equals((String) obj);
- else
- return false;
+ if (obj instanceof Catalog) {
+ return ((Catalog) obj).getId().equals(this.getId());
+ } else if (obj instanceof String) {
+ return this.getId().equals((String) obj);
+ } else {
+ return false;
+ }
}
public String toString() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
index d01b945..f540239 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/CatalogFactory.java
@@ -45,8 +45,9 @@ public class CatalogFactory {
Vector<Dictionary> dictionaries = null;
if (this.dictionaryFactories != null) {
dictionaries = new Vector<Dictionary>();
- for (DictionaryFactory dictionaryFactory : this.dictionaryFactories)
- dictionaries.add(dictionaryFactory.createDictionary());
+ for (DictionaryFactory dictionaryFactory : this.dictionaryFactories) {
+ dictionaries.add(dictionaryFactory.createDictionary());
+ }
}
return new Catalog(this.catalogId, this.indexFactory.createIndex(), dictionaries, this.restrictQueryPermissions, this.restrictIngestPermissions);
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
index 26a5fe6..426626f 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceClientFactory.java
@@ -53,8 +53,9 @@ public class CatalogServiceClientFactory implements CatalogServiceFactory {
@Required
public void setAutoPagerSize(int autoPagerSize) {
- if (autoPagerSize > 0)
- this.autoPagerSize = autoPagerSize;
+ if (autoPagerSize > 0) {
+ this.autoPagerSize = autoPagerSize;
+ }
}
public String getServerUrl() {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
index 9832110..53b619b 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/system/impl/CatalogServiceLocal.java
@@ -271,14 +271,18 @@ public class CatalogServiceLocal implements CatalogService {
backupCatalogs = new HashSet<Catalog>(this.catalogs);
for (Catalog catalog : this.catalogs) {
if (catalog.getId().equals(catalogId)) {
- if (dictionaries != null)
- catalog.setDictionaries(dictionaries);
- if (index != null)
- catalog.setIndex(index);
- if (restrictQueryPermission != null)
- catalog.setRestrictQueryPermissions(restrictQueryPermissions);
- if (restrictIngestPermission != null)
- catalog.setRestrictIngestPermissions(restrictIngestPermissions);
+ if (dictionaries != null) {
+ catalog.setDictionaries(dictionaries);
+ }
+ if (index != null) {
+ catalog.setIndex(index);
+ }
+ if (restrictQueryPermission != null) {
+ catalog.setRestrictQueryPermissions(restrictQueryPermissions);
+ }
+ if (restrictIngestPermission != null) {
+ catalog.setRestrictIngestPermissions(restrictIngestPermissions);
+ }
this.catalogRepository.serializeCatalog(catalog);
break;
}
@@ -311,10 +315,12 @@ public class CatalogServiceLocal implements CatalogService {
* URNs equals that of an existing Catalog.
*/
public void addCatalog(Catalog catalog) throws CatalogServiceException {
- if (!this.containsCatalog(catalog.getId()))
- this.replaceCatalog(catalog);
- else
- LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalog + "' already used in CatalogService, remedy and retry add -- no changes took place!");
+ if (!this.containsCatalog(catalog.getId())) {
+ this.replaceCatalog(catalog);
+ } else {
+ LOG.log(Level.WARNING, "Attempt to override an existing catalog '" + catalog
+ + "' already used in CatalogService, remedy and retry add -- no changes took place!");
+ }
}
/**
@@ -438,9 +444,11 @@ public class CatalogServiceLocal implements CatalogService {
protected Catalog getCatalog(String catalogUrn) throws CatalogServiceException {
this.catalogsLock.readLock().lock();
try {
- for (Catalog catalog : this.catalogs)
- if (catalog.getId().equals(catalogUrn))
- return catalog;
+ for (Catalog catalog : this.catalogs) {
+ if (catalog.getId().equals(catalogUrn)) {
+ return catalog;
+ }
+ }
return null;
}catch (Exception e) {
throw new CatalogServiceException("Failed to get catalog catalog '" + catalogUrn + "' : " + e.getMessage(), e);
@@ -458,8 +466,9 @@ public class CatalogServiceLocal implements CatalogService {
this.catalogsLock.readLock().lock();
try {
Set<String> catalogIds = new HashSet<String>();
- for (Catalog catalog : this.catalogs)
- catalogIds.add(catalog.getId());
+ for (Catalog catalog : this.catalogs) {
+ catalogIds.add(catalog.getId());
+ }
return catalogIds;
}catch (Exception e) {
throw new CatalogServiceException("Failed to get current catalog ids list : " + e.getMessage(), e);
@@ -469,13 +478,17 @@ public class CatalogServiceLocal implements CatalogService {
}
public TransactionReceipt ingest(Metadata metadata) throws CatalogServiceException {
- if (this.restrictIngestPermissions)
- throw new CatalogServiceException("Ingest permissions are restricted for this CatalogService -- request denied");
+ if (this.restrictIngestPermissions) {
+ throw new CatalogServiceException(
+ "Ingest permissions are restricted for this CatalogService -- request denied");
+ }
try {
boolean performUpdate;
TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(metadata);
- if (performUpdate = this.ingestMapper.hasCatalogServiceTransactionId(catalogServiceTransactionId))
- LOG.log(Level.INFO, "TransactionId '" + catalogServiceTransactionId + "' is an existing TransactionId, switching to update mode");
+ if (performUpdate = this.ingestMapper.hasCatalogServiceTransactionId(catalogServiceTransactionId)) {
+ LOG.log(Level.INFO, "TransactionId '" + catalogServiceTransactionId
+ + "' is an existing TransactionId, switching to update mode");
+ }
List<CatalogReceipt> catalogReceipts = new Vector<CatalogReceipt>();
for (Catalog catalog : this.getFilteredCatalogList(metadata)) {
if (catalog.isIngestable()) {
@@ -483,8 +496,11 @@ public class CatalogServiceLocal implements CatalogService {
try {
// perform update
if (performUpdate) {
- if (!Boolean.parseBoolean(metadata.getMetadata(ENABLE_UPDATE_MET_KEY)))
- throw new CatalogServiceException("TransactionId '" + catalogServiceTransactionId + "' already exists -- enable update by setting metadata key '" + ENABLE_UPDATE_MET_KEY + "'=true");
+ if (!Boolean.parseBoolean(metadata.getMetadata(ENABLE_UPDATE_MET_KEY))) {
+ throw new CatalogServiceException("TransactionId '" + catalogServiceTransactionId
+ + "' already exists -- enable update by setting metadata key '"
+ + ENABLE_UPDATE_MET_KEY + "'=true");
+ }
TransactionId<?> catalogTransactionId = this.ingestMapper.getCatalogTransactionId(catalogServiceTransactionId, catalog.getId());
if (catalogTransactionId != null) {
CatalogReceipt catalogReceipt = catalog.update(catalogTransactionId, metadata);
@@ -515,8 +531,10 @@ public class CatalogServiceLocal implements CatalogService {
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Failed to add metadata to catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to add metadata to catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to add metadata to catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ }
}finally {
this.ingestMapperLock.writeLock().unlock();
}
@@ -536,8 +554,10 @@ public class CatalogServiceLocal implements CatalogService {
* @throws CatalogServiceException
*/
public void delete(Metadata metadata) throws CatalogServiceException {
- if (this.restrictIngestPermissions)
- throw new CatalogServiceException("Delete permissions are restricted for this CatalogService -- request denied");
+ if (this.restrictIngestPermissions) {
+ throw new CatalogServiceException(
+ "Delete permissions are restricted for this CatalogService -- request denied");
+ }
TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(metadata, false);
if (catalogServiceTransactionId != null) {
for (Catalog catalog : this.getFilteredCatalogList(metadata)) {
@@ -567,8 +587,11 @@ public class CatalogServiceLocal implements CatalogService {
}
}catch (Exception e) {
LOG.log(Level.WARNING, "Error occured while deleting metadata for TransactionId [id = " + catalogServiceTransactionId + "] : " + e.getMessage(), e);
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Error occured while deleting metadata for TransactionId [id = " + catalogServiceTransactionId + "] : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Error occured while deleting metadata for TransactionId [id = "
+ + catalogServiceTransactionId + "] : " + e.getMessage(), e);
+ }
}finally {
this.ingestMapperLock.writeLock().unlock();
}
@@ -582,9 +605,12 @@ public class CatalogServiceLocal implements CatalogService {
}
protected boolean doReduce(Metadata metadata) {
- for (String key : metadata.getAllKeys())
- if (!(key.equals(CATALOG_SERVICE_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_IDS_MET_KEY) || key.equals(CATALOG_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_ID_MET_KEY)))
- return true;
+ for (String key : metadata.getAllKeys()) {
+ if (!(key.equals(CATALOG_SERVICE_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_IDS_MET_KEY) || key
+ .equals(CATALOG_TRANSACTION_ID_MET_KEY) || key.equals(CATALOG_ID_MET_KEY))) {
+ return true;
+ }
+ }
return false;
}
@@ -593,13 +619,19 @@ public class CatalogServiceLocal implements CatalogService {
for (Catalog catalog : this.getCurrentCatalogList()) {
try {
String val = catalog.getProperty(key);
- if (val != null)
- vals.add(val);
+ if (val != null) {
+ vals.add(val);
+ }
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e
+ .getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to get catalog property '" + key + "' from catalog '" + catalog.getId() + "' : " + e
+ .getMessage(), e);
+ }
}
}
return vals;
@@ -612,17 +644,21 @@ public class CatalogServiceLocal implements CatalogService {
Properties catalogProperties = catalog.getProperties();
for (Object key : catalogProperties.keySet()) {
String value = properties.getProperty((String) key);
- if (value != null)
- value += "," + catalogProperties.getProperty((String) key);
- else
- value = catalogProperties.getProperty((String) key);
+ if (value != null) {
+ value += "," + catalogProperties.getProperty((String) key);
+ } else {
+ value = catalogProperties.getProperty((String) key);
+ }
properties.setProperty((String) key, value);
}
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to get catalog properties from catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ }
}
}
return properties;
@@ -631,10 +667,11 @@ public class CatalogServiceLocal implements CatalogService {
public Properties getCalalogProperties(String catalogUrn) throws CatalogServiceException {
try {
Catalog catalog = this.getCatalog(catalogUrn);
- if (catalog != null)
- return catalog.getProperties();
- else
- return null;
+ if (catalog != null) {
+ return catalog.getProperties();
+ } else {
+ return null;
+ }
}catch (Exception e) {
throw new CatalogServiceException("Failed to get catalog properties from catalog '" + catalogUrn + "' : " + e.getMessage(), e);
}
@@ -671,8 +708,9 @@ public class CatalogServiceLocal implements CatalogService {
for (String catalogId : catalogToSizeOfMap.keySet()) {
Catalog catalog = this.getCatalog(catalogId);
QueryExpression qe = this.reduceToUnderstoodExpressions(catalog, queryExpression);
- if (qe != null)
- catalogReceipts.addAll(catalog.query(qe));
+ if (qe != null) {
+ catalogReceipts.addAll(catalog.query(qe));
+ }
}
List<TransactionReceipt> transactionReceipts = this.getPossiblyUnindexedTransactionReceipts(catalogReceipts);
LOG.log(Level.INFO, "Sorting Query Results . . . ");
@@ -696,8 +734,9 @@ public class CatalogServiceLocal implements CatalogService {
if (qe != null) {
List<CatalogReceipt> receipts = catalog.query(qe, desiredStartingIndex - currentIndex, Math.min((desiredStartingIndex - currentIndex) + pageInfo.getPageSize(), entry.getValue()));
pageOfReceipts.addAll(receipts);
- if (pageOfReceipts.size() >= pageInfo.getPageSize())
- break;
+ if (pageOfReceipts.size() >= pageInfo.getPageSize()) {
+ break;
+ }
}
}else {
currentIndex += entry.getValue();
@@ -738,8 +777,10 @@ public class CatalogServiceLocal implements CatalogService {
* @throws CatalogServiceException
*/
public List<TransactionReceipt> _query(QueryExpression queryExpression, Set<String> catalogIds) throws CatalogServiceException {
- if (this.restrictQueryPermissions)
- throw new CatalogServiceException("Query permissions are restricted for this CatalogService -- request denied");
+ if (this.restrictQueryPermissions) {
+ throw new CatalogServiceException(
+ "Query permissions are restricted for this CatalogService -- request denied");
+ }
try {
LOG.log(Level.INFO, "Recieved query '" + queryExpression + "'");
if (this.simplifyQueries) {
@@ -758,10 +799,15 @@ public class CatalogServiceLocal implements CatalogService {
catalogReceipts.addAll(catalog.query(reducedExpression));
}
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
+ + e.getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to query catalog '" + catalog.getId() + "' for query '" + queryExpression + "' : "
+ + e.getMessage(), e);
+ }
}
}
}
@@ -790,16 +836,18 @@ public class CatalogServiceLocal implements CatalogService {
TransactionId<?> catalogServiceTransactionId = this.getCatalogServiceTransactionId(catalogReceipt.getTransactionId(), catalogReceipt.getCatalogId());
if (catalogServiceTransactionId != null) {
List<CatalogReceipt> found = existing.get(catalogServiceTransactionId);
- if (found == null)
- found = new Vector<CatalogReceipt>();
+ if (found == null) {
+ found = new Vector<CatalogReceipt>();
+ }
found.add(catalogReceipt);
existing.put(catalogServiceTransactionId, found);
}else {
returnList.add(new TransactionReceipt(null, Collections.singletonList(catalogReceipt)));
}
}
- for (TransactionId<?> transactionId : existing.keySet())
- returnList.add(new TransactionReceipt(transactionId, existing.get(transactionId)));
+ for (TransactionId<?> transactionId : existing.keySet()) {
+ returnList.add(new TransactionReceipt(transactionId, existing.get(transactionId)));
+ }
return returnList;
}catch (Exception e) {
throw new CatalogServiceException(e.getMessage(), e);
@@ -811,8 +859,11 @@ public class CatalogServiceLocal implements CatalogService {
for (TransactionReceipt transactionReceipt : transactionReceipts) {
try {
// for (CatalogReceipt catalogReceipt : transactionReceipt.getCatalogReceipts()) {
- if (transactionReceipt.getTransactionId() == null)
- transactionReceipt = new TransactionReceipt(this.getCatalogServiceTransactionId(transactionReceipt.getCatalogReceipts().get(0), true), transactionReceipt.getCatalogReceipts());
+ if (transactionReceipt.getTransactionId() == null) {
+ transactionReceipt = new TransactionReceipt(
+ this.getCatalogServiceTransactionId(transactionReceipt.getCatalogReceipts().get(0), true),
+ transactionReceipt.getCatalogReceipts());
+ }
// }
indexedReceipts.add(transactionReceipt);
}catch(Exception e) {
@@ -840,8 +891,9 @@ public class CatalogServiceLocal implements CatalogService {
public List<TransactionalMetadata> getMetadataFromTransactionIdStrings(List<String> catalogServiceTransactionIdStrings) throws CatalogServiceException {
List<TransactionId<?>> catalogServiceTransactionIds = new Vector<TransactionId<?>>();
- for (String catalogServiceTransactionIdString : catalogServiceTransactionIdStrings)
- catalogServiceTransactionIds.add(this.generateTransactionId(catalogServiceTransactionIdString));
+ for (String catalogServiceTransactionIdString : catalogServiceTransactionIdStrings) {
+ catalogServiceTransactionIds.add(this.generateTransactionId(catalogServiceTransactionIdString));
+ }
return this.getMetadataFromTransactionIds(catalogServiceTransactionIds);
}
@@ -856,14 +908,21 @@ public class CatalogServiceLocal implements CatalogService {
metadata.addMetadata(catalog.getMetadata(catalogReceipt.getTransactionId()));
successfulCatalogReceipts.add(catalogReceipt);
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId() + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId() + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId()
+ + "' : " + e.getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to get metadata for transaction ids for catalog '" + catalogReceipt.getCatalogId()
+ + "' : " + e.getMessage(), e);
+ }
}
}
- if (metadata.getHashtable().keySet().size() > 0)
- metadataSet.add(new TransactionalMetadata(new TransactionReceipt(transactionReceipt.getTransactionId(), successfulCatalogReceipts), metadata));
+ if (metadata.getHashtable().keySet().size() > 0) {
+ metadataSet.add(new TransactionalMetadata(
+ new TransactionReceipt(transactionReceipt.getTransactionId(), successfulCatalogReceipts), metadata));
+ }
}
return new Vector<TransactionalMetadata>(metadataSet);
}
@@ -881,14 +940,22 @@ public class CatalogServiceLocal implements CatalogService {
catalogReceipts.add(catalogReceipt);
}
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogServiceException("Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogServiceException(
+ "Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e
+ .getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to get metadata for transaction ids for catalog '" + catalog.getId() + "' : " + e
+ .getMessage(), e);
+ }
}
}
- if (metadata.getHashtable().keySet().size() > 0)
- metadataSet.add(new TransactionalMetadata(new TransactionReceipt(catalogServiceTransactionId, catalogReceipts), metadata));
+ if (metadata.getHashtable().keySet().size() > 0) {
+ metadataSet.add(
+ new TransactionalMetadata(new TransactionReceipt(catalogServiceTransactionId, catalogReceipts),
+ metadata));
+ }
}
return new Vector<TransactionalMetadata>(metadataSet);
}
@@ -967,8 +1034,11 @@ public class CatalogServiceLocal implements CatalogService {
if (catalog != null) {
TransactionId<?> catalogTransactionId = catalog.getTransactionIdFromString(metadata.getMetadata(CatalogServiceLocal.CATALOG_TRANSACTION_ID_MET_KEY));
TransactionId<?> catalogServiceTransactionId = this.ingestMapper.getCatalogServiceTransactionId(catalogTransactionId, catalogId);
- if (catalogServiceTransactionId == null)
- throw new CatalogServiceException("CatalogService's Catalog '" + catalog.getId() + "' is not aware of TransactionId '" + catalogTransactionId + "'s");
+ if (catalogServiceTransactionId == null) {
+ throw new CatalogServiceException(
+ "CatalogService's Catalog '" + catalog.getId() + "' is not aware of TransactionId '"
+ + catalogTransactionId + "'s");
+ }
return catalogServiceTransactionId;
}else {
throw new CatalogServiceException("This CatalogService has no Catalog with ID = '" + catalogId + "'");
@@ -987,18 +1057,22 @@ public class CatalogServiceLocal implements CatalogService {
try {
if (metadata.containsKey(CATALOG_ID_MET_KEY)) {
Catalog catalog = this.getCatalog(metadata.getMetadata(CATALOG_ID_MET_KEY));
- if (catalog == null)
- throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY) + "' is not managed by this CatalogService");
- else
- return Collections.singleton(catalog);
+ if (catalog == null) {
+ throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY)
+ + "' is not managed by this CatalogService");
+ } else {
+ return Collections.singleton(catalog);
+ }
}else if (metadata.containsKey(CATALOG_IDS_MET_KEY)) {
HashSet<Catalog> filteredCatalogList = new HashSet<Catalog>();
for (Object catalogUrn : metadata.getAllMetadata(CATALOG_IDS_MET_KEY)) {
Catalog catalog = this.getCatalog((String) catalogUrn);
- if (catalog == null)
- throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY) + "' is not managed by this CatalogService");
- else
- filteredCatalogList.add(catalog);
+ if (catalog == null) {
+ throw new CatalogServiceException("Catalog '" + metadata.getMetadata(CATALOG_ID_MET_KEY)
+ + "' is not managed by this CatalogService");
+ } else {
+ filteredCatalogList.add(catalog);
+ }
}
return filteredCatalogList;
}else {
@@ -1015,8 +1089,9 @@ public class CatalogServiceLocal implements CatalogService {
// get children query results
List<QueryResult> childrenQueryResults = new Vector<QueryResult>();
- for (QueryExpression subQueryExpression : ((QueryLogicalGroup) queryExpression).getExpressions())
- childrenQueryResults.add(queryRecur(subQueryExpression, restrictToCatalogIds));
+ for (QueryExpression subQueryExpression : ((QueryLogicalGroup) queryExpression).getExpressions()) {
+ childrenQueryResults.add(queryRecur(subQueryExpression, restrictToCatalogIds));
+ }
// if (QueryLogicalGroup's operator is AND and is unbalanced or a child contains query results)
if ((((QueryLogicalGroup) queryExpression).getOperator().equals(QueryLogicalGroup.Operator.AND) && containsUnbalancedCatalogInterest(childrenQueryResults)) || containsTranactionReceipts(childrenQueryResults)) {
@@ -1056,8 +1131,9 @@ public class CatalogServiceLocal implements CatalogService {
// get merge of results
QueryResult queryResult = new QueryResult(queryExpression);
HashSet<String> interestedCatalogs = new HashSet<String>();
- for (QueryResult childQueryResult : childrenQueryResults)
- interestedCatalogs.addAll(childQueryResult.getInterestedCatalogs());
+ for (QueryResult childQueryResult : childrenQueryResults) {
+ interestedCatalogs.addAll(childQueryResult.getInterestedCatalogs());
+ }
queryResult.setInterestedCatalogs(interestedCatalogs);
return queryResult;
}
@@ -1095,8 +1171,9 @@ public class CatalogServiceLocal implements CatalogService {
QueryResult qr = queryResults.get(i);
TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
for (CatalogReceipt compCatalogReceipt : catalogReceipts) {
- if (catalogReceipt.getTransactionId().equals(compCatalogReceipt.getTransactionId()))
- continue TR;
+ if (catalogReceipt.getTransactionId().equals(compCatalogReceipt.getTransactionId())) {
+ continue TR;
+ }
}
catalogReceipts.remove(catalogReceipt);
}
@@ -1116,8 +1193,9 @@ TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
restrictedExpressions.clear();
break;
}
- if (restrictedQE != null)
- restrictedExpressions.add(restrictedQE);
+ if (restrictedQE != null) {
+ restrictedExpressions.add(restrictedQE);
+ }
}
if (restrictedExpressions.size() > 0) {
if (restrictedExpressions.size() == 1) {
@@ -1157,9 +1235,11 @@ TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
}
protected boolean containsTranactionReceipts(List<QueryResult> queryResults) {
- for (QueryResult queryResult : queryResults)
- if (queryResult.getCatalogReceipts() != null)
- return true;
+ for (QueryResult queryResult : queryResults) {
+ if (queryResult.getCatalogReceipts() != null) {
+ return true;
+ }
+ }
return false;
}
@@ -1168,8 +1248,9 @@ TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
QueryResult firstQueryResult = queryResults.get(0);
for (int i = 1; i < queryResults.size(); i++) {
QueryResult queryResult = queryResults.get(i);
- if (!(queryResult.interestedCatalogs.containsAll(firstQueryResult.interestedCatalogs) && firstQueryResult.interestedCatalogs.containsAll(queryResult.interestedCatalogs)))
- return true;
+ if (!(queryResult.interestedCatalogs.containsAll(firstQueryResult.interestedCatalogs) && firstQueryResult.interestedCatalogs.containsAll(queryResult.interestedCatalogs))) {
+ return true;
+ }
}
return false;
}else {
@@ -1182,14 +1263,20 @@ TR: for (CatalogReceipt catalogReceipt : qr.getCatalogReceipts()) {
for (Catalog catalog : this.getCurrentCatalogList()) {
try {
if (restrictToCatalogIds.contains(catalog.getId())) {
- if (catalog.isInterested(queryExpression))
- interestedCatalogs.add(catalog.getId());
+ if (catalog.isInterested(queryExpression)) {
+ interestedCatalogs.add(catalog.getId());
+ }
}
}catch (Exception e) {
- if (this.oneCatalogFailsAllFail)
- throw new CatalogException("Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '" + queryExpression + "' : " + e.getMessage(), e);
- else
- LOG.log(Level.WARNING, "Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '" + queryExpression + "' : " + e.getMessage(), e);
+ if (this.oneCatalogFailsAllFail) {
+ throw new CatalogException(
+ "Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '"
+ + queryExpression + "' : " + e.getMessage(), e);
+ } else {
+ LOG.log(Level.WARNING,
+ "Failed to determine if Catalog '" + catalog.getId() + "' is interested in query expression '"
+ + queryExpression + "' : " + e.getMessage(), e);
+ }
}
}
return interestedCatalogs;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
index eb89e49..8670f58 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/Term.java
@@ -100,8 +100,9 @@ public class Term implements Cloneable {
public Term(String name, List<String> values, Type type) {
this(name, values);
- if (type != null)
- this.type = type;
+ if (type != null) {
+ this.type = type;
+ }
}
public String getName() {
@@ -122,8 +123,9 @@ public class Term implements Cloneable {
public String getFirstValue() {
String firstValue = null;
- if (this.values.size() > 0)
- firstValue = this.values.get(0);
+ if (this.values.size() > 0) {
+ firstValue = this.values.get(0);
+ }
return firstValue;
}
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
index 4d3ed78..5947ba7 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/term/TermBucket.java
@@ -54,8 +54,9 @@ public class TermBucket extends Bucket {
public void setTerms(Set<Term> terms) {
if (terms != null) {
this.terms = new HashMap<String, Term>();
- for (Term term : terms)
- this.terms.put(term.name, term);
+ for (Term term : terms) {
+ this.terms.put(term.name, term);
+ }
}
}
@@ -65,8 +66,9 @@ public class TermBucket extends Bucket {
public void addTerms(Set<Term> terms, boolean replace) {
if (replace) {
- for (Term term : terms)
- this.terms.put(term.name, term);
+ for (Term term : terms) {
+ this.terms.put(term.name, term);
+ }
}else {
for (Term term : terms) {
Term found = this.terms.get(term.name);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
index 541cdc5..4686318 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/CasPropertyPlaceholderConfigurer.java
@@ -42,10 +42,11 @@ public class CasPropertyPlaceholderConfigurer extends
defaultValue = splitValue[1];
}
String result = PathUtils.doDynamicReplacement(value);
- if (result.equals("null"))
- return defaultValue;
- else
- return result;
+ if (result.equals("null")) {
+ return defaultValue;
+ } else {
+ return result;
+ }
} catch (Exception e) {
e.printStackTrace();
return value;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
index c72f6fb..a2ffefd 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/PluginClassLoader.java
@@ -53,8 +53,9 @@ public class PluginClassLoader extends URLClassLoader {
}
protected void addURLs(List<URL> urls) {
- for (URL url : urls)
- this.addURL(url);
+ for (URL url : urls) {
+ this.addURL(url);
+ }
}
public static URL[] getPluginURLs() {
@@ -85,8 +86,9 @@ public class PluginClassLoader extends URLClassLoader {
public Class<?> loadClass(String name, boolean resolve) throws ClassNotFoundException {
try {
Class<?> clazz = this.findLoadedClass(name);
- if (clazz == null)
- clazz = this.findClass(name);
+ if (clazz == null) {
+ clazz = this.findClass(name);
+ }
return clazz;
}catch (Exception ignored) {}
return super.loadClass(name, resolve);
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
index c807b08..5b29db2 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/Serializer.java
@@ -43,10 +43,11 @@ public class Serializer {
}
public void refreshClassLoader() {
- if (usePluginUrls)
- this.classLoader = new PluginClassLoader();
- else
- this.classLoader = Serializer.class.getClassLoader();
+ if (usePluginUrls) {
+ this.classLoader = new PluginClassLoader();
+ } else {
+ this.classLoader = Serializer.class.getClassLoader();
+ }
}
public void setUsePluginUrls(boolean usePluginUrls) {
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
----------------------------------------------------------------------
diff --git a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
index f2d629d..3b1a149 100644
--- a/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
+++ b/catalog/src/main/java/org/apache/oodt/cas/catalog/util/SpringUtils.java
@@ -42,9 +42,10 @@ public class SpringUtils {
for (String key : catalogsMap.keySet()) {
Catalog curCatalog = catalogsMap.get(key);
LOG.log(Level.INFO, "Loading catalog configuration for Catalog: '" + curCatalog + "'");
- if (catalogs.contains(curCatalog))
- throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. "
- + "**NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>");
+ if (catalogs.contains(curCatalog)) {
+ throw new CatalogException("Catalog URN : '" + curCatalog + "' conflicts with another Catalog's URN. "
+ + "**NOTE: URNs are created based on the following rule: urn:<namespace>:<id or name (if set)>");
+ }
catalogs.add(curCatalog);
}
return catalogs;
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/cli/src/main/java/org/apache/oodt/cas/cli/option/SimpleCmdLineOption.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/oodt/cas/cli/option/SimpleCmdLineOption.java b/cli/src/main/java/org/apache/oodt/cas/cli/option/SimpleCmdLineOption.java
index 23bf8b0..2494c0d 100755
--- a/cli/src/main/java/org/apache/oodt/cas/cli/option/SimpleCmdLineOption.java
+++ b/cli/src/main/java/org/apache/oodt/cas/cli/option/SimpleCmdLineOption.java
@@ -171,8 +171,9 @@ public class SimpleCmdLineOption implements CmdLineOption {
SimpleCmdLineOption compareObj = (SimpleCmdLineOption) obj;
return compareObj.shortOption.equals(this.shortOption)
|| compareObj.longOption.equals(this.longOption);
- } else
+ } else {
return false;
+ }
}
@Override
http://git-wip-us.apache.org/repos/asf/oodt/blob/abd71645/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java
----------------------------------------------------------------------
diff --git a/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java b/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java
index d9e0b02..87b8d8e 100755
--- a/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java
+++ b/cli/src/main/java/org/apache/oodt/cas/cli/util/CmdLineUtils.java
@@ -432,10 +432,12 @@ public class CmdLineUtils {
Validate.notNull(optionName);
Validate.notNull(optionInsts);
- for (CmdLineOptionInstance optionInst : optionInsts)
+ for (CmdLineOptionInstance optionInst : optionInsts) {
if (optionInst.getOption().getLongOption().equals(optionName)
- || optionInst.getOption().getShortOption().equals(optionName))
+ || optionInst.getOption().getShortOption().equals(optionName)) {
return optionInst;
+ }
+ }
return null;
}
@@ -1056,8 +1058,9 @@ public class CmdLineUtils {
curLine.append(splitStrings[i]).append(" ");
for (; i + 1 < splitStrings.length
- && curLine.length() + splitStrings[i + 1].length() <= (endIndex - startIndex); i++)
+ && curLine.length() + splitStrings[i + 1].length() <= (endIndex - startIndex); i++) {
curLine.append(splitStrings[i + 1]).append(" ");
+ }
outputString.append(StringUtils.repeat(" ", startIndex)).append(curLine.toString()).append("\n");
}
@@ -1069,23 +1072,27 @@ public class CmdLineUtils {
InstantiationException, IllegalAccessException {
if (type.equals(File.class)) {
List<Object> files = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
files.add(new File(value));
+ }
return files;
} else if (type.equals(Boolean.class) || type.equals(Boolean.TYPE)) {
List<Object> booleans = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
booleans.add(value.toLowerCase().trim().equals("true"));
+ }
return booleans;
} else if (type.equals(URL.class)) {
List<Object> urls = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
urls.add(new URL(value));
+ }
return urls;
} else if (type.equals(Class.class)) {
List<Object> classes = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
classes.add(Class.forName(value));
+ }
return classes;
} else if (type.equals(List.class)) {
List<Object> lists = new LinkedList<Object>();
@@ -1093,23 +1100,27 @@ public class CmdLineUtils {
return lists;
} else if (type.equals(Integer.class) || type.equals(Integer.TYPE)) {
List<Object> ints = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
ints.add(Integer.valueOf(value));
+ }
return ints;
} else if (type.equals(Long.class) || type.equals(Long.TYPE)) {
List<Object> longs = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
longs.add(Long.valueOf(value));
+ }
return longs;
} else if (type.equals(Double.class) || type.equals(Double.TYPE)) {
List<Object> doubles = new LinkedList<Object>();
- for (String value : values)
+ for (String value : values) {
doubles.add(new Double(value));
+ }
return doubles;
} else if (type.equals(String.class)) {
StringBuilder combinedString = new StringBuilder("");
- for (String value : values)
+ for (String value : values) {
combinedString.append(value).append(" ");
+ }
return Lists.newArrayList(combinedString.toString().trim());
} else {
List<Object> objects = new LinkedList<Object>();