You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@usergrid.apache.org by sn...@apache.org on 2014/01/19 11:20:49 UTC
[02/23] 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/f8ae7fe7
Tree: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/tree/f8ae7fe7
Diff: http://git-wip-us.apache.org/repos/asf/incubator-usergrid/diff/f8ae7fe7
Branch: refs/pull/30/head
Commit: f8ae7fe7883175729968b260feb24971f1c924a5
Parents: 1150e47
Author: Strong Liu <st...@hibernate.org>
Authored: Sun Jan 19 17:47:15 2014 +0800
Committer: Strong Liu <st...@hibernate.org>
Committed: Sun Jan 19 17:47:15 2014 +0800
----------------------------------------------------------------------
.../src/main/java/org/usergrid/batch/Job.java | 2 +-
.../src/main/java/org/usergrid/mq/Query.java | 7 +-
.../java/org/usergrid/mq/QueryFilterLexer.java | 3 +-
.../java/org/usergrid/mq/QueryFilterParser.java | 27 -----
.../java/org/usergrid/mq/QueryProcessor.java | 1 -
.../usergrid/persistence/CredentialsInfo.java | 2 +-
.../org/usergrid/persistence/Identifier.java | 5 +-
.../java/org/usergrid/persistence/Results.java | 2 -
.../java/org/usergrid/persistence/Schema.java | 116 +++++--------------
.../java/org/usergrid/persistence/Update.java | 2 +-
.../cassandra/CassandraPersistenceUtils.java | 2 +-
.../persistence/cassandra/CassandraService.java | 2 +-
.../cassandra/ConnectionRefImpl.java | 10 +-
.../cassandra/EntityManagerImpl.java | 10 +-
.../cassandra/RelationManagerImpl.java | 4 +-
.../usergrid/persistence/entities/JobStat.java | 7 +-
.../persistence/geo/GeoIndexSearcher.java | 14 +--
.../usergrid/persistence/geo/GeocellUtils.java | 4 +-
.../query/ir/result/AbstractScanColumn.java | 5 +-
.../query/ir/result/GeoIterator.java | 9 +-
.../persistence/query/tree/BooleanOperand.java | 5 -
.../persistence/query/tree/ContainsOperand.java | 16 ---
.../persistence/query/tree/EqualityOperand.java | 4 -
.../persistence/schema/DictionaryInfo.java | 1 -
.../usergrid/persistence/schema/EntityInfo.java | 16 +--
.../batch/ConcurrentSchedulerTestSuite.java | 2 +-
.../org/usergrid/batch/SchedulerTestSuite.java | 2 +-
.../batch/job/AbstractSchedulerRuntimeIT.java | 2 +-
.../count/BatchCountParallelismTest.java | 2 +-
.../org/usergrid/locking/zookeeper/ZooPut.java | 2 +-
.../usergrid/persistence/EntityManagerIT.java | 6 +-
.../launcher/ClasspathStaticHttpHandler.java | 9 +-
.../launcher/CustomJSPTemplateProcessor.java | 2 +-
.../main/java/org/usergrid/launcher/Server.java | 1 +
.../org/usergrid/mongo/protocol/OpQuery.java | 2 +-
.../usergrid/mongo/query/MongoQueryParser.java | 16 +--
stack/pom.xml | 2 +-
.../java/org/usergrid/rest/RootResource.java | 13 ++-
.../rest/applications/ApplicationResource.java | 2 +-
.../rest/applications/ServiceResource.java | 7 +-
.../rest/applications/users/UsersResource.java | 3 +-
.../organizations/OrganizationsResource.java | 3 +-
.../applications/ApplicationsResource.java | 3 +-
.../organizations/users/UsersResource.java | 9 +-
.../rest/management/users/UsersResource.java | 5 +-
.../organizations/OrganizationsResource.java | 5 +-
.../organizations/OrganizationResource.java | 9 +-
.../org/usergrid/rest/utils/JSONPUtils.java | 8 +-
.../org/usergrid/rest/utils/PathingUtils.java | 2 +-
.../collection/activities/AndOrQueryTest.java | 7 +-
.../queues/QueueResourceLong2IT.java | 8 +-
.../users/ConnectionResourceTest.java | 1 -
.../rest/management/RegistrationIT.java | 4 +-
.../organizations/OrganizationsResourceIT.java | 2 +-
.../usergrid/management/ActivationState.java | 2 +-
.../cassandra/ManagementServiceImpl.java | 13 +--
.../security/providers/FoursquareProvider.java | 2 +-
.../providers/PingIdentityProvider.java | 4 +-
.../security/shiro/CustomPermission.java | 5 +-
.../shiro/PrincipalCredentialsToken.java | 4 +-
.../java/org/usergrid/security/shiro/Realm.java | 6 +-
.../security/shiro/utils/SubjectUtils.java | 5 +-
.../tokens/cassandra/TokenServiceImpl.java | 31 +++--
.../org/usergrid/services/ServiceAction.java | 2 +-
.../java/org/usergrid/services/ServiceInfo.java | 2 +-
.../org/usergrid/services/ServiceManager.java | 9 +-
.../org/usergrid/services/ServiceRequest.java | 6 +-
.../applications/ApplicationsService.java | 9 +-
.../org/usergrid/NoExitSecurityManager.java | 2 +-
.../usergrid/cassandra/AvailablePortFinder.java | 2 +-
.../usergrid/cassandra/CassandraResource.java | 22 +---
71 files changed, 186 insertions(+), 355 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/batch/Job.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/batch/Job.java b/stack/core/src/main/java/org/usergrid/batch/Job.java
index 34240c8..454e52b 100644
--- a/stack/core/src/main/java/org/usergrid/batch/Job.java
+++ b/stack/core/src/main/java/org/usergrid/batch/Job.java
@@ -14,7 +14,7 @@ public interface Job {
* @param execution The execution information. This will be the same from the last run. By default you should call
* exeuction.start() once processing starts
*
- * @throws JobExecutionException If the job cannot be executed
+ * @throws Exception If the job cannot be executed
*/
public void execute( JobExecution execution ) throws Exception;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..cf1e39c 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 = "";
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..a7eccd7 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/f8ae7fe7/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..dea193b 100644
--- a/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
+++ b/stack/core/src/main/java/org/usergrid/mq/QueryFilterParser.java
@@ -98,9 +98,6 @@ public class QueryFilterParser extends Parser {
public static class property_return extends ParserRuleReturnScope {}
- ;
-
-
// $ANTLR start "property"
// org/usergrid/persistence/query/QueryFilter.g:101:1: property : ( ID ) ;
public final QueryFilterParser.property_return property() throws RecognitionException {
@@ -134,9 +131,6 @@ public class QueryFilterParser extends Parser {
public static class operator_return extends ParserRuleReturnScope {}
- ;
-
-
// $ANTLR start "operator"
// org/usergrid/persistence/query/QueryFilter.g:104:1: operator : ( '<' | '<=' | '=' | '>' | '>=' | 'in' | 'eq' |
// 'lt' | 'gt' | 'lte' | 'gte' | 'contains' | 'within' ) ;
@@ -176,9 +170,6 @@ public class QueryFilterParser extends Parser {
public static class value_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -216,9 +207,6 @@ public class QueryFilterParser extends Parser {
public static class second_value_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -256,9 +244,6 @@ public class QueryFilterParser extends Parser {
public static class third_value_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -411,9 +396,6 @@ public class QueryFilterParser extends Parser {
public static class select_subject_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -446,9 +428,6 @@ public class QueryFilterParser extends Parser {
public static class select_assign_target_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -478,9 +457,6 @@ public class QueryFilterParser extends Parser {
public static class select_assign_source_return extends ParserRuleReturnScope {}
- ;
-
-
// $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 {
@@ -683,9 +659,6 @@ public class QueryFilterParser extends Parser {
public static class direction_return extends ParserRuleReturnScope {}
- ;
-
-
// $ANTLR start "direction"
// org/usergrid/persistence/query/QueryFilter.g:165:1: direction : ( 'asc' | 'desc' ) ;
public final QueryFilterParser.direction_return direction() throws RecognitionException {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..16e3afc 100644
--- a/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
+++ b/stack/core/src/main/java/org/usergrid/mq/QueryProcessor.java
@@ -394,7 +394,6 @@ public class QueryProcessor {
}
if ( searchFinishValue == null ) {
searchFinishValue = searchStartValue;
- ;
}
if ( ( searchStartValue != null ) && searchStartValue.toString().endsWith( "*" ) ) {
searchStartValue = removeEnd( searchStartValue.toString(), "*" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/CredentialsInfo.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/CredentialsInfo.java b/stack/core/src/main/java/org/usergrid/persistence/CredentialsInfo.java
index 146af43..f8a635d 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/CredentialsInfo.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/CredentialsInfo.java
@@ -165,7 +165,7 @@ public class CredentialsInfo implements Comparable<CredentialsInfo> {
@Override
public int compareTo( CredentialsInfo o ) {
- if ( created == o.created ) {
+ if (created.equals(o.created)) {
return 0;
}
if ( o.created == null ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/Identifier.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/Identifier.java b/stack/core/src/main/java/org/usergrid/persistence/Identifier.java
index 7139e43..226ded0 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Identifier.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Identifier.java
@@ -29,6 +29,9 @@ import org.usergrid.utils.UUIDUtils;
public class Identifier implements Serializable {
+ public static final String UUID_REX = "[A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}";
+ public static final String EMAIL_REX = "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}";
+
public enum Type {
UUID, NAME, EMAIL
}
@@ -37,7 +40,7 @@ public class Identifier implements Serializable {
Type type;
Object value;
- static Pattern emailRegEx = Pattern.compile( "[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}" );
+ static Pattern emailRegEx = Pattern.compile( EMAIL_REX );
static Pattern nameRegEx = Pattern.compile( "[a-zA-Z0-9_\\-./]*" );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..ea7da45 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Results.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Results.java
@@ -706,7 +706,6 @@ public class Results implements Iterable<Entity> {
idSet.addAll( results.idSet );
ids = new ArrayList<UUID>( idSet );
- return;
}
}
@@ -756,7 +755,6 @@ 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/f8ae7fe7/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..2d233c1 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Schema.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Schema.java
@@ -160,8 +160,8 @@ public class Schema {
public static final String DICTIONARY_COUNTERS = "counters";
public static final String DICTIONARY_GEOCELL = "geocell";
- private static List<String> entitiesPackage = new ArrayList<String>();
- private static List<String> entitiesScanPath = new ArrayList<String>();
+ private static final List<String> entitiesPackage = new ArrayList<String>();
+ private static final List<String> entitiesScanPath = new ArrayList<String>();
@SuppressWarnings("rawtypes")
public static Map<String, Class> DEFAULT_DICTIONARIES =
@@ -216,7 +216,6 @@ 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 =
new TreeMap<String, Map<String, Set<CollectionInfo>>>( String.CASE_INSENSITIVE_ORDER );
@@ -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()]);
}
@@ -639,11 +639,8 @@ public class Schema {
public boolean hasProperties( String entityType ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasProperties();
- return entity.hasProperties();
}
@@ -667,7 +664,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()]);
}
@@ -679,11 +677,8 @@ public class Schema {
}
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasProperty(propertyName);
- return entity.hasProperty( propertyName );
}
@@ -702,63 +697,40 @@ public class Schema {
public boolean isPropertyMutable( String entityType, String propertyName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.isPropertyMutable(propertyName);
- return entity.isPropertyMutable( propertyName );
}
public boolean isPropertyUnique( String entityType, String propertyName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.isPropertyUnique(propertyName);
- return entity.isPropertyUnique( propertyName );
}
public boolean isPropertyIndexed( String entityType, String propertyName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return true;
- }
-
- if ( entity.hasProperty( propertyName ) ) {
- return entity.isPropertyIndexed( propertyName );
- }
+ return entity == null || !entity.hasProperty(propertyName) || entity.isPropertyIndexed(propertyName);
- return true;
}
public boolean isPropertyFulltextIndexed( String entityType, String propertyName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return true;
- }
-
- if ( entity.hasProperty( propertyName ) ) {
- return entity.isPropertyFulltextIndexed( propertyName );
- }
+ return entity == null || !entity.hasProperty(propertyName) || entity.isPropertyFulltextIndexed(propertyName);
- return true;
}
public boolean isPropertyTimestamp( String entityType, String propertyName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.isPropertyTimestamp(propertyName);
- return entity.isPropertyTimestamp( propertyName );
}
@@ -782,11 +754,8 @@ public class Schema {
}
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.isPropertyRequired(propertyName);
- return entity.isPropertyRequired( propertyName );
}
@@ -811,11 +780,8 @@ public class Schema {
public boolean isPropertyIndexedInCollection( String containerType, String collectionName, String propertyName ) {
CollectionInfo collection = getCollection( containerType, collectionName );
- if ( collection == null ) {
- return false;
- }
+ return collection != null && collection.isPropertyIndexed(propertyName);
- return collection.isPropertyIndexed( propertyName );
}
@@ -823,11 +789,8 @@ public class Schema {
public boolean hasDictionaries( String entityType ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasDictionaries();
- return entity.hasDictionaries();
}
@@ -847,11 +810,8 @@ public class Schema {
public boolean hasDictionary( String entityType, String dictionaryName ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasDictionary(dictionaryName);
- return entity.hasDictionary( dictionaryName );
}
@@ -897,11 +857,8 @@ public class Schema {
}
DictionaryInfo dictionary = entity.getDictionary( dictionaryName );
- if ( dictionary == null ) {
- return false;
- }
+ return dictionary != null && dictionary.isKeysIndexedInConnections();
- return dictionary.isKeysIndexedInConnections();
}
@@ -910,11 +867,8 @@ public class Schema {
String dictionaryName ) {
CollectionInfo collection = getCollection( containerType, collectionName );
- if ( collection == null ) {
- return false;
- }
+ return collection != null && collection.isDictionaryIndexed(dictionaryName);
- return collection.isDictionaryIndexed( dictionaryName );
}
@@ -938,22 +892,16 @@ public class Schema {
}
PropertyInfo property = item.getAliasPropertyObject();
- if ( property == null ) {
- return false;
- }
+ return property != null && property.isPathBasedName();
- return property.isPathBasedName();
}
public boolean isCollectionReversed( String containerType, String collectionName ) {
CollectionInfo collection = getCollection( containerType, collectionName );
- if ( collection == null ) {
- return false;
- }
+ return collection != null && collection.isReversed();
- return collection.isReversed();
}
@@ -1260,10 +1208,7 @@ public class Schema {
public static boolean isAssociatedEntityType( String entityType ) {
- if ( entityType == null ) {
- return false;
- }
- return entityType.indexOf( ':' ) != -1;
+ return entityType != null && entityType.contains(":");
}
@@ -1389,7 +1334,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 +1351,7 @@ public class Schema {
entityType = normalizeEntityType( entityType );
- if ( ( propertyValue instanceof String ) && ( ( String ) propertyValue ).equals( "" ) ) {
+ if ( ( propertyValue instanceof String ) && propertyValue.equals("") ) {
propertyValue = null;
}
@@ -1439,7 +1384,7 @@ public class Schema {
entityType = normalizeEntityType( entityType );
- if ( ( elementValue instanceof String ) && ( ( String ) elementValue ).equals( "" ) ) {
+ if ( ( elementValue instanceof String ) && elementValue.equals("") ) {
elementValue = null;
}
@@ -1466,8 +1411,7 @@ public class Schema {
if ( entityClass == null ) {
entityClass = DynamicEntity.class;
}
- Entity entity = mapper.convertValue( map, entityClass );
- return entity;
+ return mapper.convertValue( map, entityClass );
}
/*
@@ -1483,8 +1427,7 @@ public class Schema {
public Map<String, Object> toMap( Entity entity ) {
- Map<String, Object> map = mapper.convertValue( entity, new TypeReference<Map<String, Object>>() {} );
- return map;
+ return mapper.convertValue( entity, new TypeReference<Map<String, Object>>() {} );
}
@@ -1724,11 +1667,8 @@ public class Schema {
}
PropertyInfo property = entity.getProperty( propertyName );
- if ( property == null ) {
- return false;
- }
+ return property != null && property.isEncrypted();
- return property.isEncrypted();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..07a4551 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/Update.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/Update.java
@@ -55,7 +55,7 @@ public class Update {
public static enum UpdateOperator {
- UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST;
+ UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..0046397 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/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraService.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraService.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraService.java
index a6b6268..c471294 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraService.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/CassandraService.java
@@ -884,7 +884,7 @@ public class CassandraService {
* @return a timestamp
*/
public long createTimestamp() {
- return chc.getClockResolution().createClock();
+ return CassandraHostConfigurator.getClockResolution().createClock();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..c37d45d 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,9 @@ public class ConnectionRefImpl implements ConnectionRef {
@Override
public UUID getUuid() {
if ( id == null ) {
+ List<ConnectedEntityRef> var = getPairedConnections();
id = getId( getConnectingEntity(), getConnectedEntity(),
- getPairedConnections().toArray( new ConnectedEntityRef[0] ) );
+ var.toArray(new ConnectedEntityRef[var.size()]));
}
return id;
}
@@ -343,13 +344,13 @@ 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 +363,9 @@ public class ConnectionRefImpl implements ConnectionRef {
/** @return index ids */
public UUID[] getIndexIds() {
+ List<ConnectedEntityRef> var = getPairedConnections();
return getIndexIds( getConnectingEntity(), getConnectedEntity().getConnectionType(),
- getConnectedEntity().getType(), getPairedConnections().toArray( new ConnectedEntityRef[0] ) );
+ getConnectedEntity().getType(), var.toArray(new ConnectedEntityRef[var.size()]));
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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 f7d4069..fda492d 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 );
@@ -2255,14 +2253,14 @@ 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/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
index 4f565c7..d56a1ed 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -2128,7 +2128,7 @@ public class RelationManagerImpl implements RelationManager {
startId = UUID_PARSER.parse( slice.getCursor() ).getUUID();
}
- boolean skipFirst = node.isForceKeepFirst() ? false : slice.hasCursor();
+ boolean skipFirst = !node.isForceKeepFirst() && slice.hasCursor();
IndexScanner indexScanner = cass.getIdList( cass.getApplicationKeyspace( applicationId ),
key( headEntity.getUuid(), DICTIONARY_COLLECTIONS, collectionName ), startId, null,
@@ -2272,7 +2272,7 @@ public class RelationManagerImpl implements RelationManager {
size++;
}
- boolean skipFirst = node.isForceKeepFirst() ? false : slice.hasCursor();
+ boolean skipFirst = !node.isForceKeepFirst() && slice.hasCursor();
UUID entityIdToUse;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/entities/JobStat.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/entities/JobStat.java b/stack/core/src/main/java/org/usergrid/persistence/entities/JobStat.java
index 8c31a5e..06a324d 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/entities/JobStat.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/entities/JobStat.java
@@ -48,11 +48,6 @@ public class JobStat extends TypedEntity {
@EntityProperty(required = true, basic = true, indexed = true)
private long duration;
-
- /**
- * @param jobName
- * @param startTime
- */
public JobStat() {
}
@@ -117,7 +112,7 @@ public class JobStat extends TypedEntity {
/**
* DON'T CALL THIS, USE THE INRECMENT METHOD!
*
- * @param failCount the failCount to set
+ * @param runCount the runCount to set
*/
public void setRunCount( int runCount ) {
this.runCount = runCount;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..98629b2 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,17 +258,17 @@ 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 ) {
+ if (edge == null) {
continue;
}
- curGeocells.add( edge );
+ curGeocells.add(edge);
break;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..5b112c9 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,7 @@ 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/f8ae7fe7/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 94fb2b3..e63529b 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
@@ -46,11 +46,8 @@ public abstract class AbstractScanColumn implements ScanColumn {
AbstractScanColumn that = ( AbstractScanColumn ) o;
- if ( !uuid.equals( that.uuid ) ) {
- return false;
- }
+ return uuid.equals(that.uuid);
- return true;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..121f257 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,15 +141,14 @@ 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 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;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/query/tree/BooleanOperand.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/tree/BooleanOperand.java b/stack/core/src/main/java/org/usergrid/persistence/query/tree/BooleanOperand.java
index 9bc4cdd..8c6dc91 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/tree/BooleanOperand.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/tree/BooleanOperand.java
@@ -27,11 +27,6 @@ import org.antlr.runtime.Token;
*/
public abstract class BooleanOperand extends Operand {
-
- /**
- * @param property
- * @param literal
- */
public BooleanOperand( Token t ) {
super( t );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/query/tree/ContainsOperand.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/tree/ContainsOperand.java b/stack/core/src/main/java/org/usergrid/persistence/query/tree/ContainsOperand.java
index 1b9058e..5c03350 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/tree/ContainsOperand.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/tree/ContainsOperand.java
@@ -23,22 +23,10 @@ import org.usergrid.persistence.exceptions.PersistenceException;
/** @author tnine */
public class ContainsOperand extends EqualityOperand {
- /**
- * @param property
- * @param literal
- */
public ContainsOperand( Token t ) {
super( t );
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.usergrid.persistence.query.tree.Operand#visit(org.usergrid.persistence
- * .query.tree.QueryVisitor)
- */
@Override
public void visit( QueryVisitor visitor ) throws PersistenceException {
visitor.visit( this );
@@ -49,10 +37,6 @@ public class ContainsOperand extends EqualityOperand {
return ( StringLiteral ) getLiteral();
}
-
- /* (non-Javadoc)
- * @see org.usergrid.persistence.query.tree.EqualityOperand#newProperty(java.lang.String)
- */
@Override
protected Property newProperty( String name ) {
return new ContainsProperty( name );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/main/java/org/usergrid/persistence/query/tree/EqualityOperand.java
----------------------------------------------------------------------
diff --git a/stack/core/src/main/java/org/usergrid/persistence/query/tree/EqualityOperand.java b/stack/core/src/main/java/org/usergrid/persistence/query/tree/EqualityOperand.java
index 93e3c37..3f8a8b9 100644
--- a/stack/core/src/main/java/org/usergrid/persistence/query/tree/EqualityOperand.java
+++ b/stack/core/src/main/java/org/usergrid/persistence/query/tree/EqualityOperand.java
@@ -27,10 +27,6 @@ import org.antlr.runtime.Token;
*/
public abstract class EqualityOperand extends Operand {
- /**
- * @param property
- * @param literal
- */
public EqualityOperand( Token t ) {
super( t );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..56a3ffd 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,7 +27,6 @@ public class DictionaryInfo {
private boolean keysIndexedInConnections;
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
public DictionaryInfo() {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..e6480d3 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,7 +44,6 @@ public class EntityInfo {
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
public EntityInfo() {
@@ -115,29 +114,20 @@ public class EntityInfo {
public boolean isPropertyMutable( String propertyName ) {
PropertyInfo property = properties.get( propertyName );
- if ( property == null ) {
- return false;
- }
- return property.isMutable();
+ return property != null && property.isMutable();
}
/** A property is unique if it has either been declared as unique, or as an alias property */
public boolean isPropertyUnique( String propertyName ) {
PropertyInfo property = properties.get( propertyName );
- if ( property == null ) {
- return false;
- }
- return property.isUnique() || property.isAliasProperty();
+ return property != null && (property.isUnique() || property.isAliasProperty());
}
public boolean isPropertyTimestamp( String propertyName ) {
PropertyInfo property = properties.get( propertyName );
- if ( property == null ) {
- return false;
- }
- return property.isTimestamp();
+ return property != null && property.isTimestamp();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/test/java/org/usergrid/batch/ConcurrentSchedulerTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/batch/ConcurrentSchedulerTestSuite.java b/stack/core/src/test/java/org/usergrid/batch/ConcurrentSchedulerTestSuite.java
index 0555830..7562a11 100644
--- a/stack/core/src/test/java/org/usergrid/batch/ConcurrentSchedulerTestSuite.java
+++ b/stack/core/src/test/java/org/usergrid/batch/ConcurrentSchedulerTestSuite.java
@@ -13,7 +13,7 @@ import org.usergrid.cassandra.ConcurrentSuite;
@RunWith(ConcurrentSuite.class)
@Suite.SuiteClasses(
{
- AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class,
+ AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class
})
@Concurrent()
public class ConcurrentSchedulerTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/test/java/org/usergrid/batch/SchedulerTestSuite.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/batch/SchedulerTestSuite.java b/stack/core/src/test/java/org/usergrid/batch/SchedulerTestSuite.java
index ca73689..7eeef42 100644
--- a/stack/core/src/test/java/org/usergrid/batch/SchedulerTestSuite.java
+++ b/stack/core/src/test/java/org/usergrid/batch/SchedulerTestSuite.java
@@ -12,7 +12,7 @@ import org.usergrid.cassandra.Concurrent;
@RunWith(Suite.class)
@Suite.SuiteClasses(
{
- AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class,
+ AppArgsTest.class, UsergridJobFactoryTest.class, BulkJobExecutionUnitTest.class
})
@Concurrent()
public class SchedulerTestSuite {}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/test/java/org/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/batch/job/AbstractSchedulerRuntimeIT.java b/stack/core/src/test/java/org/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
index ca81d01..5bc9d51 100644
--- a/stack/core/src/test/java/org/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
+++ b/stack/core/src/test/java/org/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -45,7 +45,7 @@ public class AbstractSchedulerRuntimeIT {
private int count = DEFAULT_COUNT;
protected SchedulerService scheduler;
protected Properties props;
- protected long waitTime = listener.WAIT_MAX_MILLIS;
+ protected long waitTime = TestJobListener.WAIT_MAX_MILLIS;
@Before
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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 a728ddb..f273860 100644
--- a/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
+++ b/stack/core/src/test/java/org/usergrid/count/BatchCountParallelismTest.java
@@ -65,7 +65,7 @@ public class BatchCountParallelismTest {
}
LOG.info( "Task iteration # {} : ", c );
cdl.countDown();
- return new Boolean( true );
+ return true;
}
} ) );
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/core/src/test/java/org/usergrid/locking/zookeeper/ZooPut.java
----------------------------------------------------------------------
diff --git a/stack/core/src/test/java/org/usergrid/locking/zookeeper/ZooPut.java b/stack/core/src/test/java/org/usergrid/locking/zookeeper/ZooPut.java
index 70d5ac7..49e0e31 100644
--- a/stack/core/src/test/java/org/usergrid/locking/zookeeper/ZooPut.java
+++ b/stack/core/src/test/java/org/usergrid/locking/zookeeper/ZooPut.java
@@ -86,7 +86,7 @@ public class ZooPut implements Watcher {
StringBuilder sbPath = new StringBuilder();
for ( int i = 0; i < paths.length; i++ ) {
String pathPiece = paths[i];
- sbPath.append( "/" + pathPiece );
+ sbPath.append("/").append(pathPiece);
String currentPath = sbPath.toString();
Object exists = keeper.exists( currentPath, null );
if ( exists == null ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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/f8ae7fe7/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..8bdfc87 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/>
@@ -246,13 +248,12 @@ 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];
+ for (final Resource webDir : fileFolders) {
// local file
- resource = webDir.createRelative( uri );
+ resource = webDir.createRelative(uri);
final boolean exists = resource.exists();
- if ( exists ) {
+ if (exists) {
found = true;
break;
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..a29591b 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/f8ae7fe7/stack/launcher/src/main/java/org/usergrid/launcher/Server.java
----------------------------------------------------------------------
diff --git a/stack/launcher/src/main/java/org/usergrid/launcher/Server.java b/stack/launcher/src/main/java/org/usergrid/launcher/Server.java
index 14d2de2..f2eadca 100644
--- a/stack/launcher/src/main/java/org/usergrid/launcher/Server.java
+++ b/stack/launcher/src/main/java/org/usergrid/launcher/Server.java
@@ -100,6 +100,7 @@ public class Server implements org.springframework.context.ApplicationContextAwa
}
+ @SuppressWarnings("InfiniteLoopStatement")
public synchronized void startServer() {
if ( startDatabaseWithServer ) {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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/f8ae7fe7/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..89bd8cc 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,8 +155,8 @@ 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
@@ -178,8 +178,8 @@ 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 ) {
@@ -265,12 +265,12 @@ public class MongoQueryParser {
Stack<Operand> expressions = new Stack<Operand>();
- for ( int i = 0; i < size; i++ ) {
+ for (Object value1 : values) {
Equal equal = new Equal();
- equal.setProperty( sourceField );
- equal.setLiteral( values.get( i ) );
+ equal.setProperty(sourceField);
+ equal.setLiteral(value1);
- expressions.push( equal );
+ expressions.push(equal);
}
// we need to build a tree of expressions
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/pom.xml
----------------------------------------------------------------------
diff --git a/stack/pom.xml b/stack/pom.xml
index 2ec4757..d9f9f70 100644
--- a/stack/pom.xml
+++ b/stack/pom.xml
@@ -1760,7 +1760,7 @@
<version>1.6.0</version>
</requireJavaVersion>
<requireMavenVersion>
- <version>[3.0,3.1)</version>
+ <version>[3.0,3.1.1]</version>
</requireMavenVersion>
</rules>
</configuration>
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/RootResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/RootResource.java b/stack/rest/src/main/java/org/usergrid/rest/RootResource.java
index 0719190..bee1f27 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/RootResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/RootResource.java
@@ -42,6 +42,7 @@ import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
+import org.usergrid.persistence.Identifier;
import org.usergrid.rest.applications.ApplicationResource;
import org.usergrid.rest.exceptions.NoOpException;
import org.usergrid.rest.organizations.OrganizationResource;
@@ -237,24 +238,28 @@ public class RootResource extends AbstractContextResource implements MetricProce
}
- @Path("applications/{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path("applications/"+APPLICATION_ID_PATH)
public ApplicationResource getApplicationById2( @PathParam("applicationId") String applicationId )
throws Exception {
return getApplicationById( applicationId );
}
- @Path("apps/{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path("apps/"+APPLICATION_ID_PATH)
public ApplicationResource getApplicationById3( @PathParam("applicationId") String applicationId )
throws Exception {
return getApplicationById( applicationId );
}
+ public static final String APPLICATION_ID_PATH = "{applicationId: " + Identifier.UUID_REX + "}";
+ public static final String ORGANIZATION_ID_PATH = "{organizationId: " + Identifier.UUID_REX + "}";
+ public static final String USER_ID_PATH = "{userId: " + Identifier.UUID_REX + "}";
+ public static final String ENTITY_ID_PATH = "{entityId: " + Identifier.UUID_REX + "}";
+ public static final String EMAIL_PATH = "{email: " + Identifier.EMAIL_REX + "}";
@Timed(name = "getApplicationByUuids_timer", group = "rest_timers")
@ExceptionMetered(group = "rest_exceptions", name = "getApplicationByUuids_exceptions")
- @Path("{organizationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12"
- + "}}/{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(ORGANIZATION_ID_PATH+"/"+APPLICATION_ID_PATH)
public ApplicationResource getApplicationByUuids( @PathParam("organizationId") String organizationIdStr,
@PathParam("applicationId") String applicationIdStr )
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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/f8ae7fe7/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 eeb5704..33ab281 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
@@ -52,6 +52,7 @@ import org.usergrid.persistence.EntityManager;
import org.usergrid.persistence.Query;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.applications.assets.AssetsResource;
import org.usergrid.rest.security.annotations.RequireApplicationAccess;
import org.usergrid.security.oauth.AccessInfo;
@@ -194,7 +195,7 @@ public class ServiceResource extends AbstractContextResource {
}
- @Path("{entityId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(RootResource.ENTITY_ID_PATH)
public AbstractContextResource addIdParameter( @Context UriInfo ui, @PathParam("entityId") PathSegment entityId )
throws Exception {
@@ -242,8 +243,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/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/applications/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/applications/users/UsersResource.java b/stack/rest/src/main/java/org/usergrid/rest/applications/users/UsersResource.java
index 877f7fd..4a36c97 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/applications/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/applications/users/UsersResource.java
@@ -45,6 +45,7 @@ import org.usergrid.persistence.Query;
import org.usergrid.persistence.entities.User;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.applications.ServiceResource;
import org.usergrid.rest.exceptions.RedirectionException;
import org.usergrid.rest.security.annotations.RequireApplicationAccess;
@@ -77,7 +78,7 @@ public class UsersResource extends ServiceResource {
@Override
- @Path("{entityId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(RootResource.ENTITY_ID_PATH)
public AbstractContextResource addIdParameter( @Context UriInfo ui, @PathParam("entityId") PathSegment entityId )
throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/management/organizations/OrganizationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/OrganizationsResource.java
index adce2ab..519d150 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/OrganizationsResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/OrganizationsResource.java
@@ -42,6 +42,7 @@ import org.usergrid.management.OrganizationOwnerInfo;
import org.usergrid.management.exceptions.ManagementException;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.security.annotations.RequireOrganizationAccess;
import org.apache.commons.lang.StringUtils;
@@ -70,7 +71,7 @@ public class OrganizationsResource extends AbstractContextResource {
}
- @Path( "{organizationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}" )
+ @Path(RootResource.ORGANIZATION_ID_PATH)
@RequireOrganizationAccess
public OrganizationResource getOrganizationById( @Context UriInfo ui,
@PathParam( "organizationId" ) String organizationIdStr )
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/management/organizations/applications/ApplicationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/applications/ApplicationsResource.java b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/applications/ApplicationsResource.java
index 9a3b248..40edbb9 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/applications/ApplicationsResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/applications/ApplicationsResource.java
@@ -42,6 +42,7 @@ import org.usergrid.management.OrganizationInfo;
import org.usergrid.persistence.exceptions.EntityNotFoundException;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.security.annotations.RequireOrganizationAccess;
import com.google.common.base.Preconditions;
@@ -127,7 +128,7 @@ public class ApplicationsResource extends AbstractContextResource {
@RequireOrganizationAccess
- @Path( "{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}" )
+ @Path(RootResource.APPLICATION_ID_PATH)
public ApplicationResource applicationFromOrganizationByApplicationId( @Context UriInfo ui,
@PathParam( "applicationId" )
String applicationIdStr ) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/management/organizations/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/users/UsersResource.java b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/users/UsersResource.java
index 57ac7ff..f7c09ea 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/organizations/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/organizations/users/UsersResource.java
@@ -45,6 +45,7 @@ import org.usergrid.management.UserInfo;
import org.usergrid.management.exceptions.ManagementException;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.security.annotations.RequireOrganizationAccess;
import org.usergrid.security.shiro.utils.SubjectUtils;
@@ -174,7 +175,7 @@ public class UsersResource extends AbstractContextResource {
@RequireOrganizationAccess
@PUT
- @Path("{userId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(RootResource.USER_ID_PATH)
public JSONWithPadding addUserToOrganization( @Context UriInfo ui, @PathParam("userId") String userIdStr,
@QueryParam("callback") @DefaultValue("callback") String callback )
throws Exception {
@@ -199,7 +200,7 @@ public class UsersResource extends AbstractContextResource {
@RequireOrganizationAccess
@PUT
- @Path("{email: [A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}}")
+ @Path(RootResource.EMAIL_PATH)
public JSONWithPadding addUserToOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
@QueryParam("callback") @DefaultValue("callback")
String callback ) throws Exception {
@@ -257,7 +258,7 @@ public class UsersResource extends AbstractContextResource {
@RequireOrganizationAccess
@DELETE
- @Path("{userId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(RootResource.USER_ID_PATH)
public JSONWithPadding removeUserFromOrganizationByUserId( @Context UriInfo ui,
@PathParam("userId") String userIdStr,
@QueryParam("callback") @DefaultValue("callback")
@@ -317,7 +318,7 @@ public class UsersResource extends AbstractContextResource {
@RequireOrganizationAccess
@DELETE
- @Path("{email: [A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}}")
+ @Path(RootResource.EMAIL_PATH)
public JSONWithPadding removeUserFromOrganizationByEmail( @Context UriInfo ui, @PathParam("email") String email,
@QueryParam("callback") @DefaultValue("callback")
String callback ) throws Exception {
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/management/users/UsersResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/users/UsersResource.java b/stack/rest/src/main/java/org/usergrid/rest/management/users/UsersResource.java
index 5e345e6..fe04134 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/users/UsersResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/users/UsersResource.java
@@ -39,6 +39,7 @@ import org.springframework.stereotype.Component;
import org.usergrid.management.UserInfo;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.exceptions.AuthErrorInfo;
import org.usergrid.rest.exceptions.RedirectionException;
import org.usergrid.security.shiro.utils.SubjectUtils;
@@ -71,7 +72,7 @@ public class UsersResource extends AbstractContextResource {
}
- @Path( "{userId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}" )
+ @Path(RootResource.USER_ID_PATH)
public UserResource getUserById( @Context UriInfo ui, @PathParam( "userId" ) String userIdStr ) throws Exception {
return getSubResource( UserResource.class )
@@ -95,7 +96,7 @@ public class UsersResource extends AbstractContextResource {
}
- @Path( "{email: [a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,4}}" )
+ @Path(RootResource.EMAIL_PATH)
public UserResource getUserByEmail( @Context UriInfo ui, @PathParam( "email" ) String email ) throws Exception {
return getSubResource( UserResource.class ).init( management.getAdminUserByEmail( email ) );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/management/users/organizations/OrganizationsResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/management/users/organizations/OrganizationsResource.java b/stack/rest/src/main/java/org/usergrid/rest/management/users/organizations/OrganizationsResource.java
index b969c2b..2f40f67 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/management/users/organizations/OrganizationsResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/management/users/organizations/OrganizationsResource.java
@@ -41,6 +41,7 @@ import org.usergrid.management.UserInfo;
import org.usergrid.management.exceptions.ManagementException;
import org.usergrid.rest.AbstractContextResource;
import org.usergrid.rest.ApiResponse;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.security.annotations.RequireAdminUserAccess;
import org.usergrid.rest.security.annotations.RequireOrganizationAccess;
import org.usergrid.security.shiro.utils.SubjectUtils;
@@ -151,7 +152,7 @@ public class OrganizationsResource extends AbstractContextResource {
@RequireOrganizationAccess
@PUT
- @Path( "{organizationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}" )
+ @Path(RootResource.ORGANIZATION_ID_PATH)
public JSONWithPadding addUserToOrganizationByOrganizationId( @Context UriInfo ui, @PathParam( "organizationId" )
String organizationIdStr, @QueryParam( "callback" ) @DefaultValue( "callback" ) String callback ) throws Exception {
@@ -167,7 +168,7 @@ public class OrganizationsResource extends AbstractContextResource {
@RequireOrganizationAccess
@DELETE
- @Path( "{organizationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}" )
+ @Path( RootResource.ORGANIZATION_ID_PATH )
public JSONWithPadding removeUserFromOrganizationByOrganizationId( @Context UriInfo ui,
@PathParam( "organizationId" )
String organizationIdStr,
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/organizations/OrganizationResource.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/organizations/OrganizationResource.java b/stack/rest/src/main/java/org/usergrid/rest/organizations/OrganizationResource.java
index d26581d..deda09a 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/organizations/OrganizationResource.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/organizations/OrganizationResource.java
@@ -18,6 +18,7 @@ import org.springframework.stereotype.Component;
import org.usergrid.exception.NotImplementedException;
import org.usergrid.management.OrganizationInfo;
import org.usergrid.rest.AbstractContextResource;
+import org.usergrid.rest.RootResource;
import org.usergrid.rest.applications.ApplicationResource;
import org.usergrid.rest.exceptions.NoOpException;
import org.usergrid.rest.exceptions.OrganizationApplicationNotFoundException;
@@ -64,7 +65,7 @@ public class OrganizationResource extends AbstractContextResource {
}
- @Path("{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path(RootResource.APPLICATION_ID_PATH)
public ApplicationResource getApplicationById( @PathParam("applicationId") String applicationIdStr )
throws Exception {
@@ -82,7 +83,7 @@ public class OrganizationResource extends AbstractContextResource {
if ( org_info != null ) {
organizationId = org_info.getUuid();
}
- if ( applicationId == null || organizationId == null ) {
+ if (organizationId == null) {
return null;
}
BiMap<UUID, String> apps = management.getApplicationsForOrganization( organizationId );
@@ -94,14 +95,14 @@ public class OrganizationResource extends AbstractContextResource {
}
- @Path("applications/{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path("applications/"+RootResource.APPLICATION_ID_PATH)
public ApplicationResource getApplicationById2( @PathParam("applicationId") String applicationId )
throws Exception {
return getApplicationById( applicationId );
}
- @Path("apps/{applicationId: [A-Fa-f0-9]{8}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{4}-[A-Fa-f0-9]{12}}")
+ @Path("apps/"+RootResource.APPLICATION_ID_PATH)
public ApplicationResource getApplicationById3( @PathParam("applicationId") String applicationId )
throws Exception {
return getApplicationById( applicationId );
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/main/java/org/usergrid/rest/utils/JSONPUtils.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/main/java/org/usergrid/rest/utils/JSONPUtils.java b/stack/rest/src/main/java/org/usergrid/rest/utils/JSONPUtils.java
index 2b962bb..06a6532 100644
--- a/stack/rest/src/main/java/org/usergrid/rest/utils/JSONPUtils.java
+++ b/stack/rest/src/main/java/org/usergrid/rest/utils/JSONPUtils.java
@@ -53,11 +53,8 @@ public class JSONPUtils {
}
Set<String> subtypes = javascriptTypes.get( m.getType() );
- if ( subtypes == null ) {
- return false;
- }
+ return subtypes != null && subtypes.contains(m.getSubtype());
- return subtypes.contains( m.getSubtype() );
}
@@ -83,8 +80,7 @@ public class JSONPUtils {
public static String wrapJSONPResponse( MediaType m, String callback, String jsonResponse ) {
if ( isJavascript( m ) && isNotBlank( callback ) ) {
- String jsResponse = callback + "(" + jsonResponse + ")";
- return jsResponse;
+ return callback + "(" + jsonResponse + ")";
}
else {
return jsonResponse;
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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/f8ae7fe7/stack/rest/src/test/java/org/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/applications/collection/activities/AndOrQueryTest.java b/stack/rest/src/test/java/org/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
index 1dece05..60dc437 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
@@ -109,13 +109,12 @@ public class AndOrQueryTest extends AbstractRestIT {
int numValuesTested = 20;
- JsonNode[] correctValues = new JsonNode[numValuesTested];
props.put( "actor", actor );
props.put( "verb", "go" );
props.put( "content", "bragh" );
- correctValues = activities.createEntitiesWithOrdinal( props, numValuesTested );
+ JsonNode[] correctValues = activities.createEntitiesWithOrdinal( props, numValuesTested );
String inCorrectQuery = "select * where verb = 'go' and ordinal >= 10 ";
@@ -129,9 +128,7 @@ public class AndOrQueryTest extends AbstractRestIT {
CustomCollection madeupStuff = context.collection( "imagination" );
Map character = hashMap( "WhoHelpedYou", "Ruff" );
- JsonNode[] correctValues = new JsonNode[1000];
-
-
+ JsonNode[] correctValues;
correctValues = madeupStuff.createEntitiesWithOrdinal( character, 1000 );
String inquisitiveQuery =
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..fb64ee2 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,15 +58,15 @@ public class QueueResourceLong2IT extends AbstractQueueResourceIT {
List<String> originalMessageIds = transHandler.getMessageIds();
BiMap<String, String> transactionInfo = transHandler.getTransactionToMessageId();
- for ( int i = 0; i < originalMessageIds.size(); i++ ) {
+ for (String originalMessageId : originalMessageIds) {
// check the messages come back in the same order, they should
- assertEquals( originalMessageIds.get( i ), originalMessageIds.get( i ) );
+ 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 ) ) );
+ queue.transactions().transaction(transactionInfo.get(originalMessageId));
transaction.delete();
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
----------------------------------------------------------------------
diff --git a/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java b/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
index ab29ea8..6923cff 100644
--- a/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
+++ b/stack/rest/src/test/java/org/usergrid/rest/applications/users/ConnectionResourceTest.java
@@ -85,7 +85,6 @@ public class ConnectionResourceTest extends AbstractRestIT {
}
catch ( UniformInterfaceException uie ) {
assertEquals( 404, uie.getResponse().getClientResponseStatus().getStatusCode() );
- return;
}
}
http://git-wip-us.apache.org/repos/asf/incubator-usergrid/blob/f8ae7fe7/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..a5fb6e8 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,9 @@ 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;
}