Refactored windows APIs

revert-dabc3590
harshanl 8 years ago
parent 532f66ebc5
commit 16d9338dce

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans; package org.wso2.carbon.mdm.mobileservices.windows.common.beans;
/** /**
* Class for get device IDS. * Class for get device IDS.

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,8 +16,9 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans; package org.wso2.carbon.mdm.mobileservices.windows.common.beans;
import org.wso2.carbon.mdm.mobileservices.windows.common.beans.Device;
import org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans.BasicOperation; import org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans.BasicOperation;
import java.util.List; import java.util.List;

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice; package org.wso2.carbon.mdm.mobileservices.windows.services;
import org.wso2.carbon.apimgt.annotations.api.API; import org.wso2.carbon.apimgt.annotations.api.API;
import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scope;

@ -0,0 +1,56 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.mobileservices.windows.services;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
/**
* Interface for Admin operations persisting. This interface accepts operations added via UI.
*/
@Path("/admin/devices")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface DeviceManagementAdminService {
@POST
@Path("/lock-devices")
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/disenroll-devices")
Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/wipe-devices")
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/ring-devices")
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceIds) throws WindowsDeviceEnrolmentException;
@POST
@Path("/lockreset-devices")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceIds)
throws WindowsDeviceEnrolmentException;
}

@ -4,7 +4,7 @@
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice; package org.wso2.carbon.mdm.mobileservices.windows.services;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.license.mgt.License; import org.wso2.carbon.device.mgt.common.license.mgt.License;
@ -50,25 +50,25 @@ public interface DeviceManagementService {
/** /**
* Fetch Windows device details of a given device Id. * Fetch Windows device details of a given device Id.
* *
* @param id Device Id * @param deviceId Device Id
* @return Returns retrieved device. * @return Returns retrieved device.
* @throws WindowsConfigurationException occurred while getting device from DB. * @throws WindowsConfigurationException occurred while getting device from DB.
*/ */
@GET @GET
@Path("{id}") @Path("{id}")
Device getDevice(@PathParam("id") String id) throws WindowsConfigurationException; Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException;
/** /**
* Update Windows device details of given device id. * Update Windows device details of given device id.
* *
* @param id Device Id. * @param deviceId Device Id.
* @param device Device details to be updated. * @param device Device details to be updated.
* @return Returns the message whether device update or not. * @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info. * @throws WindowsConfigurationException occurred while updating the Device Info.
*/ */
@PUT @PUT
@Path("{id}") @Path("{id}")
Message updateDevice(@PathParam("id") String id, Device device) throws WindowsConfigurationException; Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException;
/** /**
* Fetch the Licence agreement for specific windows platform. * Fetch the Licence agreement for specific windows platform.
* *

@ -0,0 +1,46 @@
/*
* Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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.
* you may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.mobileservices.windows.services;
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.
*/
@WebService
@Produces({ "application/json", "application/xml"})
@Consumes({"application/json", "application/xml"})
public interface PolicyManagementService {
/**
* Get the applicable effective policy for an enrolled windows device.
*
* @param deviceId Device Id
* @return Returns retrieved devices.
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
*/
@GET
@Path("{deviceId}")
Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader,
@PathParam("deviceId") String deviceId) throws WindowsConfigurationException;
}

@ -1,57 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
import java.util.List;
/**
* Interface for Admin operations persisting. This interface accepts operations added via UI.
*/
@Path("/operation")
@Consumes(MediaType.APPLICATION_JSON)
@Produces(MediaType.APPLICATION_JSON)
public interface Operations {
@POST
@Path("/devicelock")
Response lock(@HeaderParam("Accept") String headerParam, List<String> deviceids) throws WindowsDeviceEnrolmentException;
@POST
@Path("/devicedisenroll")
Response disenroll(@HeaderParam("Accept") String headerParam, List<String> deviceids) throws WindowsDeviceEnrolmentException;
@POST
@Path("/devicewipe")
Response wipe(@HeaderParam("Accept") String headerParam, List<String> deviceids) throws WindowsDeviceEnrolmentException;
@POST
@Path("/devicering")
Response ring(@HeaderParam("Accept") String headerParam, List<String> deviceids) throws WindowsDeviceEnrolmentException;
@POST
@Path("/lockreset")
Response lockReset(@HeaderParam("Accept") String acceptHeader, List<String> deviceids)
throws WindowsDeviceEnrolmentException;
}

@ -1,112 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
//package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.util;
//
//import com.google.gson.Gson;
//import org.apache.commons.logging.Log;
//import org.apache.commons.logging.LogFactory;
//import org.wso2.carbon.context.PrivilegedCarbonContext;
//import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
//import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
//import org.wso2.carbon.device.mgt.common.DeviceManagementException;
//import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
//import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
//import org.wso2.carbon.device.mgt.core.operation.mgt.ConfigOperation;
//import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
//import org.wso2.carbon.mdm.mobileservices.windows.common.SyncmlCommandType;
//import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDeviceEnrolmentException;
//import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.Device;
//import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.beans.OperationRequest;
//import org.wso2.carbon.mdm.mobileservices.windows.services.syncml.beans.Wifi;
//
//import java.util.ArrayList;
//import java.util.List;
//
//public class OperationStore {
//
// private static Log log = LogFactory.getLog(OperationStore.class);
//
// public static boolean storeOperation(OperationRequest operationRequest, Operation.Type type,
// String commandType) throws
// WindowsDeviceEnrolmentException {
//
// List<Device> devices = operationRequest.getDeviceList();
// List<DeviceIdentifier> deviceIdentifiers = new ArrayList<DeviceIdentifier>();
// DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
//
// Operation operation = transformBasicOperation(operationRequest, type, commandType);
//
// for (int i = 0; i < devices.size(); i++) {
// try {
// deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
// deviceIdentifier.setId(devices.get(i).getID());
// deviceIdentifiers.add(deviceIdentifier);
// getDeviceManagementServiceProvider().getDevice(deviceIdentifier);
//
// } catch (DeviceManagementException e) {
// log.error("Cannot validate device ID: " + devices.get(i).getID());
// deviceIdentifiers.remove(i);
// }
// }
// try {
// getDeviceManagementServiceProvider().addOperation(operation, deviceIdentifiers);
// } catch (OperationManagementException e) {
// String msg = "Failure occurred while storing command operation.";
// log.error(msg);
// return false;
// }
// return true;
// }
//
// private static DeviceManagementProviderService getDeviceManagementServiceProvider() {
// DeviceManagementProviderService deviceManager;
// PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
// deviceManager =
// (DeviceManagementProviderService) ctx.getOSGiService(DeviceManagementProviderService.class, null);
//
// if (deviceManager == null) {
// String msg = "Device management service is not initialized.";
// log.error(msg);
// }
// return deviceManager;
// }
//
// private static Operation transformBasicOperation(OperationRequest operationRequest, Operation.Type type,
// String commandType) throws WindowsDeviceEnrolmentException {
//
// Operation operation = new Operation();
// operation.setCode(commandType);
// operation.setType(type);
// Gson gson = new Gson();
//
// if (commandType == SyncmlCommandType.WIFI.getValue()) {
//
// operation = new ConfigOperation();
// operation.setCode(commandType);
// operation.setType(type);
//
// Wifi wifiObject = (Wifi) operationRequest.getBasicOperation();
// operation.setPayLoad(gson.toJson(wifiObject));
// } else {
// // no operation.....
// }
//
// return operation;
// }
//}

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice; package org.wso2.carbon.mdm.mobileservices.windows.services.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -29,6 +29,7 @@ import org.wso2.carbon.mdm.mobileservices.windows.common.PluginConstants;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils;
import org.wso2.carbon.mdm.mobileservices.windows.services.ConfigurationMgtService;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -40,7 +41,7 @@ import java.util.List;
@Produces({"application/json", "application/xml"}) @Produces({"application/json", "application/xml"})
@Consumes({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"})
@Path("/") @Path("/")
public class ConfigurationMgtServiceImpl implements ConfigurationMgtService{ public class ConfigurationMgtServiceImpl implements ConfigurationMgtService {
private static Log log = LogFactory.getLog(ConfigurationMgtServiceImpl.class); private static Log log = LogFactory.getLog(ConfigurationMgtServiceImpl.class);

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.impl; package org.wso2.carbon.mdm.mobileservices.windows.services.impl;
import com.ibm.wsdl.OperationImpl; import com.ibm.wsdl.OperationImpl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
@ -30,7 +30,7 @@ import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsDevic
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsOperationsException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsOperationsException;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils;
import org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.Operations; import org.wso2.carbon.mdm.mobileservices.windows.services.DeviceManagementAdminService;
import javax.ws.rs.HeaderParam; import javax.ws.rs.HeaderParam;
import javax.ws.rs.POST; import javax.ws.rs.POST;
@ -43,7 +43,7 @@ import java.util.List;
* Implementation class of operations interface. Each method in this class receives the operations comes via UI * Implementation class of operations interface. Each method in this class receives the operations comes via UI
* and persists those in the correct format. * and persists those in the correct format.
*/ */
public class OperationsImpl implements Operations { public class DeviceManagementAdminServiceImpl implements DeviceManagementAdminService {
private static Log log = LogFactory.getLog(OperationImpl.class); private static Log log = LogFactory.getLog(OperationImpl.class);
@ -56,7 +56,7 @@ public class OperationsImpl implements Operations {
* @throws WindowsDeviceEnrolmentException * @throws WindowsDeviceEnrolmentException
*/ */
@POST @POST
@Path("/lock") @Path("/lock-devices")
public Response lock(@HeaderParam("Accept") String acceptHeader, List<String> deviceIDs) public Response lock(@HeaderParam("Accept") String acceptHeader, List<String> deviceIDs)
throws WindowsDeviceEnrolmentException { throws WindowsDeviceEnrolmentException {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {

@ -4,7 +4,7 @@
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice.impl; package org.wso2.carbon.mdm.mobileservices.windows.services.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -28,7 +28,7 @@ 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.exceptions.WindowsConfigurationException;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils;
import org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice.DeviceManagementService; import org.wso2.carbon.mdm.mobileservices.windows.services.DeviceManagementService;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.*; import javax.ws.rs.*;
@ -72,17 +72,17 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
/** /**
* Fetch Windows device details of a given device Id. * Fetch Windows device details of a given device Id.
* *
* @param id Device Id * @param deviceId Device Id
* @return Returns retrieved device. * @return Returns retrieved device.
* @throws WindowsConfigurationException occurred while getting device from DB. * @throws WindowsConfigurationException occurred while getting device from DB.
*/ */
@GET @GET
@Path("{id}") @Path("{id}")
public Device getDevice(@PathParam("id") String id) throws WindowsConfigurationException { public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException {
String msg; String msg;
Device device; Device device;
try { try {
DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier); device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
if (device == null) { if (device == null) {
Response.status(Response.Status.NOT_FOUND); Response.status(Response.Status.NOT_FOUND);
@ -98,18 +98,18 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
/** /**
* Update Windows device details of given device id. * Update Windows device details of given device id.
* *
* @param id Device Id. * @param deviceId Device Id.
* @param device Device details to be updated. * @param device Device details to be updated.
* @return Returns the message whether device update or not. * @return Returns the message whether device update or not.
* @throws WindowsConfigurationException occurred while updating the Device Info. * @throws WindowsConfigurationException occurred while updating the Device Info.
*/ */
@PUT @PUT
@Path("{id}") @Path("{id}")
public Message updateDevice(@PathParam("id") String id, Device device) throws WindowsConfigurationException { public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException {
String msg; String msg;
Message responseMessage = new Message(); Message responseMessage = new Message();
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(); DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
deviceIdentifier.setId(id); deviceIdentifier.setId(deviceId);
deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS); deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
boolean isUpdated; boolean isUpdated;
try { try {

@ -1,10 +1,10 @@
/* /*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * Copyright (c) 2016, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
* *
* WSO2 Inc. licenses this file to you under the Apache License, * WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except * Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. * in compliance with the License.
* You may obtain a copy of the License at * you may obtain a copy of the License at
* *
* http://www.apache.org/licenses/LICENSE-2.0 * http://www.apache.org/licenses/LICENSE-2.0
* *
@ -16,7 +16,7 @@
* under the License. * under the License.
*/ */
package org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice; package org.wso2.carbon.mdm.mobileservices.windows.services.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -24,29 +24,28 @@ import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException; import org.wso2.carbon.mdm.mobileservices.windows.common.exceptions.WindowsConfigurationException;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message; import org.wso2.carbon.mdm.mobileservices.windows.common.util.Message;
import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils; import org.wso2.carbon.mdm.mobileservices.windows.common.util.WindowsAPIUtils;
import org.wso2.carbon.mdm.mobileservices.windows.services.PolicyManagementService;
import org.wso2.carbon.policy.mgt.common.Policy; import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException; import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService; import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import javax.jws.WebService; import javax.jws.WebService;
import javax.ws.rs.*; import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
/**
* Endpoint for Enforce Effective Policy.
*/
@WebService @WebService
@Produces({"application/json", "application/xml"}) @Produces({ MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
@Consumes({"application/json", "application/xml"}) @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public class PolicyMgtService { public class PolicyManagementServiceImpl implements PolicyManagementService {
private static Log log = LogFactory.getLog(PolicyMgtService.class); private static Log log = LogFactory.getLog(PolicyManagementServiceImpl.class);
@GET @GET
@Path("{id}") @Path("{deviceId}")
public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader, public Message getEffectivePolicy(@HeaderParam("Accept") String acceptHeader,
@PathParam("id") String id) throws WindowsConfigurationException { @PathParam("deviceId") String deviceId) throws WindowsConfigurationException {
DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(id); DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
Message responseMessage = new Message(); Message responseMessage = new Message();
Policy policy; Policy policy;
try { try {

@ -44,7 +44,7 @@ public interface CertificateEnrollmentService {
@WebMethod(operationName = "RequestSecurityToken") @WebMethod(operationName = "RequestSecurityToken")
@ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace = @ResponseWrapper(localName = "RequestSecurityTokenResponseCollection", targetNamespace =
PluginConstants.WS_TRUST_TARGET_NAMESPACE) PluginConstants.WS_TRUST_TARGET_NAMESPACE)
public void requestSecurityToken( void requestSecurityToken(
@WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) @WebParam(name = "TokenType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)
String tokenType, String tokenType,
@WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE) @WebParam(name = "RequestType", targetNamespace = PluginConstants.WS_TRUST_TARGET_NAMESPACE)

@ -32,7 +32,7 @@
<!--Discovery Service GET Endpoint--> <!--Discovery Service GET Endpoint-->
<jaxrs:server id="DiscoveryService_rest" address="/discovery/get"> <jaxrs:server id="DiscoveryService_rest" address="/discovery/get">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="DiscoveryService_rest_bean"/> <ref bean="discoveryService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
</jaxrs:server> </jaxrs:server>
@ -114,14 +114,14 @@
<!--BST provider Endpoint for returning binary security token after authentication--> <!--BST provider Endpoint for returning binary security token after authentication-->
<jaxrs:server id="bstprovider" address="/federated"> <jaxrs:server id="bstprovider" address="/federated">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="bstprovider_bean"/> <ref bean="bstProviderService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
</jaxrs:server> </jaxrs:server>
<!--Endpoint for UI admin operations--> <!--Endpoint for UI admin operations-->
<jaxrs:server id="adminoperations" address="/windows"> <jaxrs:server id="adminoperations" address="/windows">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="adminoperations_bean"/> <ref bean="deviceMgtAdminService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
@ -131,7 +131,7 @@
<!-- Endpoint for Configurations --> <!-- Endpoint for Configurations -->
<jaxrs:server id="configurationService" address="/configuration"> <jaxrs:server id="configurationService" address="/configuration">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="configurationServiceBean"/> <ref bean="configurationMgtService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
@ -142,7 +142,7 @@
<!--Endpoint for Policy --> <!--Endpoint for Policy -->
<jaxrs:server id="policyService" address="/policy"> <jaxrs:server id="policyService" address="/policy">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="policyServiceBean"/> <ref bean="policyManagementService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
@ -153,7 +153,7 @@
<!--Endpoint for Devicemanager --> <!--Endpoint for Devicemanager -->
<jaxrs:server id="deviceManagementService" address="/device"> <jaxrs:server id="deviceManagementService" address="/device">
<jaxrs:serviceBeans> <jaxrs:serviceBeans>
<ref bean="deviceMgtServiceBean"/> <ref bean="deviceMgtService"/>
</jaxrs:serviceBeans> </jaxrs:serviceBeans>
<jaxrs:providers> <jaxrs:providers>
<ref bean="jsonProvider"/> <ref bean="jsonProvider"/>
@ -161,11 +161,11 @@
</jaxrs:providers> </jaxrs:providers>
</jaxrs:server> </jaxrs:server>
<bean id="bstprovider_bean" <bean id="bstProviderService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.authbst.impl.BSTProviderImpl"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.authbst.impl.BSTProviderImpl"/>
<bean id="adminoperations_bean" <bean id="deviceMgtAdminService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.adminoperations.impl.OperationsImpl"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.impl.DeviceManagementAdminServiceImpl"/>
<bean id="DiscoveryService_rest_bean" <bean id="discoveryService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.discovery.impl.DiscoveryServiceImpl"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.discovery.impl.DiscoveryServiceImpl"/>
<bean id="wss4jInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor"> <bean id="wss4jInInterceptor" class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<property name="properties"> <property name="properties">
@ -196,12 +196,12 @@
<bean id="serviceOptionsHandler" <bean id="serviceOptionsHandler"
class="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.util.MessageHandler"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.wstep.util.MessageHandler"/>
<bean id="jsonProvider" class="org.wso2.carbon.mdm.mobileservices.windows.common.util.GsonMessageBodyHandler"/> <bean id="jsonProvider" class="org.wso2.carbon.mdm.mobileservices.windows.common.util.GsonMessageBodyHandler"/>
<bean id="configurationServiceBean" <bean id="configurationMgtService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.configurationmgtservice.ConfigurationMgtServiceImpl"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.impl.ConfigurationMgtServiceImpl"/>
<bean id="policyServiceBean" <bean id="policyManagementService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.policymgtservice.PolicyMgtService"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.impl.PolicyManagementServiceImpl"/>
<bean id="errorHandler" class="org.wso2.carbon.mdm.mobileservices.windows.common.util.ErrorHandler"/> <bean id="errorHandler" class="org.wso2.carbon.mdm.mobileservices.windows.common.util.ErrorHandler"/>
<bean id="deviceMgtServiceBean" <bean id="deviceMgtService"
class="org.wso2.carbon.mdm.mobileservices.windows.services.devicemgtservice.impl.DeviceManagementServiceImpl"/> class="org.wso2.carbon.mdm.mobileservices.windows.services.impl.DeviceManagementServiceImpl"/>
</beans> </beans>

Loading…
Cancel
Save