Bypass check of app APM setting if APM not enabled
Project: http://git-wip-us.apache.org/repos/asf/usergrid/repo Commit: http://git-wip-us.apache.org/repos/asf/usergrid/commit/9e16e2f0 Tree: http://git-wip-us.apache.org/repos/asf/usergrid/tree/9e16e2f0 Diff: http://git-wip-us.apache.org/repos/asf/usergrid/diff/9e16e2f0 Branch: refs/heads/expose-reindex Commit: 9e16e2f006676d9e16997d378224e06a8683c744 Parents: 4170295 Author: Mike Dunker <mdun...@google.com> Authored: Thu Sep 14 15:07:30 2017 -0700 Committer: Mike Dunker <mdun...@google.com> Committed: Thu Sep 14 15:07:30 2017 -0700 ---------------------------------------------------------------------- .../apache/usergrid/rest/applications/ApplicationResource.java | 4 ++++ .../java/org/apache/usergrid/management/ManagementService.java | 2 ++ .../usergrid/management/cassandra/ManagementServiceImpl.java | 5 +++++ 3 files changed, 11 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/usergrid/blob/9e16e2f0/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java ---------------------------------------------------------------------- diff --git a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java index 7479a90..a6eefb1 100644 --- a/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java +++ b/stack/rest/src/main/java/org/apache/usergrid/rest/applications/ApplicationResource.java @@ -621,6 +621,10 @@ public class ApplicationResource extends CollectionResource { public Object getAPMConfig( @Context UriInfo ui, @QueryParam("callback") @DefaultValue("callback") String callback ) throws Exception { + if (!management.isAPMEnabled()) { + // no need to check app for setting + throw new EntityNotFoundException("apigeeMobileConfig not enabled."); + } EntityManager em = emf.getEntityManager( applicationId ); Object value = em.getProperty( new SimpleEntityRef( Application.ENTITY_TYPE, applicationId ), APIGEE_MOBILE_APM_CONFIG_JSON_KEY ); http://git-wip-us.apache.org/repos/asf/usergrid/blob/9e16e2f0/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java ---------------------------------------------------------------------- diff --git a/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java b/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java index 8b840d6..3d0c9fb 100644 --- a/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java +++ b/stack/services/src/main/java/org/apache/usergrid/management/ManagementService.java @@ -343,6 +343,8 @@ public interface ManagementService { Object registerAppWithAPM( OrganizationInfo orgInfo, ApplicationInfo appInfo ) throws Exception; + boolean isAPMEnabled() throws Exception; + /** For testing purposes only */ Properties getProperties(); http://git-wip-us.apache.org/repos/asf/usergrid/blob/9e16e2f0/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java ---------------------------------------------------------------------- diff --git a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java index 89375fd..2302d8d 100644 --- a/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java +++ b/stack/services/src/main/java/org/apache/usergrid/management/cassandra/ManagementServiceImpl.java @@ -3404,6 +3404,11 @@ public class ManagementServiceImpl implements ManagementService { } @Override + public boolean isAPMEnabled() throws Exception { + return false; + } + + @Override public Observable<Id> deleteAllEntities(final UUID applicationId,final int limit){ if(applicationId.equals(CpNamingUtils.MANAGEMENT_APPLICATION_ID)){ throw new IllegalArgumentException("Can't delete from management app");