From 2eb5aebb608b873dcc8a860d23848db2a4b59ab1 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Wed, 25 May 2016 13:53:39 +0530 Subject: [PATCH 1/3] fixed code issues in EventService --- .../android/services/event/EventService.java | 10 +++++----- .../services/event/impl/EventServiceImpl.java | 13 ++++++------- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 9 +++++++++ 3 files changed, 20 insertions(+), 12 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/event/EventService.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/event/EventService.java index 30ce612d6..6eb87f002 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/event/EventService.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/event/EventService.java @@ -21,7 +21,6 @@ package org.wso2.carbon.mdm.services.android.services.event; import io.swagger.annotations.*; import org.wso2.carbon.mdm.services.android.bean.DeviceState; import org.wso2.carbon.mdm.services.android.bean.wrapper.EventBeanWrapper; -import org.wso2.carbon.mdm.services.android.exception.AndroidAgentException; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; @@ -49,7 +48,8 @@ public interface EventService { @HeaderParam(ACCEPT) String acceptHeader, @ApiParam(name = "eventBeanWrapper", value = "Information of the agent event to be published on DAS.") - EventBeanWrapper eventBeanWrapper) throws AndroidAgentException; + EventBeanWrapper eventBeanWrapper); + @GET @Path("{deviceId}") @Produces("application/json") @@ -70,7 +70,7 @@ public interface EventService { Response retrieveAlert(@ApiParam(name = "acceptHeader", value = "Accept Header.") @HeaderParam(ACCEPT) String acceptHeader, @ApiParam(name = "deviceId", value = "DeviceId which need to retrieve published events.") - @PathParam("deviceId") String deviceId) throws AndroidAgentException; + @PathParam("deviceId") String deviceId); @GET @Path("{deviceId}/date") @@ -97,7 +97,7 @@ public interface EventService { @ApiParam(name = "from", value = "From Date.") @QueryParam("from") long from, @ApiParam(name = "to", value = "To Date.") - @QueryParam("to") long to) throws AndroidAgentException; + @QueryParam("to") long to); @GET @Path("{deviceId}/type/{type}") @@ -120,5 +120,5 @@ public interface EventService { @ApiParam(name = "deviceId", value = "Device Identifier to be need to retrieve events.") @PathParam("deviceId") String deviceId, @ApiParam(name = "type", value = "Type of the Alert to be need to retrieve events.") - @PathParam("type") String type) throws AndroidAgentException; + @PathParam("type") String type); } 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/event/impl/EventServiceImpl.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/event/impl/EventServiceImpl.java index 16d80297d..00f9f9759 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/event/impl/EventServiceImpl.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/event/impl/EventServiceImpl.java @@ -42,7 +42,7 @@ public class EventServiceImpl implements EventService { @POST public Response publishEvents(@HeaderParam(ACCEPT) String acceptHeader, - EventBeanWrapper eventBeanWrapper) throws AndroidAgentException { + EventBeanWrapper eventBeanWrapper) { if (log.isDebugEnabled()) { log.debug("Invoking Android device even logging."); @@ -73,7 +73,7 @@ public class EventServiceImpl implements EventService { @Produces("application/json") @GET public Response retrieveAlert(@HeaderParam(ACCEPT) String acceptHeader, - @PathParam("deviceId") String deviceId) throws AndroidAgentException { + @PathParam("deviceId") String deviceId) { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device Identifier."); @@ -104,7 +104,7 @@ public class EventServiceImpl implements EventService { @GET public Response retrieveAlertFromDate(@HeaderParam(ACCEPT) String acceptHeader, @PathParam("deviceId") String deviceId, @QueryParam("from") long from, - @QueryParam("to") long to) throws AndroidAgentException { + @QueryParam("to") long to) { String fromDate = String.valueOf(from); String toDate = String.valueOf(to); if (log.isDebugEnabled()) { @@ -136,8 +136,7 @@ public class EventServiceImpl implements EventService { @Path("{deviceId}/type/{type}") @GET public Response retrieveAlertType(@HeaderParam(ACCEPT) String acceptHeader, - @PathParam("deviceId") String deviceId, @PathParam("type") String type) - throws AndroidAgentException { + @PathParam("deviceId") String deviceId, @PathParam("type") String type) { if (log.isDebugEnabled()) { log.debug("Retrieving events for given device identifier and type."); @@ -149,8 +148,8 @@ public class EventServiceImpl implements EventService { try { deviceStates = AndroidAPIUtils.getAllEventsForDevice(EVENT_STREAM_DEFINITION, query); if (deviceStates == null) { - message.setResponseCode("No any alerts are published for given Device: " + - "" + deviceId + " on specific date."); + message.setResponseCode("No any alerts are published for given Device: " + + deviceId + " on specific date."); return Response.status(Response.Status.OK).entity(message).build(); } else { diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 27ff000ae..1eb310318 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -68,6 +68,15 @@ + + + + + + + + + From d4bce21f75e41209e5b0043cfe59f610d636d597 Mon Sep 17 00:00:00 2001 From: hasuniea Date: Fri, 27 May 2016 18:45:20 +0530 Subject: [PATCH 2/3] windows plugin --- .../pom.xml | 17 ++++++++++++++--- .../windows/services/authbst/BSTProvider.java | 2 ++ .../ConfigurationMgtService.java | 2 ++ .../DeviceManagementService.java | 2 -- .../services/discovery/DiscoveryService.java | 2 ++ .../policymgtservice/PolicyMgtService.java | 3 --- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 6 +++--- .../src/main/resources/p2.inf | 3 +-- 8 files changed, 24 insertions(+), 13 deletions(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 33f3d3b25..1ae84a457 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -3,7 +3,7 @@ ~ ~ WSO2 Inc. licenses this file to you under the Apache License, ~ Version 2.0 (the "License"); you may not use this file except - ~ in compliance with the License. + ~ in compliance with the License.a ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 @@ -72,7 +72,7 @@ - + @@ -129,6 +129,12 @@ org.apache.cxf cxf-rt-bindings-http + + + org.slf4j + slf4j-api + + org.apache.ws.security @@ -263,6 +269,12 @@ org.wso2.carbon.identity org.wso2.carbon.identity.oauth provided + + + org.slf4j + slf4j-api + + javax.cache @@ -306,7 +318,6 @@ io.swagger swagger-annotations - provided diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java index a29170b37..fda4845a3 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/authbst/BSTProvider.java @@ -18,6 +18,7 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.authbst; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @@ -33,6 +34,7 @@ import javax.ws.rs.core.Response; /** * Interface for handling authentication request comes via MDM login page. */ +@Api(value = "BSTProvider", description = "Windows Device Management REST-API implementation.") @Path("/bst") public interface BSTProvider { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java index f943affb0..cbf499680 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/configurationmgtservice/ConfigurationMgtService.java @@ -18,6 +18,7 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @@ -36,6 +37,7 @@ import javax.ws.rs.core.MediaType; @WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) +@Api(value = "ConfigurationMgtService", description = "Windows Device Management REST-API implementation.") public interface ConfigurationMgtService { /** diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java index 34ff654fd..be175c9f1 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/devicemgtservice/DeviceManagementService.java @@ -27,7 +27,6 @@ import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; -import javax.jws.WebService; import javax.ws.rs.*; import javax.ws.rs.core.MediaType; import java.util.List; @@ -37,7 +36,6 @@ import java.util.List; * All end points supports JSON, XMl with content negotiation. */ @Api(value = "DeviceManagementService", description = "Windows Device Management REST-API implementation.") -@WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) public interface DeviceManagementService { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java index b4a206fce..3bd6c7cb6 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/discovery/DiscoveryService.java @@ -18,6 +18,7 @@ package org.wso2.carbon.mdm.mobileservices.windows.services.discovery; +import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; @@ -43,6 +44,7 @@ import javax.xml.ws.soap.SOAPBinding; @WebService(targetNamespace = PluginConstants.DISCOVERY_SERVICE_TARGET_NAMESPACE, name = "IDiscoveryService") @BindingType(value = SOAPBinding.SOAP12HTTP_BINDING) +@Api(value = "DiscoveryService", description = "Windows Device Management REST-API implementation.") public interface DiscoveryService { @POST diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java index 348d3068f..bb1ed19b0 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/java/org/wso2/carbon/mdm/mobileservices/windows/services/policymgtservice/PolicyMgtService.java @@ -22,18 +22,15 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiResponse; import io.swagger.annotations.ApiResponses; - import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; -import javax.jws.WebService; import javax.ws.rs.*; /** * Endpoint for Enforce Effective Policy. */ @Api(value = "PolicyMgtService", description = "Windows Device Management REST-API implementation.") -@WebService @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) public interface PolicyMgtService { diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 168cb1c53..b19ad6fa7 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -197,11 +197,11 @@ class="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.util.MessageHandler"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice.impl.ConfigurationMgtServiceImpl"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice.impl.PolicyMgtServiceImpl"/> + class="org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice.impl.DeviceManagementServiceImpl"/> diff --git a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf index 92ebf2462..11320712c 100644 --- a/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf +++ b/features/mobile-plugins-feature/windows-plugin-feature/org.wso2.carbon.device.mgt.mobile.windows.feature/src/main/resources/p2.inf @@ -1,7 +1,6 @@ instructions.configure = \ -org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\ -org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/webapps/mdm-windows-agent.war,target:${installFolder}/../../deployment/server/webapps/mdm-windows-agent.war,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins/windows,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../database/);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile.windows_${feature.version}/database/,target:${installFolder}/../../database/,overwrite:true);\ From cc8190b541b2cae0d6fcc9d9f804b74c152cbdec Mon Sep 17 00:00:00 2001 From: hasuniea Date: Fri, 27 May 2016 20:03:25 +0530 Subject: [PATCH 3/3] add windows feature --- .../org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml index 1ae84a457..944446791 100644 --- a/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml +++ b/components/mobile-plugins/windows-plugin/org.wso2.carbon.device.mgt.mobile.windows.api/pom.xml @@ -72,7 +72,7 @@ - +