http://git-wip-us.apache.org/repos/asf/usergrid/blob/6db4af0f/stack/services/src/main/java/org/apache/usergrid/services/AbstractService.java
----------------------------------------------------------------------
diff --git
a/stack/services/src/main/java/org/apache/usergrid/services/AbstractService.java
b/stack/services/src/main/java/org/apache/usergrid/services/AbstractService.java
index 77fd220..d6a04dc 100644
---
a/stack/services/src/main/java/org/apache/usergrid/services/AbstractService.java
+++
b/stack/services/src/main/java/org/apache/usergrid/services/AbstractService.java
@@ -126,6 +126,7 @@ public abstract class AbstractService implements Service {
this.entitiesGetTimer = metricsFactory.getTimer(this.getClass(),
"importEntities.get");
this.entitiesParallelGetTimer = metricsFactory.getTimer(
this.getClass(),"importEntitiesP.get" );
this.invokeTimer = metricsFactory.getTimer(
this.getClass(),"service.invoke" );
+
this.cacheFactory = injector.getInstance( CacheFactory.class );
}
@@ -455,7 +456,6 @@ public abstract class AbstractService implements Service {
* @param results
*/
private void importEntitiesParallel(final ServiceRequest request, final
Results results ) {
-
//create our tuples
final Observable<EntityTuple> tuples = Observable.create(new
Observable.OnSubscribe<EntityTuple>() {
@Override
@@ -467,6 +467,7 @@ public abstract class AbstractService implements Service {
for (int i = 0; i < size && !subscriber.isUnsubscribed(); i++)
{
subscriber.onNext(new EntityTuple(i, entities.get(i)));
}
+
subscriber.onCompleted();
}
});
@@ -656,7 +657,7 @@ public abstract class AbstractService implements Service {
EntityRef owner = request.getOwner();
String collectionName =
- "application".equals( owner.getType() ) ? pluralize(
info.getItemType() ) : info.getCollectionName();
+ "application".equals( owner.getType() ) ? pluralize(
info.getItemType() ) : info.getCollectionName();
List<ServiceParameter> parameters = filter(request.getParameters(),
replaceParameters);
ServiceParameter first_parameter = null;
@@ -668,11 +669,11 @@ public abstract class AbstractService implements Service {
if ( first_parameter instanceof NameParameter ) {
if ( hasServiceMetadata( first_parameter.getName() ) ) {
return new ServiceContext( this, action, request,
previousResults, owner, collectionName, parameters,
- payload ).withServiceMetadata(
first_parameter.getName() );
+ payload ).withServiceMetadata( first_parameter.getName() );
}
else if ( hasServiceCommand( first_parameter.getName() ) ) {
return new ServiceContext( this, action, request,
previousResults, owner, collectionName, parameters,
- payload ).withServiceCommand(
first_parameter.getName() );
+ payload ).withServiceCommand( first_parameter.getName() );
}
}
@@ -685,20 +686,20 @@ public abstract class AbstractService implements Service {
if ( first_parameter instanceof IdParameter ) {
UUID id = first_parameter.getId();
return new ServiceContext( this, action, request, previousResults,
owner, collectionName,
- Query.fromUUID( id ), parameters, payload );
+ Query.fromUUID( id ), parameters, payload );
}
else if ( first_parameter instanceof NameParameter ) {
String name = first_parameter.getName();
return new ServiceContext( this, action, request, previousResults,
owner, collectionName,
- Query.fromIdentifier( name ), parameters, payload );
+ Query.fromIdentifier( name ), parameters, payload );
}
else if ( query != null ) {
return new ServiceContext( this, action, request, previousResults,
owner, collectionName, query, parameters,
- payload );
+ payload );
}
else if ( first_parameter == null ) {
return new ServiceContext( this, action, request, previousResults,
owner, collectionName, null, null,
- payload );
+ payload );
}
return null;
@@ -984,13 +985,13 @@ public abstract class AbstractService implements Service {
public ServiceResults putServiceCommand( ServiceContext context, String
command, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
public ServiceResults postServiceCommand( ServiceContext context, String
command, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
@@ -1111,14 +1112,14 @@ public abstract class AbstractService implements
Service {
public ServiceResults putEntityDictionary( ServiceContext context,
List<EntityRef> refs,
EntityDictionaryEntry
dictionary, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
public ServiceResults postEntityDictionary( ServiceContext context,
List<EntityRef> refs,
EntityDictionaryEntry
dictionary, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
@@ -1162,7 +1163,7 @@ public abstract class AbstractService implements Service {
public ServiceResults handleEntityCommand( ServiceContext context,
ServiceResults results, String command )
- throws Exception {
+ throws Exception {
if ( command != null ) {
if ( results.size() == 1 ) {
results = handleEntityCommand( context, results.getRef(),
command );
@@ -1176,7 +1177,7 @@ public abstract class AbstractService implements Service {
public ServiceResults handleEntityCommand( ServiceContext context,
EntityRef ref, String command )
- throws Exception {
+ throws Exception {
if ( ref == null ) {
throw new UnsupportedServiceOperationException( context );
}
@@ -1187,7 +1188,7 @@ public abstract class AbstractService implements Service {
public ServiceResults handleEntityCommand( ServiceContext context,
List<EntityRef> refs, String command )
- throws Exception {
+ throws Exception {
if ( ( refs == null ) || ( refs.size() == 0 ) ) {
throw new UnsupportedServiceOperationException( context );
}
@@ -1213,7 +1214,7 @@ public abstract class AbstractService implements Service {
public ServiceResults getEntityCommand( ServiceContext context,
List<EntityRef> refs, String command )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
@@ -1232,13 +1233,13 @@ public abstract class AbstractService implements
Service {
public ServiceResults deleteEntityCommand( ServiceContext context,
List<EntityRef> refs, String command )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
public ServiceResults headEntityCommand( ServiceContext context,
List<EntityRef> refs, String command )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
@@ -1299,13 +1300,13 @@ public abstract class AbstractService implements
Service {
public ServiceResults putServiceMetadata( ServiceContext context, String
metadataType, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
public ServiceResults postServiceMetadata( ServiceContext context, String
metadataType, ServicePayload payload )
- throws Exception {
+ throws Exception {
throw new UnsupportedServiceOperationException( context );
}
@@ -1356,8 +1357,8 @@ public abstract class AbstractService implements Service {
return;
}
String perm =
- getPermissionFromPath( em.getApplicationRef().getUuid(),
context.getAction().toString().toLowerCase(),
- path );
+ getPermissionFromPath( em.getApplicationRef().getUuid(),
context.getAction().toString().toLowerCase(),
+ path );
boolean permitted = currentUser.isPermitted( perm );
if ( logger.isDebugEnabled() ) {
logger.debug( PATH_MSG, new Object[] { path, context.getAction(),
perm, permitted } );
@@ -1370,8 +1371,8 @@ public abstract class AbstractService implements Service {
private static final String PATH_MSG =
- "---- Checked permissions for path
--------------------------------------------\n" + "Requested path: {} \n"
- + "Requested action: {} \n" + "Requested permission: {}
\n" + "Permitted: {} \n";
+ "---- Checked permissions for path
--------------------------------------------\n" + "Requested path: {} \n"
+ + "Requested action: {} \n" + "Requested permission: {} \n" +
"Permitted: {} \n";
/** Purpose is to enable entity dictionary entries to have name not equal
to path segment. */