From 3eafd0fc458838c9de6a008cf96c6da7f0ac0329 Mon Sep 17 00:00:00 2001 From: manoj Date: Mon, 5 Jan 2015 13:05:54 +0530 Subject: [PATCH 1/3] change copy right text and refactor error handling --- product/modules/agents/android/jax-rs/pom.xml | 21 +++---- .../src/main/java/cdm/api/android/Device.java | 53 ++++++++++-------- .../main/java/cdm/api/android/Enrollment.java | 56 ++++++------------- .../src/main/java/cdm/api/android/Test.java | 4 +- .../android/common/AndroidAgentException.java | 24 ++++---- .../cdm/api/android/common/ErrorHandler.java | 23 ++++---- .../cdm/api/android/common/ErrorMessage.java | 23 ++++---- .../cdm/api/android/util/AndroidAPIUtils.java | 25 +++++---- .../api/android/util/AndroidConstants.java | 21 +++---- .../java/cdm/api/android/util/Message.java | 25 ++++----- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 26 ++++----- .../jax-rs/src/main/webapp/WEB-INF/web.xml | 22 ++++---- 12 files changed, 155 insertions(+), 168 deletions(-) diff --git a/product/modules/agents/android/jax-rs/pom.xml b/product/modules/agents/android/jax-rs/pom.xml index 45fbb86f0..6ee8f104b 100644 --- a/product/modules/agents/android/jax-rs/pom.xml +++ b/product/modules/agents/android/jax-rs/pom.xml @@ -1,18 +1,20 @@ + ~ 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. +--> 2.6.1 4.8.2 - diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Device.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Device.java index e1d3c7d20..f1cdfc64f 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Device.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Device.java @@ -1,19 +1,20 @@ /* * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * - * 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 + * 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 + * 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. + * 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 cdm.api.android.common.AndroidAgentException; @@ -38,7 +39,7 @@ import java.util.List; @Consumes({ "application/json", "application/xml" }) public class Device { - private static Log log = LogFactory.getLog(Device.class); + private static Log LOG = LogFactory.getLog(Device.class); @GET public List getAllDevices() throws AndroidAgentException { @@ -52,28 +53,27 @@ public class Device { } catch (DeviceManagementServiceException deviceMgtServiceEx) { String errorMsg = "Device management service error"; - log.error(errorMsg, deviceMgtServiceEx); - throw new AndroidAgentException(); + LOG.error(errorMsg, deviceMgtServiceEx); + throw new AndroidAgentException(errorMsg, deviceMgtServiceEx); } try { - devices = dmService.getAllDevices(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); Response.status(HttpStatus.SC_OK); + return devices; } catch (DeviceManagementException e) { msg = "Error occurred while fetching the device list."; - log.error(msg, e); + LOG.error(msg, e); Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR); throw new AndroidAgentException(msg, e); - } - return devices; } @GET @Path("{id}") public org.wso2.carbon.device.mgt.common.Device getDevice(@PathParam("id") String id) throws AndroidAgentException { + String msg; DeviceManagementService dmService; org.wso2.carbon.device.mgt.common.Device device; @@ -83,21 +83,23 @@ public class Device { } catch (DeviceManagementServiceException deviceMgtServiceEx) { String errorMsg = "Device management service error"; - log.error(errorMsg, deviceMgtServiceEx); + LOG.error(errorMsg, deviceMgtServiceEx); throw new AndroidAgentException(errorMsg, deviceMgtServiceEx); } + DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); try { device = dmService.getDevice(deviceIdentifier); if (device == null) { Response.status(HttpStatus.SC_NOT_FOUND); } + return device; + } catch (DeviceManagementException deviceMgtEx) { msg = "Error occurred while fetching the device information."; - log.error(msg, deviceMgtEx); + LOG.error(msg, deviceMgtEx); throw new AndroidAgentException(msg, deviceMgtEx); } - return device; } @PUT @@ -115,7 +117,7 @@ public class Device { } catch (DeviceManagementServiceException deviceManagementServiceException) { String errorMsg = "Device management service error"; - log.error(errorMsg, deviceManagementServiceException); + LOG.error(errorMsg, deviceManagementServiceException); } try { @@ -133,9 +135,16 @@ public class Device { } catch (DeviceManagementException deviceMgtEx) { String msg = "Error occurred while modifying the device information."; - log.error(msg, deviceMgtEx); + LOG.error(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"; } } diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Enrollment.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Enrollment.java index 3dff018c5..5c93765f5 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Enrollment.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Enrollment.java @@ -1,17 +1,19 @@ /* * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * - * 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 + * 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 + * 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. + * 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; @@ -40,14 +42,6 @@ public class Enrollment { 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 public Message enrollDevice(org.wso2.carbon.device.mgt.common.Device device) throws AndroidAgentException { @@ -75,7 +69,6 @@ public class Enrollment { log.error(errorMsg, deviceMgtEx); throw new AndroidAgentException(errorMsg, deviceMgtEx); } - } @GET @@ -106,25 +99,14 @@ public class Enrollment { Response.status(HttpStatus.SC_NOT_FOUND); responseMsg.setResponseMessage("Device not found"); } - return responseMsg; - } catch (DeviceManagementException deviceMgtEx) { String errormsg = "Error occurred while enrollment of the device."; log.error(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 @Path("{id}") public Message modifyEnrollment(@PathParam("id") String id, org.wso2.carbon.device.mgt.common.Device device) @@ -157,19 +139,17 @@ public class Enrollment { return responseMsg; - } catch (DeviceManagementException e) { + } catch (DeviceManagementException deviceMgtEx) { String errorMsg = "Error occurred while modifying enrollment of the device"; - log.error(errorMsg, e); - Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR); - responseMsg.setResponseMessage(errorMsg); - return responseMsg; + log.error(errorMsg, deviceMgtEx); + throw new AndroidAgentException(errorMsg, deviceMgtEx); } } @DELETE @Path("{id}") - public Message disenrollDevice(@PathParam("id") String id) throws AndroidAgentException { + public Message disEnrollDevice(@PathParam("id") String id) throws AndroidAgentException { DeviceManagementService dmService; Message responseMsg = new Message(); @@ -195,14 +175,12 @@ public class Enrollment { responseMsg.setResponseMessage("Device not found"); Response.status(HttpStatus.SC_NOT_FOUND); } - return responseMsg; + } catch (DeviceManagementException deviceMgtEx) { String errorMsg = "Error occurred while dis enrolling the device"; log.error(errorMsg, deviceMgtEx); - Response.status(HttpStatus.SC_INTERNAL_SERVER_ERROR); - responseMsg.setResponseMessage(errorMsg); - return responseMsg; + throw new AndroidAgentException(errorMsg, deviceMgtEx); } } } diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Test.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Test.java index 5af6c8f3d..caf7cf538 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Test.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Test.java @@ -11,7 +11,9 @@ import javax.ws.rs.core.Response; import java.util.ArrayList; import java.util.List; - +/** + * This is a Test class + */ @Produces({"application/json", "application/xml"}) @Consumes({"application/json", "application/xml"}) public class Test { diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/AndroidAgentException.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/AndroidAgentException.java index 84523d396..138a3fa95 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/AndroidAgentException.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/AndroidAgentException.java @@ -1,24 +1,22 @@ /* * 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 + * 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 + * 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. + * 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.common; - public class AndroidAgentException extends Exception{ private static final long serialVersionUID = 7950151650447893900L; diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorHandler.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorHandler.java index 698ce3ffe..de3d0c523 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorHandler.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorHandler.java @@ -1,21 +1,20 @@ /* * 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 + * 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 + * 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. + * 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.common; import org.wso2.carbon.device.mgt.common.DeviceManagementException; diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorMessage.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorMessage.java index 7f526900d..d166f105d 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorMessage.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/common/ErrorMessage.java @@ -1,21 +1,20 @@ /* * 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 + * 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 + * 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. + * 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.common; diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtils.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtils.java index e2ae093a0..e0e418b8a 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtils.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidAPIUtils.java @@ -1,19 +1,20 @@ /* * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * - * 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 + * 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 + * 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. - */ - + * 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.util; import org.apache.commons.logging.Log; @@ -31,6 +32,7 @@ public class AndroidAPIUtils { private static Log log = LogFactory.getLog(AndroidAPIUtils.class); public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId) { + DeviceIdentifier identifier = new DeviceIdentifier(); identifier.setId(deviceId); identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); @@ -41,7 +43,6 @@ public class AndroidAPIUtils { public static DeviceManagementService getDeviceManagementService() throws DeviceManagementServiceException{ // until complete login this is use to load super tenant context - DeviceManagementService dmService; PrivilegedCarbonContext.startTenantFlow(); PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidConstants.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidConstants.java index 0dcb9e59d..f3880536c 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidConstants.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/AndroidConstants.java @@ -1,19 +1,20 @@ /* * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. + * 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 + * 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. - */ - + * 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.util; /** diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/Message.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/Message.java index f5e34cf7e..5361ff0d4 100644 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/Message.java +++ b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/util/Message.java @@ -1,21 +1,20 @@ /* * 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 + * 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 + * 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. - */ - + * 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.util; import javax.xml.bind.annotation.XmlElement; diff --git a/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml b/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml index 693d44557..7f7e753d1 100644 --- a/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -1,21 +1,21 @@ - - + ~ 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. +--> - + @@ -60,8 +60,6 @@ - - diff --git a/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/web.xml b/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/web.xml index b12b2cf4e..1a5ca4fed 100644 --- a/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/web.xml +++ b/product/modules/agents/android/jax-rs/src/main/webapp/WEB-INF/web.xml @@ -1,19 +1,21 @@ + ~ 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. +--> CDM-Android-API From 704afe78ae24fcd8a962e17046b5ee6e55997fbe Mon Sep 17 00:00:00 2001 From: manoj Date: Mon, 5 Jan 2015 15:31:47 +0530 Subject: [PATCH 2/3] Delete test classes --- .../device/mgt/core/dao/DeviceDAOTest.java | 28 -------------- .../java/cdm/api/android/Authentication.java | 37 ------------------- 2 files changed, 65 deletions(-) delete mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAOTest.java delete mode 100644 product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Authentication.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAOTest.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAOTest.java deleted file mode 100644 index 980527aae..000000000 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/dao/DeviceDAOTest.java +++ /dev/null @@ -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"); - } - -} diff --git a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Authentication.java b/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Authentication.java deleted file mode 100644 index b5687928b..000000000 --- a/product/modules/agents/android/jax-rs/src/main/java/cdm/api/android/Authentication.java +++ /dev/null @@ -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"; - } -} From f01f822f6f43c5ae5b1b3f78d346faedce8053a5 Mon Sep 17 00:00:00 2001 From: manoj Date: Mon, 5 Jan 2015 15:32:02 +0530 Subject: [PATCH 3/3] Refactor Device Management service exception class --- .../device/mgt/common/DeviceManagementServiceException.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementServiceException.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementServiceException.java index 941d04db5..d350a1391 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementServiceException.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceManagementServiceException.java @@ -18,9 +18,6 @@ package org.wso2.carbon.device.mgt.common; -/** - * Created by manoj on 12/22/14. - */ public class DeviceManagementServiceException extends Exception { private static final long serialVersionUID = -8933146283800122640L;