You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by st...@apache.org on 2013/11/26 17:35:03 UTC
[4/4] git commit: Miscellaneous changes
Miscellaneous changes
Project: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/commit/a4196a85
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/a4196a85
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/a4196a85
Branch: refs/heads/maven
Commit: a4196a85767434d94404d48bd9158eb4f11e1699
Parents: da610bc
Author: Strong Liu <st...@hibernate.org>
Authored: Tue Nov 26 23:17:23 2013 +0800
Committer: Strong Liu <st...@hibernate.org>
Committed: Tue Nov 26 23:17:23 2013 +0800
----------------------------------------------------------------------
.../src/main/java/org/usergrid/mq/Query.java | 40 +++++-------
.../java/org/usergrid/mq/QueryFilterLexer.java | 3 +-
.../java/org/usergrid/mq/QueryFilterParser.java | 69 ++++++--------------
.../java/org/usergrid/mq/QueryProcessor.java | 3 +-
.../org/usergrid/mq/cassandra/io/EndSearch.java | 7 +-
.../java/org/usergrid/persistence/Results.java | 6 +-
.../java/org/usergrid/persistence/Schema.java | 15 +++--
.../java/org/usergrid/persistence/Update.java | 4 +-
.../cassandra/CassandraPersistenceUtils.java | 2 +-
.../cassandra/ConnectionRefImpl.java | 20 ++++--
.../persistence/cassandra/CursorCache.java | 2 +-
.../cassandra/EntityManagerImpl.java | 16 ++---
.../persistence/geo/GeoIndexSearcher.java | 24 ++++---
.../usergrid/persistence/geo/GeocellUtils.java | 5 +-
.../query/ir/result/AbstractScanColumn.java | 7 +-
.../query/ir/result/GeoIterator.java | 15 ++---
.../persistence/query/tree/StringLiteral.java | 2 +-
.../persistence/schema/DictionaryInfo.java | 3 +-
.../usergrid/persistence/schema/EntityInfo.java | 3 +-
.../count/BatchCountParallelismTest.java | 2 +-
.../usergrid/persistence/EntityManagerIT.java | 6 +-
.../launcher/ClasspathStaticHttpHandler.java | 23 +++----
.../launcher/CustomJSPTemplateProcessor.java | 2 +-
.../org/usergrid/mongo/protocol/OpQuery.java | 2 +-
.../usergrid/mongo/query/MongoQueryParser.java | 24 +++----
.../rest/applications/ApplicationResource.java | 2 +-
.../rest/applications/ServiceResource.java | 4 +-
.../org/usergrid/rest/utils/PathingUtils.java | 2 +-
.../queues/QueueResourceLong2IT.java | 18 ++---
.../rest/filters/ContentTypeResourceIT.java | 6 +-
.../rest/management/RegistrationIT.java | 6 +-
.../organizations/OrganizationsResourceIT.java | 2 +-
.../usergrid/management/ActivationState.java | 2 +-
.../cassandra/ManagementServiceImpl.java | 6 +-
.../security/providers/FacebookProvider.java | 5 +-
.../security/providers/FoursquareProvider.java | 4 +-
.../providers/PingIdentityProvider.java | 4 +-
.../security/shiro/CustomPermission.java | 7 +-
.../java/org/usergrid/security/shiro/Realm.java | 6 +-
.../security/shiro/utils/SubjectUtils.java | 7 +-
.../org/usergrid/services/ServiceAction.java | 2 +-
.../java/org/usergrid/services/ServiceInfo.java | 2 +-
.../org/usergrid/services/ServiceManager.java | 5 +-
.../org/usergrid/services/ServiceRequest.java | 2 +-
.../applications/ApplicationsService.java | 11 ++--
.../usergrid/cassandra/AvailablePortFinder.java | 2 +-
46 files changed, 182 insertions(+), 228 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/mq/Query.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/mq/Query.java b/stack/core/src/main/java/org/usergrid/mq/Query.java
index f7e2530..7b6ba97 100644
--- a/stack/core/src/main/java/org/usergrid/mq/Query.java
+++ b/stack/core/src/main/java/org/usergrid/mq/Query.java
@@ -498,12 +498,7 @@ public class Query {
return this;
}
- if ( StringUtils.isNotEmpty( output ) ) {
- mergeSelectResults = true;
- }
- else {
- mergeSelectResults = false;
- }
+ mergeSelectResults = StringUtils.isNotEmpty( output );
if ( output == null ) {
output = "";
@@ -757,20 +752,18 @@ public class Query {
if ( name == null ) {
return null;
}
- ListIterator<FilterPredicate> iterator = filterPredicates.listIterator();
- while ( iterator.hasNext() ) {
- FilterPredicate f = iterator.next();
- if ( f.propertyName.equalsIgnoreCase( name ) ) {
- if ( operator != null ) {
- if ( operator == f.operator ) {
- return f;
- }
- }
- else {
- return f;
- }
- }
- }
+ for ( FilterPredicate f : filterPredicates ) {
+ if ( f.propertyName.equalsIgnoreCase( name ) ) {
+ if ( operator != null ) {
+ if ( operator == f.operator ) {
+ return f;
+ }
+ }
+ else {
+ return f;
+ }
+ }
+ }
return null;
}
@@ -1415,10 +1408,9 @@ public class Query {
if ( ( operator == Query.FilterOperator.IN ) || ( operator == Query.FilterOperator.WITHIN ) ) {
if ( ( !( value instanceof Collection ) ) && ( value instanceof Iterable ) ) {
List newValue = new ArrayList();
- for ( Iterator i$ = ( ( Iterable ) value ).iterator(); i$.hasNext(); ) {
- Object val = i$.next();
- newValue.add( val );
- }
+ for ( Object val : ((Iterable) value) ) {
+ newValue.add( val );
+ }
value = newValue;
}
// DataTypeUtils.checkSupportedValue(propertyName, value, true,
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/mq/QueryFilterLexer.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/mq/QueryFilterLexer.java b/stack/core/src/main/java/org/usergrid/mq/QueryFilterLexer.java
index ebef342..9755be7 100644
--- a/stack/core/src/main/java/org/usergrid/mq/QueryFilterLexer.java
+++ b/stack/core/src/main/java/org/usergrid/mq/QueryFilterLexer.java
@@ -70,7 +70,8 @@ public class QueryFilterLexer extends Lexer {
// delegators
- public QueryFilterLexer() {;}
+ public QueryFilterLexer() {
+ }
public QueryFilterLexer( CharStream input ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java b/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
index 0f0c913..c2061b3 100644
--- a/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
+++ b/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
@@ -98,10 +98,7 @@ public class QueryFilterParser extends Parser {
public static class property_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "property"
+ // $ANTLR start "property"
// org/usergrid/persistence/query/QueryFilter.g:101:1: property : ( ID ) ;
public final QueryFilterParser.property_return property() throws RecognitionException {
QueryFilterParser.property_return retval = new QueryFilterParser.property_return();
@@ -134,10 +131,7 @@ public class QueryFilterParser extends Parser {
public static class operator_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "operator"
+ // $ANTLR start "operator"
// org/usergrid/persistence/query/QueryFilter.g:104:1: operator : ( '<' | '<=' | '=' | '>' | '>=' | 'in' | 'eq' |
// 'lt' | 'gt' | 'lte' | 'gte' | 'contains' | 'within' ) ;
public final QueryFilterParser.operator_return operator() throws RecognitionException {
@@ -176,10 +170,7 @@ public class QueryFilterParser extends Parser {
public static class value_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "value"
+ // $ANTLR start "value"
// org/usergrid/persistence/query/QueryFilter.g:107:1: value : ( BOOLEAN | STRING | INT | FLOAT | UUID ) ;
public final QueryFilterParser.value_return value() throws RecognitionException {
QueryFilterParser.value_return retval = new QueryFilterParser.value_return();
@@ -216,10 +207,7 @@ public class QueryFilterParser extends Parser {
public static class second_value_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "second_value"
+ // $ANTLR start "second_value"
// org/usergrid/persistence/query/QueryFilter.g:109:1: second_value : ( BOOLEAN | STRING | INT | FLOAT | UUID ) ;
public final QueryFilterParser.second_value_return second_value() throws RecognitionException {
QueryFilterParser.second_value_return retval = new QueryFilterParser.second_value_return();
@@ -256,10 +244,7 @@ public class QueryFilterParser extends Parser {
public static class third_value_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "third_value"
+ // $ANTLR start "third_value"
// org/usergrid/persistence/query/QueryFilter.g:111:1: third_value : ( BOOLEAN | STRING | INT | FLOAT | UUID ) ;
public final QueryFilterParser.third_value_return third_value() throws RecognitionException {
QueryFilterParser.third_value_return retval = new QueryFilterParser.third_value_return();
@@ -411,10 +396,7 @@ public class QueryFilterParser extends Parser {
public static class select_subject_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "select_subject"
+ // $ANTLR start "select_subject"
// org/usergrid/persistence/query/QueryFilter.g:127:1: select_subject : ID ;
public final QueryFilterParser.select_subject_return select_subject() throws RecognitionException {
QueryFilterParser.select_subject_return retval = new QueryFilterParser.select_subject_return();
@@ -446,10 +428,7 @@ public class QueryFilterParser extends Parser {
public static class select_assign_target_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "select_assign_target"
+ // $ANTLR start "select_assign_target"
// org/usergrid/persistence/query/QueryFilter.g:134:1: select_assign_target : ID ;
public final QueryFilterParser.select_assign_target_return select_assign_target() throws RecognitionException {
QueryFilterParser.select_assign_target_return retval = new QueryFilterParser.select_assign_target_return();
@@ -478,10 +457,7 @@ public class QueryFilterParser extends Parser {
public static class select_assign_source_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "select_assign_source"
+ // $ANTLR start "select_assign_source"
// org/usergrid/persistence/query/QueryFilter.g:137:1: select_assign_source : ID ;
public final QueryFilterParser.select_assign_source_return select_assign_source() throws RecognitionException {
QueryFilterParser.select_assign_source_return retval = new QueryFilterParser.select_assign_source_return();
@@ -544,8 +520,7 @@ public class QueryFilterParser extends Parser {
}
finally {
}
- return;
- }
+ }
// $ANTLR end "select_assign"
@@ -644,20 +619,20 @@ public class QueryFilterParser extends Parser {
String property = ( property8 != null ? input.toString( property8.start, property8.stop ) : null );
String operator = ( operator9 != null ? input.toString( operator9.start, operator9.stop ) : null );
String value = ( value10 != null ? input.toString( value10.start, value10.stop ) : null );
- int value_type = ( value10 != null ? ( ( Token ) value10.start ) : null ) != null ?
- ( value10 != null ? ( ( Token ) value10.start ) : null ).getType() : 0;
+ int value_type = ( value10 != null ? value10.start : null ) != null ?
+ ( value10 != null ? value10.start : null ).getType() : 0;
String second_value =
( second_value11 != null ? input.toString( second_value11.start, second_value11.stop ) :
null );
int second_value_type =
- ( second_value11 != null ? ( ( Token ) second_value11.start ) : null ) != null ?
- ( second_value11 != null ? ( ( Token ) second_value11.start ) : null ).getType() : 0;
+ ( second_value11 != null ? second_value11.start : null ) != null ?
+ ( second_value11 != null ? second_value11.start : null ).getType() : 0;
String third_value =
( third_value12 != null ? input.toString( third_value12.start, third_value12.stop ) :
null );
int third_value_type =
- ( third_value12 != null ? ( ( Token ) third_value12.start ) : null ) != null ?
- ( third_value12 != null ? ( ( Token ) third_value12.start ) : null ).getType() : 0;
+ ( third_value12 != null ? third_value12.start : null ) != null ?
+ ( third_value12 != null ? third_value12.start : null ).getType() : 0;
FilterPredicate filter =
new FilterPredicate( property, operator, value, value_type, second_value, second_value_type,
third_value, third_value_type );
@@ -675,18 +650,14 @@ public class QueryFilterParser extends Parser {
}
finally {
}
- return;
- }
+ }
// $ANTLR end "where"
public static class direction_return extends ParserRuleReturnScope {}
- ;
-
-
- // $ANTLR start "direction"
+ // $ANTLR start "direction"
// org/usergrid/persistence/query/QueryFilter.g:165:1: direction : ( 'asc' | 'desc' ) ;
public final QueryFilterParser.direction_return direction() throws RecognitionException {
QueryFilterParser.direction_return retval = new QueryFilterParser.direction_return();
@@ -774,8 +745,7 @@ public class QueryFilterParser extends Parser {
}
finally {
}
- return;
- }
+ }
// $ANTLR end "order"
@@ -907,8 +877,7 @@ public class QueryFilterParser extends Parser {
}
finally {
}
- return;
- }
+ }
// $ANTLR end "select_expr"
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java b/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
index 6cc805a..3211455 100644
--- a/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
+++ b/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
@@ -394,8 +394,7 @@ public class QueryProcessor {
}
if ( searchFinishValue == null ) {
searchFinishValue = searchStartValue;
- ;
- }
+ }
if ( ( searchStartValue != null ) && searchStartValue.toString().endsWith( "*" ) ) {
searchStartValue = removeEnd( searchStartValue.toString(), "*" );
searchFinishValue = searchStartValue + "\uFFFF";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/mq/cassandra/io/EndSearch.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/mq/cassandra/io/EndSearch.java b/stack/core/src/main/java/org/usergrid/mq/cassandra/io/EndSearch.java
index 4ca09aa..5bf77e4 100644
--- a/stack/core/src/main/java/org/usergrid/mq/cassandra/io/EndSearch.java
+++ b/stack/core/src/main/java/org/usergrid/mq/cassandra/io/EndSearch.java
@@ -33,19 +33,18 @@ public class EndSearch extends NoTransactionSearch
/**
* @param ko
- * @param cassTimestamp
*/
public EndSearch( Keyspace ko )
{
super( ko );
- } /*
+ }
+
+ /*
* (non-Javadoc)
*
* @see org.usergrid.mq.cassandra.io.NoTransaction#getParams(java.util.UUID,
* java.util.UUID, org.usergrid.mq.QueueQuery)
*/
-
-
@Override
protected SearchParam getParams( UUID queueId, UUID consumerId, QueueQuery query )
{
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/Results.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/Results.java b/stack/core/src/main/java/org/usergrid/persistence/Results.java
index a6329d6..5068300 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Results.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Results.java
@@ -706,8 +706,7 @@ public class Results implements Iterable<Entity> {
idSet.addAll( results.idSet );
ids = new ArrayList<UUID>( idSet );
- return;
- }
+ }
}
@@ -756,8 +755,7 @@ public class Results implements Iterable<Entity> {
idSet = newSet;
ids = new ArrayList<UUID>( idSet );
level = Level.IDS;
- return;
- }
+ }
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/Schema.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/Schema.java b/stack/core/src/main/java/org/usergrid/persistence/Schema.java
index 587a65f..25cef4c 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Schema.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Schema.java
@@ -216,9 +216,8 @@ public class Schema {
new ConcurrentHashMap<Class<? extends Entity>, EntityInfo>();
Map<String, EntityInfo> entityMap = new TreeMap<String, EntityInfo>( String.CASE_INSENSITIVE_ORDER );
- ;
- Map<String, Map<String, Set<CollectionInfo>>> entityContainerCollections =
+ Map<String, Map<String, Set<CollectionInfo>>> entityContainerCollections =
new TreeMap<String, Map<String, Set<CollectionInfo>>>( String.CASE_INSENSITIVE_ORDER );
Map<String, Map<String, Set<CollectionInfo>>> entityContainerCollectionsIndexingProperties =
@@ -500,7 +499,8 @@ public class Schema {
public String[] getAllPropertyNamesAsArray() {
- return allProperties.keySet().toArray( new String[0] );
+ Set<String> strings = allProperties.keySet();
+ return strings.toArray( new String[strings.size()] );
}
@@ -667,7 +667,8 @@ public class Schema {
return new String[0];
}
- return entity.getProperties().keySet().toArray( new String[0] );
+ Set<String> strings = entity.getProperties().keySet();
+ return strings.toArray( new String[strings.size()] );
}
@@ -1389,7 +1390,7 @@ public class Schema {
continue;
}
Object propertyValue = entry.getValue();
- if ( ( propertyValue instanceof String ) && ( ( ( String ) propertyValue ) == "" ) ) {
+ if ( ( propertyValue instanceof String ) && (propertyValue.equals( "" )) ) {
propertyValue = null;
}
if ( ( propertyValue == null ) && isRequiredProperty( entityType, entry.getKey() ) ) {
@@ -1406,7 +1407,7 @@ public class Schema {
entityType = normalizeEntityType( entityType );
- if ( ( propertyValue instanceof String ) && ( ( String ) propertyValue ).equals( "" ) ) {
+ if ( ( propertyValue instanceof String ) && propertyValue.equals( "" ) ) {
propertyValue = null;
}
@@ -1439,7 +1440,7 @@ public class Schema {
entityType = normalizeEntityType( entityType );
- if ( ( elementValue instanceof String ) && ( ( String ) elementValue ).equals( "" ) ) {
+ if ( ( elementValue instanceof String ) && elementValue.equals( "" ) ) {
elementValue = null;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/Update.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/Update.java b/stack/core/src/main/java/org/usergrid/persistence/Update.java
index 0f5d018..aad6605 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Update.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Update.java
@@ -55,8 +55,8 @@ public class Update {
public static enum UpdateOperator {
- UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST;
- }
+ UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST
+ }
public Update() {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraPersistenceUtils.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
index 00dc4bc..61caf40 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
@@ -442,7 +442,7 @@ public class CassandraPersistenceUtils {
CFEnum[] values = null;
try {
- values = ( CFEnum[] ) invokeStaticMethod( cfEnum, "values", ( Object[] ) null );
+ values = ( CFEnum[] ) invokeStaticMethod( cfEnum, "values", null );
}
catch ( Exception e ) {
logger.error( "Couldn't get CFEnum values", e );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/cassandra/ConnectionRefImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/ConnectionRefImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/ConnectionRefImpl.java
index e16d780..c8fe4ad 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/ConnectionRefImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/ConnectionRefImpl.java
@@ -328,8 +328,11 @@ public class ConnectionRefImpl implements ConnectionRef {
@Override
public UUID getUuid() {
if ( id == null ) {
- id = getId( getConnectingEntity(), getConnectedEntity(),
- getPairedConnections().toArray( new ConnectedEntityRef[0] ) );
+ List<ConnectedEntityRef> connections = getPairedConnections();
+ id = getId(
+ getConnectingEntity(), getConnectedEntity(),
+ connections.toArray( new ConnectedEntityRef[connections.size()] )
+ );
}
return id;
}
@@ -343,13 +346,15 @@ public class ConnectionRefImpl implements ConnectionRef {
public UUID getIndexId() {
return getIndexId( getConnectingEntity(), getConnectionType(), getConnectedEntityType(),
- pairedConnections.toArray( new ConnectedEntityRef[0] ) );
+ pairedConnections.toArray( new ConnectedEntityRef[pairedConnections.size()] )
+ );
}
public UUID getConnectingIndexId() {
return getIndexId( getConnectingEntity(), getConnectionType(), null,
- pairedConnections.toArray( new ConnectedEntityRef[0] ) );
+ pairedConnections.toArray( new ConnectedEntityRef[pairedConnections.size()] )
+ );
}
@@ -362,8 +367,11 @@ public class ConnectionRefImpl implements ConnectionRef {
/** @return index ids */
public UUID[] getIndexIds() {
- return getIndexIds( getConnectingEntity(), getConnectedEntity().getConnectionType(),
- getConnectedEntity().getType(), getPairedConnections().toArray( new ConnectedEntityRef[0] ) );
+ List<ConnectedEntityRef> connections = getPairedConnections();
+ return getIndexIds(
+ getConnectingEntity(), getConnectedEntity().getConnectionType(),
+ getConnectedEntity().getType(), connections.toArray( new ConnectedEntityRef[connections.size()] )
+ );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/cassandra/CursorCache.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CursorCache.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CursorCache.java
index 7b29a2b..0f0bcdc 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CursorCache.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CursorCache.java
@@ -89,7 +89,7 @@ public class CursorCache {
return null;
}
- StringBuffer buff = new StringBuffer();
+ StringBuilder buff = new StringBuilder();
int nullCount = 0;
ByteBuffer value = null;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/cassandra/EntityManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/EntityManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/EntityManagerImpl.java
index 6ebbc01..8b85847 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/EntityManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/EntityManagerImpl.java
@@ -912,7 +912,7 @@ public class EntityManagerImpl implements EntityManager {
private void incrementEntityCollection( String collection_name, long cassandraTimestamp ) {
try {
- incrementAggregateCounters( null, null, null, new String( APPLICATION_COLLECTION + collection_name ),
+ incrementAggregateCounters( null, null, null, APPLICATION_COLLECTION + collection_name,
ONE_COUNT, cassandraTimestamp );
}
catch ( Exception e ) {
@@ -1027,9 +1027,7 @@ public class EntityManagerImpl implements EntityManager {
column_names.add( PROPERTY_TYPE );
column_names.add( PROPERTY_UUID );
- for ( String propertyName : propertyNames ) {
- column_names.add( propertyName );
- }
+ Collections.addAll( column_names, propertyNames );
results = cass.getColumns( cass.getApplicationKeyspace( applicationId ), ENTITY_PROPERTIES, key( entityId ),
column_names, se, be );
@@ -2010,7 +2008,7 @@ public class EntityManagerImpl implements EntityManager {
public void setProperty( EntityRef entityRef, String propertyName, Object propertyValue, boolean override )
throws Exception {
- if ( ( propertyValue instanceof String ) && ( ( String ) propertyValue ).equals( "" ) ) {
+ if ( ( propertyValue instanceof String ) && propertyValue.equals( "" ) ) {
propertyValue = null;
}
@@ -2164,7 +2162,7 @@ public class EntityManagerImpl implements EntityManager {
Long count = null;
if ( !Schema.isAssociatedEntityType( collectionName ) ) {
Map<String, Long> counts = getApplicationCounters();
- count = counts.get( new String( APPLICATION_COLLECTION + collectionName ) );
+ count = counts.get( APPLICATION_COLLECTION + collectionName );
}
return count != null ? count : 0;
}
@@ -2257,14 +2255,16 @@ public class EntityManagerImpl implements EntityManager {
if ( roleNames != null ) {
nameResults = getDictionaryElementValues( getApplicationRef(), DICTIONARY_ROLENAMES,
- roleNames.toArray( new String[0] ) );
+ roleNames.toArray( new String[roleNames.size()] )
+ );
}
else {
nameResults = cast( getDictionaryAsMap( getApplicationRef(), DICTIONARY_ROLENAMES ) );
roleNames = nameResults.keySet();
}
Map<String, Object> timeResults = getDictionaryElementValues( getApplicationRef(), DICTIONARY_ROLETIMES,
- roleNames.toArray( new String[0] ) );
+ roleNames.toArray( new String[roleNames.size()] )
+ );
for ( String roleName : roleNames ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/geo/GeoIndexSearcher.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/geo/GeoIndexSearcher.java b/stack/core/src/main/java/org/usergrid/persistence/geo/GeoIndexSearcher.java
index 052e9ac..87f7ccb 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/geo/GeoIndexSearcher.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/geo/GeoIndexSearcher.java
@@ -238,9 +238,7 @@ public abstract class GeoIndexSearcher {
// final check - top level tiles
curGeocells.clear();
String[] items = "0123456789abcdef".split( "(?!^)" );
- for ( String item : items ) {
- curGeocells.add( item );
- }
+ Collections.addAll( curGeocells, items );
done = true;
}
else {
@@ -260,19 +258,19 @@ public abstract class GeoIndexSearcher {
// Get adjacent in one direction.
// TODO(romannurik): Watch for +/- 90 degree latitude edge case
// geocells.
- for ( int i = 0; i < sortedEdgesDistances.size(); i++ ) {
+ for ( Tuple<int[], Double> sortedEdgesDistance : sortedEdgesDistances ) {
- int nearestEdge[] = sortedEdgesDistances.get( i ).getFirst();
- String edge = GeocellUtils.adjacent( curGeocells.get( 0 ), nearestEdge );
+ int nearestEdge[] = sortedEdgesDistance.getFirst();
+ String edge = GeocellUtils.adjacent( curGeocells.get( 0 ), nearestEdge );
- // we're at the edge of the world, search in a different direction
- if ( edge == null ) {
- continue;
- }
+ // we're at the edge of the world, search in a different direction
+ if ( edge == null ) {
+ continue;
+ }
- curGeocells.add( edge );
- break;
- }
+ curGeocells.add( edge );
+ break;
+ }
}
else if ( curGeocells.size() == 2 ) {
// Get adjacents in perpendicular direction.
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/geo/GeocellUtils.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/geo/GeocellUtils.java b/stack/core/src/main/java/org/usergrid/persistence/geo/GeocellUtils.java
index 9d9df0f..a359278 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/geo/GeocellUtils.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/geo/GeocellUtils.java
@@ -443,7 +443,7 @@ public final class GeocellUtils {
// NOTE: This only works for grid size 4.
int charI = GEOCELL_ALPHABET.indexOf( char_ );
return new int[] {
- ( charI & 4 ) >> 1 | ( charI & 1 ) >> 0, ( charI & 8 ) >> 2 | ( charI & 2 ) >> 1
+ ( charI & 4 ) >> 1 | (charI & 1), ( charI & 8 ) >> 2 | ( charI & 2 ) >> 1
};
}
@@ -458,7 +458,8 @@ public final class GeocellUtils {
return GEOCELL_ALPHABET.charAt( ( pos[1] & 2 ) << 2 |
( pos[0] & 2 ) << 1 |
( pos[1] & 1 ) << 1 |
- ( pos[0] & 1 ) << 0 );
+ (pos[0] & 1)
+ );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/AbstractScanColumn.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/AbstractScanColumn.java b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/AbstractScanColumn.java
index 9cd034b..26c02ca 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/AbstractScanColumn.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/AbstractScanColumn.java
@@ -45,12 +45,9 @@ public abstract class AbstractScanColumn implements ScanColumn {
AbstractScanColumn that = ( AbstractScanColumn ) o;
- if ( !uuid.equals( that.uuid ) ) {
- return false;
- }
+ return uuid.equals( that.uuid );
- return true;
- }
+ }
@Override
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/GeoIterator.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/GeoIterator.java b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/GeoIterator.java
index cf831c9..dac9433 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/GeoIterator.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/ir/result/GeoIterator.java
@@ -141,18 +141,17 @@ public class GeoIterator implements ResultIterator {
lastCellsSearched = results.lastSearchedGeoCells;
- for ( int i = 0; i < locations.size(); i++ ) {
+ for ( final EntityLocationRef location : locations ) {
- final EntityLocationRef location = locations.get( i );
- final UUID id = location.getUuid();
+ final UUID id = location.getUuid();
- final LocationScanColumn locationScan = new LocationScanColumn( location );
+ final LocationScanColumn locationScan = new LocationScanColumn( location );
- idOrder.put( id, locationScan );
- lastLoaded.add( locationScan );
+ idOrder.put( id, locationScan );
+ lastLoaded.add( locationScan );
- last = location;
- }
+ last = location;
+ }
if ( locations.size() < resultSize ) {
done = true;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/query/tree/StringLiteral.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/tree/StringLiteral.java b/stack/core/src/main/java/org/usergrid/persistence/query/tree/StringLiteral.java
index be8b0cf..b0944b4 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/tree/StringLiteral.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/tree/StringLiteral.java
@@ -59,7 +59,7 @@ public class StringLiteral extends Literal<String> {
}
if ( value != null && value.endsWith( "*" ) ) {
- this.value = removeEnd( value.toString(), "*" );
+ this.value = removeEnd( value, "*" );
finishValue = this.value + "\uFFFF";
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/schema/DictionaryInfo.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/schema/DictionaryInfo.java b/stack/core/src/main/java/org/usergrid/persistence/schema/DictionaryInfo.java
index 3d88358..c4a8eee 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/schema/DictionaryInfo.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/schema/DictionaryInfo.java
@@ -27,10 +27,9 @@ public class DictionaryInfo {
private boolean keysIndexedInConnections;
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
- public DictionaryInfo() {
+ public DictionaryInfo() {
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/main/java/org/usergrid/persistence/schema/EntityInfo.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/schema/EntityInfo.java b/stack/core/src/main/java/org/usergrid/persistence/schema/EntityInfo.java
index 843412d..ddacbe5 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/schema/EntityInfo.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/schema/EntityInfo.java
@@ -44,10 +44,9 @@ public class EntityInfo {
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
- public EntityInfo() {
+ public EntityInfo() {
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java b/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
index 949e600..497873e 100644
--- a/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
+++ b/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
@@ -63,7 +63,7 @@ public class BatchCountParallelismTest {
}
System.out.println( "c: " + c );
cdl.countDown();
- return new Boolean( true );
+ return true;
}
} ) );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/core/src/test/java/org/usergrid/persistence/EntityManagerIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/persistence/EntityManagerIT.java b/stack/core/src/test/java/org/usergrid/persistence/EntityManagerIT.java
index 21b1a5e..c71c90e 100644
--- a/stack/core/src/test/java/org/usergrid/persistence/EntityManagerIT.java
+++ b/stack/core/src/test/java/org/usergrid/persistence/EntityManagerIT.java
@@ -244,9 +244,9 @@ public class EntityManagerIT extends AbstractCoreIT {
assertNotNull( "properties should not be null", props );
assertEquals( "wrong number of properties", 8, props.size() );
- assertEquals( "wrong value for property alpha", new Long( 1 ), props.get( "alpha" ) );
- assertEquals( "wrong value for property beta", new Long( 2 ), props.get( "beta" ) );
- assertEquals( "wrong value for property gamma", new Long( 3 ), props.get( "gamma" ) );
+ assertEquals( "wrong value for property alpha", (long) 1, props.get( "alpha" ) );
+ assertEquals( "wrong value for property beta", (long) 2, props.get( "beta" ) );
+ assertEquals( "wrong value for property gamma", (long) 3, props.get( "gamma" ) );
for ( Entry<String, Object> entry : props.entrySet() ) {
LOG.info( entry.getKey() + " : " + entry.getValue() );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/launcher/src/main/java/org/usergrid/launcher/ClasspathStaticHttpHandler.java
----------------------------------------------------------------------
diff --git a/stack/launcher/src/main/java/org/usergrid/launcher/ClasspathStaticHttpHandler.java b/stack/launcher/src/main/java/org/usergrid/launcher/ClasspathStaticHttpHandler.java
index 83099f5..9872648 100644
--- a/stack/launcher/src/main/java/org/usergrid/launcher/ClasspathStaticHttpHandler.java
+++ b/stack/launcher/src/main/java/org/usergrid/launcher/ClasspathStaticHttpHandler.java
@@ -62,6 +62,8 @@ package org.usergrid.launcher;
*/
+import org.springframework.core.io.Resource;
+
/**
* Modified version of the StaticHttpHandler to serve resources from the classpath.
* <p/>
@@ -197,7 +199,7 @@ public class ClasspathStaticHttpHandler extends org.glassfish.grizzly.http.serve
protected String getRelativeURI( final org.glassfish.grizzly.http.server.Request request ) {
String uri = request.getRequestURI();
- if ( uri.indexOf( ".." ) >= 0 ) {
+ if ( uri.contains( ".." ) ) {
return null;
}
@@ -246,17 +248,16 @@ public class ClasspathStaticHttpHandler extends org.glassfish.grizzly.http.serve
org.springframework.core.io.Resource resource = null;
- for ( int i = 0; i < fileFolders.length; i++ ) {
- final org.springframework.core.io.Resource webDir = fileFolders[i];
- // local file
- resource = webDir.createRelative( uri );
- final boolean exists = resource.exists();
+ for ( final Resource webDir : fileFolders ) {
+ // local file
+ resource = webDir.createRelative( uri );
+ final boolean exists = resource.exists();
- if ( exists ) {
- found = true;
- break;
- }
- }
+ if ( exists ) {
+ found = true;
+ break;
+ }
+ }
if ( !found ) {
if ( LOGGER.isLoggable( java.util.logging.Level.FINE ) ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/launcher/src/main/java/org/usergrid/launcher/CustomJSPTemplateProcessor.java
----------------------------------------------------------------------
diff --git a/stack/launcher/src/main/java/org/usergrid/launcher/CustomJSPTemplateProcessor.java b/stack/launcher/src/main/java/org/usergrid/launcher/CustomJSPTemplateProcessor.java
index 2704efb..9291293 100644
--- a/stack/launcher/src/main/java/org/usergrid/launcher/CustomJSPTemplateProcessor.java
+++ b/stack/launcher/src/main/java/org/usergrid/launcher/CustomJSPTemplateProcessor.java
@@ -86,7 +86,7 @@ public class CustomJSPTemplateProcessor implements com.sun.jersey.spi.template.V
return null;
}
- if ( basePath != "" ) {
+ if ( !basePath.equals( "" ) ) {
path = basePath + path;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/mongo-emulator/src/main/java/org/usergrid/mongo/protocol/OpQuery.java
----------------------------------------------------------------------
diff --git a/stack/mongo-emulator/src/main/java/org/usergrid/mongo/protocol/OpQuery.java b/stack/mongo-emulator/src/main/java/org/usergrid/mongo/protocol/OpQuery.java
index 5449c0e..3374c2b 100644
--- a/stack/mongo-emulator/src/main/java/org/usergrid/mongo/protocol/OpQuery.java
+++ b/stack/mongo-emulator/src/main/java/org/usergrid/mongo/protocol/OpQuery.java
@@ -70,7 +70,7 @@ public class OpQuery extends OpCrud {
static Set<String> operators = new HashSet<String>();
- {
+ static {
operators.add( "all" );
operators.add( "and" );
operators.add( "elemMatch" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/mongo-emulator/src/main/java/org/usergrid/mongo/query/MongoQueryParser.java
----------------------------------------------------------------------
diff --git a/stack/mongo-emulator/src/main/java/org/usergrid/mongo/query/MongoQueryParser.java b/stack/mongo-emulator/src/main/java/org/usergrid/mongo/query/MongoQueryParser.java
index f5feaf0..4e05663 100644
--- a/stack/mongo-emulator/src/main/java/org/usergrid/mongo/query/MongoQueryParser.java
+++ b/stack/mongo-emulator/src/main/java/org/usergrid/mongo/query/MongoQueryParser.java
@@ -155,9 +155,9 @@ public class MongoQueryParser {
Stack<Operand> expressions = new Stack<Operand>();
- for ( int i = 0; i < size; i++ ) {
- expressions.push( eval( ( BSONObject ) values.get( i ) ) );
- }
+ for ( Object value : values ) {
+ expressions.push( eval( (BSONObject) value ) );
+ }
// we need to build a tree of expressions
while ( expressions.size() > 1 ) {
@@ -178,9 +178,9 @@ public class MongoQueryParser {
Stack<Operand> expressions = new Stack<Operand>();
- for ( int i = 0; i < size; i++ ) {
- expressions.push( eval( ( BSONObject ) values.get( i ) ) );
- }
+ for ( Object value : values ) {
+ expressions.push( eval( (BSONObject) value ) );
+ }
while ( expressions.size() > 1 ) {
AndOperand and = new AndOperand();
@@ -265,13 +265,13 @@ public class MongoQueryParser {
Stack<Operand> expressions = new Stack<Operand>();
- for ( int i = 0; i < size; i++ ) {
- Equal equal = new Equal();
- equal.setProperty( sourceField );
- equal.setLiteral( values.get( i ) );
+ for ( Object value1 : values ) {
+ Equal equal = new Equal();
+ equal.setProperty( sourceField );
+ equal.setLiteral( value1 );
- expressions.push( equal );
- }
+ expressions.push( equal );
+ }
// we need to build a tree of expressions
while ( expressions.size() > 1 ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/main/java/org/usergrid/rest/applications/ApplicationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/applications/ApplicationResource.java b/stack/rest/src/main/java/org/usergrid/rest/applications/ApplicationResource.java
index 0278623..453538a 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/applications/ApplicationResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/applications/ApplicationResource.java
@@ -597,7 +597,7 @@ public class ApplicationResource extends ServiceResource {
public JSONWithPadding getAPMConfig( @Context UriInfo ui,
@QueryParam("callback") @DefaultValue("callback") String callback )
throws Exception {
- EntityManager em = ( EntityManager ) emf.getEntityManager( applicationId );
+ EntityManager em = emf.getEntityManager( applicationId );
Object value = em.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ),
APIGEE_MOBILE_APM_CONFIG_JSON_KEY );
//If there is no apm configuration then try to create apm config on the fly
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/main/java/org/usergrid/rest/applications/ServiceResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/applications/ServiceResource.java b/stack/rest/src/main/java/org/usergrid/rest/applications/ServiceResource.java
index 8cb92d5..d208456 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/applications/ServiceResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/applications/ServiceResource.java
@@ -242,8 +242,8 @@ public class ServiceResource extends AbstractContextResource {
boolean tree = "true".equalsIgnoreCase( ui.getQueryParameters().getFirst( "tree" ) );
boolean collectionGet = false;
if ( action == ServiceAction.GET ) {
- collectionGet = ( getServiceParameters().size() == 1 && InflectionUtils
- .isPlural( getServiceParameters().get( 0 ) ) ) ? true : false;
+ collectionGet = (getServiceParameters().size() == 1 && InflectionUtils
+ .isPlural( getServiceParameters().get( 0 ) ));
}
addQueryParams( getServiceParameters(), ui );
ServiceRequest r = services.newRequest( action, tree, getServiceParameters(), payload );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/main/java/org/usergrid/rest/utils/PathingUtils.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/utils/PathingUtils.java b/stack/rest/src/main/java/org/usergrid/rest/utils/PathingUtils.java
index 3ae9004..ee3ea60 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/utils/PathingUtils.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/utils/PathingUtils.java
@@ -24,7 +24,7 @@ public class PathingUtils {
* @return a new string in the format "organizationName/applicationName"
*/
public static String assembleAppName( String organizationName, String applicationName ) {
- return new String( organizationName.toLowerCase() + SLASH + applicationName.toLowerCase() );
+ return organizationName.toLowerCase() + SLASH + applicationName.toLowerCase();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/test/java/org/usergrid/rest/applications/queues/QueueResourceLong2IT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/applications/queues/QueueResourceLong2IT.java b/stack/rest/src/test/java/org/usergrid/rest/applications/queues/QueueResourceLong2IT.java
index 154a581..19aba18 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/applications/queues/QueueResourceLong2IT.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/applications/queues/QueueResourceLong2IT.java
@@ -58,17 +58,17 @@ public class QueueResourceLong2IT extends AbstractQueueResourceIT {
List<String> originalMessageIds = transHandler.getMessageIds();
BiMap<String, String> transactionInfo = transHandler.getTransactionToMessageId();
- for ( int i = 0; i < originalMessageIds.size(); i++ ) {
- // check the messages come back in the same order, they should
- assertEquals( originalMessageIds.get( i ), originalMessageIds.get( i ) );
+ for ( String originalMessageId : originalMessageIds ) {
+ // check the messages come back in the same order, they should
+ assertEquals( originalMessageId, originalMessageId );
- assertNotNull( transactionInfo.get( originalMessageIds.get( i ) ) );
+ assertNotNull( transactionInfo.get( originalMessageId ) );
- // ack the transaction we were returned
- Transaction transaction =
- queue.transactions().transaction( transactionInfo.get( originalMessageIds.get( i ) ) );
- transaction.delete();
- }
+ // ack the transaction we were returned
+ Transaction transaction =
+ queue.transactions().transaction( transactionInfo.get( originalMessageId ) );
+ transaction.delete();
+ }
// now sleep until our timeout expires
Thread.sleep( Math.max( 0, timeout - ( System.currentTimeMillis() - start ) ) );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/test/java/org/usergrid/rest/filters/ContentTypeResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/filters/ContentTypeResourceIT.java b/stack/rest/src/test/java/org/usergrid/rest/filters/ContentTypeResourceIT.java
index 8b16db2..cc78e31 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/filters/ContentTypeResourceIT.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/filters/ContentTypeResourceIT.java
@@ -298,9 +298,9 @@ public class ContentTypeResourceIT extends AbstractRestIT {
System.out.println( rsp.getStatusLine() );
Header[] headers = rsp.getAllHeaders();
- for ( int i = 0; i < headers.length; i++ ) {
- System.out.println( headers[i] );
- }
+ for ( Header header : headers ) {
+ System.out.println( header );
+ }
System.out.println( "----------------------------------------" );
if ( entity != null ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/test/java/org/usergrid/rest/management/RegistrationIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/management/RegistrationIT.java b/stack/rest/src/test/java/org/usergrid/rest/management/RegistrationIT.java
index 66dd62e..7301a19 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/management/RegistrationIT.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/management/RegistrationIT.java
@@ -342,9 +342,11 @@ public class RegistrationIT extends AbstractRestIT {
for ( Message m : msgs ) {
logger.info( "Subject: " + m.getSubject() );
logger.info(
- "Body content 0 " + ( String ) ( ( MimeMultipart ) m.getContent() ).getBodyPart( 0 ).getContent() );
+ "Body content 0 " + ( ( MimeMultipart ) m.getContent() ).getBodyPart( 0 ).getContent()
+ );
logger.info(
- "Body content 1 " + ( String ) ( ( MimeMultipart ) m.getContent() ).getBodyPart( 1 ).getContent() );
+ "Body content 1 " + ( ( MimeMultipart ) m.getContent() ).getBodyPart( 1 ).getContent()
+ );
}
return msgs;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/rest/src/test/java/org/usergrid/rest/management/organizations/OrganizationsResourceIT.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/management/organizations/OrganizationsResourceIT.java b/stack/rest/src/test/java/org/usergrid/rest/management/organizations/OrganizationsResourceIT.java
index 713ab74..f35ec5b 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/management/organizations/OrganizationsResourceIT.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/management/organizations/OrganizationsResourceIT.java
@@ -76,7 +76,7 @@ public class OrganizationsResourceIT extends AbstractRestIT {
EntityManager em = setup.getEmf().getEntityManager( CassandraService.MANAGEMENT_APPLICATION_ID );
User user = em.get( ui.getUuid(), User.class );
assertEquals( "Test User", user.getName() );
- assertEquals( "Apigee", ( String ) user.getProperty( "company" ) );
+ assertEquals( "Apigee", user.getProperty( "company" ) );
OrganizationInfo orgInfo = setup.getMgmtSvc().getOrganizationByName( "test-org-1" );
assertEquals( 5L, orgInfo.getProperties().get( "securityLevel" ) );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/management/ActivationState.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/ActivationState.java b/stack/services/src/main/java/org/usergrid/management/ActivationState.java
index 4836a6f..aaf0b43 100644
--- a/stack/services/src/main/java/org/usergrid/management/ActivationState.java
+++ b/stack/services/src/main/java/org/usergrid/management/ActivationState.java
@@ -3,6 +3,6 @@ package org.usergrid.management;
public enum ActivationState {
- UNKNOWN, UNCONFIRMED, CONFIRMED_AWAITING_ACTIVATION, ACTIVATED;
+ UNKNOWN, UNCONFIRMED, CONFIRMED_AWAITING_ACTIVATION, ACTIVATED
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
index f7cc99c..1ccda52 100644
--- a/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
+++ b/stack/services/src/main/java/org/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -2454,7 +2454,7 @@ public class ManagementServiceImpl implements ManagementService {
Boolean registration_requires_admin_approval = ( Boolean ) em
.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ),
REGISTRATION_REQUIRES_ADMIN_APPROVAL );
- return registration_requires_admin_approval != null ? registration_requires_admin_approval.booleanValue() :
+ return registration_requires_admin_approval != null ? registration_requires_admin_approval :
false;
}
@@ -2466,7 +2466,7 @@ public class ManagementServiceImpl implements ManagementService {
.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ),
REGISTRATION_REQUIRES_EMAIL_CONFIRMATION );
return registration_requires_email_confirmation != null ?
- registration_requires_email_confirmation.booleanValue() : false;
+ registration_requires_email_confirmation : false;
}
@@ -2475,7 +2475,7 @@ public class ManagementServiceImpl implements ManagementService {
Boolean notify_admin_of_new_users = ( Boolean ) em
.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ),
NOTIFY_ADMIN_OF_NEW_USERS );
- return notify_admin_of_new_users != null ? notify_admin_of_new_users.booleanValue() : false;
+ return notify_admin_of_new_users != null ? notify_admin_of_new_users : false;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/providers/FacebookProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/providers/FacebookProvider.java b/stack/services/src/main/java/org/usergrid/security/providers/FacebookProvider.java
index 0881b24..214f36d 100644
--- a/stack/services/src/main/java/org/usergrid/security/providers/FacebookProvider.java
+++ b/stack/services/src/main/java/org/usergrid/security/providers/FacebookProvider.java
@@ -75,7 +75,8 @@ public class FacebookProvider extends AbstractProvider {
}
- @Override
+ @SuppressWarnings("unchecked")
+ @Override
Map<String, Object> userFromResource( String externalToken ) {
return client.resource( apiUrl ).queryParam( "access_token", externalToken )
.accept( MediaType.APPLICATION_JSON ).get( Map.class );
@@ -97,7 +98,7 @@ public class FacebookProvider extends AbstractProvider {
User user = null;
- if ( ( fb_user != null ) && !anyNull( fb_user_id, fb_user_name ) ) {
+ if ( !anyNull( fb_user_id, fb_user_name ) ) {
Results r = null;
try {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/providers/FoursquareProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/providers/FoursquareProvider.java b/stack/services/src/main/java/org/usergrid/security/providers/FoursquareProvider.java
index 0c953c7..1cb4d2c 100644
--- a/stack/services/src/main/java/org/usergrid/security/providers/FoursquareProvider.java
+++ b/stack/services/src/main/java/org/usergrid/security/providers/FoursquareProvider.java
@@ -82,7 +82,7 @@ public class FoursquareProvider extends AbstractProvider {
String fq_user_username = ( String ) fq_user.get( "id" );
String fq_user_email = ( String ) ( ( Map<?, ?> ) fq_user.get( "contact" ) ).get( "email" );
String fq_user_picture = ( String ) ( ( Map<?, ?> ) fq_user.get( "photo" ) ).get( "suffix" );
- String fq_user_name = new String( "" );
+ String fq_user_name = "";
// Grab the last check-in so we can store that as the user location
Map<String, Object> fq_location =
@@ -99,7 +99,7 @@ public class FoursquareProvider extends AbstractProvider {
// Only the first name is guaranteed to be here
try {
- fq_user_name = ( String ) fq_user.get( "firstName" ) + " " + ( String ) fq_user.get( "lastName" );
+ fq_user_name = fq_user.get( "firstName" ) + " " + fq_user.get( "lastName" );
}
catch ( NullPointerException e ) {
fq_user_name = ( String ) fq_user.get( "firstName" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/providers/PingIdentityProvider.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/providers/PingIdentityProvider.java b/stack/services/src/main/java/org/usergrid/security/providers/PingIdentityProvider.java
index 5930c28..a6de36c 100644
--- a/stack/services/src/main/java/org/usergrid/security/providers/PingIdentityProvider.java
+++ b/stack/services/src/main/java/org/usergrid/security/providers/PingIdentityProvider.java
@@ -136,8 +136,8 @@ public class PingIdentityProvider extends AbstractProvider {
public static long extractExpiration( User user ) {
Long expiration = ( Long ) user.getProperty( "expiration" );
if ( expiration == null ) {
- expiration = new Long( 7200 );
+ expiration = (long) 7200;
}
- return expiration.longValue() * 1000;
+ return expiration * 1000;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/shiro/CustomPermission.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/shiro/CustomPermission.java b/stack/services/src/main/java/org/usergrid/security/shiro/CustomPermission.java
index 7d510ae..0f2af5c 100644
--- a/stack/services/src/main/java/org/usergrid/security/shiro/CustomPermission.java
+++ b/stack/services/src/main/java/org/usergrid/security/shiro/CustomPermission.java
@@ -185,11 +185,8 @@ public class CustomPermission extends WildcardPermission {
if ( matcher.match( p1, p2 ) ) {
return true;
}
- if ( matcher.match( normalizeIfPath( p1 ), normalizeIfPath( p2 ) ) ) {
- return true;
- }
- return false;
- }
+ return matcher.match( normalizeIfPath( p1 ), normalizeIfPath( p2 ) );
+ }
return p1.equalsIgnoreCase( p2 );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/shiro/Realm.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/shiro/Realm.java b/stack/services/src/main/java/org/usergrid/security/shiro/Realm.java
index 1b6e612..03f9a5a 100644
--- a/stack/services/src/main/java/org/usergrid/security/shiro/Realm.java
+++ b/stack/services/src/main/java/org/usergrid/security/shiro/Realm.java
@@ -276,7 +276,7 @@ public class Realm extends AuthorizingRealm {
// They have access to organizations and organization
// applications
- UserInfo user = ( ( AdminUserPrincipal ) principal ).getUser();
+ UserInfo user = principal.getUser();
if ( superUserEnabled && ( superUser != null ) && superUser.equals( user.getUsername() ) ) {
// The system user has access to everything
@@ -349,7 +349,7 @@ public class Realm extends AuthorizingRealm {
UUID applicationId = ( ( ApplicationUserPrincipal ) principal ).getApplicationId();
AccessTokenCredentials tokenCredentials =
- ( ( ApplicationUserPrincipal ) principal ).getAccessTokenCredentials();
+ principal.getAccessTokenCredentials();
TokenInfo token = null;
if ( tokenCredentials != null ) {
try {
@@ -388,7 +388,7 @@ public class Realm extends AuthorizingRealm {
logger.error( "Unable to get user default role permissions", e );
}
- UserInfo user = ( ( ApplicationUserPrincipal ) principal ).getUser();
+ UserInfo user = principal.getUser();
try {
Set<String> permissions = em.getUserPermissions( user.getUuid() );
grant( info, principal, applicationId, permissions );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java b/stack/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java
index 204cd13..090955b 100644
--- a/stack/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java
+++ b/stack/services/src/main/java/org/usergrid/security/shiro/utils/SubjectUtils.java
@@ -54,11 +54,8 @@ public class SubjectUtils {
if ( currentUser == null ) {
return true;
}
- if ( !currentUser.isAuthenticated() && !currentUser.isRemembered() ) {
- return true;
- }
- return false;
- }
+ return !currentUser.isAuthenticated() && !currentUser.isRemembered();
+ }
public static boolean isOrganizationAdmin() {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/services/ServiceAction.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/services/ServiceAction.java b/stack/services/src/main/java/org/usergrid/services/ServiceAction.java
index 7fdef55..83f1945 100644
--- a/stack/services/src/main/java/org/usergrid/services/ServiceAction.java
+++ b/stack/services/src/main/java/org/usergrid/services/ServiceAction.java
@@ -17,5 +17,5 @@ package org.usergrid.services;
public enum ServiceAction {
- POST, GET, PUT, DELETE, HEAD, OPTIONS;
+ POST, GET, PUT, DELETE, HEAD, OPTIONS
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/services/ServiceInfo.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/services/ServiceInfo.java b/stack/services/src/main/java/org/usergrid/services/ServiceInfo.java
index f1bb7d1..06258a3 100644
--- a/stack/services/src/main/java/org/usergrid/services/ServiceInfo.java
+++ b/stack/services/src/main/java/org/usergrid/services/ServiceInfo.java
@@ -184,7 +184,7 @@ public class ServiceInfo {
}
String eType = determineType( collections, first, last - 1 );
- if ( eType != "entity" ) {
+ if ( !eType.equals( "entity" ) ) {
return "/entities:" + eType + "/*/" + collections[last];
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/services/ServiceManager.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/services/ServiceManager.java b/stack/services/src/main/java/org/usergrid/services/ServiceManager.java
index 672c50f..e2bd5eb 100644
--- a/stack/services/src/main/java/org/usergrid/services/ServiceManager.java
+++ b/stack/services/src/main/java/org/usergrid/services/ServiceManager.java
@@ -18,6 +18,7 @@ package org.usergrid.services;
import java.lang.reflect.Modifier;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
import java.util.Properties;
import java.util.UUID;
@@ -125,9 +126,7 @@ public class ServiceManager {
private void setServicePackagePrefixes( String packages ) {
List<String> packagePrefixes = new ArrayList<String>();
- for ( String prefix : package_prefixes ) {
- packagePrefixes.add( prefix );
- }
+ Collections.addAll( packagePrefixes, package_prefixes );
String[] prefixes = packages.split( ";" );
for ( String prefix : prefixes ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/services/ServiceRequest.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/services/ServiceRequest.java b/stack/services/src/main/java/org/usergrid/services/ServiceRequest.java
index 70b9bdc..7b913e0 100644
--- a/stack/services/src/main/java/org/usergrid/services/ServiceRequest.java
+++ b/stack/services/src/main/java/org/usergrid/services/ServiceRequest.java
@@ -202,7 +202,7 @@ public class ServiceRequest {
private String debugString() {
- StringBuffer sb = new StringBuffer();
+ StringBuilder sb = new StringBuilder();
sb.append( "request details:\n " );
sb.append( action );
sb.append( " " );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/services/src/main/java/org/usergrid/services/applications/ApplicationsService.java
----------------------------------------------------------------------
diff --git a/stack/services/src/main/java/org/usergrid/services/applications/ApplicationsService.java b/stack/services/src/main/java/org/usergrid/services/applications/ApplicationsService.java
index ace9962..d146e0e 100644
--- a/stack/services/src/main/java/org/usergrid/services/applications/ApplicationsService.java
+++ b/stack/services/src/main/java/org/usergrid/services/applications/ApplicationsService.java
@@ -102,7 +102,7 @@ public class ApplicationsService extends AbstractService {
}
else if ( context.parameterCount() > 0 ) {
if ( context.getParameters().get( 0 ) instanceof QueryParameter ) {
- return getApplicationCounters( ( ( QueryParameter ) context.getParameters().get( 0 ) ).getQuery() );
+ return getApplicationCounters( context.getParameters().get( 0 ).getQuery() );
}
}
}
@@ -165,13 +165,10 @@ public class ApplicationsService extends AbstractService {
private boolean isReservedCollection( String collection ) {
- if ( StringUtils.equalsIgnoreCase( "applications", collection ) || StringUtils
- .equalsIgnoreCase( "application", collection ) ) {
- return true;
- }
+ return StringUtils.equalsIgnoreCase( "applications", collection ) || StringUtils
+ .equalsIgnoreCase( "application", collection );
- return false;
- }
+ }
public ServiceResults getApplicationCounterNames() throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/a4196a85/stack/test-utils/src/main/java/org/usergrid/cassandra/AvailablePortFinder.java
----------------------------------------------------------------------
diff --git a/stack/test-utils/src/main/java/org/usergrid/cassandra/AvailablePortFinder.java b/stack/test-utils/src/main/java/org/usergrid/cassandra/AvailablePortFinder.java
index a3a5d6b..027c0f6 100644
--- a/stack/test-utils/src/main/java/org/usergrid/cassandra/AvailablePortFinder.java
+++ b/stack/test-utils/src/main/java/org/usergrid/cassandra/AvailablePortFinder.java
@@ -165,7 +165,7 @@ public class AvailablePortFinder {
try {
s = new ServerSocket( i );
- result.add( new Integer( i ) );
+ result.add( i );
}
catch ( IOException e ) {
// Do nothing