forked from community/device-mgt-core
Merge branch 'master' of https://github.com/geethkokila/product-cdm
commit
0543d71f6b
@ -0,0 +1,6 @@
|
||||
package org.wso2.carbon.device.mgt.core.dto;
|
||||
|
||||
|
||||
public enum OwnerShip {
|
||||
BYOD,COPE
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.common;
|
||||
|
||||
|
||||
public enum DBTypes {
|
||||
Oracle("Oracle"),H2("H2"),MySql("MySql");
|
||||
|
||||
String dbName ;
|
||||
DBTypes(String dbStrName) {
|
||||
dbName = dbStrName;
|
||||
}
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.common;
|
||||
|
||||
import javax.xml.bind.annotation.XmlAttribute;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement(name = "DBType")
|
||||
public class TestDBConfiguration {
|
||||
|
||||
private String connectionUrl;
|
||||
private String driverClass;
|
||||
private String userName;
|
||||
private String pwd;
|
||||
|
||||
@Override public String toString() {
|
||||
return "TestDBConfiguration{" +
|
||||
"connectionUrl='" + connectionUrl + '\'' +
|
||||
", driverClass='" + driverClass + '\'' +
|
||||
", userName='" + userName + '\'' +
|
||||
", pwd='" + pwd + '\'' +
|
||||
", dbType='" + dbType + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
private String dbType;
|
||||
|
||||
@XmlElement(name = "connectionurl", nillable = false)
|
||||
public String getConnectionUrl() {
|
||||
return connectionUrl;
|
||||
}
|
||||
|
||||
public void setConnectionUrl(String connectionUrl) {
|
||||
this.connectionUrl = connectionUrl;
|
||||
}
|
||||
|
||||
@XmlElement(name = "driverclass", nillable = false)
|
||||
public String getDriverClass() {
|
||||
return driverClass;
|
||||
}
|
||||
|
||||
public void setDriverClass(String driverClass) {
|
||||
this.driverClass = driverClass;
|
||||
}
|
||||
|
||||
@XmlElement(name = "userName", nillable = false)
|
||||
public String getUserName() {
|
||||
return userName;
|
||||
}
|
||||
|
||||
public void setUserName(String userName) {
|
||||
this.userName = userName;
|
||||
}
|
||||
|
||||
@XmlElement(name = "pwd", nillable = false)
|
||||
public String getPwd() {
|
||||
return pwd;
|
||||
}
|
||||
|
||||
public void setPwd(String pwd) {
|
||||
this.pwd = pwd;
|
||||
}
|
||||
|
||||
@XmlAttribute(name = "typeName")
|
||||
public String getDbType() {
|
||||
return dbType;
|
||||
}
|
||||
|
||||
public void setDbType(String dbType) {
|
||||
this.dbType = dbType;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,36 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.common;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "DeviceMgtTestDBConfigurations")
|
||||
public class TestDBConfigurations {
|
||||
|
||||
private List<TestDBConfiguration> dbTypesList;
|
||||
|
||||
@XmlElement(name = "DBType")
|
||||
public List<TestDBConfiguration> getDbTypesList() {
|
||||
return dbTypesList;
|
||||
}
|
||||
|
||||
public void setDbTypesList(List<TestDBConfiguration> dbTypesList) {
|
||||
this.dbTypesList = dbTypesList;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.dao;
|
||||
|
||||
import org.testng.Assert;
|
||||
|
||||
public class DeviceDAOTest {
|
||||
|
||||
// @Test
|
||||
public void setUp() throws Exception {
|
||||
// log.info("Testing started.");
|
||||
Assert.assertEquals("A", "A");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,174 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.core.dao;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Parameters;
|
||||
import org.testng.annotations.Test;
|
||||
import org.w3c.dom.Document;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.core.common.DBTypes;
|
||||
import org.wso2.carbon.device.mgt.core.common.TestDBConfiguration;
|
||||
import org.wso2.carbon.device.mgt.core.common.TestDBConfigurations;
|
||||
import org.wso2.carbon.device.mgt.core.dto.Device;
|
||||
import org.wso2.carbon.device.mgt.core.dto.DeviceType;
|
||||
import org.wso2.carbon.device.mgt.core.dto.OwnerShip;
|
||||
import org.wso2.carbon.device.mgt.core.dto.Status;
|
||||
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import java.io.File;
|
||||
import java.sql.*;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class DeviceMgtDAOTestSuite {
|
||||
|
||||
private TestDBConfiguration testDBConfiguration;
|
||||
private DeviceType devType = new DeviceType();
|
||||
private Connection conn = null;
|
||||
private Statement stmt = null;
|
||||
|
||||
@BeforeClass
|
||||
@Parameters("dbType")
|
||||
public void setUpDB(String dbTypeStr) throws Exception {
|
||||
|
||||
DBTypes dbType = DBTypes.valueOf(dbTypeStr);
|
||||
testDBConfiguration = getTestDBConfiguration(dbType);
|
||||
|
||||
switch (dbType) {
|
||||
case H2:
|
||||
createH2DB(testDBConfiguration);
|
||||
BasicDataSource testDataSource = new BasicDataSource();
|
||||
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass());
|
||||
testDataSource.setUrl(testDBConfiguration.getConnectionUrl());
|
||||
testDataSource.setUsername(testDBConfiguration.getUserName());
|
||||
testDataSource.setPassword(testDBConfiguration.getPwd());
|
||||
DeviceManagementDAOFactory.init(testDataSource);
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
private TestDBConfiguration getTestDBConfiguration(DBTypes dbType)
|
||||
throws DeviceManagementDAOException, DeviceManagementException {
|
||||
|
||||
File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml");
|
||||
Document doc = null;
|
||||
testDBConfiguration = null;
|
||||
TestDBConfigurations testDBConfigurations = null;
|
||||
|
||||
doc = DeviceManagerUtil.convertToDocument(deviceMgtConfig);
|
||||
JAXBContext testDBContext = null;
|
||||
|
||||
try {
|
||||
testDBContext = JAXBContext.newInstance(TestDBConfigurations.class);
|
||||
Unmarshaller unmarshaller = testDBContext.createUnmarshaller();
|
||||
testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc);
|
||||
} catch (JAXBException e) {
|
||||
throw new DeviceManagementDAOException("Error parsing test db configurations", e);
|
||||
}
|
||||
|
||||
Iterator<TestDBConfiguration> itrDBConfigs = testDBConfigurations.getDbTypesList().iterator();
|
||||
while (itrDBConfigs.hasNext()) {
|
||||
testDBConfiguration = itrDBConfigs.next();
|
||||
if (testDBConfiguration.getDbType().equals(dbType.toString())) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return testDBConfiguration;
|
||||
}
|
||||
|
||||
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
|
||||
|
||||
Class.forName(testDBConf.getDriverClass());
|
||||
conn = DriverManager.getConnection(testDBConf.getConnectionUrl());
|
||||
stmt = conn.createStatement();
|
||||
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
|
||||
stmt.close();
|
||||
conn.close();
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void addDeviceTypeTest() throws DeviceManagementDAOException, DeviceManagementException {
|
||||
|
||||
DeviceTypeDAO deviceTypeMgtDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
|
||||
|
||||
devType.setName("IOS");
|
||||
|
||||
deviceTypeMgtDAO.addDeviceType(devType);
|
||||
Long deviceTypeId = null;
|
||||
|
||||
try {
|
||||
conn = DeviceManagementDAOFactory.getDataSource().getConnection();
|
||||
stmt = conn.createStatement();
|
||||
ResultSet resultSet = stmt.executeQuery("SELECT ID,NAME from DM_DEVICE_TYPE DType where DType.NAME='IOS'");
|
||||
|
||||
while (resultSet.next()) {
|
||||
deviceTypeId = resultSet.getLong(1);
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException sqlEx) {
|
||||
throw new DeviceManagementDAOException("error in fetch device type by name IOS", sqlEx);
|
||||
}
|
||||
|
||||
Assert.assertNotNull(deviceTypeId, "Device Type Id is null");
|
||||
devType.setId(deviceTypeId);
|
||||
|
||||
}
|
||||
|
||||
@Test(dependsOnMethods = { "addDeviceTypeTest" })
|
||||
public void addDeviceTest() throws DeviceManagementDAOException, DeviceManagementException {
|
||||
|
||||
DeviceDAO deviceMgtDAO = DeviceManagementDAOFactory.getDeviceDAO();
|
||||
|
||||
Device device = new Device();
|
||||
|
||||
device.setDateOfEnrollment(new Date().getTime());
|
||||
device.setDateOfLastUpdate(new Date().getTime());
|
||||
device.setDescription("test description");
|
||||
device.setStatus(Status.ACTIVE);
|
||||
device.setDeviceIdentificationId("111");
|
||||
device.setDeviceType(devType.getId().intValue());
|
||||
device.setOwnerShip(OwnerShip.BYOD.toString());
|
||||
device.setOwnerId("111");
|
||||
device.setTenantId(-1234);
|
||||
deviceMgtDAO.addDevice(device);
|
||||
|
||||
Long deviceId = null;
|
||||
try {
|
||||
conn = DeviceManagementDAOFactory.getDataSource().getConnection();
|
||||
stmt = conn.createStatement();
|
||||
ResultSet resultSet = stmt
|
||||
.executeQuery("SELECT ID from DM_DEVICE DEVICE where DEVICE.DEVICE_IDENTIFICATION='111'");
|
||||
|
||||
while (resultSet.next()) {
|
||||
deviceId = resultSet.getLong(1);
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException sqlEx) {
|
||||
throw new DeviceManagementDAOException("error in fetch device by device identification id", sqlEx);
|
||||
}
|
||||
|
||||
Assert.assertNotNull(deviceId, "Device Id is null");
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
|
||||
(
|
||||
ID INT auto_increment NOT NULL,
|
||||
NAME VARCHAR(300) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (ID)
|
||||
);
|
||||
|
||||
CREATE TABLE IF NOT EXISTS DM_DEVICE
|
||||
(
|
||||
ID INT auto_increment NOT NULL,
|
||||
DESCRIPTION TEXT NULL DEFAULT NULL,
|
||||
NAME VARCHAR(100) NULL DEFAULT NULL,
|
||||
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
|
||||
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
|
||||
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
|
||||
STATUS VARCHAR(15) NULL DEFAULT NULL,
|
||||
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
|
||||
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
|
||||
OWNER VARCHAR(45) NULL DEFAULT NULL,
|
||||
TENANT_ID INTEGER DEFAULT 0,
|
||||
PRIMARY KEY (ID),
|
||||
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
|
||||
REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
|
||||
);
|
@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||
<!--
|
||||
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~ http://www.apache.org/licenses/LICENSE-2.
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<DeviceMgtTestDBConfigurations>
|
||||
<DBType typeName="H2">
|
||||
<connectionurl>jdbc:h2:mem:cdm-test-db;DB_CLOSE_DELAY=-1</connectionurl>
|
||||
<driverclass>org.h2.Driver</driverclass>
|
||||
<userName></userName>
|
||||
<pwd></pwd>
|
||||
</DBType>
|
||||
</DeviceMgtTestDBConfigurations>
|
@ -0,0 +1,28 @@
|
||||
<!--
|
||||
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
~ WSO2 Inc. licenses this file to you under the Apache License,
|
||||
~ Version 2.0 (the "License"); you may not use this file except
|
||||
~ in compliance with the License.
|
||||
~ You may obtain a copy of the License at
|
||||
~ http://www.apache.org/licenses/LICENSE-2.
|
||||
~ Unless required by applicable law or agreed to in writing,
|
||||
~ software distributed under the License is distributed on an
|
||||
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
~ KIND, either express or implied. See the License for the
|
||||
~ specific language governing permissions and limitations
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
|
||||
|
||||
<suite name="EMM-core-initializer">
|
||||
<parameter name="useDefaultListeners" value="false"/>
|
||||
|
||||
<test name="DAO Unit Tests" preserve-order="true">
|
||||
<parameter name="dbType" value="H2"/>
|
||||
<classes>
|
||||
|
||||
<class name="org.wso2.carbon.device.mgt.core.dao.DeviceMgtDAOTestSuite"/>
|
||||
</classes>
|
||||
</test>
|
||||
</suite>
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice;
|
||||
|
||||
/**
|
||||
* This class represents the key operations associated with persisting mobile-device related information.
|
||||
*/
|
||||
public interface MobileDeviceDAO {
|
||||
|
||||
MobileDevice getDevice(String deviceId) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void addDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void updateDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void deleteDevice(String deviceId) throws MobileDeviceManagementDAOException;
|
||||
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
/**
|
||||
* Custom exception class for mobile device specific data access related exceptions.
|
||||
*/
|
||||
public class MobileDeviceManagementDAOException extends Exception {
|
||||
|
||||
private String message;
|
||||
private static final long serialVersionUID = 2021891706072918865L;
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified detail message and nested exception.
|
||||
*
|
||||
* @param message error message
|
||||
* @param nestedException exception
|
||||
*/
|
||||
public MobileDeviceManagementDAOException(String message, Exception nestedException) {
|
||||
super(message, nestedException);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified detail message and cause.
|
||||
*
|
||||
* @param message the detail message.
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public MobileDeviceManagementDAOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified detail message
|
||||
*
|
||||
* @param message the detail message.
|
||||
*/
|
||||
public MobileDeviceManagementDAOException(String message) {
|
||||
super(message);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new exception with the specified and cause.
|
||||
*
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public MobileDeviceManagementDAOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.message = errorMessage;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDeviceModel;
|
||||
|
||||
/**
|
||||
* This class represents the key operations associated with persisting mobile-device model related
|
||||
* information.
|
||||
*/
|
||||
public interface MobileDeviceModelDAO {
|
||||
|
||||
MobileDeviceModel getDeviceModel(String modelId) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void addDeviceModel(MobileDeviceModel deviceModel) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void updateDeviceModel(MobileDeviceModel deviceModel) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void deleteDeviceModel(String modelId) throws MobileDeviceManagementDAOException;
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDeviceVendor;
|
||||
|
||||
/**
|
||||
* This class represents the key operations associated with persisting mobile-device vendor
|
||||
* related information.
|
||||
*/
|
||||
public interface MobileDeviceVendorDAO {
|
||||
|
||||
MobileDeviceVendor getDeviceModel(String vendorId) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void addDeviceVendor(MobileDeviceVendor deviceVendor) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void updateDeviceVendor(MobileDeviceVendor deviceVendor)
|
||||
throws MobileDeviceManagementDAOException;
|
||||
|
||||
void deleteDeviceVendor(String vendorId) throws MobileDeviceManagementDAOException;
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileOSVersion;
|
||||
|
||||
/**
|
||||
* This class represents the key operations associated with persisting mobile-device OS version
|
||||
* related information.
|
||||
*/
|
||||
public interface MobileOSVersionDAO {
|
||||
|
||||
MobileOSVersion getMobileOSVersion(String versionId) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void addMobileOSVersion(MobileOSVersion osVersion) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void updateMobileOSVersion(MobileOSVersion osVersion) throws MobileDeviceManagementDAOException;
|
||||
|
||||
void deleteMobileOSVersion(String versionId) throws MobileDeviceManagementDAOException;
|
||||
}
|
@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice;
|
||||
|
||||
/**
|
||||
* Implementation of MobileDeviceDAO.
|
||||
*/
|
||||
public class MobileDeviceDAOImpl implements MobileDeviceDAO {
|
||||
@Override
|
||||
public MobileDevice getDevice(String deviceId) throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDevice(MobileDevice mobileDevice)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDevice(MobileDevice mobileDevice)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDevice(String deviceId) throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceModelDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDeviceModel;
|
||||
|
||||
/**
|
||||
* Implementation of MobileDeviceModel.
|
||||
*/
|
||||
public class MobileDeviceModelImpl implements MobileDeviceModelDAO {
|
||||
@Override
|
||||
public MobileDeviceModel getDeviceModel(String modelId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeviceModel(MobileDeviceModel deviceModel)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceModel(MobileDeviceModel deviceModel)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceModel(String modelId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceVendorDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDeviceVendor;
|
||||
|
||||
/**
|
||||
* Implementation of MobileDeviceVendorDAO.
|
||||
*/
|
||||
public class MobileDeviceVendorDAOImpl implements MobileDeviceVendorDAO {
|
||||
@Override
|
||||
public MobileDeviceVendor getDeviceModel(String vendorId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addDeviceVendor(MobileDeviceVendor deviceVendor)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateDeviceVendor(MobileDeviceVendor deviceVendor)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteDeviceVendor(String vendorId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,46 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileOSVersionDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileOSVersion;
|
||||
|
||||
/**
|
||||
* Implementation of MobileOSVersionDAO.
|
||||
*/
|
||||
public class MobileOSVersionDAOImpl implements MobileOSVersionDAO {
|
||||
@Override public MobileOSVersion getMobileOSVersion(String versionId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public void addMobileOSVersion(MobileOSVersion osVersion)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override public void updateMobileOSVersion(MobileOSVersion osVersion)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
|
||||
@Override public void deleteMobileOSVersion(String versionId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dao.util;
|
||||
|
||||
/**
|
||||
* Utility method required by MobileDeviceManagement DAO classes.
|
||||
*/
|
||||
public class MobileDeviceManagementDAOUtil {
|
||||
}
|
@ -0,0 +1,89 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* DTO of MobileDevice.
|
||||
*/
|
||||
public class MobileDevice implements Serializable {
|
||||
|
||||
private String mobileDeviceId;
|
||||
private String regId;
|
||||
private String imei;
|
||||
private String imsi;
|
||||
private int osVersionId;
|
||||
private int modelId;
|
||||
private int vendorId;
|
||||
|
||||
public String getMobileDeviceId() {
|
||||
return mobileDeviceId;
|
||||
}
|
||||
|
||||
public void setMobileDeviceId(String mobileDeviceId) {
|
||||
this.mobileDeviceId = mobileDeviceId;
|
||||
}
|
||||
|
||||
public String getRegId() {
|
||||
return regId;
|
||||
}
|
||||
|
||||
public void setRegId(String regId) {
|
||||
this.regId = regId;
|
||||
}
|
||||
|
||||
public String getImei() {
|
||||
return imei;
|
||||
}
|
||||
|
||||
public void setImei(String imei) {
|
||||
this.imei = imei;
|
||||
}
|
||||
|
||||
public String getImsi() {
|
||||
return imsi;
|
||||
}
|
||||
|
||||
public void setImsi(String imsi) {
|
||||
this.imsi = imsi;
|
||||
}
|
||||
|
||||
public int getOsVersionId() {
|
||||
return osVersionId;
|
||||
}
|
||||
|
||||
public void setOsVersionId(int osVersionId) {
|
||||
this.osVersionId = osVersionId;
|
||||
}
|
||||
|
||||
public int getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(int modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public int getVendorId() {
|
||||
return vendorId;
|
||||
}
|
||||
|
||||
public void setVendorId(int vendorId) {
|
||||
this.vendorId = vendorId;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* DTO of MobileDeviceModel.
|
||||
*/
|
||||
public class MobileDeviceModel implements Serializable {
|
||||
|
||||
private int modelId;
|
||||
private String model;
|
||||
|
||||
public int getModelId() {
|
||||
return modelId;
|
||||
}
|
||||
|
||||
public void setModelId(int modelId) {
|
||||
this.modelId = modelId;
|
||||
}
|
||||
|
||||
public String getModel() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public void setModel(String model) {
|
||||
this.model = model;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* DTO of MobileVendor.
|
||||
*/
|
||||
public class MobileDeviceVendor implements Serializable {
|
||||
|
||||
private int vendorId;
|
||||
private String vendor;
|
||||
|
||||
public int getVendorId() {
|
||||
return vendorId;
|
||||
}
|
||||
|
||||
public void setVendorId(int vendorId) {
|
||||
this.vendorId = vendorId;
|
||||
}
|
||||
|
||||
public String getVendor() {
|
||||
return vendor;
|
||||
}
|
||||
|
||||
public void setVendor(String vendor) {
|
||||
this.vendor = vendor;
|
||||
}
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* 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 org.wso2.carbon.device.mgt.mobile.impl.dto;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* DTO of MobileOSVersion.
|
||||
*/
|
||||
public class MobileOSVersion implements Serializable {
|
||||
|
||||
private int osVersionId;
|
||||
private String osVersion;
|
||||
|
||||
public int getOsVersionId() {
|
||||
return osVersionId;
|
||||
}
|
||||
|
||||
public void setOsVersionId(int osVersionId) {
|
||||
this.osVersionId = osVersionId;
|
||||
}
|
||||
|
||||
public String getOsVersion() {
|
||||
return osVersion;
|
||||
}
|
||||
|
||||
public void setOsVersion(String osVersion) {
|
||||
this.osVersion = osVersion;
|
||||
}
|
||||
}
|
Loading…
Reference in new issue