parent
d2d39a241e
commit
68cabad5b8
@ -1,111 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.device.mgt.mobile.windows.api.services;
|
|
||||||
|
|
||||||
import io.swagger.annotations.SwaggerDefinition;
|
|
||||||
import io.swagger.annotations.Info;
|
|
||||||
import io.swagger.annotations.ExtensionProperty;
|
|
||||||
import io.swagger.annotations.Extension;
|
|
||||||
import io.swagger.annotations.Tag;
|
|
||||||
import io.swagger.annotations.Api;
|
|
||||||
import org.wso2.carbon.device.mgt.common.Device;
|
|
||||||
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
|
|
||||||
import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
|
|
||||||
|
|
||||||
import javax.jws.WebService;
|
|
||||||
import javax.ws.rs.Consumes;
|
|
||||||
import javax.ws.rs.GET;
|
|
||||||
import javax.ws.rs.PUT;
|
|
||||||
import javax.ws.rs.Path;
|
|
||||||
import javax.ws.rs.PathParam;
|
|
||||||
import javax.ws.rs.Produces;
|
|
||||||
import javax.ws.rs.core.MediaType;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Windows Device Management REST-API implementation. All end points supports JSON, XMl with content negotiation.
|
|
||||||
*/
|
|
||||||
@Api(value = "Windows Device Management",
|
|
||||||
description = "This carries all the resources related to Windows device management functionalities")
|
|
||||||
|
|
||||||
@SwaggerDefinition(
|
|
||||||
info = @Info(
|
|
||||||
version = "1.0.0",
|
|
||||||
title = "",
|
|
||||||
extensions = {
|
|
||||||
@Extension(properties = {
|
|
||||||
@ExtensionProperty(name = "name", value = "Windows Device Management"),
|
|
||||||
@ExtensionProperty(name = "context", value = "/api/device-mgt/windows/v1.0/devices"),
|
|
||||||
})
|
|
||||||
}
|
|
||||||
),
|
|
||||||
tags = {
|
|
||||||
@Tag(name = "devicemgt_windows", description = "")
|
|
||||||
}
|
|
||||||
)
|
|
||||||
@WebService
|
|
||||||
@Path("/devices")
|
|
||||||
@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
||||||
@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
||||||
public interface DeviceManagementService {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get all devices.Returns list of Windows devices registered in MDM.
|
|
||||||
*
|
|
||||||
* @return Returns retrieved devices.
|
|
||||||
* @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
List<Device> getAllDevices() throws WindowsConfigurationException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch Windows device details of a given device Id.
|
|
||||||
*
|
|
||||||
* @param deviceId Device Id
|
|
||||||
* @return Returns retrieved device.
|
|
||||||
* @throws WindowsConfigurationException occurred while getting device from DB.
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("{id}")
|
|
||||||
Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Update Windows device details of given device id.
|
|
||||||
*
|
|
||||||
* @param deviceId Device Id.
|
|
||||||
* @param device Device details to be updated.
|
|
||||||
* @return Returns the message whether device update or not.
|
|
||||||
* @throws WindowsConfigurationException occurred while updating the Device Info.
|
|
||||||
*/
|
|
||||||
@PUT
|
|
||||||
@Path("{id}")
|
|
||||||
Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Fetch the Licence agreement for specific windows platform.
|
|
||||||
*
|
|
||||||
* @return Returns License agreement.
|
|
||||||
* @throws WindowsConfigurationException occurred while getting licence for specific platform and Language.
|
|
||||||
*/
|
|
||||||
@GET
|
|
||||||
@Path("license")
|
|
||||||
@Produces("application/json")
|
|
||||||
License getLicense() throws WindowsConfigurationException;
|
|
||||||
}
|
|
@ -1,157 +0,0 @@
|
|||||||
///*
|
|
||||||
// * 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.device.mgt.mobile.windows.api.services.impl;
|
|
||||||
//
|
|
||||||
//import org.apache.commons.logging.Log;
|
|
||||||
//import org.apache.commons.logging.LogFactory;
|
|
||||||
//import org.wso2.carbon.device.mgt.common.Device;
|
|
||||||
//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.license.mgt.License;
|
|
||||||
//import org.wso2.carbon.device.mgt.mobile.windows.api.common.exceptions.WindowsConfigurationException;
|
|
||||||
//import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.Message;
|
|
||||||
//import org.wso2.carbon.device.mgt.mobile.windows.api.common.util.WindowsAPIUtils;
|
|
||||||
//import org.wso2.carbon.device.mgt.mobile.windows.api.services.DeviceManagementService;
|
|
||||||
//
|
|
||||||
//import javax.jws.WebService;
|
|
||||||
//import javax.ws.rs.*;
|
|
||||||
//import javax.ws.rs.core.MediaType;
|
|
||||||
//import javax.ws.rs.core.Response;
|
|
||||||
//import java.util.List;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * Windows Device Management REST-API implementation.
|
|
||||||
// * All end points supports JSON, XMl with content negotiation.
|
|
||||||
// */
|
|
||||||
//@WebService
|
|
||||||
//@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
||||||
//@Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
|
|
||||||
//public class DeviceManagementServiceImpl implements DeviceManagementService {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// private static Log log = LogFactory.getLog(
|
|
||||||
// org.wso2.carbon.device.mgt.mobile.windows.api.services.impl.DeviceManagementServiceImpl.class);
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Get all devices.Returns list of Windows devices registered in MDM.
|
|
||||||
// *
|
|
||||||
// * @return Returns retrieved devices.
|
|
||||||
// * @throws WindowsConfigurationException occurred while retrieving all the devices from DB.
|
|
||||||
// */
|
|
||||||
// @GET
|
|
||||||
// public List<Device> getAllDevices() throws WindowsConfigurationException {
|
|
||||||
// String msg;
|
|
||||||
// List<Device> devices;
|
|
||||||
// try {
|
|
||||||
// devices = WindowsAPIUtils.getDeviceManagementService().
|
|
||||||
// getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
|
||||||
// } catch (DeviceManagementException e) {
|
|
||||||
// msg = "Error occurred while fetching the device list.";
|
|
||||||
// log.error(msg, e);
|
|
||||||
// throw new WindowsConfigurationException(msg, e);
|
|
||||||
// }
|
|
||||||
// return devices;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Fetch Windows device details of a given device Id.
|
|
||||||
// *
|
|
||||||
// * @param deviceId Device Id
|
|
||||||
// * @return Returns retrieved device.
|
|
||||||
// * @throws WindowsConfigurationException occurred while getting device from DB.
|
|
||||||
// */
|
|
||||||
// @GET
|
|
||||||
// @Path("{id}")
|
|
||||||
// public Device getDevice(@PathParam("id") String deviceId) throws WindowsConfigurationException {
|
|
||||||
// String msg;
|
|
||||||
// Device device;
|
|
||||||
// try {
|
|
||||||
// DeviceIdentifier deviceIdentifier = WindowsAPIUtils.convertToDeviceIdentifierObject(deviceId);
|
|
||||||
// device = WindowsAPIUtils.getDeviceManagementService().getDevice(deviceIdentifier);
|
|
||||||
// if (device == null) {
|
|
||||||
// Response.status(Response.Status.NOT_FOUND);
|
|
||||||
// }
|
|
||||||
// } catch (DeviceManagementException e) {
|
|
||||||
// msg = "Error occurred while fetching the device information.";
|
|
||||||
// log.error(msg, e);
|
|
||||||
// throw new WindowsConfigurationException(msg, e);
|
|
||||||
// }
|
|
||||||
// return device;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Update Windows device details of given device id.
|
|
||||||
// *
|
|
||||||
// * @param deviceId Device Id.
|
|
||||||
// * @param device Device details to be updated.
|
|
||||||
// * @return Returns the message whether device update or not.
|
|
||||||
// * @throws WindowsConfigurationException occurred while updating the Device Info.
|
|
||||||
// */
|
|
||||||
// @PUT
|
|
||||||
// @Path("{id}")
|
|
||||||
// public Message updateDevice(@PathParam("id") String deviceId, Device device) throws WindowsConfigurationException {
|
|
||||||
// String msg;
|
|
||||||
// Message responseMessage = new Message();
|
|
||||||
// DeviceIdentifier deviceIdentifier = new DeviceIdentifier();
|
|
||||||
// deviceIdentifier.setId(deviceId);
|
|
||||||
// deviceIdentifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
|
||||||
// boolean isUpdated;
|
|
||||||
// try {
|
|
||||||
// device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS);
|
|
||||||
// isUpdated = WindowsAPIUtils.getDeviceManagementService().updateDeviceInfo(deviceIdentifier, device);
|
|
||||||
// if (isUpdated) {
|
|
||||||
// Response.status(Response.Status.ACCEPTED);
|
|
||||||
// responseMessage.setResponseMessage("Device information has modified successfully.");
|
|
||||||
// } else {
|
|
||||||
// Response.status(Response.Status.NOT_MODIFIED);
|
|
||||||
// responseMessage.setResponseMessage("Device not found for the update.");
|
|
||||||
// }
|
|
||||||
// } catch (DeviceManagementException e) {
|
|
||||||
// msg = "Error occurred while modifying the device information.";
|
|
||||||
// log.error(msg, e);
|
|
||||||
// throw new WindowsConfigurationException(msg, e);
|
|
||||||
// }
|
|
||||||
// return responseMessage;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * Fetch the Licence agreement for specific windows platform.
|
|
||||||
// *
|
|
||||||
// * @return Returns License agreement.
|
|
||||||
// * @throws WindowsConfigurationException occurred while getting licence for specific platform and Language.
|
|
||||||
// */
|
|
||||||
// @GET
|
|
||||||
// @Path("license")
|
|
||||||
// @Produces("application/json")
|
|
||||||
// public License getLicense() throws WindowsConfigurationException {
|
|
||||||
// License license;
|
|
||||||
// try {
|
|
||||||
// license =
|
|
||||||
// WindowsAPIUtils.getDeviceManagementService().getLicense(
|
|
||||||
// DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS,
|
|
||||||
// DeviceManagementConstants.LanguageCodes.LANGUAGE_CODE_ENGLISH_US);
|
|
||||||
// } catch (DeviceManagementException e) {
|
|
||||||
// String msg = "Error occurred while retrieving the license configured for Windows device enrollment";
|
|
||||||
// log.error(msg, e);
|
|
||||||
// throw new WindowsConfigurationException(msg, e);
|
|
||||||
// }
|
|
||||||
// return license;
|
|
||||||
// }
|
|
||||||
//}
|
|
Loading…
Reference in new issue