forked from community/device-mgt-core
parent
7b41e2cd0d
commit
175205b959
@ -0,0 +1,76 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.mgt.extensions.common;
|
||||||
|
|
||||||
|
import javax.xml.bind.annotation.XmlElement;
|
||||||
|
import javax.xml.bind.annotation.XmlRootElement;
|
||||||
|
|
||||||
|
@XmlRootElement(name = "DataSourceConfig")
|
||||||
|
public class DataSourceConfig {
|
||||||
|
|
||||||
|
private String url;
|
||||||
|
private String driverClassName;
|
||||||
|
private String user;
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
return "DataSourceConfig[" +
|
||||||
|
" Url ='" + url + '\'' +
|
||||||
|
", DriverClassName ='" + driverClassName + '\'' +
|
||||||
|
", UserName ='" + user + '\'' +
|
||||||
|
", Password ='" + password + '\'' +
|
||||||
|
"]";
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Url", nillable = false)
|
||||||
|
public String getUrl() {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUrl(String url) {
|
||||||
|
this.url = url;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "DriverClassName", nillable = false)
|
||||||
|
public String getDriverClassName() {
|
||||||
|
return driverClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDriverClassName(String driverClassName) {
|
||||||
|
this.driverClassName = driverClassName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "User", nillable = false)
|
||||||
|
public String getUser() {
|
||||||
|
return user;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUser(String user) {
|
||||||
|
this.user = user;
|
||||||
|
}
|
||||||
|
|
||||||
|
@XmlElement(name = "Password", nillable = false)
|
||||||
|
public String getPassword() {
|
||||||
|
return password;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setPassword(String password) {
|
||||||
|
this.password = password;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,127 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.mgt.extensions.mock;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceStatusTaskPluginConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.InitialOperationConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.MonitoringOperation;
|
||||||
|
import org.wso2.carbon.device.mgt.common.OperationMonitoringTaskConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.ProvisioningConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.StartupOperationConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.general.GeneralConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.invitation.mgt.DeviceEnrollmentInvitationDetails;
|
||||||
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||||
|
import org.wso2.carbon.device.mgt.common.policy.mgt.PolicyMonitoringManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.pull.notification.PullNotificationSubscriber;
|
||||||
|
import org.wso2.carbon.device.mgt.common.push.notification.PushNotificationConfig;
|
||||||
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.common.type.mgt.DeviceTypePlatformDetails;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
|
||||||
|
public class TypeXDeviceManagementService implements DeviceManagementService {
|
||||||
|
|
||||||
|
private String deviceType;
|
||||||
|
|
||||||
|
public TypeXDeviceManagementService(String deviceType) {
|
||||||
|
this.deviceType = deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws DeviceManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return deviceType;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public OperationMonitoringTaskConfig getOperationMonitoringConfig() {
|
||||||
|
OperationMonitoringTaskConfig operationMonitoringTaskConfig = new OperationMonitoringTaskConfig();
|
||||||
|
operationMonitoringTaskConfig.setMonitoringOperation(new ArrayList<MonitoringOperation>());
|
||||||
|
return operationMonitoringTaskConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceManager getDeviceManager() {
|
||||||
|
return new TypeXDeviceManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationManager getApplicationManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ProvisioningConfig getProvisioningConfig() {
|
||||||
|
return new ProvisioningConfig("carbon.super", true);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PushNotificationConfig getPushNotificationConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PolicyMonitoringManager getPolicyMonitoringManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public InitialOperationConfig getInitialOperationConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StartupOperationConfig getStartupOperationConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PullNotificationSubscriber getPullNotificationSubscriber() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceStatusTaskPluginConfig getDeviceStatusTaskPluginConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public GeneralConfig getGeneralConfig() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceTypePlatformDetails getDeviceTypePlatformDetails() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceEnrollmentInvitationDetails getDeviceEnrollmentInvitationDetails() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public License getLicenseConfig() { return null; }
|
||||||
|
}
|
@ -0,0 +1,130 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2021, Entgra (Pvt) Ltd. (http://www.entgra.io) All Rights Reserved.
|
||||||
|
*
|
||||||
|
* Entgra (Pvt) Ltd. licenses this file to you under the Apache License,
|
||||||
|
* Version 2.0 (the "License"); you may not use this file except
|
||||||
|
* in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing,
|
||||||
|
* software distributed under the License is distributed on an
|
||||||
|
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||||
|
* KIND, either express or implied. See the License for the
|
||||||
|
* specific language governing permissions and limitations
|
||||||
|
* under the License.
|
||||||
|
*/
|
||||||
|
package org.wso2.carbon.device.mgt.extensions.mock;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.EnrolmentInfo;
|
||||||
|
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.configuration.mgt.PlatformConfiguration;
|
||||||
|
import org.wso2.carbon.device.mgt.common.exceptions.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||||
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class TypeXDeviceManager implements DeviceManager {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureManager getFeatureManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveConfiguration(PlatformConfiguration configuration)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public PlatformConfiguration getConfiguration() throws DeviceManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteDevices(List<String> deviceIdentifiers) throws DeviceManagementException {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getAllDevices() throws DeviceManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public boolean updateDeviceProperties(DeviceIdentifier deviceId, List<Device.Property> list)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setStatus(DeviceIdentifier deviceId, String currentOwner, EnrolmentInfo.Status status)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public License getLicense(String languageCode) throws LicenseManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addLicense(License license) throws LicenseManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean requireDeviceAuthorization() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,33 @@
|
|||||||
|
<?xml version="1.0" encoding="ISO-8859-1"?>
|
||||||
|
<!--
|
||||||
|
~ Copyright (c) 2021, Entgra (pvt) Ltd. (http://entgra.io) All Rights Reserved.
|
||||||
|
~
|
||||||
|
~ Entgra (pvt) Ltd. 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<DataSourceConfig>
|
||||||
|
<Url>jdbc:h2:mem:cdm-test-db;DB_CLOSE_ON_EXIT=FALSE;MVCC=true</Url>
|
||||||
|
<DriverClassName>org.h2.Driver</DriverClassName>
|
||||||
|
<User>wso2carbon</User>
|
||||||
|
<Password>wso2carbon</Password>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- For MySql -->
|
||||||
|
|
||||||
|
<!--<Url>jdbc:mysql://localhost:3306/WSO2CDM</Url>-->
|
||||||
|
<!--<DriverClassName>com.mysql.jdbc.Driver</DriverClassName>-->
|
||||||
|
<!--<User>root</User>-->
|
||||||
|
<!--<Password></Password>-->
|
||||||
|
</DataSourceConfig>
|
Loading…
Reference in new issue