Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Miscellaneous changes #30

Merged
merged 2 commits into from

3 participants

@stliu

Miscellaneous changes, only some code refactoring and change the enforcer rule to allow maven 3.1.1, all tests pass

@tnine
Owner

Hey man. Sorry this hasn't been reviewed yet, I'm swamped at the moment, I'm hoping to get to it some time this weekend.

@tnine
Owner

Hey Strong,
Can you update this PR to work with the latest master? Also, if you could, can you remove the import changes, and we'll tackle that later? We're going to add a checkstyle plugin to maven that ensures we all follow the same formatting and import rules. Until then, I think we should avoid changes like the imports and braces to keep our change sets clearer.

@tnine tnine was assigned
@stliu

updated as request, thanks

@tnine
Owner

Thanks man. I need to manually merge/check this since Jenkins isn't set up for this yet. I've scheduled some time to get to it on Monday.

@tnine
Owner

Would it be possible to merge/rebase this onto the package rename?

@snoopdave

@stliu I'm curious. What tool did you use to make the "miscellaneous" changes?

@stliu

sorry for the late response, I just pushed a new commit which rebased to the latest master, so it can be merged fast forward

I'm using Intellij, it has a very cool code inspection tool, which can find some bad smell code and do quick fix, but mostly, I do mirror code refactor during read the code and combine them together

@stliu

anyone is going to take a look of this or shall i just go head and merge it by myself?

@snoopdave snoopdave merged commit d4f4f84 into usergrid:master
@GERey GERey referenced this pull request from a commit
@GERey GERey Revert pull request #30. 0d1588d
@GERey GERey referenced this pull request
Merged

Revert pull request #30. #182

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Apr 21, 2014
  1. @stliu

    Miscellaneous changes

    stliu authored
  2. @stliu

    Miscellaneous changes

    stliu authored
This page is out of date. Refresh to see the latest.
Showing with 182 additions and 358 deletions.
  1. +1 −6 stack/core/src/main/java/org/apache/usergrid/mq/Query.java
  2. +2 −1  stack/core/src/main/java/org/apache/usergrid/mq/QueryFilterLexer.java
  3. +0 −27 stack/core/src/main/java/org/apache/usergrid/mq/QueryFilterParser.java
  4. +0 −1  stack/core/src/main/java/org/apache/usergrid/mq/QueryProcessor.java
  5. +1 −1  stack/core/src/main/java/org/apache/usergrid/persistence/CredentialsInfo.java
  6. +4 −1 stack/core/src/main/java/org/apache/usergrid/persistence/Identifier.java
  7. +0 −2  stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
  8. +28 −88 stack/core/src/main/java/org/apache/usergrid/persistence/Schema.java
  9. +1 −1  stack/core/src/main/java/org/apache/usergrid/persistence/Update.java
  10. +1 −1  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
  11. +1 −1  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
  12. +6 −4 stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/ConnectionRefImpl.java
  13. +4 −6 stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
  14. +1 −2  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
  15. +1 −6 stack/core/src/main/java/org/apache/usergrid/persistence/entities/JobStat.java
  16. +6 −8 stack/core/src/main/java/org/apache/usergrid/persistence/geo/GeoIndexSearcher.java
  17. +2 −2 stack/core/src/main/java/org/apache/usergrid/persistence/geo/GeocellUtils.java
  18. +1 −4 stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
  19. +4 −5 stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GeoIterator.java
  20. +0 −5 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/BooleanOperand.java
  21. +1 −17 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/ContainsOperand.java
  22. +0 −4 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/EqualityOperand.java
  23. +0 −1  stack/core/src/main/java/org/apache/usergrid/persistence/schema/DictionaryInfo.java
  24. +3 −13 stack/core/src/main/java/org/apache/usergrid/persistence/schema/EntityInfo.java
  25. +1 −1  stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
  26. +1 −1  stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java
  27. +1 −1  stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java
  28. +3 −3 stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
  29. +5 −4 stack/launcher/src/main/java/org/apache/usergrid/launcher/ClasspathStaticHttpHandler.java
  30. +1 −1  stack/launcher/src/main/java/org/apache/usergrid/launcher/CustomJSPTemplateProcessor.java
  31. +1 −0  stack/launcher/src/main/java/org/apache/usergrid/launcher/Server.java
  32. +1 −1  stack/mongo-emulator/src/main/java/org/apache/usergrid/mongo/protocol/OpQuery.java
  33. +8 −8 stack/mongo-emulator/src/main/java/org/apache/usergrid/mongo/query/MongoQueryParser.java
  34. +1 −0  stack/pom.xml
  35. +9 −4 stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
  36. +1 −1  stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
  37. +5 −10 stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
  38. +2 −1  stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
  39. +2 −1  stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
  40. +2 −1  ...rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
  41. +5 −4 stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
  42. +3 −2 stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
  43. +3 −2 stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java
  44. +5 −4 stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
  45. +2 −6 stack/rest/src/main/java/org/apache/usergrid/rest/utils/JSONPUtils.java
  46. +1 −1  stack/rest/src/main/java/org/apache/usergrid/rest/utils/PathingUtils.java
  47. +2 −5 stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
  48. +4 −4 stack/rest/src/test/java/org/apache/usergrid/rest/applications/queues/QueueResourceLong2IT.java
  49. +0 −1  stack/rest/src/test/java/org/apache/usergrid/rest/applications/users/ConnectionResourceTest.java
  50. +2 −2 stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
  51. +1 −1  stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/OrganizationsResourceIT.java
  52. +5 −9 stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
  53. +1 −1  stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
  54. +2 −2 stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
  55. +1 −4 stack/services/src/main/java/org/apache/usergrid/security/shiro/CustomPermission.java
  56. +2 −2 stack/services/src/main/java/org/apache/usergrid/security/shiro/PrincipalCredentialsToken.java
  57. +3 −3 stack/services/src/main/java/org/apache/usergrid/security/shiro/Realm.java
  58. +1 −4 stack/services/src/main/java/org/apache/usergrid/security/shiro/utils/SubjectUtils.java
  59. +14 −17 stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
  60. +1 −1  stack/services/src/main/java/org/apache/usergrid/services/ServiceInfo.java
  61. +2 −7 stack/services/src/main/java/org/apache/usergrid/services/ServiceManager.java
  62. +3 −3 stack/services/src/main/java/org/apache/usergrid/services/ServiceRequest.java
  63. +3 −6 stack/services/src/main/java/org/apache/usergrid/services/applications/ApplicationsService.java
  64. +1 −1  stack/test-utils/src/main/java/org/apache/usergrid/NoExitSecurityManager.java
  65. +1 −1  stack/test-utils/src/main/java/org/apache/usergrid/cassandra/AvailablePortFinder.java
  66. +2 −20 stack/test-utils/src/main/java/org/apache/usergrid/cassandra/CassandraResource.java
View
7 stack/core/src/main/java/org/apache/usergrid/mq/Query.java
@@ -499,12 +499,7 @@ public Query addSelect( String select, String output ) {
return this;
}
- if ( StringUtils.isNotEmpty( output ) ) {
- mergeSelectResults = true;
- }
- else {
- mergeSelectResults = false;
- }
+ mergeSelectResults = StringUtils.isNotEmpty(output);
if ( output == null ) {
output = "";
View
3  stack/core/src/main/java/org/apache/usergrid/mq/QueryFilterLexer.java
@@ -86,7 +86,8 @@ public void emitErrorMessage( String msg ) {
// delegators
- public QueryFilterLexer() {;}
+ public QueryFilterLexer() {
+ }
public QueryFilterLexer( CharStream input ) {
View
27 stack/core/src/main/java/org/apache/usergrid/mq/QueryFilterParser.java
@@ -114,9 +114,6 @@ public void emitErrorMessage( String msg ) {
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 {
@@ -150,9 +147,6 @@ public void emitErrorMessage( String msg ) {
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' ) ;
@@ -192,9 +186,6 @@ public void emitErrorMessage( String msg ) {
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 {
@@ -232,9 +223,6 @@ public void emitErrorMessage( String msg ) {
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 {
@@ -272,9 +260,6 @@ public void emitErrorMessage( String msg ) {
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 {
@@ -427,9 +412,6 @@ public final FilterPredicate filter() throws RecognitionException {
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 {
@@ -462,9 +444,6 @@ public final FilterPredicate filter() throws RecognitionException {
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 {
@@ -494,9 +473,6 @@ public final FilterPredicate filter() throws RecognitionException {
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 {
@@ -699,9 +675,6 @@ public final void where() throws RecognitionException {
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 {
View
1  stack/core/src/main/java/org/apache/usergrid/mq/QueryProcessor.java
@@ -410,7 +410,6 @@ public RangePair getRangeForFilter( FilterPredicate f ) {
}
if ( searchFinishValue == null ) {
searchFinishValue = searchStartValue;
- ;
}
if ( ( searchStartValue != null ) && searchStartValue.toString().endsWith( "*" ) ) {
searchStartValue = removeEnd( searchStartValue.toString(), "*" );
View
2  stack/core/src/main/java/org/apache/usergrid/persistence/CredentialsInfo.java
@@ -166,7 +166,7 @@ public Long getCreated() {
@Override
public int compareTo( CredentialsInfo o ) {
- if ( created == o.created ) {
+ if (created.equals(o.created)) {
return 0;
}
if ( o.created == null ) {
View
5 stack/core/src/main/java/org/apache/usergrid/persistence/Identifier.java
@@ -30,6 +30,9 @@
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
}
@@ -38,7 +41,7 @@
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_\\-./]*" );
View
2  stack/core/src/main/java/org/apache/usergrid/persistence/Results.java
@@ -707,7 +707,6 @@ else if ( idSet == null && results.idSet != null ) {
idSet.addAll( results.idSet );
ids = new ArrayList<UUID>( idSet );
- return;
}
}
@@ -757,7 +756,6 @@ public void subtract( Results results ) {
idSet = newSet;
ids = new ArrayList<UUID>( idSet );
level = Level.IDS;
- return;
}
}
View
116 stack/core/src/main/java/org/apache/usergrid/persistence/Schema.java
@@ -161,8 +161,8 @@
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 =
@@ -217,7 +217,6 @@ public String load( String key ) { // no checked exception
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 );
@@ -501,7 +500,8 @@ public void removeEntitiesPackage( String entityPackage ) {
public String[] getAllPropertyNamesAsArray() {
- return allProperties.keySet().toArray( new String[0] );
+ Set<String> strings = allProperties.keySet();
+ return strings.toArray(new String[strings.size()]);
}
@@ -640,11 +640,8 @@ public String getEntityType( Class<? extends Entity> cls ) {
public boolean hasProperties( String entityType ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasProperties();
- return entity.hasProperties();
}
@@ -668,7 +665,8 @@ public boolean hasProperties( String entityType ) {
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()]);
}
@@ -680,11 +678,8 @@ public boolean hasProperty( String entityType, String propertyName ) {
}
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasProperty(propertyName);
- return entity.hasProperty( propertyName );
}
@@ -703,63 +698,40 @@ public String aliasProperty( String entityType ) {
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 );
}
@@ -783,11 +755,8 @@ public boolean isRequiredProperty( String entityType, String propertyName ) {
}
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.isPropertyRequired(propertyName);
- return entity.isPropertyRequired( propertyName );
}
@@ -812,11 +781,8 @@ public boolean isRequiredProperty( String entityType, String propertyName ) {
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 );
}
@@ -824,11 +790,8 @@ public boolean isPropertyIndexedInCollection( String containerType, String colle
public boolean hasDictionaries( String entityType ) {
EntityInfo entity = getEntityInfo( entityType );
- if ( entity == null ) {
- return false;
- }
+ return entity != null && entity.hasDictionaries();
- return entity.hasDictionaries();
}
@@ -848,11 +811,8 @@ public boolean hasDictionaries( String entityType ) {
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 );
}
@@ -898,11 +858,8 @@ public boolean isDictionaryIndexedInConnections( String entityType, String dicti
}
DictionaryInfo dictionary = entity.getDictionary( dictionaryName );
- if ( dictionary == null ) {
- return false;
- }
+ return dictionary != null && dictionary.isKeysIndexedInConnections();
- return dictionary.isKeysIndexedInConnections();
}
@@ -911,11 +868,8 @@ public boolean isDictionaryIndexedInCollection( String containerType, String col
String dictionaryName ) {
CollectionInfo collection = getCollection( containerType, collectionName );
- if ( collection == null ) {
- return false;
- }
+ return collection != null && collection.isDictionaryIndexed(dictionaryName);
- return collection.isDictionaryIndexed( dictionaryName );
}
@@ -939,22 +893,16 @@ public boolean isCollectionPathBased( String containerType, String collectionNam
}
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();
}
@@ -1261,10 +1209,7 @@ private static String createNormalizedEntityType( String entityType, boolean bas
public static boolean isAssociatedEntityType( String entityType ) {
- if ( entityType == null ) {
- return false;
- }
- return entityType.indexOf( ':' ) != -1;
+ return entityType != null && entityType.contains(":");
}
@@ -1390,7 +1335,7 @@ public EntityInfo getDynamicEntityInfo( String entityType ) {
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() ) ) {
@@ -1407,7 +1352,7 @@ public Object validateEntityPropertyValue( String entityType, String propertyNam
entityType = normalizeEntityType( entityType );
- if ( ( propertyValue instanceof String ) && ( ( String ) propertyValue ).equals( "" ) ) {
+ if ( ( propertyValue instanceof String ) && propertyValue.equals("") ) {
propertyValue = null;
}
@@ -1440,7 +1385,7 @@ public Object validateEntitySetValue( String entityType, String dictionaryName,
entityType = normalizeEntityType( entityType );
- if ( ( elementValue instanceof String ) && ( ( String ) elementValue ).equals( "" ) ) {
+ if ( ( elementValue instanceof String ) && elementValue.equals("") ) {
elementValue = null;
}
@@ -1467,8 +1412,7 @@ public Entity toEntity( Map<String, Object> map ) {
if ( entityClass == null ) {
entityClass = DynamicEntity.class;
}
- Entity entity = mapper.convertValue( map, entityClass );
- return entity;
+ return mapper.convertValue( map, entityClass );
}
/*
@@ -1484,8 +1428,7 @@ public Entity toEntity( Map<String, Object> map ) {
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>>() {} );
}
@@ -1725,11 +1668,8 @@ public boolean isPropertyEncrypted( String entityType, String propertyName ) {
}
PropertyInfo property = entity.getProperty( propertyName );
- if ( property == null ) {
- return false;
- }
+ return property != null && property.isEncrypted();
- return property.isEncrypted();
}
View
2  stack/core/src/main/java/org/apache/usergrid/persistence/Update.java
@@ -56,7 +56,7 @@ public Object getValue() {
public static enum UpdateOperator {
- UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST;
+ UPDATE, DELETE, ADD_TO_LIST, REMOVE_FROM_LIST
}
View
2  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraPersistenceUtils.java
@@ -443,7 +443,7 @@ public static ByteBuffer toStorableBinaryValue( Object obj, boolean forceJson )
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 );
View
2  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/CassandraService.java
@@ -885,7 +885,7 @@ public void setColumns( Keyspace ko, Object columnFamily, byte[] key, Map<?, ?>
* @return a timestamp
*/
public long createTimestamp() {
- return chc.getClockResolution().createClock();
+ return CassandraHostConfigurator.getClockResolution().createClock();
}
View
10 stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/ConnectionRefImpl.java
@@ -329,8 +329,9 @@ public UUID getConnectedEntityId() {
@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;
}
@@ -344,13 +345,13 @@ public String getType() {
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()]));
}
@@ -363,8 +364,9 @@ public ConnectionRefImpl getConnectionToConnectionEntity() {
/** @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()]));
}
View
10 stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/EntityManagerImpl.java
@@ -913,7 +913,7 @@ else if ( ( v instanceof String ) && isBlank( ( String ) v ) ) {
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 ) {
@@ -1028,9 +1028,7 @@ public DynamicEntity loadPartialEntity( UUID entityId, String... propertyNames )
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 );
@@ -2256,14 +2254,14 @@ public String getRoleTitle( String roleName ) throws Exception {
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 ) {
View
3  stack/core/src/main/java/org/apache/usergrid/persistence/cassandra/RelationManagerImpl.java
@@ -2129,7 +2129,6 @@ public void visit( AllNode node ) throws Exception {
startId = UUID_PARSER.parse( slice.getCursor() ).getUUID();
}
-
IndexScanner indexScanner = cass.getIdList( cass.getApplicationKeyspace( applicationId ),
key( headEntity.getUuid(), DICTIONARY_COLLECTIONS, collectionName ), startId, null,
queryProcessor.getPageSizeHint( node ), query.isReversed(), indexBucketLocator, applicationId,
@@ -2268,7 +2267,7 @@ public void visit( AllNode node ) throws Exception {
}
- boolean skipFirst = node.isForceKeepFirst() ? false : slice.hasCursor();
+ boolean skipFirst = !node.isForceKeepFirst() && slice.hasCursor();
UUID entityIdToUse;
View
7 stack/core/src/main/java/org/apache/usergrid/persistence/entities/JobStat.java
@@ -49,11 +49,6 @@
@EntityProperty(required = true, basic = true, indexed = true)
private long duration;
-
- /**
- * @param jobName
- * @param startTime
- */
public JobStat() {
}
@@ -118,7 +113,7 @@ public int getRunCount() {
/**
* 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;
View
14 stack/core/src/main/java/org/apache/usergrid/persistence/geo/GeoIndexSearcher.java
@@ -254,9 +254,7 @@ public final SearchResults proximitySearch( final EntityLocationRef minMatch, fi
// 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 {
@@ -276,17 +274,17 @@ else if ( curGeocells.size() == 1 ) {
// 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;
}
}
View
4 stack/core/src/main/java/org/apache/usergrid/persistence/geo/GeocellUtils.java
@@ -447,7 +447,7 @@ public static boolean isValid( String cell ) {
// 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
};
}
@@ -462,7 +462,7 @@ public static char subdivChar( int[] pos ) {
return GEOCELL_ALPHABET.charAt( ( pos[1] & 2 ) << 2 |
( pos[0] & 2 ) << 1 |
( pos[1] & 1 ) << 1 |
- ( pos[0] & 1 ) << 0 );
+ (pos[0] & 1));
}
View
5 stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/AbstractScanColumn.java
@@ -62,11 +62,8 @@ public boolean equals( Object o ) {
AbstractScanColumn that = ( AbstractScanColumn ) o;
- if ( !uuid.equals( that.uuid ) ) {
- return false;
- }
+ return uuid.equals(that.uuid);
- return true;
}
View
9 stack/core/src/main/java/org/apache/usergrid/persistence/query/ir/result/GeoIterator.java
@@ -142,15 +142,14 @@ private void advance() {
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;
}
View
5 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/BooleanOperand.java
@@ -28,11 +28,6 @@
*/
public abstract class BooleanOperand extends Operand {
-
- /**
- * @param property
- * @param literal
- */
public BooleanOperand( Token t ) {
super( t );
}
View
18 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/ContainsOperand.java
@@ -1,4 +1,4 @@
-/*
+ /*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
@@ -24,22 +24,10 @@
/** @author tnine */
public class ContainsOperand extends EqualityOperand {
- /**
- * @param property
- * @param literal
- */
public ContainsOperand( Token t ) {
super( t );
}
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.apache.usergrid.persistence.query.tree.Operand#visit(org.apache.usergrid.persistence
- * .query.tree.QueryVisitor)
- */
@Override
public void visit( QueryVisitor visitor ) throws PersistenceException {
visitor.visit( this );
@@ -50,10 +38,6 @@ public StringLiteral getString() {
return ( StringLiteral ) getLiteral();
}
-
- /* (non-Javadoc)
- * @see org.apache.usergrid.persistence.query.tree.EqualityOperand#newProperty(java.lang.String)
- */
@Override
protected Property newProperty( String name ) {
return new ContainsProperty( name );
View
4 stack/core/src/main/java/org/apache/usergrid/persistence/query/tree/EqualityOperand.java
@@ -28,10 +28,6 @@
*/
public abstract class EqualityOperand extends Operand {
- /**
- * @param property
- * @param literal
- */
public EqualityOperand( Token t ) {
super( t );
}
View
1  stack/core/src/main/java/org/apache/usergrid/persistence/schema/DictionaryInfo.java
@@ -28,7 +28,6 @@
private boolean keysIndexedInConnections;
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
public DictionaryInfo() {
View
16 stack/core/src/main/java/org/apache/usergrid/persistence/schema/EntityInfo.java
@@ -45,7 +45,6 @@
private boolean publicVisible = true;
private boolean includedInExport = true;
- ;
public EntityInfo() {
@@ -116,29 +115,20 @@ public void setProperties( Map<String, PropertyInfo> properties ) {
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();
}
View
2  stack/core/src/test/java/org/apache/usergrid/batch/job/AbstractSchedulerRuntimeIT.java
@@ -45,7 +45,7 @@
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
View
2  stack/core/src/test/java/org/apache/usergrid/count/BatchCountParallelismTest.java
@@ -81,7 +81,7 @@ public Boolean call() throws Exception {
}
LOG.info( "Task iteration # {} : ", c );
cdl.countDown();
- return new Boolean( true );
+ return true;
}
} ) );
}
View
2  stack/core/src/test/java/org/apache/usergrid/locking/zookeeper/ZooPut.java
@@ -87,7 +87,7 @@ public void makePath( String path, CreateMode createMode ) throws KeeperExceptio
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 ) {
View
6 stack/core/src/test/java/org/apache/usergrid/persistence/EntityManagerIT.java
@@ -245,9 +245,9 @@ public void testProperties() throws Exception {
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() );
View
9 stack/launcher/src/main/java/org/apache/usergrid/launcher/ClasspathStaticHttpHandler.java
@@ -62,6 +62,8 @@
*/
+import org.springframework.core.io.Resource;
+
/**
* Modified version of the StaticHttpHandler to serve resources from the classpath.
* <p/>
@@ -246,13 +248,12 @@ protected boolean handle( final String uri, final org.glassfish.grizzly.http.ser
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;
}
View
2  stack/launcher/src/main/java/org/apache/usergrid/launcher/CustomJSPTemplateProcessor.java
@@ -86,7 +86,7 @@ public String resolve( String path ) {
return null;
}
- if ( basePath != "" ) {
+ if (!basePath.equals("")) {
path = basePath + path;
}
View
1  stack/launcher/src/main/java/org/apache/usergrid/launcher/Server.java
@@ -100,6 +100,7 @@ public void startServerFromCommandLine( String[] args ) {
}
+ @SuppressWarnings("InfiniteLoopStatement")
public synchronized void startServer() {
if ( startDatabaseWithServer ) {
View
2  stack/mongo-emulator/src/main/java/org/apache/usergrid/mongo/protocol/OpQuery.java
@@ -71,7 +71,7 @@
static Set<String> operators = new HashSet<String>();
- {
+ static {
operators.add( "all" );
operators.add( "and" );
operators.add( "elemMatch" );
View
16 stack/mongo-emulator/src/main/java/org/apache/usergrid/mongo/query/MongoQueryParser.java
@@ -156,8 +156,8 @@ private static Operand eval( BSONObject exp ) {
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
@@ -179,8 +179,8 @@ else if ( "$and".equals( field ) ) {
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 ) {
@@ -266,12 +266,12 @@ else if ( "$in".equals( field ) ) {
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
View
1  stack/pom.xml
@@ -1799,6 +1799,7 @@
<exclude>**/src/test/resources/**</exclude>
<exclude>**/cloudbees.xml</exclude>
<exclude>**/aws.properties</exclude>
+ <exclude>**/usergrid-custom.properties</exclude>
</excludes>
</configuration>
View
13 stack/rest/src/main/java/org/apache/usergrid/rest/RootResource.java
@@ -36,6 +36,7 @@
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.persistence.Identifier;
import org.codehaus.jackson.node.JsonNodeFactory;
import org.codehaus.jackson.node.ObjectNode;
import org.slf4j.Logger;
@@ -238,24 +239,28 @@ private ApplicationResource appResourceFor( UUID applicationId ) throws Exceptio
}
- @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 )
View
2  stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java
@@ -598,7 +598,7 @@ private String buildRedirectUriWithAuthCode( String redirect_uri, String state,
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
View
15 stack/rest/src/main/java/org/apache/usergrid/rest/applications/ServiceResource.java
@@ -43,6 +43,8 @@
import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
+import org.apache.usergrid.services.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -56,16 +58,9 @@
import org.apache.usergrid.rest.applications.assets.AssetsResource;
import org.apache.usergrid.rest.security.annotations.RequireApplicationAccess;
import org.apache.usergrid.security.oauth.AccessInfo;
-import org.apache.usergrid.services.ServiceAction;
-import org.apache.usergrid.services.ServiceManager;
-import org.apache.usergrid.services.ServiceParameter;
-import org.apache.usergrid.services.ServicePayload;
-import org.apache.usergrid.services.ServiceRequest;
-import org.apache.usergrid.services.ServiceResults;
import org.apache.usergrid.services.assets.data.AssetUtils;
import org.apache.usergrid.services.assets.data.BinaryStore;
import org.apache.usergrid.utils.InflectionUtils;
-
import org.apache.commons.lang.StringUtils;
import com.sun.jersey.api.json.JSONWithPadding;
@@ -195,7 +190,7 @@ public AbstractContextResource getFileResource( @Context UriInfo ui ) throws Exc
}
- @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 {
@@ -243,8 +238,8 @@ public ServiceResults executeServiceRequest( UriInfo ui, ApiResponse response, S
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 );
View
3  stack/rest/src/main/java/org/apache/usergrid/rest/applications/users/UsersResource.java
@@ -36,6 +36,7 @@
import javax.ws.rs.core.PathSegment;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
@@ -78,7 +79,7 @@ public UsersResource() {
@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 {
View
3  stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/OrganizationsResource.java
@@ -32,6 +32,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@@ -71,7 +72,7 @@ public OrganizationsResource() {
}
- @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 )
View
3  ...t/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationsResource.java
@@ -34,6 +34,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
@@ -128,7 +129,7 @@ public JSONWithPadding newApplicationForOrganizationFromForm( @Context UriInfo u
@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 {
View
9 stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/users/UsersResource.java
@@ -37,6 +37,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Scope;
@@ -175,7 +176,7 @@ public JSONWithPadding newUserForOrganizationFromForm( @Context UriInfo ui, @For
@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 {
@@ -200,7 +201,7 @@ public JSONWithPadding addUserToOrganization( @Context UriInfo ui, @PathParam("u
@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 {
@@ -258,7 +259,7 @@ public JSONWithPadding addUserToOrganizationByUsername( @Context UriInfo ui, @Pa
@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")
@@ -318,7 +319,7 @@ public JSONWithPadding removeUserFromOrganizationByUsername( @Context UriInfo ui
@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 {
View
5 stack/rest/src/main/java/org/apache/usergrid/rest/management/users/UsersResource.java
@@ -34,6 +34,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
@@ -72,7 +73,7 @@ public UsersResource() {
}
- @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 )
@@ -96,7 +97,7 @@ public UserResource getUserByUsername( @Context UriInfo ui, @PathParam( "usernam
}
- @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 ) );
View
5 stack/rest/src/main/java/org/apache/usergrid/rest/management/users/organizations/OrganizationsResource.java
@@ -35,6 +35,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.apache.usergrid.management.OrganizationInfo;
@@ -152,7 +153,7 @@ public JSONWithPadding addUserToOrganizationByOrganizationName( @Context UriInfo
@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 {
@@ -168,7 +169,7 @@ public JSONWithPadding addUserToOrganizationByOrganizationId( @Context UriInfo u
@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,
View
9 stack/rest/src/main/java/org/apache/usergrid/rest/organizations/OrganizationResource.java
@@ -29,6 +29,7 @@
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.UriInfo;
+import org.apache.usergrid.rest.RootResource;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;
import org.apache.usergrid.exception.NotImplementedException;
@@ -80,7 +81,7 @@ private ApplicationResource appResourceFor( UUID applicationId ) throws Exceptio
}
- @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 {
@@ -98,7 +99,7 @@ public ApplicationResource getApplicationById( @PathParam("applicationId") Strin
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 );
@@ -110,14 +111,14 @@ public ApplicationResource getApplicationById( @PathParam("applicationId") Strin
}
- @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 );
View
8 stack/rest/src/main/java/org/apache/usergrid/rest/utils/JSONPUtils.java
@@ -54,11 +54,8 @@ public static boolean isJavascript( MediaType m ) {
}
Set<String> subtypes = javascriptTypes.get( m.getType() );
- if ( subtypes == null ) {
- return false;
- }
+ return subtypes != null && subtypes.contains(m.getSubtype());
- return subtypes.contains( m.getSubtype() );
}
@@ -84,8 +81,7 @@ public static String wrapJSONPResponse( String callback, String jsonResponse ) {
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;
View
2  stack/rest/src/main/java/org/apache/usergrid/rest/utils/PathingUtils.java
@@ -40,7 +40,7 @@
* @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();
}
View
7 stack/rest/src/test/java/org/apache/usergrid/rest/applications/collection/activities/AndOrQueryTest.java
@@ -125,13 +125,12 @@ public void queryReturnCount() throws Exception {
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 ";
@@ -145,9 +144,7 @@ public void queryCheckAsc() throws Exception {
CustomCollection madeupStuff = context.collection( "imagination" );
Map character = hashMap( "WhoHelpedYou", "Ruff" );
- JsonNode[] correctValues = new JsonNode[1000];
-
-
+ JsonNode[] correctValues;
correctValues = madeupStuff.createEntitiesWithOrdinal( character, 1000 );
String inquisitiveQuery =
View
8 stack/rest/src/test/java/org/apache/usergrid/rest/applications/queues/QueueResourceLong2IT.java
@@ -74,15 +74,15 @@ public void transactionPageSize() throws InterruptedException {
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();
}
View
1  stack/rest/src/test/java/org/apache/usergrid/rest/applications/users/ConnectionResourceTest.java
@@ -102,7 +102,6 @@ public void connectionsQueryTest() {
}
catch ( UniformInterfaceException uie ) {
assertEquals( 404, uie.getResponse().getClientResponseStatus().getStatusCode() );
- return;
}
}
View
4 stack/rest/src/test/java/org/apache/usergrid/rest/management/RegistrationIT.java
@@ -345,9 +345,9 @@ public void addExistingAdminUserToOrganization() throws Exception {
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;
}
View
2  stack/rest/src/test/java/org/apache/usergrid/rest/management/organizations/OrganizationsResourceIT.java
@@ -95,7 +95,7 @@ public void createOrgAndOwner() throws Exception {
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" ) );
View
14 stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java
@@ -1233,10 +1233,8 @@ public UserInfo verifyAdminUserPasswordCredentials( String name, String password
boolean userIsSuperAdmin = properties.getSuperUser().isEnabled() && properties.getSuperUser().getEmail().equals(userInfo.getEmail());
boolean testUserEnabled = parseBoolean( properties.getProperty( PROPERTIES_SETUP_TEST_ACCOUNT ) );
-
- boolean userIsTestUser = !testUserEnabled ? false :
- properties.getProperty( PROPERTIES_TEST_ACCOUNT_ADMIN_USER_EMAIL )
- .equals( userInfo.getEmail() );
+ boolean userIsTestUser = testUserEnabled && properties.getProperty(PROPERTIES_SYSADMIN_LOGIN_EMAIL)
+ .equals(userInfo.getEmail());
if ( !userIsSuperAdmin && !userIsTestUser ) {
@@ -2440,8 +2438,7 @@ public boolean newAppUsersNeedAdminApproval( UUID applicationId ) throws Excepti
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() :
- false;
+ return registration_requires_admin_approval != null && registration_requires_admin_approval.booleanValue();
}
@@ -2451,8 +2448,7 @@ public boolean newAppUsersRequireConfirmation( UUID applicationId ) throws Excep
Boolean registration_requires_email_confirmation = ( Boolean ) em
.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ),
REGISTRATION_REQUIRES_EMAIL_CONFIRMATION );
- return registration_requires_email_confirmation != null ?
- registration_requires_email_confirmation.booleanValue() : false;
+ return registration_requires_email_confirmation != null && registration_requires_email_confirmation.booleanValue();
}
@@ -2461,7 +2457,7 @@ public boolean notifyAdminOfNewAppUsers( UUID applicationId ) throws Exception {
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.booleanValue();
}
View
2  stack/services/src/main/java/org/apache/usergrid/security/providers/FoursquareProvider.java
@@ -98,7 +98,7 @@ public User createOrAuthenticate( String externalToken ) throws BadTokenExceptio
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 =
View
4 stack/services/src/main/java/org/apache/usergrid/security/providers/PingIdentityProvider.java
@@ -152,8 +152,8 @@ public static String pingUsernameFrom( String rawEmail ) {
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;
}
}
View
5 stack/services/src/main/java/org/apache/usergrid/security/shiro/CustomPermission.java
@@ -186,10 +186,7 @@ else if ( p1.contains( ME ) ) {
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 );
}
View
4 stack/services/src/main/java/org/apache/usergrid/security/shiro/PrincipalCredentialsToken.java
@@ -130,11 +130,11 @@ public static PrincipalCredentialsToken getFromAppUserInfoAndAccessToken( UserIn
public boolean isDisabled() {
- return ( principal != null ) ? principal.isDisabled() : false;
+ return (principal != null) && principal.isDisabled();
}
public boolean isActivated() {
- return ( principal != null ) ? principal.isActivated() : true;
+ return (principal == null) || principal.isActivated();
}
}
View
6 stack/services/src/main/java/org/apache/usergrid/security/shiro/Realm.java
@@ -277,7 +277,7 @@ else if ( principal instanceof AdminUserPrincipal ) {
// 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
@@ -350,7 +350,7 @@ else if ( principal instanceof ApplicationUserPrincipal ) {
UUID applicationId = ( ( ApplicationUserPrincipal ) principal ).getApplicationId();
AccessTokenCredentials tokenCredentials =
- ( ( ApplicationUserPrincipal ) principal ).getAccessTokenCredentials();
+ principal.getAccessTokenCredentials();
TokenInfo token = null;
if ( tokenCredentials != null ) {
try {
@@ -389,7 +389,7 @@ else if ( principal instanceof ApplicationUserPrincipal ) {
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 );
View
5 stack/services/src/main/java/org/apache/usergrid/security/shiro/utils/SubjectUtils.java
@@ -55,10 +55,7 @@ public static boolean isAnonymous() {
if ( currentUser == null ) {
return true;
}
- if ( !currentUser.isAuthenticated() && !currentUser.isRemembered() ) {
- return true;
- }
- return false;
+ return !currentUser.isAuthenticated() && !currentUser.isRemembered();
}
View
31 stack/services/src/main/java/org/apache/usergrid/security/tokens/cassandra/TokenServiceImpl.java
@@ -18,12 +18,7 @@
import java.nio.ByteBuffer;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.UUID;
+import java.util.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -102,20 +97,22 @@
private static final ByteBufferSerializer BUFF_SER = ByteBufferSerializer.get();
private static final StringSerializer STR_SER = StringSerializer.get();
- private static final HashSet<String> TOKEN_PROPERTIES = new HashSet<String>();
+ private static final Set<String> TOKEN_PROPERTIES ;
static {
- TOKEN_PROPERTIES.add( TOKEN_UUID );
- TOKEN_PROPERTIES.add( TOKEN_TYPE );
- TOKEN_PROPERTIES.add( TOKEN_CREATED );
- TOKEN_PROPERTIES.add( TOKEN_ACCESSED );
- TOKEN_PROPERTIES.add( TOKEN_INACTIVE );
- TOKEN_PROPERTIES.add