From ec91b0a539fcf99061ea2d6758c0fb9e82b56a05 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Thu, 2 Jun 2016 15:30:09 +0530 Subject: [PATCH 1/3] fixing eventReceiver --- .../android/services/impl/EventReceiverServiceImpl.java | 4 ++-- .../src/main/webapp/META-INF/permissions.xml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java index b7bb1e5dc0..9afe00057b 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java @@ -43,7 +43,7 @@ public class EventReceiverServiceImpl implements EventReceiverService { @POST @Path("/publish") @Override - public Response publishEvents(EventBeanWrapper eventBeanWrapper) { + public Response publishEvents(EventBeanWrapper eventBeanWrapper) { if (log.isDebugEnabled()) { log.debug("Invoking Android device even logging."); } @@ -62,7 +62,7 @@ public class EventReceiverServiceImpl implements EventReceiverService { entity(message).build(); } } catch (DataPublisherConfigurationException e) { - String msg = "Error occurred while getting the Data publisher Service."; + String msg = "Error occurred while getting the Data publisher Service instance."; log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml index 9c6bded302..3251719277 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/META-INF/permissions.xml @@ -388,7 +388,7 @@ Event Retrieve /device-mgt/android/events/view - /events/* + /events GET emm_admin From c170373aced71e4048691dd239507085d1039168 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Thu, 2 Jun 2016 15:57:00 +0530 Subject: [PATCH 2/3] fix responce code --- .../android/services/impl/EventReceiverServiceImpl.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java index 9afe00057b..d80b3606c5 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/impl/EventReceiverServiceImpl.java @@ -150,7 +150,7 @@ public class EventReceiverServiceImpl implements EventReceiverService { deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); if (deviceStates == null) { message.setResponseCode("No any alerts are published for given Device: " + - "" + deviceId + " on specific date."); + "" + deviceId + "and given specific Type."); return Response.status(Response.Status.NOT_FOUND).entity(message).build(); } else { @@ -158,7 +158,7 @@ public class EventReceiverServiceImpl implements EventReceiverService { } } catch (AnalyticsException e) { String msg = "Error occurred while getting published events for specific " + - "Device: " + deviceId + "and given device Type."; + "Device: " + deviceId + "and given specific Type."; log.error(msg, e); throw new UnexpectedServerErrorException( new ErrorResponse.ErrorResponseBuilder().setCode(500l).setMessage(msg).build()); From 2b89b692a42d7565880c22e65880cf02822e1910 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Thu, 2 Jun 2016 16:37:50 +0530 Subject: [PATCH 3/3] adding event configuration refference --- .../mdm/services/android/services/EventReceiverService.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java index 7dc619cd85..c488440906 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/java/org/wso2/carbon/mdm/services/android/services/EventReceiverService.java @@ -26,7 +26,9 @@ import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; -@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.") +@Api(value = "Event Receiver", description = "Event publishing/retrieving related APIs.To enable Eventing need to" + + " configure as ref-https://docs.wso2.com/display/EMM210/Managing+Event+Publishing+with+WSO2+Data+Analytics+Server, " + + "https://docs.wso2.com/display/EMM210/Creating+a+New+Event+Stream+and+Receiver") @Path("/events") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON)