mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Merge branch 'master' of https://github.com/geethkokila/product-cdm
This commit is contained in:
commit
ff859eaf19
@ -18,9 +18,6 @@
|
|||||||
|
|
||||||
package org.wso2.carbon.device.mgt.common;
|
package org.wso2.carbon.device.mgt.common;
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by manoj on 12/22/14.
|
|
||||||
*/
|
|
||||||
public class DeviceManagementServiceException extends Exception {
|
public class DeviceManagementServiceException extends Exception {
|
||||||
|
|
||||||
private static final long serialVersionUID = -8933146283800122640L;
|
private static final long serialVersionUID = -8933146283800122640L;
|
||||||
|
|||||||
@ -1,28 +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.
|
|
||||||
* 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.core.dao;
|
|
||||||
|
|
||||||
import org.testng.Assert;
|
|
||||||
|
|
||||||
public class DeviceDAOTest {
|
|
||||||
|
|
||||||
// @Test
|
|
||||||
public void setUp() throws Exception {
|
|
||||||
// log.info("Testing started.");
|
|
||||||
Assert.assertEquals("A", "A");
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +1,20 @@
|
|||||||
<!--
|
<!--
|
||||||
~ Copyright 2014 WSO2, Inc. (http://wso2.com)
|
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
~ you may not use this file except in compliance with the 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
|
~ 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
|
||||||
~
|
~
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
~ software distributed under the License is distributed on an
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
~ See the License for the specific language governing permissions and
|
~ KIND, either express or implied. See the License for the
|
||||||
~ limitations under the License.
|
~ specific language governing permissions and limitations
|
||||||
-->
|
~ under the License.
|
||||||
|
-->
|
||||||
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
@ -176,5 +178,4 @@
|
|||||||
<cxf.version>2.6.1</cxf.version>
|
<cxf.version>2.6.1</cxf.version>
|
||||||
<junit.version>4.8.2</junit.version>
|
<junit.version>4.8.2</junit.version>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright 2011-2012 WSO2, Inc. (http://wso2.com)
|
|
||||||
*
|
|
||||||
* Licensed 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 cdm.api.android;
|
|
||||||
|
|
||||||
import javax.ws.rs.*;
|
|
||||||
|
|
||||||
@Path("/authenticate/")
|
|
||||||
public class Authentication {
|
|
||||||
|
|
||||||
@POST
|
|
||||||
@Path("/device/")
|
|
||||||
public String authenticateDevice(@FormParam("username") String username,
|
|
||||||
@FormParam("password") String password) {
|
|
||||||
return "jwwfowrjwqporqwrpqworpq";
|
|
||||||
}
|
|
||||||
|
|
||||||
@POST
|
|
||||||
@Path("/device/license")
|
|
||||||
@Produces ("text/plain")
|
|
||||||
public String getLicense() {
|
|
||||||
return "License Agreement";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,19 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* you may not use this file except in compliance with the 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
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* software distributed under the License is distributed on an
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* See the License for the specific language governing permissions and
|
* KIND, either express or implied. See the License for the
|
||||||
* limitations under the License.
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android;
|
package cdm.api.android;
|
||||||
|
|
||||||
import cdm.api.android.common.AndroidAgentException;
|
import cdm.api.android.common.AndroidAgentException;
|
||||||
@ -38,7 +39,7 @@ import java.util.List;
|
|||||||
@Consumes({ "application/json", "application/xml" })
|
@Consumes({ "application/json", "application/xml" })
|
||||||
public class Device {
|
public class Device {
|
||||||
|
|
||||||
private static Log log = LogFactory.getLog(Device.class);
|
private static Log LOG = LogFactory.getLog(Device.class);
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
public List<org.wso2.carbon.device.mgt.common.Device> getAllDevices() throws AndroidAgentException {
|
public List<org.wso2.carbon.device.mgt.common.Device> getAllDevices() throws AndroidAgentException {
|
||||||
@ -52,28 +53,27 @@ public class Device {
|
|||||||
|
|
||||||
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
||||||
String errorMsg = "Device management service error";
|
String errorMsg = "Device management service error";
|
||||||
log.error(errorMsg, deviceMgtServiceEx);
|
LOG.error(errorMsg, deviceMgtServiceEx);
|
||||||
throw new AndroidAgentException();
|
throw new AndroidAgentException(errorMsg, deviceMgtServiceEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
devices = dmService.getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
devices = dmService.getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||||
Response.status(HttpStatus.SC_OK);
|
Response.status(HttpStatus.SC_OK);
|
||||||
|
return devices;
|
||||||
|
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException e) {
|
||||||
msg = "Error occurred while fetching the device list.";
|
msg = "Error occurred while fetching the device list.";
|
||||||
log.error(msg, e);
|
LOG.error(msg, e);
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
||||||
throw new AndroidAgentException(msg, e);
|
throw new AndroidAgentException(msg, e);
|
||||||
|
|
||||||
}
|
}
|
||||||
return devices;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
public org.wso2.carbon.device.mgt.common.Device getDevice(@PathParam("id") String id) throws AndroidAgentException {
|
public org.wso2.carbon.device.mgt.common.Device getDevice(@PathParam("id") String id) throws AndroidAgentException {
|
||||||
|
|
||||||
String msg;
|
String msg;
|
||||||
DeviceManagementService dmService;
|
DeviceManagementService dmService;
|
||||||
org.wso2.carbon.device.mgt.common.Device device;
|
org.wso2.carbon.device.mgt.common.Device device;
|
||||||
@ -83,21 +83,23 @@ public class Device {
|
|||||||
|
|
||||||
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
} catch (DeviceManagementServiceException deviceMgtServiceEx) {
|
||||||
String errorMsg = "Device management service error";
|
String errorMsg = "Device management service error";
|
||||||
log.error(errorMsg, deviceMgtServiceEx);
|
LOG.error(errorMsg, deviceMgtServiceEx);
|
||||||
throw new AndroidAgentException(errorMsg, deviceMgtServiceEx);
|
throw new AndroidAgentException(errorMsg, deviceMgtServiceEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id);
|
DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id);
|
||||||
try {
|
try {
|
||||||
device = dmService.getDevice(deviceIdentifier);
|
device = dmService.getDevice(deviceIdentifier);
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
Response.status(HttpStatus.SC_NOT_FOUND);
|
Response.status(HttpStatus.SC_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
return device;
|
||||||
|
|
||||||
} catch (DeviceManagementException deviceMgtEx) {
|
} catch (DeviceManagementException deviceMgtEx) {
|
||||||
msg = "Error occurred while fetching the device information.";
|
msg = "Error occurred while fetching the device information.";
|
||||||
log.error(msg, deviceMgtEx);
|
LOG.error(msg, deviceMgtEx);
|
||||||
throw new AndroidAgentException(msg, deviceMgtEx);
|
throw new AndroidAgentException(msg, deviceMgtEx);
|
||||||
}
|
}
|
||||||
return device;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@PUT
|
@PUT
|
||||||
@ -115,7 +117,7 @@ public class Device {
|
|||||||
|
|
||||||
} catch (DeviceManagementServiceException deviceManagementServiceException) {
|
} catch (DeviceManagementServiceException deviceManagementServiceException) {
|
||||||
String errorMsg = "Device management service error";
|
String errorMsg = "Device management service error";
|
||||||
log.error(errorMsg, deviceManagementServiceException);
|
LOG.error(errorMsg, deviceManagementServiceException);
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
@ -133,9 +135,16 @@ public class Device {
|
|||||||
|
|
||||||
} catch (DeviceManagementException deviceMgtEx) {
|
} catch (DeviceManagementException deviceMgtEx) {
|
||||||
String msg = "Error occurred while modifying the device information.";
|
String msg = "Error occurred while modifying the device information.";
|
||||||
log.error(msg, deviceMgtEx);
|
LOG.error(msg, deviceMgtEx);
|
||||||
throw new AndroidAgentException(msg, deviceMgtEx);
|
throw new AndroidAgentException(msg, deviceMgtEx);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@POST
|
||||||
|
@Path("/device/license")
|
||||||
|
@Produces ("text/plain")
|
||||||
|
public String getLicense() {
|
||||||
|
//TODO: need to implement fetch license from core
|
||||||
|
return "License Agreement";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,17 +1,19 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* you may not use this file except in compliance with the 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
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* software distributed under the License is distributed on an
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* See the License for the specific language governing permissions and
|
* KIND, either express or implied. See the License for the
|
||||||
* limitations under the License.
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android;
|
package cdm.api.android;
|
||||||
@ -40,14 +42,6 @@ public class Enrollment {
|
|||||||
|
|
||||||
private static Log log = LogFactory.getLog(Enrollment.class);
|
private static Log log = LogFactory.getLog(Enrollment.class);
|
||||||
|
|
||||||
/*
|
|
||||||
* Request Format : {"deviceIdentifier":"macid","description":"description","ownership":"BYOD",
|
|
||||||
* "properties":[{"name":"username","value":"harshan"},{"name":"device","value":"Harshan S5"},
|
|
||||||
* {"name":"imei","value":"356938035643809"},{"name":"imsi","value":"404685505601234"},{"name":"model","value":"Galaxy S5"},
|
|
||||||
* {"name":"regId","value":"02fab24b2242"},{"name":"vendor","value":"Samsung"},
|
|
||||||
* {"name":"osVersion","value":"5.0.0"}]}
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
@POST
|
@POST
|
||||||
public Message enrollDevice(org.wso2.carbon.device.mgt.common.Device device) throws AndroidAgentException {
|
public Message enrollDevice(org.wso2.carbon.device.mgt.common.Device device) throws AndroidAgentException {
|
||||||
|
|
||||||
@ -75,7 +69,6 @@ public class Enrollment {
|
|||||||
log.error(errorMsg, deviceMgtEx);
|
log.error(errorMsg, deviceMgtEx);
|
||||||
throw new AndroidAgentException(errorMsg, deviceMgtEx);
|
throw new AndroidAgentException(errorMsg, deviceMgtEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GET
|
@GET
|
||||||
@ -106,25 +99,14 @@ public class Enrollment {
|
|||||||
Response.status(HttpStatus.SC_NOT_FOUND);
|
Response.status(HttpStatus.SC_NOT_FOUND);
|
||||||
responseMsg.setResponseMessage("Device not found");
|
responseMsg.setResponseMessage("Device not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
|
|
||||||
} catch (DeviceManagementException deviceMgtEx) {
|
} catch (DeviceManagementException deviceMgtEx) {
|
||||||
String errormsg = "Error occurred while enrollment of the device.";
|
String errormsg = "Error occurred while enrollment of the device.";
|
||||||
log.error(errormsg, deviceMgtEx);
|
log.error(errormsg, deviceMgtEx);
|
||||||
throw new AndroidAgentException(errormsg, deviceMgtEx);
|
throw new AndroidAgentException(errormsg, deviceMgtEx);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Request Format : {"deviceIdentifier":"macid","description":"description","ownership":"BYOD",
|
|
||||||
* "properties":[{"name":"username","value":"harshan"},{"name":"device","value":"Harshan S5"},
|
|
||||||
* {"name":"imei","value":"356938035643809"},{"name":"imsi","value":"404685505601234"},{"name":"model","value":"Galaxy S5"},
|
|
||||||
* {"name":"regId","value":"02fab24b2242"},{"name":"vendor","value":"Samsung"},
|
|
||||||
* {"name":"osVersion","value":"5.0.0"}]}
|
|
||||||
*
|
|
||||||
**/
|
|
||||||
@PUT
|
@PUT
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
public Message modifyEnrollment(@PathParam("id") String id, org.wso2.carbon.device.mgt.common.Device device)
|
public Message modifyEnrollment(@PathParam("id") String id, org.wso2.carbon.device.mgt.common.Device device)
|
||||||
@ -157,19 +139,17 @@ public class Enrollment {
|
|||||||
|
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
|
|
||||||
} catch (DeviceManagementException e) {
|
} catch (DeviceManagementException deviceMgtEx) {
|
||||||
String errorMsg = "Error occurred while modifying enrollment of the device";
|
String errorMsg = "Error occurred while modifying enrollment of the device";
|
||||||
log.error(errorMsg, e);
|
log.error(errorMsg, deviceMgtEx);
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
throw new AndroidAgentException(errorMsg, deviceMgtEx);
|
||||||
responseMsg.setResponseMessage(errorMsg);
|
|
||||||
return responseMsg;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@DELETE
|
@DELETE
|
||||||
@Path("{id}")
|
@Path("{id}")
|
||||||
public Message disenrollDevice(@PathParam("id") String id) throws AndroidAgentException {
|
public Message disEnrollDevice(@PathParam("id") String id) throws AndroidAgentException {
|
||||||
|
|
||||||
DeviceManagementService dmService;
|
DeviceManagementService dmService;
|
||||||
Message responseMsg = new Message();
|
Message responseMsg = new Message();
|
||||||
@ -195,14 +175,12 @@ public class Enrollment {
|
|||||||
responseMsg.setResponseMessage("Device not found");
|
responseMsg.setResponseMessage("Device not found");
|
||||||
Response.status(HttpStatus.SC_NOT_FOUND);
|
Response.status(HttpStatus.SC_NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|
||||||
return responseMsg;
|
return responseMsg;
|
||||||
|
|
||||||
} catch (DeviceManagementException deviceMgtEx) {
|
} catch (DeviceManagementException deviceMgtEx) {
|
||||||
String errorMsg = "Error occurred while dis enrolling the device";
|
String errorMsg = "Error occurred while dis enrolling the device";
|
||||||
log.error(errorMsg, deviceMgtEx);
|
log.error(errorMsg, deviceMgtEx);
|
||||||
Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR);
|
throw new AndroidAgentException(errorMsg, deviceMgtEx);
|
||||||
responseMsg.setResponseMessage(errorMsg);
|
|
||||||
return responseMsg;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,7 +11,9 @@ import javax.ws.rs.core.Response;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is a Test class
|
||||||
|
*/
|
||||||
@Produces({"application/json", "application/xml"})
|
@Produces({"application/json", "application/xml"})
|
||||||
@Consumes({"application/json", "application/xml"})
|
@Consumes({"application/json", "application/xml"})
|
||||||
public class Test {
|
public class Test {
|
||||||
|
|||||||
@ -15,10 +15,8 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android.common;
|
package cdm.api.android.common;
|
||||||
|
|
||||||
|
|
||||||
public class AndroidAgentException extends Exception{
|
public class AndroidAgentException extends Exception{
|
||||||
|
|
||||||
private static final long serialVersionUID = 7950151650447893900L;
|
private static final long serialVersionUID = 7950151650447893900L;
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android.common;
|
package cdm.api.android.common;
|
||||||
|
|
||||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
|
|||||||
@ -15,7 +15,6 @@
|
|||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android.common;
|
package cdm.api.android.common;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* you may not use this file except in compliance with the 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
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* software distributed under the License is distributed on an
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* See the License for the specific language governing permissions and
|
* KIND, either express or implied. See the License for the
|
||||||
* limitations under the License.
|
* specific language governing permissions and limitations
|
||||||
*/
|
* under the License.
|
||||||
|
*/
|
||||||
package cdm.api.android.util;
|
package cdm.api.android.util;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
@ -31,6 +32,7 @@ public class AndroidAPIUtils {
|
|||||||
private static Log log = LogFactory.getLog(AndroidAPIUtils.class);
|
private static Log log = LogFactory.getLog(AndroidAPIUtils.class);
|
||||||
|
|
||||||
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) {
|
public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) {
|
||||||
|
|
||||||
DeviceIdentifier identifier = new DeviceIdentifier();
|
DeviceIdentifier identifier = new DeviceIdentifier();
|
||||||
identifier.setId(deviceId);
|
identifier.setId(deviceId);
|
||||||
identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID);
|
||||||
@ -41,7 +43,6 @@ public class AndroidAPIUtils {
|
|||||||
public static DeviceManagementService getDeviceManagementService() throws DeviceManagementServiceException{
|
public static DeviceManagementService getDeviceManagementService() throws DeviceManagementServiceException{
|
||||||
|
|
||||||
// until complete login this is use to load super tenant context
|
// until complete login this is use to load super tenant context
|
||||||
|
|
||||||
DeviceManagementService dmService;
|
DeviceManagementService dmService;
|
||||||
PrivilegedCarbonContext.startTenantFlow();
|
PrivilegedCarbonContext.startTenantFlow();
|
||||||
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext();
|
||||||
|
|||||||
@ -1,19 +1,20 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
* you may not use this file except in compliance with the 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
|
* 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
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing,
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* software distributed under the License is distributed on an
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
* See the License for the specific language governing permissions and
|
* KIND, either express or implied. See the License for the
|
||||||
* limitations under the License.
|
* specific language governing permissions and limitations
|
||||||
*/
|
* under the License.
|
||||||
|
*/
|
||||||
package cdm.api.android.util;
|
package cdm.api.android.util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -14,8 +14,7 @@
|
|||||||
* KIND, either express or implied. See the License for the
|
* KIND, either express or implied. See the License for the
|
||||||
* specific language governing permissions and limitations
|
* specific language governing permissions and limitations
|
||||||
* under the License.
|
* under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package cdm.api.android.util;
|
package cdm.api.android.util;
|
||||||
|
|
||||||
import javax.xml.bind.annotation.XmlElement;
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
|||||||
@ -1,21 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2014 WSO2, Inc. (http://wso2.com)
|
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
~ you may not use this file except in compliance with the 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
|
~ 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
|
||||||
~
|
~
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
~ software distributed under the License is distributed on an
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
~ See the License for the specific language governing permissions and
|
~ KIND, either express or implied. See the License for the
|
||||||
~ limitations under the License.
|
~ specific language governing permissions and limitations
|
||||||
-->
|
~ under the License.
|
||||||
|
-->
|
||||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
xmlns:jaxrs="http://cxf.apache.org/jaxrs"
|
||||||
@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
<jaxrs:server id="customerService" address="/register">
|
<jaxrs:server id="customerService" address="/register">
|
||||||
<jaxrs:serviceBeans>
|
<jaxrs:serviceBeans>
|
||||||
<ref bean="serviceBean"/>
|
<ref bean="deviceMgtServiceBean"/>
|
||||||
</jaxrs:serviceBeans>
|
</jaxrs:serviceBeans>
|
||||||
<jaxrs:providers>
|
<jaxrs:providers>
|
||||||
<ref bean="jsonProvider"/>
|
<ref bean="jsonProvider"/>
|
||||||
@ -60,8 +60,6 @@
|
|||||||
<ref bean="errorHandler"/>
|
<ref bean="errorHandler"/>
|
||||||
</jaxrs:providers>
|
</jaxrs:providers>
|
||||||
</jaxrs:server>
|
</jaxrs:server>
|
||||||
|
|
||||||
<bean id="serviceBean" class="cdm.api.android.Authentication"/>
|
|
||||||
<bean id="deviceMgtServiceBean" class="cdm.api.android.Device"/>
|
<bean id="deviceMgtServiceBean" class="cdm.api.android.Device"/>
|
||||||
<bean id="enrollmentServiceBean" class="cdm.api.android.Enrollment"/>
|
<bean id="enrollmentServiceBean" class="cdm.api.android.Enrollment"/>
|
||||||
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
|
<bean id="jsonProvider" class="org.codehaus.jackson.jaxrs.JacksonJsonProvider"/>
|
||||||
|
|||||||
@ -1,19 +1,21 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!--
|
<!--
|
||||||
~ Copyright 2014 WSO2, Inc. (http://wso2.com)
|
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||||
~
|
~
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||||
~ you may not use this file except in compliance with the 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
|
~ You may obtain a copy of the License at
|
||||||
~1-2012
|
~
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
~ http://www.apache.org/licenses/LICENSE-2.0
|
||||||
~
|
~
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
~ Unless required by applicable law or agreed to in writing,
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
~ software distributed under the License is distributed on an
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
~ See the License for the specific language governing permissions and
|
~ KIND, either express or implied. See the License for the
|
||||||
~ limitations under the License.
|
~ specific language governing permissions and limitations
|
||||||
-->
|
~ under the License.
|
||||||
|
-->
|
||||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
|
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version="2.5">
|
||||||
<display-name>CDM-Android-API</display-name>
|
<display-name>CDM-Android-API</display-name>
|
||||||
<servlet>
|
<servlet>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user