From 8157f26401ed333be6b705736a48e4624852e3d8 Mon Sep 17 00:00:00 2001 From: Asok Date: Sun, 18 Jan 2015 12:10:35 +0530 Subject: [PATCH 1/7] updating windows plugin --- .../cdm/api/windows/DiscoveryService.java | 47 --- .../cdm/api/windows/EnrolmentService.java | 43 --- .../windows/impl/DiscoveryServiceImpl.java | 72 ----- .../windows/impl/EnrolmentServiceImpl.java | 305 ------------------ .../util/CertificateSigningService.java | 92 ------ .../cdm/api/windows/util/WindowsAPIUtil.java | 45 --- .../src/main/resources/applicationContext.xml | 52 --- .../jax-rs/src/main/resources/ca_cert.pem | 20 -- .../jax-rs/src/main/resources/ca_private.key | 27 -- .../src/main/resources/discover-service.xml | 27 -- .../src/main/resources/enrollment-service.xml | 27 -- .../jax-rs/src/main/resources/log4j.xml | 50 --- .../src/main/resources/policy-service.xml | 15 - .../src/main/resources/wap-provisioning.xml | 80 ----- .../resources/windows-mdm-server.properties | 8 - 15 files changed, 910 deletions(-) delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/applicationContext.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/ca_cert.pem delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/ca_private.key delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/discover-service.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/enrollment-service.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/log4j.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/policy-service.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml delete mode 100644 product/modules/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java deleted file mode 100644 index 64cd0e8ecb..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/DiscoveryService.java +++ /dev/null @@ -1,47 +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 cdm.api.windows; - -import javax.ws.rs.*; -import javax.ws.rs.core.Response; -import java.io.InputStream; - -@Path("/EnrollmentServer") -public interface DiscoveryService { - - @Path("/Discovery.svc") - @POST - @Consumes({ "application/soap+xml;charset=utf-8", "application/xml" }) - @Produces("application/soap+xml;charset=utf-8") - Response getDiscoveryResponse( - InputStream discoveryRequest); - - @Path("/Discovery.svc") - @GET - @Consumes("text/html") - @Produces("text/html") - Response getDiscoveryOKRequest(); - - @Path("/Discovery.svc") - @GET - @Consumes({ "application/soap+xml;charset=utf-8", "application/xml" }) - @Produces("text/html") - Response getDiscoveryOKRequestWithBody(InputStream discoveryRequest); - -} diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java deleted file mode 100644 index 9a61a3c61d..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/EnrolmentService.java +++ /dev/null @@ -1,43 +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 cdm.api.windows; - -import javax.swing.text.Document; -import javax.ws.rs.Consumes; -import javax.ws.rs.POST; -import javax.ws.rs.Path; -import javax.ws.rs.Produces; -import javax.ws.rs.core.Response; - -@Path("/ENROLLMENTSERVER") -public interface EnrolmentService { - - @Path("/PolicyEnrollmentWebservice.svc") - @POST - @Consumes("application/soap+xml;charset=utf-8") - @Produces("application/soap+xml;charset=utf-8") - Response getPolicies(Document request); - - @Path("/DeviceEnrollmentWebservice.svc") - @POST - @Consumes("application/soap+xml;charset=utf-8") - @Produces("application/soap+xml;charset=utf-8") - Response enrollUser(Document request); - -} diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java deleted file mode 100644 index 59de66ae0f..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/DiscoveryServiceImpl.java +++ /dev/null @@ -1,72 +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 cdm.api.windows.impl; - -import cdm.api.windows.DiscoveryService; - -import javax.ws.rs.core.Response; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; - - -import org.apache.log4j.Logger; - -public class DiscoveryServiceImpl implements DiscoveryService { - - private Logger LOGGER = Logger.getLogger(DiscoveryServiceImpl.class); - - public Response getDiscoveryResponse(InputStream discoveryRequest) { - LOGGER.info("Received Discovery Service POST Request [{}]"); - - String response = null; - File file = null; - FileInputStream fis = null; - byte[] data = null; - - try { - - file = new File("./conf/discover-service.xml"); - fis = new FileInputStream(file); - data = new byte[(int) file.length()]; - fis.read(data); - fis.close(); - response = new String(data, "UTF-8"); - - } catch (IOException e) { - LOGGER.error("An Unexpected Error has occurred while processing the request ", e); - } - LOGGER.info("Sending Discovery Response"); - - return Response.ok().entity(response).build(); - } - - public Response getDiscoveryOKRequest() { - LOGGER.info("Received a GET Request without body"); - return Response.ok().build(); - } - - public Response getDiscoveryOKRequestWithBody(InputStream discoveryRequest) { - LOGGER.info("Received a GET Request with body [{}]"); - return Response.ok().build(); - } - - -} diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java deleted file mode 100644 index c3acde8387..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/impl/EnrolmentServiceImpl.java +++ /dev/null @@ -1,305 +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 cdm.api.windows.impl; - -import cdm.api.windows.EnrolmentService; -import org.apache.log4j.Logger; -import org.bouncycastle.jce.provider.BouncyCastleProvider; -import org.bouncycastle.pkcs.PKCS10CertificationRequest; -import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; -import org.w3c.dom.NamedNodeMap; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; -import sun.misc.BASE64Decoder; -import sun.misc.BASE64Encoder; -import javax.swing.text.Document; -import javax.ws.rs.core.Response; -import javax.xml.namespace.NamespaceContext; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import javax.xml.xpath.XPath; -import javax.xml.xpath.XPathConstants; -import javax.xml.xpath.XPathFactory; -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.StringWriter; -import java.security.KeyFactory; -import java.security.PrivateKey; -import java.security.Security; -import java.security.cert.CertificateFactory; -import java.security.cert.X509Certificate; -import java.security.spec.PKCS8EncodedKeySpec; -import java.util.Iterator; - -import cdm.api.windows.util.CertificateSigningService; - -public class EnrolmentServiceImpl implements EnrolmentService { - - private Logger LOGGER = Logger.getLogger(EnrolmentServiceImpl.class); - - static { - Security.addProvider(new BouncyCastleProvider()); - } - - private String enrollmentResponseFile; - - private String wapProvisioningXmlFile; - - private String privatePemKeyFilePath; - - private String caCertificateFilePath; - - PrivateKey privateKey; - - X509Certificate rooCACertificate; - - public void init() { - - try { - FileInputStream in = new FileInputStream(privatePemKeyFilePath); - byte[] keyBytes = new byte[in.available()]; - in.read(keyBytes); - in.close(); - - String key = new String(keyBytes, "UTF-8"); - key = key.replaceAll( - "(-+BEGIN RSA PRIVATE KEY-+\\r?\\n|-+END RSA PRIVATE KEY-+\\r?\\n?)", ""); - - // don't use this for real projects! - BASE64Decoder decoder = new BASE64Decoder(); - keyBytes = decoder.decodeBuffer(key); - - // generate private key - - PKCS8EncodedKeySpec spec = new PKCS8EncodedKeySpec(keyBytes); - KeyFactory keyFactory = KeyFactory.getInstance("RSA"); - - privateKey = keyFactory.generatePrivate(spec); - - LOGGER.info("Private Key Algorithm : " + privateKey.getAlgorithm()); - } catch (Exception e) { - LOGGER.error("An unexpected Error has occurred while reading CA Private Key, ", e); - } - - try { - FileInputStream fr = new FileInputStream(caCertificateFilePath); - CertificateFactory cf = CertificateFactory.getInstance("X509"); - rooCACertificate = (X509Certificate) cf.generateCertificate(fr); - - rooCACertificate.verify(rooCACertificate.getPublicKey()); - - LOGGER.info("CA Certificate Expiration Date : " + rooCACertificate.getNotAfter()); - - } catch (Exception e) { - LOGGER.error("An unexpected Error has occurred while reading CA Root Certificate, ", e); - } - - /*try { - KeyPairGenerator gen = KeyPairGenerator.getInstance("RSA"); - gen.initialize(2048); - key = gen.generateKeyPair(); - PrivateKey privateKey = key.getPrivate(); - PublicKey publicKey = key.getPublic(); - - - *//** - * Following details need to be provided - * - * Serial number - * Signature algorithm - * Issuer Name. - * Subject Name -- or a Subject Alternative Name (SAN). - * Date range (not before, not after). - * Subject Public Key. - *//* - - X509V3CertificateGenerator v3CertGen = new X509V3CertificateGenerator(); - v3CertGen.setSerialNumber(BigInteger.valueOf(new SecureRandom().nextInt(Integer.MAX_VALUE))); - v3CertGen.setIssuerDN(new X509Principal("CN=wso2.com")); - //v3CertGen.setIssuerDN(new X509Principal("CN=wso2.com, OU=Mobile, O=wso2 L=Colombo, C=LK")); - v3CertGen.setNotBefore(new Date(System.currentTimeMillis() - 1000L * 60 * 60 * 24 * 30)); - v3CertGen.setNotAfter(new Date(System.currentTimeMillis() + (1000L * 60 * 60 * 24 * 365*10))); - v3CertGen.setSubjectDN(new X509Principal("CN=wso2.com")); - v3CertGen.setPublicKey(publicKey); - v3CertGen.setSignatureAlgorithm("SHA1withRSA"); - - rooCACertificate = v3CertGen.generateX509Certificate(privateKey); - - } catch (Exception e) { - e.printStackTrace(); - }*/ - } - - public Response getPolicies(Document request) { - LOGGER.info("Received Get Policies Request"); - - String response = null; - File file = null; - FileInputStream fis = null; - byte[] data = null; - - try { - - file = new File("./conf/policy-service.xml"); - fis = new FileInputStream(file); - data = new byte[(int) file.length()]; - fis.read(data); - fis.close(); - response = new String(data, "UTF-8"); - - } catch (IOException e) { - LOGGER.error("An Unexpected Error has occurred while processing the request ", e); - } - - LOGGER.info("Sending Get Policy Response"); - return Response.ok().entity(response).build(); - } - - public Response enrollUser(Document request) { - LOGGER.info("Received User Enrollment Request"); - - XPath xPath = XPathFactory.newInstance().newXPath(); - xPath.setNamespaceContext(new MyNamespaceContext()); - String response = null; - - DocumentBuilderFactory domFactory = DocumentBuilderFactory.newInstance(); - - try { - NodeList nl = (NodeList) xPath.evaluate( - "/s:Envelope/s:Body/wst:RequestSecurityToken/wsse:BinarySecurityToken", request, - XPathConstants.NODESET); - Node node = nl.item(0); - String certificateDataString = node.getTextContent(); - byte[] derByteArray = - javax.xml.bind.DatatypeConverter.parseBase64Binary(certificateDataString); - - PKCS10CertificationRequest certificationRequest = - new PKCS10CertificationRequest(derByteArray); - JcaPKCS10CertificationRequest csrReq = - new JcaPKCS10CertificationRequest(certificationRequest); - - LOGGER.info("Public Key of CSR : " + csrReq.getPublicKey()); - - X509Certificate signedCert = - CertificateSigningService.signCSR(csrReq, privateKey, rooCACertificate); - - LOGGER.info("Verifying Signed Certificate with CSR's public key : " + - signedCert.getPublicKey()); - - BASE64Encoder base64Encoder = new BASE64Encoder(); - String rootCertEncodedString = base64Encoder.encode(rooCACertificate.getEncoded()); - String signedCertEncoded = base64Encoder.encode(signedCert.getEncoded()); - - DocumentBuilder builder = domFactory.newDocumentBuilder(); - org.w3c.dom.Document dDoc = builder.parse(wapProvisioningXmlFile); - - NodeList wapParm = dDoc.getElementsByTagName("parm"); - - NamedNodeMap rootCertAttributes = wapParm.item(0).getAttributes(); - Node b64Encoded = rootCertAttributes.getNamedItem("value"); - b64Encoded.setTextContent(rootCertEncodedString); - - NamedNodeMap clientCertAttributes = wapParm.item(1).getAttributes(); - Node b64CliendEncoded = clientCertAttributes.getNamedItem("value"); - b64CliendEncoded.setTextContent(signedCertEncoded); - - String wapProvisioning = convertDocumentToString(dDoc); - String encodedWap = base64Encoder.encode(wapProvisioning.getBytes()); - - org.w3c.dom.Document responseXml = builder.parse(enrollmentResponseFile); - NodeList token = responseXml.getElementsByTagName("BinarySecurityToken"); - - Node firstToken = token.item(0); - firstToken.setTextContent(encodedWap); - - response = convertDocumentToString(responseXml); - } catch (Exception e) { - LOGGER.error("An Unexpected Error has occurred while processing the request ", e); - } - - LOGGER.info("Sending User Enrollment Response"); - return Response.ok().entity(response).build(); - } - - private String convertDocumentToString(org.w3c.dom.Document document) throws Exception { - DOMSource domSource = new DOMSource(document); - StringWriter writer = new StringWriter(); - StreamResult result = new StreamResult(writer); - TransformerFactory tf = TransformerFactory.newInstance(); - Transformer transformer = tf.newTransformer(); - transformer.transform(domSource, result); - String wapProvisioning = writer.toString(); - - return wapProvisioning; - - } - - public void setEnrollmentResponseFile(String enrollmentResponseFile) { - this.enrollmentResponseFile = enrollmentResponseFile; - } - - public void setWapProvisioningXmlFile(String wapProvisioningXmlFile) { - this.wapProvisioningXmlFile = wapProvisioningXmlFile; - } - - public void setPrivatePemKeyFilePath(String privatePemKeyFilePath) { - this.privatePemKeyFilePath = privatePemKeyFilePath; - } - - public void setCaCertificateFilePath(String caCertificateFilePath) { - this.caCertificateFilePath = caCertificateFilePath; - } - - public void setPrivateKey(PrivateKey privateKey) { - this.privateKey = privateKey; - } - - public void setRooCACertificate(X509Certificate rooCACertificate) { - this.rooCACertificate = rooCACertificate; - } - - private static class MyNamespaceContext implements NamespaceContext { - - public String getNamespaceURI(String prefix) { - - if ("s".equals(prefix)) { - return "http://www.w3.org/2003/05/soap-envelope"; - } else if ("wst".equals(prefix)) { - return "http://docs.oasis-open.org/ws-sx/ws-trust/200512"; - } else if ("wsse".equals(prefix)) { - return "http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"; - } - return null; - - } - - public String getPrefix(String namespaceURI) { - return null; - } - - public Iterator getPrefixes(String namespaceURI) { - return null; - } - } -} diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java deleted file mode 100644 index 6b00694097..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/CertificateSigningService.java +++ /dev/null @@ -1,92 +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 cdm.api.windows.util; - -import org.apache.log4j.Logger; -import org.bouncycastle.asn1.x500.X500Name; -import org.bouncycastle.cert.X509v3CertificateBuilder; -import org.bouncycastle.cert.jcajce.JcaX509CertificateConverter; -import org.bouncycastle.cert.jcajce.JcaX509ExtensionUtils; -import org.bouncycastle.cert.jcajce.JcaX509v3CertificateBuilder; -import org.bouncycastle.operator.ContentSigner; -import org.bouncycastle.operator.jcajce.JcaContentSignerBuilder; -import org.bouncycastle.pkcs.jcajce.JcaPKCS10CertificationRequest; - -import java.math.BigInteger; -import java.security.PrivateKey; -import java.security.SecureRandom; -import java.security.cert.X509Certificate; -import java.util.Date; - -public class CertificateSigningService { - - private static Logger LOGGER = Logger.getLogger(CertificateSigningService.class); - - public static X509Certificate signCSR(JcaPKCS10CertificationRequest jcaRequest, - PrivateKey privateKey, X509Certificate caCert) - throws Exception { - try { - - X509v3CertificateBuilder certificateBuilder = new JcaX509v3CertificateBuilder(caCert, - BigInteger - .valueOf( - new SecureRandom() - .nextInt( - Integer.MAX_VALUE)), - new Date( - System.currentTimeMillis() - - 1000L * - 60 * - 60 * - 24 * - 30), - new Date( - System.currentTimeMillis() + - (1000L * - 60 * - 60 * - 24 * - 365 * - 10)), - new X500Name( - "CN=abimaran"), - jcaRequest - .getPublicKey()); - - JcaX509ExtensionUtils extUtils = new JcaX509ExtensionUtils(); - - ContentSigner signer = - new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(privateKey); - - X509Certificate theCert = - new JcaX509CertificateConverter().setProvider("BC").getCertificate( - certificateBuilder.build(signer)); - - LOGGER.info("Signed Certificate CN : " + theCert.getSubjectDN().getName()); - - LOGGER.info("Signed CSR's public key : " + theCert.getPublicKey()); - - return theCert; - - } catch (Exception e) { - throw new Exception("Error in signing the certificate", e); - } - } - -} diff --git a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java b/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java deleted file mode 100644 index ca784e1895..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/java/cdm/api/windows/util/WindowsAPIUtil.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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 - * - * 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.windows.util; - - -import com.google.gson.JsonObject; -import org.wso2.carbon.device.mgt.common.Device; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; -import org.wso2.carbon.device.mgt.common.DeviceManagementConstants; - - -/** - * WindowsAPIUtil class provides utility function used by Android REST-API classes. - */ -public class WindowsAPIUtil { - - public static Device convertToDeviceObject(JsonObject json){ - Device device = new Device(); - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - device.setName("Test Device"); - device.setOwner("harshan"); - return device; - } - - public static DeviceIdentifier convertToDeviceIdentifierObject(String deviceId){ - DeviceIdentifier identifier = new DeviceIdentifier(); - identifier.setId(deviceId); - identifier.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - return identifier; - } -} diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/applicationContext.xml b/product/modules/agents/windows/jax-rs/src/main/resources/applicationContext.xml deleted file mode 100644 index 5dd63f2c88..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/applicationContext.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/ca_cert.pem b/product/modules/agents/windows/jax-rs/src/main/resources/ca_cert.pem deleted file mode 100644 index 6eaad0f570..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/ca_cert.pem +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDXDCCAkQCCQDWxw0vNF9H8DANBgkqhkiG9w0BAQUFADBwMQswCQYDVQQGEwJM -SzEQMA4GA1UECBMHQ29sb21ibzEQMA4GA1UEBxMHQ29sb21ibzENMAsGA1UEChME -d3NvMjEPMA0GA1UECxMGbW9iaWxlMR0wGwYDVQQDFBRjYV93c28yV2luZG93c01v -YmlsZTAeFw0xNDA3MDcxMDE4MDhaFw0xNTA3MDcxMDE4MDhaMHAxCzAJBgNVBAYT -AkxLMRAwDgYDVQQIEwdDb2xvbWJvMRAwDgYDVQQHEwdDb2xvbWJvMQ0wCwYDVQQK -EwR3c28yMQ8wDQYDVQQLEwZtb2JpbGUxHTAbBgNVBAMUFGNhX3dzbzJXaW5kb3dz -TW9iaWxlMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz+w93X1S8nOM -VM3ScGP8XY9+PnoUaFZgKaD3d9Z6cj4HPKjIzv8iTMx9JBfDjSsLiks5nJqxm1in -juck7n0tl/CZ5L2j/3DhsA4D0Ngp5JsH5ZF+Vu2T+z8wUq8UwGD6qsn/EP9jBbj/ -WN0TtOPcfhOhfJVxaNOrt+9htYad9WOeU8Rh+CIb5oQrigEd417e5d5j4wcU8QLj -sVQQ8WRCYDrnKKof834ZnViBYX4UAdLtXkWFtKcD0RM/cB2LdjydwP3HEj6pkwjT -hRLGHdVF21VCbKOF6mnQagvuseT/ynioBNY60TXb283BQ6YrDfMytvRuzguEQ/7/ -AsTPclNZxQIDAQABMA0GCSqGSIb3DQEBBQUAA4IBAQB3cwy5pibn009WvAYzmw9B -oB77bt21GQO4gFLJlNkvIRrneE5SinjoO6ezWOgY3+8t9ViNeD874momq4kuE6Hb -XDZE1qqinJlqfMJQuEaFkDZKg55kO66wy5+8ioFhA9V8SpeM+SYy3ENBucxiDLQE -ZhM7RKJCpSIq0rRHJyBRbs6GoW7cOB5QQcFDfSW+/CajicWzeD/OJMIfjJezCsZ8 -GNXJpyAS/Te+ysHlfmrKMb1VMZphFNiTmpEx8OI8F/kbhmdwePaZ3SOw2kJp8e3v -Ke4/zPwB95wjz8luzU+PbqNO2K4ZKtXHk6rx5yybR1UBpYINvUEjsRI3hgy1IoE+ ------END CERTIFICATE----- diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/ca_private.key b/product/modules/agents/windows/jax-rs/src/main/resources/ca_private.key deleted file mode 100644 index 764b316630..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/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+9KtfZ0QnmQSsluJfrUBGej6UYO0z -DUv5CLNYLPwOVGTb/jb5n+lY2IzjKmA+aWZRML/JAoGBAJSfUycVVzJTdXydt1Hd -OTLDpcfHnTIpfRg2SOHpp/tAIVWdbD06Bp6QfREZExb96jhkr+9BzLSITL2mG4Ou -15K5nDMhHjE3Eozgt0Ah5HIBouEXfQk39W8bvecLe2rHZifuMCHXju8vMweY9GEy -AlFaW1VOs/E40x5cTVegG5TRAoGANLxmUJtTeZYwkBtDr+2GrpfcSLzK73i6otx1 -fs9vPaSpBFXxa/yaJ7xtUaIWtdlh9dfcwF/Zl590yLEdBX+8dP6bDYekRTu3YtPB -7qNMVY1KtNXGBq3OIcgsXoZkfXR9TOP0wrDS289d1F11G39KhmSMp9uNMbynfuGx -uUPBu5kCgYA1UUtQkVPbkKaaopSrDkqAJDlsUnNVkvXH5yWqdAYI2Frw1iOwhED3 -cKmwAejf8nl1HPwfDTGQMRB5PCDkK7mWJ5w9W4MUbJ7ZiNPHloZutUTcw3Nz58cn -OZMZGR/Trtn+YLoj2526NPwKqlw0bRB27UR0KOdgPOHynI3uYPnwgQ== ------END RSA PRIVATE KEY----- diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/discover-service.xml b/product/modules/agents/windows/jax-rs/src/main/resources/discover-service.xml deleted file mode 100644 index 05f8f939b9..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/discover-service.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - - http://schemas.microsoft.com/windows/management/2012/01/enrollment/IDiscoveryService/DiscoverResponse - - - d9eb2fdd-e38a-46ee-bd93-aea9dc86a3b8 - - urn:uuid: 748132ec-a575-4329-b01b-6171a9cf8478 - - - - - OnPremise - - https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/PolicyEnrollmentWebservice.svc - - - https://EnterpriseEnrollment.wso2.com/ENROLLMENTSERVER/DeviceEnrollmentWebservice.svc - - - - - \ No newline at end of file diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/enrollment-service.xml b/product/modules/agents/windows/jax-rs/src/main/resources/enrollment-service.xml deleted file mode 100644 index 4be6e477ac..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/enrollment-service.xml +++ /dev/null @@ -1,27 +0,0 @@ - - - http://schemas.microsoft.com/windows/pki/2009/01/enrollment/RSTRC/wstep - urn:uuid:81a5419a-496b-474f-a627-5cdd33eed8ab - - - 2012-08-02T00:32:59.420Z - 2014-08-02T00:37:59.420Z - - - - - - - http://schemas.microsoft.com/5.0.0.0/ConfigurationManager/Enrollment/DeviceEnrollmentToken - - - - - 0 - - - - \ No newline at end of file diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/log4j.xml b/product/modules/agents/windows/jax-rs/src/main/resources/log4j.xml deleted file mode 100644 index 7cd7d64125..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/log4j.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/policy-service.xml b/product/modules/agents/windows/jax-rs/src/main/resources/policy-service.xml deleted file mode 100644 index e38440d6bd..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/policy-service.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - http://schemas.microsoft.com/windows/pki/2009/01/enrollmentpolicy/IPolicy/GetPoliciesResponse - - - - - - - - \ No newline at end of file diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml b/product/modules/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml deleted file mode 100644 index d51958a715..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/wap-provisioning.xml +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/product/modules/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties b/product/modules/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties deleted file mode 100644 index 6f092e31fb..0000000000 --- a/product/modules/agents/windows/jax-rs/src/main/resources/windows-mdm-server.properties +++ /dev/null @@ -1,8 +0,0 @@ -service.url=http://0.0.0.0:9090 - - -discovery.service.file.location=./conf/discover-service.xml -policy.certificate.file.location=./conf/policy-service.xml -enrollment.service.file.location=./conf/enrollment-service.xml - -enrollment.service.wap.provisioning.file.location=./conf/wap-provisioning.xml \ No newline at end of file From 83402a4009cdacf46b62812035253372500d881a Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Tue, 20 Jan 2015 13:32:31 +0530 Subject: [PATCH 2/7] Added the SSO js module feature to the cdm product --- pom.xml | 1 + product/modules/p2-profile-gen/pom.xml | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/pom.xml b/pom.xml index 0aa59f7d8e..e8602bfc4e 100644 --- a/pom.xml +++ b/pom.xml @@ -221,6 +221,7 @@ 1.1.0 1.0.0 1.0.0 + 1.1.0-SNAPSHOT 1.1.0 4.3.1 diff --git a/product/modules/p2-profile-gen/pom.xml b/product/modules/p2-profile-gen/pom.xml index 46bb0c0f39..047e7a8372 100644 --- a/product/modules/p2-profile-gen/pom.xml +++ b/product/modules/p2-profile-gen/pom.xml @@ -127,6 +127,9 @@ org.jaggeryjs.modules:uuid.feature:${uuid.feature.version} + + org.jaggeryjs.modules:sso.feature:${sso.feature.version} + org.jaggeryjs.modules:jaggery-test.feature:${jaggery-test.feature.version} @@ -281,6 +284,10 @@ org.jaggeryjs.modules.uuid.feature.group ${uuid.feature.version} + + org.jaggeryjs.modules.sso.feature.group + ${sso.feature.version} + org.jaggeryjs.modules.jaggery-test.feature.group ${jaggery-test.feature.version} From 9fc79868aa625446811f5846072edbca9ff914a7 Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Tue, 20 Jan 2015 18:48:07 +0530 Subject: [PATCH 3/7] Added a tabbed layout for the device list UI --- .../jaggeryapps/cdm/pages/dashboard.jag | 50 +++++++++++++------ 1 file changed, 34 insertions(+), 16 deletions(-) diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag index 35d2f255b5..7231b35304 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag @@ -14,25 +14,43 @@ var title="WSO2 CDM";

Devices list

+ +
+ + + + + +
+
+
+ + + + + + + + + + + + + + +
IdentifierNameOwnerOwnershipDevice TypeVendorModelOS Version
+
+
+
sdfweroiweuroi
+
+
From ad303e46110591ac874241f8b0a436d1869afe44 Mon Sep 17 00:00:00 2001 From: asok Date: Wed, 21 Jan 2015 10:46:56 +0530 Subject: [PATCH 4/7] committing --- product/modules/agents/windows/jax-rs/pom.xml | 98 +++++++++++++++++++ .../src/main/webapp/WEB-INF/cxf-servlet.xml | 48 +++++++-- .../jax-rs/src/main/webapp/WEB-INF/web.xml | 14 ++- 3 files changed, 147 insertions(+), 13 deletions(-) diff --git a/product/modules/agents/windows/jax-rs/pom.xml b/product/modules/agents/windows/jax-rs/pom.xml index 1b3963e4b7..484ab066ec 100644 --- a/product/modules/agents/windows/jax-rs/pom.xml +++ b/product/modules/agents/windows/jax-rs/pom.xml @@ -186,6 +186,104 @@ bcprov-jdk15on 1.49 + + org.apache.ws.commons.axiom + axiom-api + 1.2.14 + + + org.apache.ws.commons.axiom + axiom-impl + 1.2.14 + + + org.apache.cxf + cxf-rt-frontend-jaxws + 2.6.1 + + + org.apache.cxf + cxf-rt-bindings-soap + 2.6.1 + compile + + + org.apache.cxf + cxf-rt-transports-http + 2.6.1 + compile + + + org.apache.cxf + cxf-rt-rs-extension-providers + 2.6.1 + compile + + + org.apache.cxf + cxf-rt-ws-security + 2.6.1 + + + org.apache.cxf + cxf-rt-transports-http + 2.6.1 + + + org.apache.wss4j + wss4j-ws-security-common + 2.0.0 + + + org.springframework + spring-web + 3.0.5.RELEASE + + + org.springframework + spring-context + 3.0.5.RELEASE + + + com.sun.xml.messaging.saaj + saaj-impl + 1.3.18 + + + com.sun.xml.messaging.saaj + saaj-impl + 1.3.18 + + + org.bouncycastle + bcpkix-jdk15on + 1.49 + + + org.bouncycastle + bcprov-jdk15on + 1.49 + + + org.codehaus.plexus + plexus-utils + 3.0.21 + + + com.madgag.spongycastle + pkix + 1.51.0.0 + + + com.madgag.spongycastle + prov + 1.51.0.0 + + + com.madgag.spongycastle + core + 1.51.0.0 + 2.6.1 diff --git a/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml b/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml index 165c967047..89c9d1e886 100644 --- a/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -23,22 +23,52 @@ - - - - - - + + + - + - - + + + + + + + + + + + + + + + + + + + + + + + diff --git a/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml b/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml index 777ee8a709..c36bac34d5 100644 --- a/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml +++ b/product/modules/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml @@ -20,10 +20,16 @@ --> CDM-Windows-API + + + contextConfigLocation + /WEB-INF/cxf-servlet.xml + + - JAX-WS/JAX-RS Endpoint - JAX-WS/JAX-RS Servlet - JAXServlet + JAX-WS/JAX-RS-windows Endpoint + JAX-WS/JAX-RS-windows Servlet + JAXServlet-windows org.apache.cxf.transport.servlet.CXFServlet @@ -34,7 +40,7 @@ 1 - JAXServlet + JAXServlet-windows /* From eb0fd6dc3137c436f0a137ce5263b71268b3e925 Mon Sep 17 00:00:00 2001 From: harshanL Date: Wed, 21 Jan 2015 12:29:06 +0530 Subject: [PATCH 5/7] Added operation support for Android --- .../datasource/MobileDataSourceConfig.java | 3 +- .../dao/MobileDeviceManagementDAOFactory.java | 165 +++++++------ .../impl/MobileDeviceOperationDAOImpl.java | 10 +- .../dao/impl/MobileOperationDAOImpl.java | 4 +- .../util/MobileDeviceManagementDAOUtil.java | 55 ----- .../AndroidMobileOperationManager.java | 8 +- ...obileDeviceManagementServiceComponent.java | 219 ++++++++++-------- .../modules/distribution/src/assembly/bin.xml | 12 +- .../repository/database/WSO2MobileDM_DB.h2.db | Bin 0 -> 2109440 bytes .../src/repository/dbscripts/cdm/h2.sql | 2 +- .../repository/dbscripts/cdm/plugins/h2.sql | 13 +- .../repository/dbscripts/cdm/plugins/h2.sql~ | 38 ++- .../mobileservices/android/Enrollment.java | 217 ++++++++--------- .../src/main/webapp/WEB-INF/cxf-servlet.xml | 5 +- 14 files changed, 377 insertions(+), 374 deletions(-) create mode 100644 product/modules/distribution/src/repository/database/WSO2MobileDM_DB.h2.db diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java index 2b9c570c9f..b8f6a8a3ca 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java @@ -28,12 +28,11 @@ public class MobileDataSourceConfig { private JNDILookupDefinition jndiLookupDefinition; @XmlElement(name = "JndiLookupDefinition", nillable = true) - public JNDILookupDefinition getJndiLookupDefintion() { + public JNDILookupDefinition getJndiLookupDefinition() { return jndiLookupDefinition; } public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) { this.jndiLookupDefinition = jndiLookupDefinition; } - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java index ddaf0adf82..c014f9d6b9 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java @@ -19,81 +19,108 @@ package org.wso2.carbon.device.mgt.mobile.dao; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.mgt.common.DeviceManagementException; -import org.wso2.carbon.device.mgt.mobile.DataSourceListener; +import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.dao.impl.*; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; -import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementBundleActivator; import javax.sql.DataSource; +import java.util.Hashtable; +import java.util.List; /** * Factory class used to create MobileDeviceManagement related DAO objects. */ -public class MobileDeviceManagementDAOFactory implements DataSourceListener { - - private static DataSource dataSource; - private static MobileDataSourceConfig mobileDataSourceConfig; - private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOFactory.class); - - public MobileDeviceManagementDAOFactory() { - - } - - public void init() throws DeviceManagementException { - dataSource = MobileDeviceManagementDAOUtil.resolveDataSource(mobileDataSourceConfig); - if (dataSource != null) { - MobileDeviceManagementDAOUtil.createDataSource(dataSource); - } else { - MobileDeviceManagementBundleActivator.registerDataSourceListener(this); - } - } - - public static MobileDeviceDAO getMobileDeviceDAO() { - return new MobileDeviceDAOImpl(dataSource); - } - - public static MobileOperationDAO getMobileOperationDAO() { - return new MobileOperationDAOImpl(dataSource); - } - - public static MobileOperationPropertyDAO getMobileOperationPropertyDAO() { - return new MobileOperationPropertyDAOImpl(dataSource); - } - - public static MobileDeviceOperationDAO getMobileDeviceOperationDAO() { - return new MobileDeviceOperationDAOImpl(dataSource); - } - - public static FeatureDAO getFeatureDAO() { - return new FeatureDAOImpl(dataSource); - } - - public static FeaturePropertyDAO getFeaturePropertyDAO() { - return new FeaturePropertyDAOImpl(dataSource); - } - - public static MobileDataSourceConfig getMobileDeviceManagementConfig() { - return mobileDataSourceConfig; - } - - public static void setMobileDataSourceConfig( - MobileDataSourceConfig mobileDataSourceConfig) { - MobileDeviceManagementDAOFactory.mobileDataSourceConfig = - mobileDataSourceConfig; - } - - public static DataSource getDataSource() { - return dataSource; - } - - @Override - public void notifyObserver() { - try { - dataSource = MobileDeviceManagementDAOUtil.resolveDataSource(mobileDataSourceConfig); - MobileDeviceManagementDAOUtil.createDataSource(dataSource); - } catch (DeviceManagementException e) { - log.error("Error occurred while resolving mobile device management metadata repository data source", e); - } - } -} +public class MobileDeviceManagementDAOFactory { + + private static DataSource dataSource; + private static MobileDataSourceConfig mobileDataSourceConfig; + private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOFactory.class); + + public MobileDeviceManagementDAOFactory() { + + } + + public static void init() { + try { + dataSource = MobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfig); + } catch (DeviceManagementException e) { + log.error("Exception occurred while initializing the mobile datasource.",e); + } + } + + /** + * Resolve data source from the data source definition. + * + * @param config Mobile data source configuration + * @return data source resolved from the data source definition + */ + private static DataSource resolveDataSource(MobileDataSourceConfig config) + throws DeviceManagementException { + DataSource dataSource = null; + if (config == null) { + throw new RuntimeException("Device Management Repository data source configuration " + + "is null and thus, is not initialized"); + } + JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); + if (jndiConfig != null) { + if (log.isDebugEnabled()) { + log.debug("Initializing Device Management Repository data source using the JNDI " + + "Lookup Definition"); + } + List jndiPropertyList = + jndiConfig.getJndiProperties(); + if (jndiPropertyList != null) { + Hashtable jndiProperties = new Hashtable(); + for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { + jndiProperties.put(prop.getName(), prop.getValue()); + } + dataSource = + MobileDeviceManagementDAOUtil + .lookupDataSource(jndiConfig.getJndiName(), jndiProperties); + } else { + dataSource = MobileDeviceManagementDAOUtil + .lookupDataSource(jndiConfig.getJndiName(), null); + } + } + return dataSource; + } + + public static MobileDeviceDAO getMobileDeviceDAO() { + return new MobileDeviceDAOImpl(dataSource); + } + + public static MobileOperationDAO getMobileOperationDAO() { + return new MobileOperationDAOImpl(dataSource); + } + + public static MobileOperationPropertyDAO getMobileOperationPropertyDAO() { + return new MobileOperationPropertyDAOImpl(dataSource); + } + + public static MobileDeviceOperationDAO getMobileDeviceOperationDAO() { + return new MobileDeviceOperationDAOImpl(dataSource); + } + + public static FeatureDAO getFeatureDAO() { + return new FeatureDAOImpl(dataSource); + } + + public static FeaturePropertyDAO getFeaturePropertyDAO() { + return new FeaturePropertyDAOImpl(dataSource); + } + + public static MobileDataSourceConfig getMobileDeviceManagementConfig() { + return mobileDataSourceConfig; + } + + public static void setMobileDataSourceConfig( + MobileDataSourceConfig mobileDataSourceConfig) { + MobileDeviceManagementDAOFactory.mobileDataSourceConfig = + mobileDataSourceConfig; + } + + public static DataSource getDataSource() { + return dataSource; + } +} \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationDAOImpl.java index e2d24e5e9b..25b13a5904 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationDAOImpl.java @@ -52,7 +52,7 @@ public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO { try { conn = this.getConnection(); String createDBQuery = - "INSERT INTO MBL_DEVICE_OPERATION(DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE) VALUES (?, ?, ?, ?)"; + "INSERT INTO MBL_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE) VALUES (?, ?, ?, ?)"; stmt = conn.prepareStatement(createDBQuery); stmt.setString(1, deviceOperation.getDeviceId()); @@ -86,7 +86,7 @@ public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO { try { conn = this.getConnection(); String updateDBQuery = - "UPDATE MBL_DEVICE_OPERATION SET SENT_DATE = ?, RECEIVED_DATE = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?"; + "UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?"; stmt = conn.prepareStatement(updateDBQuery); stmt.setLong(1, deviceOperation.getSentDate()); stmt.setLong(2, deviceOperation.getReceivedDate()); @@ -117,7 +117,7 @@ public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO { try { conn = this.getConnection(); String deleteDBQuery = - "DELETE FROM MBL_DEVICE_OPERATION WHERE DEVICE_ID = ? AND OPERATION_ID=?"; + "DELETE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?"; stmt = conn.prepareStatement(deleteDBQuery); stmt.setString(1, deviceId); stmt.setInt(2, operationId); @@ -146,7 +146,7 @@ public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO { try { conn = this.getConnection(); String selectDBQuery = - "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION WHERE DEVICE_ID = ? AND OPERATION_ID=?"; + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?"; stmt = conn.prepareStatement(selectDBQuery); stmt.setString(1, deviceId); stmt.setInt(2, operationId); @@ -181,7 +181,7 @@ public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO { try { conn = this.getConnection(); String selectDBQuery = - "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION WHERE DEVICE_ID = ?"; + "SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?"; stmt = conn.prepareStatement(selectDBQuery); stmt.setString(1, deviceId); ResultSet resultSet = stmt.executeQuery(); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java index 01612098a1..e2fb47b732 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java @@ -138,11 +138,13 @@ public class MobileOperationDAOImpl implements MobileOperationDAO { String selectDBQuery = "SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE OPERATION_ID = ?"; stmt = conn.prepareStatement(selectDBQuery); - stmt.setInt(1, operation.getOperationId()); + stmt.setInt(1, operationId); ResultSet resultSet = stmt.executeQuery(); while (resultSet.next()) { operation = new MobileOperation(); operation.setOperationId(resultSet.getInt(1)); + operation.setFeatureCode(resultSet.getString(2)); + operation.setCreatedDate(resultSet.getLong(3)); break; } } catch (SQLException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java index 146a33bcbf..af181b321b 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java @@ -39,40 +39,6 @@ public class MobileDeviceManagementDAOUtil { private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOUtil.class); - /** - * Resolve data source from the data source definition. - * - * @param config Mobile data source configuration - * @return data source resolved from the data source definition - */ - public static DataSource resolveDataSource(MobileDataSourceConfig config) throws DeviceManagementException { - DataSource dataSource = null; - if (config == null) { - throw new RuntimeException("Device Management Repository data source configuration " + - "is null and thus, is not initialized"); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefintion(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing Device Management Repository data source using the JNDI " + - "Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = - MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = MobileDeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); - } - } - return dataSource; - } - public static DataSource lookupDataSource(String dataSourceName, final Hashtable jndiProperties) throws DeviceManagementException { @@ -113,27 +79,6 @@ public class MobileDeviceManagementDAOUtil { } } - /** - * Initializes the creation of mobile device management schema if -Dsetup has provided. - * - * @param dataSource Mobile data source - */ - public static void createDataSource(DataSource dataSource) { - String setupOption = System.getProperty("setup"); - if (setupOption != null) { - if (log.isDebugEnabled()) { - log.debug( - "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + - "to begin"); - } - try { - MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema(dataSource); - } catch (DeviceManagementException e) { - log.error("Exception occurred while initializing mobile device management database schema", e); - } - } - } - /** * Creates the mobile device management schema. * diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidMobileOperationManager.java index f04bba9a94..76c6332434 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidMobileOperationManager.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidMobileOperationManager.java @@ -58,7 +58,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage mobileDeviceOperation.setDeviceId(deviceIdentifier.getId()); status = MobileDeviceManagementDAOFactory.getMobileDeviceOperationDAO() .addMobileDeviceOperation( - new MobileDeviceOperation()); + mobileDeviceOperation); } } } catch (MobileDeviceManagementDAOException e) { @@ -75,6 +75,7 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage throws OperationManagementException { List operations = new ArrayList(); List mobileDeviceOperations = null; + List operationProperties = null; MobileOperation mobileOperation = null; try { mobileDeviceOperations = MobileDeviceManagementDAOFactory.getMobileDeviceOperationDAO() @@ -88,6 +89,11 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO() .getMobileOperation( operationId); + operationProperties = + MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO() + .getAllMobileOperationPropertiesOfOperation( + operationId); + mobileOperation.setProperties(operationProperties); operations.add(MobileDeviceManagementUtil .convertMobileOperationToOperation(mobileOperation)); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java index 195929bb2f..28606783db 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java @@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory; +import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; @@ -54,112 +55,134 @@ import java.util.List; */ public class MobileDeviceManagementServiceComponent { - private ServiceRegistration androidServiceRegRef; - private ServiceRegistration iOSServiceRegRef; - private ServiceRegistration windowsServiceRegRef; + private ServiceRegistration androidServiceRegRef; + private ServiceRegistration iOSServiceRegRef; + private ServiceRegistration windowsServiceRegRef; - private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class); + private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class); - protected void activate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("Activating Mobile Device Management Service Component"); - } - try { - BundleContext bundleContext = ctx.getBundleContext(); + protected void activate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("Activating Mobile Device Management Service Component"); + } + try { + BundleContext bundleContext = ctx.getBundleContext(); /* Initialize the datasource configuration */ - MobileDeviceConfigurationManager.getInstance().initConfig(); - MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() - .getMobileDeviceManagementConfig(); - MobileDataSourceConfig dsConfig = - config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); - - MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig); - - androidServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new AndroidDeviceManagerService(), null); - iOSServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new IOSDeviceManagerService(), null); - windowsServiceRegRef = - bundleContext.registerService(DeviceManagerService.class.getName(), - new WindowsDeviceManagerService(), null); + MobileDeviceConfigurationManager.getInstance().initConfig(); + MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance() + .getMobileDeviceManagementConfig(); + MobileDataSourceConfig dsConfig = + config.getMobileDeviceMgtRepository().getMobileDataSourceConfig(); + + MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig); + MobileDeviceManagementDAOFactory.init(); + String setupOption = System.getProperty("setup"); + if (setupOption != null) { + if (log.isDebugEnabled()) { + log.debug( + "-Dsetup is enabled. Mobile Device management repository schema initialization is about " + + "to begin"); + } + try { + MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema( + MobileDeviceManagementDAOFactory.getDataSource()); + } catch (DeviceManagementException e) { + log.error( + "Exception occurred while initializing mobile device management database schema", + e); + } + } + + androidServiceRegRef = + bundleContext.registerService(DeviceManagerService.class.getName(), + new AndroidDeviceManagerService(), null); + iOSServiceRegRef = + bundleContext.registerService(DeviceManagerService.class.getName(), + new IOSDeviceManagerService(), null); + windowsServiceRegRef = + bundleContext.registerService(DeviceManagerService.class.getName(), + new WindowsDeviceManagerService(), null); /* Initialize all API configurations with corresponding API Providers */ - this.initAPIConfigs(); - /* Publish all mobile device management related JAX-RS services as APIs */ - this.publishAPIs(); - - if (log.isDebugEnabled()) { - log.debug("Mobile Device Management Service Component has been successfully activated"); - } - } catch (Throwable e) { - log.error("Error occurred while activating Mobile Device Management Service Component", e); - } - } - - protected void deactivate(ComponentContext ctx) { - if (log.isDebugEnabled()) { - log.debug("De-activating Mobile Device Management Service Component"); - } - try { - BundleContext bundleContext = ctx.getBundleContext(); - - androidServiceRegRef.unregister(); - iOSServiceRegRef.unregister(); - windowsServiceRegRef.unregister(); + this.initAPIConfigs(); + /* Publish all mobile device management related JAX-RS services as APIs */ + this.publishAPIs(); + + if (log.isDebugEnabled()) { + log.debug( + "Mobile Device Management Service Component has been successfully activated"); + } + } catch (Throwable e) { + log.error("Error occurred while activating Mobile Device Management Service Component", + e); + } + } + + protected void deactivate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("De-activating Mobile Device Management Service Component"); + } + try { + BundleContext bundleContext = ctx.getBundleContext(); + + androidServiceRegRef.unregister(); + iOSServiceRegRef.unregister(); + windowsServiceRegRef.unregister(); /* Removing all APIs published upon start-up for mobile device management related JAX-RS services */ - this.removeAPIs(); - if (log.isDebugEnabled()) { - log.debug("Mobile Device Management Service Component has been successfully de-activated"); - } - } catch (Throwable e) { - log.error("Error occurred while de-activating Mobile Device Management bundle", e); - } - } - - private void initAPIConfigs() throws DeviceManagementException { - List apiConfigs = - MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getAPIs(); - for (APIConfig apiConfig : apiConfigs) { - try { - APIProvider provider = APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner()); - apiConfig.init(provider); - } catch (APIManagementException e) { - throw new DeviceManagementException("Error occurred while initializing API Config '" + - apiConfig.getName() + "'", e); - } - } - } - - private void publishAPIs() throws DeviceManagementException { - List apiConfigs = - MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getAPIs(); - for (APIConfig apiConfig : apiConfigs) { - DeviceManagementAPIPublisherUtil.publishAPI(apiConfig); - } - } - - private void removeAPIs() throws DeviceManagementException { - List apiConfigs = - MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). - getApiPublisherConfig().getAPIs(); - for (APIConfig apiConfig : apiConfigs) { - DeviceManagementAPIPublisherUtil.removeAPI(apiConfig); - } - } - - protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } - - protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) { - //do nothing - } + this.removeAPIs(); + if (log.isDebugEnabled()) { + log.debug( + "Mobile Device Management Service Component has been successfully de-activated"); + } + } catch (Throwable e) { + log.error("Error occurred while de-activating Mobile Device Management bundle", e); + } + } + + private void initAPIConfigs() throws DeviceManagementException { + List apiConfigs = + MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). + getApiPublisherConfig().getAPIs(); + for (APIConfig apiConfig : apiConfigs) { + try { + APIProvider provider = + APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner()); + apiConfig.init(provider); + } catch (APIManagementException e) { + throw new DeviceManagementException( + "Error occurred while initializing API Config '" + + apiConfig.getName() + "'", e); + } + } + } + + private void publishAPIs() throws DeviceManagementException { + List apiConfigs = + MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). + getApiPublisherConfig().getAPIs(); + for (APIConfig apiConfig : apiConfigs) { + DeviceManagementAPIPublisherUtil.publishAPI(apiConfig); + } + } + + private void removeAPIs() throws DeviceManagementException { + List apiConfigs = + MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig(). + getApiPublisherConfig().getAPIs(); + for (APIConfig apiConfig : apiConfigs) { + DeviceManagementAPIPublisherUtil.removeAPI(apiConfig); + } + } + + protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) { + //do nothing + } + + protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) { + //do nothing + } } diff --git a/product/modules/distribution/src/assembly/bin.xml b/product/modules/distribution/src/assembly/bin.xml index 1478107e94..e1eb407829 100644 --- a/product/modules/distribution/src/assembly/bin.xml +++ b/product/modules/distribution/src/assembly/bin.xml @@ -210,7 +210,7 @@ - ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm + ../distribution/src/repository/dbscripts/cdm wso2cdm-${project.version}/dbscripts/cdm */** @@ -460,5 +460,15 @@ 644 + + + + ../distribution/src/repository/database/WSO2MobileDM_DB.h2.db + + ${pom.artifactId}-${pom.version}/repository/database + WSO2MobileDM_DB.h2.db + 644 + + diff --git a/product/modules/distribution/src/repository/database/WSO2MobileDM_DB.h2.db b/product/modules/distribution/src/repository/database/WSO2MobileDM_DB.h2.db new file mode 100644 index 0000000000000000000000000000000000000000..219f5ea3fba3982c9681e889a3317060a2cbbeb2 GIT binary patch literal 2109440 zcmeI&2Y8kB-N#`P4yahFh!)YJPqad)K@&1ax@^V?q=W=BP`ZvFV7J|^U0PS`9^HHI z-P*nP-h1!8_pa|ZA?JjkA+&w3_qyKp&gDnoX&=l=hm5pm6$V#C^^`K0!fdx|w{ zibZLkf1Wq*zd@5cy0FsuAAEZQhu#V3(~@=$NWNo009C72>b^M zxc>hKE~<}2fB*pk1PBlyK!5-N0t5&UAV7cs0RsQ^0tXy?hZs!!m4E)~zrL>Sule1? zU;ZDE4onB7Md{#lle9S9G#!!-O-s^YX=yq<9g%L9mZc-p@^n->I^8_2NXMjOQ;{0d zaq0MUi*!O-nO3F7v^w1~otT=^n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XF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ zfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&U zAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C7 z2oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N z0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+ z009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBly zK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF z5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk z1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs z0RjXF5FkK+009C72oNAZfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF5FkK+009C72oNAZ gfB*pk1PBlyK!5-N0t5&UAV7cs0RjXF{I?7I4=6ua!vFvP literal 0 HcmV?d00001 diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql index 783acaa8de..3ceea15a02 100644 --- a/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql +++ b/product/modules/distribution/src/repository/dbscripts/cdm/h2.sql @@ -23,4 +23,4 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION ); -- TO:DO - Remove this INSERT sql statement. -Insert into DM_DEVICE_TYPE (ID,NAME) VALUES (1, 'android'); +Insert into DM_DEVICE_TYPE (NAME) VALUES ('android'); diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql index fd239aa58f..39610edd9a 100644 --- a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql @@ -31,13 +31,8 @@ CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( CREATE TABLE IF NOT EXISTS `MBL_OPERATION` ( `OPERATION_ID` INT NOT NULL AUTO_INCREMENT , `FEATURE_CODE` VARCHAR(45) NOT NULL , - `CREATED_DATE` INT NULL , - PRIMARY KEY (`OPERATION_ID`) , - CONSTRAINT `fk_MBL_OPERATION_MBL_FEATURES1` - FOREIGN KEY (`FEATURE_CODE` ) - REFERENCES `MBL_FEATURE` (`CODE` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION); + `CREATED_DATE` BIGINT NULL , + PRIMARY KEY (`OPERATION_ID`)); -- ----------------------------------------------------- -- Table `MBL_DEVICE_OPERATION_MAPPING` @@ -45,8 +40,8 @@ CREATE TABLE IF NOT EXISTS `MBL_OPERATION` ( CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` ( `DEVICE_ID` VARCHAR(45) NOT NULL , `OPERATION_ID` INT NOT NULL , - `SENT_DATE` INT NULL , - `RECEIVED_DATE` INT NULL , + `SENT_DATE` BIGINT NULL , + `RECEIVED_DATE` BIGINT NULL , PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) , CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE` FOREIGN KEY (`DEVICE_ID` ) diff --git a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ index 85304414bf..31ae8bd724 100644 --- a/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ +++ b/product/modules/distribution/src/repository/dbscripts/cdm/plugins/h2.sql~ @@ -10,6 +10,8 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( `OS_VERSION` VARCHAR(45) NULL DEFAULT NULL , `DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL , `VENDOR` VARCHAR(45) NULL DEFAULT NULL , + `LATITUDE` VARCHAR(45) NULL DEFAULT NULL, + `LONGITUDE` VARCHAR(45) NULL DEFAULT NULL, PRIMARY KEY (`MOBILE_DEVICE_ID`) ); @@ -18,7 +20,7 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( `FEATURE_ID` INT NOT NULL AUTO_INCREMENT , - `CODE` VARCHAR(45) NULL , + `CODE` VARCHAR(45) NOT NULL , `NAME` VARCHAR(100) NULL , `DESCRIPTION` VARCHAR(200) NULL , PRIMARY KEY (`FEATURE_ID`) ); @@ -28,23 +30,18 @@ CREATE TABLE IF NOT EXISTS `MBL_FEATURE` ( -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `MBL_OPERATION` ( `OPERATION_ID` INT NOT NULL AUTO_INCREMENT , - `FEATURE_CODE` VARCHAR(45) NULL , - `CREATED_DATE` INT NULL , - PRIMARY KEY (`OPERATION_ID`) , - CONSTRAINT `fk_MBL_OPERATION_MBL_FEATURES1` - FOREIGN KEY (`FEATURE_CODE` ) - REFERENCES `MBL_FEATURE` (`CODE` ) - ON DELETE NO ACTION - ON UPDATE NO ACTION); + `FEATURE_CODE` VARCHAR(45) NOT NULL , + `CREATED_DATE` LONG NULL , + PRIMARY KEY (`OPERATION_ID`)); -- ----------------------------------------------------- --- Table `MBL_DEVICE_OPERATION_MAPING` +-- Table `MBL_DEVICE_OPERATION_MAPPING` -- ----------------------------------------------------- -CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPING` ( +CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` ( `DEVICE_ID` VARCHAR(45) NOT NULL , `OPERATION_ID` INT NOT NULL , - `SENT_DATE` INT NULL , - `RECEIVED_DATE` INT NULL , + `SENT_DATE` LONG NULL , + `RECEIVED_DATE` LONG NULL , PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) , CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE` FOREIGN KEY (`DEVICE_ID` ) @@ -61,11 +58,10 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPING` ( -- Table `MBL_OPERATION_PROPERTY` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` ( - `OPERATION_PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , - `OPERATION_ID` INT NULL , - `PROPERTY_ID` INT NULL , + `OPERATION_ID` INT NOT NULL , + `PROPERTY` VARCHAR(45) NOT NULL , `VALUE` TEXT NULL , - PRIMARY KEY (`OPERATION_PROPERTY_ID`) , + PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) , CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1` FOREIGN KEY (`OPERATION_ID` ) REFERENCES `MBL_OPERATION` (`OPERATION_ID` ) @@ -76,13 +72,11 @@ CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` ( -- Table `MBL_FEATURE_PROPERTY` -- ----------------------------------------------------- CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` ( - `PROPERTY_ID` INT NOT NULL AUTO_INCREMENT , - `PROPERTY` VARCHAR(100) NULL , - `FEATURE_ID` VARCHAR(45) NULL , - PRIMARY KEY (`PROPERTY_ID`) , + `PROPERTY` VARCHAR(45) NOT NULL , + `FEATURE_ID` VARCHAR(45) NOT NULL , + PRIMARY KEY (`PROPERTY`) , CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1` FOREIGN KEY (`FEATURE_ID` ) REFERENCES `MBL_FEATURE` (`FEATURE_ID` ) ON DELETE NO ACTION ON UPDATE NO ACTION); - diff --git a/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/cdmserver/mobileservices/android/Enrollment.java b/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/cdmserver/mobileservices/android/Enrollment.java index a5fb3b8de7..d2e2438f8f 100644 --- a/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/cdmserver/mobileservices/android/Enrollment.java +++ b/product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/cdmserver/mobileservices/android/Enrollment.java @@ -39,112 +39,113 @@ import javax.ws.rs.core.Response; @Consumes({ "application/json", "application/xml" }) public class Enrollment { - private static Log log = LogFactory.getLog(Enrollment.class); - - @POST - public Message enrollDevice(org.wso2.carbon.device.mgt.common.Device device) throws AndroidAgentException { - - Message responseMsg = new Message(); - - try { - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - AndroidAPIUtils.getDeviceManagementService().enrollDevice(device); - Response.status(Response.Status.CREATED); - responseMsg.setResponseMessage("Device enrollment succeeded"); - return responseMsg; - } catch (DeviceManagementServiceException deviceServiceMgtEx) { - String errorMsg = "Device management service error"; - log.error(errorMsg, deviceServiceMgtEx); - throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); - } catch (DeviceManagementException deviceMgtEx) { - String errorMsg = "Error occurred while enrolling the device"; - log.error(errorMsg, deviceMgtEx); - throw new AndroidAgentException(errorMsg, deviceMgtEx); - } - } - - @GET - @Path("{id}") - public Message isEnrolled(@PathParam("id") String id) throws AndroidAgentException { - - boolean result; - Message responseMsg = new Message(); - DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); - - try { - result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier); - if (result) { - responseMsg.setResponseMessage("Device has already enrolled"); - } else { - Response.status(Response.Status.NOT_FOUND); - responseMsg.setResponseMessage("Device not found"); - } - return responseMsg; - } catch (DeviceManagementServiceException deviceServiceMgtEx) { - String errorMsg = "Device management service error"; - log.error(errorMsg, deviceServiceMgtEx); - throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); - } catch (DeviceManagementException deviceMgtEx) { - String errorMsg = "Error occurred while enrollment of the device."; - log.error(errorMsg, deviceMgtEx); - throw new AndroidAgentException(errorMsg, deviceMgtEx); - } - } - - @PUT - @Path("{id}") - public Message modifyEnrollment(@PathParam("id") String id, org.wso2.carbon.device.mgt.common.Device device) - throws AndroidAgentException { - - boolean result; - Message responseMsg = new Message(); - try { - device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); - result = AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device); - if (result) { - responseMsg.setResponseMessage("Device enrollment has updated successfully"); - Response.status(Response.Status.ACCEPTED); - } else { - responseMsg.setResponseMessage("Device not found for enrollment"); - Response.status(Response.Status.NOT_MODIFIED); - } - return responseMsg; - } catch (DeviceManagementServiceException deviceServiceMgtEx) { - String errorMsg = "Device management service error"; - log.error(errorMsg, deviceServiceMgtEx); - throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); - } catch (DeviceManagementException deviceMgtEx) { - String errorMsg = "Error occurred while modifying enrollment of the device"; - log.error(errorMsg, deviceMgtEx); - throw new AndroidAgentException(errorMsg, deviceMgtEx); - } - } - - @DELETE - @Path("{id}") - public Message disEnrollDevice(@PathParam("id") String id) throws AndroidAgentException { - - Message responseMsg = new Message(); - boolean result; - DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); - - try { - result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); - if (result) { - responseMsg.setResponseMessage("Device has removed successfully"); - } else { - responseMsg.setResponseMessage("Device not found"); - Response.status(Response.Status.NOT_FOUND); - } - return responseMsg; - } catch (DeviceManagementServiceException deviceServiceMgtEx) { - String errorMsg = "Device management service error"; - log.error(errorMsg, deviceServiceMgtEx); - throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); - } catch (DeviceManagementException deviceMgtEx) { - String errorMsg = "Error occurred while dis enrolling the device"; - log.error(errorMsg, deviceMgtEx); - throw new AndroidAgentException(errorMsg, deviceMgtEx); - } - } + private static Log log = LogFactory.getLog(Enrollment.class); + + @POST + public Message enrollDevice(org.wso2.carbon.device.mgt.common.Device device) + throws AndroidAgentException { + + Message responseMsg = new Message(); + + try { + device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + AndroidAPIUtils.getDeviceManagementService().enrollDevice(device); + Response.status(Response.Status.CREATED); + responseMsg.setResponseMessage("Device enrollment succeeded"); + return responseMsg; + } catch (DeviceManagementServiceException deviceServiceMgtEx) { + String errorMsg = "Device management service error"; + log.error(errorMsg, deviceServiceMgtEx); + throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); + } catch (DeviceManagementException deviceMgtEx) { + String errorMsg = "Error occurred while enrolling the device"; + log.error(errorMsg, deviceMgtEx); + throw new AndroidAgentException(errorMsg, deviceMgtEx); + } + } + + @GET + @Path("{id}") + public Message isEnrolled(@PathParam("id") String id) throws AndroidAgentException { + + boolean result; + Message responseMsg = new Message(); + DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); + + try { + result = AndroidAPIUtils.getDeviceManagementService().isEnrolled(deviceIdentifier); + if (result) { + responseMsg.setResponseMessage("Device has already enrolled"); + } else { + Response.status(Response.Status.NOT_FOUND); + responseMsg.setResponseMessage("Device not found"); + } + return responseMsg; + } catch (DeviceManagementServiceException deviceServiceMgtEx) { + String errorMsg = "Device management service error"; + log.error(errorMsg, deviceServiceMgtEx); + throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); + } catch (DeviceManagementException deviceMgtEx) { + String errorMsg = "Error occurred while enrollment of the device."; + log.error(errorMsg, deviceMgtEx); + throw new AndroidAgentException(errorMsg, deviceMgtEx); + } + } + + @PUT + @Path("{id}") + public Message modifyEnrollment(@PathParam("id") String id, + org.wso2.carbon.device.mgt.common.Device device) + throws AndroidAgentException { + + boolean result; + Message responseMsg = new Message(); + try { + device.setType(DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID); + result = AndroidAPIUtils.getDeviceManagementService().modifyEnrollment(device); + if (result) { + responseMsg.setResponseMessage("Device enrollment has updated successfully"); + Response.status(Response.Status.ACCEPTED); + } else { + responseMsg.setResponseMessage("Device not found for enrollment"); + Response.status(Response.Status.NOT_MODIFIED); + } + return responseMsg; + } catch (DeviceManagementServiceException deviceServiceMgtEx) { + String errorMsg = "Device management service error"; + log.error(errorMsg, deviceServiceMgtEx); + throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); + } catch (DeviceManagementException deviceMgtEx) { + String errorMsg = "Error occurred while modifying enrollment of the device"; + log.error(errorMsg, deviceMgtEx); + throw new AndroidAgentException(errorMsg, deviceMgtEx); + } + } + + @DELETE + @Path("{id}") + public Message disEnrollDevice(@PathParam("id") String id) throws AndroidAgentException { + Message responseMsg = new Message(); + boolean result; + DeviceIdentifier deviceIdentifier = AndroidAPIUtils.convertToDeviceIdentifierObject(id); + + try { + result = AndroidAPIUtils.getDeviceManagementService().disenrollDevice(deviceIdentifier); + if (result) { + responseMsg.setResponseMessage("Device has removed successfully"); + } else { + responseMsg.setResponseMessage("Device not found"); + Response.status(Response.Status.NOT_FOUND); + } + return responseMsg; + } catch (DeviceManagementServiceException deviceServiceMgtEx) { + String errorMsg = "Device management service error"; + log.error(errorMsg, deviceServiceMgtEx); + throw new AndroidAgentException(errorMsg, deviceServiceMgtEx); + } catch (DeviceManagementException deviceMgtEx) { + String errorMsg = "Error occurred while dis enrolling the device"; + log.error(errorMsg, deviceMgtEx); + throw new AndroidAgentException(errorMsg, deviceMgtEx); + } + } } diff --git a/product/modules/mobileservices/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml b/product/modules/mobileservices/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml index a58b5fc254..5b0c46836a 100644 --- a/product/modules/mobileservices/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/product/modules/mobileservices/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -23,9 +23,9 @@ http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> - + - + @@ -53,6 +53,7 @@ + From a195844042606af8ecc6cc09770a613bf43ac1d5 Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Wed, 21 Jan 2015 16:55:37 +0530 Subject: [PATCH 6/7] Changed the properties implementation to a Map from List. Removed unnecessary utility methods. Changed the conversion util methods. --- .../wso2/carbon/device/mgt/common/Device.java | 29 ++------- .../util/MobileDeviceManagementUtil.java | 65 +++++++------------ 2 files changed, 27 insertions(+), 67 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java index 94786b4191..4e083cedaa 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/Device.java @@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.common; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; +import java.util.Map; @XmlRootElement public class Device { @@ -34,7 +35,7 @@ public class Device { private String deviceIdentifier; private String owner; private List features; - private List properties; + private Map properties; @XmlElement public int getId() { @@ -145,34 +146,12 @@ public class Device { } @XmlElement - public List getProperties() { + public Map getProperties() { return properties; } - public void setProperties(List properties) { + public void setProperties(Map properties) { this.properties = properties; } - public static class Property { - - private String name; - private String value; - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } - } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java index d170379eea..60ad0e4503 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java @@ -60,39 +60,19 @@ public class MobileDeviceManagementUtil { } } - private static String getPropertyValue(Device device, String property) { - for (Device.Property prop : device.getProperties()) { - if (property.equals(prop.getName())) { - return prop.getValue(); - } - } - return null; - } - - private static Device.Property getProperty(String property, String value) { - Device.Property prop = null; - if (property != null) { - prop = new Device.Property(); - prop.setName(property); - prop.setValue(value); - return prop; - } - return prop; - } - public static MobileDevice convertToMobileDevice(Device device) { MobileDevice mobileDevice = null; if (device != null) { mobileDevice = new MobileDevice(); mobileDevice.setMobileDeviceId(device.getDeviceIdentifier()); - mobileDevice.setImei(getPropertyValue(device, MOBILE_DEVICE_IMEI)); - mobileDevice.setImsi(getPropertyValue(device, MOBILE_DEVICE_IMSI)); - mobileDevice.setRegId(getPropertyValue(device, MOBILE_DEVICE_REG_ID)); - mobileDevice.setModel(getPropertyValue(device, MOBILE_DEVICE_MODEL)); - mobileDevice.setOsVersion(getPropertyValue(device, MOBILE_DEVICE_OS_VERSION)); - mobileDevice.setVendor(getPropertyValue(device, MOBILE_DEVICE_VENDOR)); - mobileDevice.setLatitude(getPropertyValue(device, MOBILE_DEVICE_LATITUDE)); - mobileDevice.setLongitude(getPropertyValue(device, MOBILE_DEVICE_LONGITUDE)); + mobileDevice.setImei(device.getProperties().get(MOBILE_DEVICE_IMEI)); + mobileDevice.setImsi(device.getProperties().get(MOBILE_DEVICE_IMSI)); + mobileDevice.setRegId(device.getProperties().get(MOBILE_DEVICE_REG_ID)); + mobileDevice.setModel(device.getProperties().get(MOBILE_DEVICE_MODEL)); + mobileDevice.setOsVersion(device.getProperties().get(MOBILE_DEVICE_OS_VERSION)); + mobileDevice.setVendor(device.getProperties().get(MOBILE_DEVICE_VENDOR)); + mobileDevice.setLatitude(device.getProperties().get(MOBILE_DEVICE_LATITUDE)); + mobileDevice.setLongitude(device.getProperties().get(MOBILE_DEVICE_LONGITUDE)); } return mobileDevice; } @@ -101,16 +81,16 @@ public class MobileDeviceManagementUtil { Device device = null; if (mobileDevice != null) { device = new Device(); - List propertyList = new ArrayList(); - propertyList.add(getProperty(MOBILE_DEVICE_IMEI, mobileDevice.getImei())); - propertyList.add(getProperty(MOBILE_DEVICE_IMSI, mobileDevice.getImsi())); - propertyList.add(getProperty(MOBILE_DEVICE_REG_ID, mobileDevice.getRegId())); - propertyList.add(getProperty(MOBILE_DEVICE_MODEL, mobileDevice.getModel())); - propertyList.add(getProperty(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion())); - propertyList.add(getProperty(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor())); - propertyList.add(getProperty(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude())); - propertyList.add(getProperty(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude())); - device.setProperties(propertyList); + Map propertyMap = new HashMap(); + propertyMap.put(MOBILE_DEVICE_IMEI, mobileDevice.getImei()); + propertyMap.put(MOBILE_DEVICE_IMSI, mobileDevice.getImsi()); + propertyMap.put(MOBILE_DEVICE_REG_ID, mobileDevice.getRegId()); + propertyMap.put(MOBILE_DEVICE_MODEL, mobileDevice.getModel()); + propertyMap.put(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion()); + propertyMap.put(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor()); + propertyMap.put(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude()); + propertyMap.put(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude()); + device.setProperties(propertyMap); device.setDeviceIdentifier(mobileDevice.getMobileDeviceId()); } return device; @@ -137,18 +117,19 @@ public class MobileDeviceManagementUtil { public static List getMobileOperationIdsFromMobileDeviceOperations( List mobileDeviceOperations) { List mobileOperationIds = new ArrayList(); - for(MobileDeviceOperation mobileDeviceOperation:mobileDeviceOperations){ + for (MobileDeviceOperation mobileDeviceOperation : mobileDeviceOperations) { mobileOperationIds.add(mobileDeviceOperation.getOperationId()); } return mobileOperationIds; } - public static Operation convertMobileOperationToOperation(MobileOperation mobileOperation){ + public static Operation convertMobileOperationToOperation(MobileOperation mobileOperation) { Operation operation = new Operation(); Properties properties = new Properties(); operation.setCode(mobileOperation.getFeatureCode()); - for(MobileOperationProperty mobileOperationProperty:mobileOperation.getProperties()){ - properties.put(mobileOperationProperty.getProperty(),mobileOperationProperty.getValue()); + for (MobileOperationProperty mobileOperationProperty : mobileOperation.getProperties()) { + properties + .put(mobileOperationProperty.getProperty(), mobileOperationProperty.getValue()); } operation.setProperties(properties); return operation; From 93a82676e318341056e9bcd6e3b8c14ea46fe8f8 Mon Sep 17 00:00:00 2001 From: Dulitha Wijewantha Date: Wed, 21 Jan 2015 17:08:12 +0530 Subject: [PATCH 7/7] * Created a utility js to hold the utility functions * Created the UI APIs for mobile * Fixed a bug and changed the implementation to work with the properties Map instead of the List * Changed method signature and implementation to accept DeviceType for the conversion * UI level changes and license headers --- .../device/mgt/core/DeviceManagerImpl.java | 19 ++++++---- .../dao/util/DeviceManagementDAOUtil.java | 22 ++--------- .../jaggeryapps/cdm/api/mobile/device-api.jag | 38 +++++++++++++++++++ .../src/repository/jaggeryapps/cdm/init.js | 33 +++++++++++++++- .../repository/jaggeryapps/cdm/jaggery.conf | 10 +++-- .../jaggeryapps/cdm/modules/utility.js | 32 ++++++++++++++++ .../jaggeryapps/cdm/pages/dashboard.jag | 23 +++++++++-- .../jaggeryapps/cdm/pages/device.jag | 19 +++++++++- 8 files changed, 162 insertions(+), 34 deletions(-) create mode 100644 product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag create mode 100644 product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java index 37b49b32b0..1af868981a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagerImpl.java @@ -28,6 +28,7 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException; import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO; import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil; +import org.wso2.carbon.device.mgt.core.dto.DeviceType; import java.util.ArrayList; import java.util.List; @@ -109,17 +110,19 @@ public class DeviceManagerImpl implements DeviceManager { List devicesList = new ArrayList(); try { Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(type); - List devices = - this.getDeviceDAO().getDevices(deviceTypeId); + List devices = + this.getDeviceDAO().getDevices(deviceTypeId); for (org.wso2.carbon.device.mgt.core.dto.Device device : devices) { - Device convertedDevice = DeviceManagementDAOUtil.convertDevice(device); - DeviceIdentifier deviceIdentifier = DeviceManagementDAOUtil - .createDeviceIdentifier(device, this.deviceTypeDAO - .getDeviceType(device.getDeviceTypeId())); + DeviceType deviceType = this.deviceTypeDAO.getDeviceType(device.getDeviceTypeId()); + Device convertedDevice = DeviceManagementDAOUtil.convertDevice(device, deviceType); + DeviceIdentifier deviceIdentifier = + DeviceManagementDAOUtil.createDeviceIdentifier(device, deviceType); Device dmsDevice = dms.getDevice(deviceIdentifier); - convertedDevice.setProperties(dmsDevice.getProperties()); - convertedDevice.setFeatures(dmsDevice.getFeatures()); + if (dmsDevice != null) { + convertedDevice.setProperties(dmsDevice.getProperties()); + convertedDevice.setFeatures(dmsDevice.getFeatures()); + } devicesList.add(convertedDevice); } } catch (DeviceManagementDAOException e) { diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java index 951d33dae9..fdc3df4d2a 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/dao/util/DeviceManagementDAOUtil.java @@ -34,9 +34,7 @@ import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; import java.util.Hashtable; -import java.util.List; public final class DeviceManagementDAOUtil { @@ -107,9 +105,10 @@ public final class DeviceManagementDAOUtil { /** * @param device - The DTO device object. + * @param deviceType - The DeviceType object associated with the device * @return A Business Object. */ - public static org.wso2.carbon.device.mgt.common.Device convertDevice(Device device){ + public static org.wso2.carbon.device.mgt.common.Device convertDevice(Device device, DeviceType deviceType){ org.wso2.carbon.device.mgt.common.Device deviceBO = new org.wso2.carbon.device.mgt.common.Device(); deviceBO.setDateOfEnrolment(device.getDateOfEnrollment()); @@ -117,6 +116,7 @@ public final class DeviceManagementDAOUtil { deviceBO.setDescription(device.getDescription()); deviceBO.setDeviceIdentifier(device.getDeviceIdentificationId()); deviceBO.setDeviceTypeId(device.getDeviceTypeId()); + deviceBO.setType(deviceType.getName()); deviceBO.setName(device.getName()); deviceBO.setId(device.getId()); deviceBO.setOwner(device.getOwnerId()); @@ -126,21 +126,7 @@ public final class DeviceManagementDAOUtil { } else if (device.getStatus() == Status.INACTIVE) { deviceBO.setStatus(false); } - return null; - } - - /** - * @param devices - DTO Device Object list. - * @return converted Business Object list. - */ - public static List convertDevices( - List devices) { - List deviceBOList = - new ArrayList(); - for (Device device : devices) { - deviceBOList.add(convertDevice(device)); - } - return deviceBOList; + return deviceBO; } public static Device convertDevice(org.wso2.carbon.device.mgt.common.Device diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag new file mode 100644 index 0000000000..10f37dc405 --- /dev/null +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/api/mobile/device-api.jag @@ -0,0 +1,38 @@ +<% +/* + * 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. + */ +var utility = require("/modules/utility.js"); +var deviceManagementService = utility.getDeviceManagementService(); +var devices = deviceManagementService.getAllDevices("android"); +var logger = new Log(); +var deviceList = []; +for (i = 0; i < devices.size(); i++) { + var device = devices.get(i); + deviceList.push({ + "identifier": device.getDeviceIdentifier(), + "name": device.getName(), + "ownership": device.getOwnership(), + "owner": device.getOwner(), + "deviceType": device.getType(), + "vendor": device.getProperties().get("vendor"), + "model": device.getProperties().get("model"), + "osVersion": device.getProperties().get("osVersion") + }); +} +print(deviceList); +%> \ No newline at end of file diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js b/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js index 27d9cf25ce..859dd1037f 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/init.js @@ -1 +1,32 @@ -//Init js to execute \ No newline at end of file +/* + * 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. + */ +//Init js to execute +var logger = new Log(); +logger.debug("running debug"); +var app_TENANT_CONFIGS = 'tenant.configs'; +var app_carbon = require('carbon'); +var app_configs = { + "HTTPS_URL": "https://localhost:9443" +}; + +var app_server = new app_carbon.server.Server({ + tenanted: app_configs.tenanted, + url: app_configs.HTTPS_URL + '/admin' +}); +application.put("SERVER", app_server); +application.put(app_TENANT_CONFIGS, {}); diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf b/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf index 3012d60828..efc8b12576 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/jaggery.conf @@ -1,6 +1,6 @@ { "welcomeFiles": ["pages/dashboard.jag"], - "initScripts": ["init.js"], + "initScripts": ["/init.js"], "urlMappings": [ { "url": "/devices/*", @@ -9,12 +9,16 @@ { "url": "/dashboard", "path": "/pages/dashboard.jag" + }, + { + "url": "/api/devices/mobile/*", + "path": "/api/mobile/device-api.jag" } ], "errorPages": { "500": "/error500.jag", "404": "/error404.jag", - "403": "/error403.jag" + "403": "/error403.jag " }, - "logLevel": "info" + "logLevel": "debug" } \ No newline at end of file diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js b/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js new file mode 100644 index 0000000000..47b8862bfe --- /dev/null +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/modules/utility.js @@ -0,0 +1,32 @@ +/* + * 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. + */ + +//temporary + +var PrivilegedCarbonContext = Packages.org.wso2.carbon.context.PrivilegedCarbonContext, + Class = java.lang.Class; + +osgiService = function (clazz) { + return PrivilegedCarbonContext.getThreadLocalCarbonContext().getOSGiService(Class.forName(clazz)); +}; +var getDeviceManagementService= function(){ + //server.authenticate("admin", "admin"); + var realmService = osgiService('org.wso2.carbon.device.mgt.core.service.DeviceManagementService'); + //var realmService = null; + return realmService; +} diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag index 7231b35304..46c5cd3dad 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/dashboard.jag @@ -1,5 +1,22 @@ -<% +<% +/* + * 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. + */ var title="WSO2 CDM"; %> @@ -31,7 +48,7 @@ var title="WSO2 CDM";
- +
@@ -39,7 +56,7 @@ var title="WSO2 CDM"; - + diff --git a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag index e4930c190f..3005b915cd 100644 --- a/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag +++ b/product/modules/distribution/src/repository/jaggeryapps/cdm/pages/device.jag @@ -1,5 +1,22 @@ -<% +<% +/* + * 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. + */ var title="WSO2 CDM"; %>
Name Owner OwnershipDevice TypeDevice Type Vendor Model OS Version