forked from community/device-mgt-plugins
Merge pull request #54 from Shabirmean/IoTS-1.0.0-M1
Added RPi device_type component
commit
b794aaed23
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>device-mgt-iot-raspberrypi</artifactId>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>bundle</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Server RaspberryPi Management Plugin</name>
|
||||||
|
<description>WSO2 Carbon - RaspberryPi Management/Control Plugin Implementation</description>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<source>1.7</source>
|
||||||
|
<target>1.7</target>
|
||||||
|
</configuration>
|
||||||
|
<version>2.3.2</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-bundle-plugin</artifactId>
|
||||||
|
<version>1.4.0</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<configuration>
|
||||||
|
<instructions>
|
||||||
|
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||||
|
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||||
|
<Bundle-Version>${carbon.iot.device.mgt.version}</Bundle-Version>
|
||||||
|
<Bundle-Description>IoT Server Impl Bundle</Bundle-Description>
|
||||||
|
<Private-Package>org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.internal</Private-Package>
|
||||||
|
<Import-Package>
|
||||||
|
org.osgi.framework,
|
||||||
|
org.osgi.service.component,
|
||||||
|
org.apache.commons.logging,
|
||||||
|
javax.xml.bind.*,
|
||||||
|
javax.naming,
|
||||||
|
javax.sql,
|
||||||
|
javax.xml.bind.annotation.*,
|
||||||
|
javax.xml.parsers,
|
||||||
|
javax.net,
|
||||||
|
javax.net.ssl,
|
||||||
|
org.w3c.dom,
|
||||||
|
org.wso2.carbon.device.mgt.common.*,
|
||||||
|
org.wso2.carbon.device.mgt.common,
|
||||||
|
org.wso2.carbon.context.*,
|
||||||
|
org.wso2.carbon.ndatasource.core,
|
||||||
|
org.wso2.carbon.device.mgt.iot.*,
|
||||||
|
</Import-Package>
|
||||||
|
|
||||||
|
<Export-Package>
|
||||||
|
!org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.internal,
|
||||||
|
org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.*
|
||||||
|
</Export-Package>
|
||||||
|
</instructions>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.eclipse.osgi</groupId>
|
||||||
|
<artifactId>org.eclipse.osgi.services</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.ndatasource.core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot</artifactId>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
|
||||||
|
</project>
|
@ -0,0 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.constants;
|
||||||
|
|
||||||
|
public class RaspberrypiConstants {
|
||||||
|
|
||||||
|
public final static String DEVICE_TYPE = "raspberrypi";
|
||||||
|
public final static String DEVICE_PLUGIN_DEVICE_NAME = "DEVICE_NAME";
|
||||||
|
public final static String DEVICE_PLUGIN_DEVICE_ID = "RASPBERRYPI_DEVICE_ID";
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,281 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.common.Device;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
|
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.TenantConfiguration;
|
||||||
|
import org.wso2.carbon.device.mgt.common.license.mgt.License;
|
||||||
|
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dto.IotDevice;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.util.IotDeviceManagementUtil;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.dao.RaspberrypiDAO;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This represents the Raspberrypi implementation of DeviceManagerService.
|
||||||
|
*/
|
||||||
|
public class RaspberrypiManager implements DeviceManager {
|
||||||
|
|
||||||
|
private static final IotDeviceManagementDAOFactory iotDeviceManagementDAOFactory = new RaspberrypiDAO();
|
||||||
|
private static final Log log = LogFactory.getLog(RaspberrypiManager.class);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FeatureManager getFeatureManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean saveConfiguration(TenantConfiguration tenantConfiguration)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
//TODO implement this
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TenantConfiguration getConfiguration() throws DeviceManagementException {
|
||||||
|
//TODO implement this
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean enrollDevice(Device device) throws DeviceManagementException {
|
||||||
|
boolean status;
|
||||||
|
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Enrolling a new Raspberrypi device : " + device.getDeviceIdentifier());
|
||||||
|
}
|
||||||
|
RaspberrypiDAO.beginTransaction();
|
||||||
|
status = iotDeviceManagementDAOFactory.getIotDeviceDAO().addIotDevice(
|
||||||
|
iotDevice);
|
||||||
|
RaspberrypiDAO.commitTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
try {
|
||||||
|
RaspberrypiDAO.rollbackTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException iotDAOEx) {
|
||||||
|
String msg = "Error occurred while roll back the device enrol transaction :" + device.toString();
|
||||||
|
log.warn(msg, iotDAOEx);
|
||||||
|
}
|
||||||
|
String msg = "Error while enrolling the Raspberrypi device : " + device.getDeviceIdentifier();
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
|
||||||
|
boolean status;
|
||||||
|
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Modifying the Raspberrypi device enrollment data");
|
||||||
|
}
|
||||||
|
RaspberrypiDAO.beginTransaction();
|
||||||
|
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
||||||
|
.updateIotDevice(iotDevice);
|
||||||
|
RaspberrypiDAO.commitTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
try {
|
||||||
|
RaspberrypiDAO.rollbackTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException iotDAOEx) {
|
||||||
|
String msg = "Error occurred while roll back the update device transaction :" + device.toString();
|
||||||
|
log.warn(msg, iotDAOEx);
|
||||||
|
}
|
||||||
|
String msg = "Error while updating the enrollment of the Raspberrypi device : " +
|
||||||
|
device.getDeviceIdentifier();
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
boolean status;
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Dis-enrolling Raspberrypi device : " + deviceId);
|
||||||
|
}
|
||||||
|
RaspberrypiDAO.beginTransaction();
|
||||||
|
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
||||||
|
.deleteIotDevice(deviceId.getId());
|
||||||
|
RaspberrypiDAO.commitTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
try {
|
||||||
|
RaspberrypiDAO.rollbackTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException iotDAOEx) {
|
||||||
|
String msg = "Error occurred while roll back the device dis enrol transaction :" + deviceId.toString();
|
||||||
|
log.warn(msg, iotDAOEx);
|
||||||
|
}
|
||||||
|
String msg = "Error while removing the Raspberrypi device : " + deviceId.getId();
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
boolean isEnrolled = false;
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Checking the enrollment of Raspberrypi device : " + deviceId.getId());
|
||||||
|
}
|
||||||
|
IotDevice iotDevice =
|
||||||
|
iotDeviceManagementDAOFactory.getIotDeviceDAO().getIotDevice(
|
||||||
|
deviceId.getId());
|
||||||
|
if (iotDevice != null) {
|
||||||
|
isEnrolled = true;
|
||||||
|
}
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
String msg = "Error while checking the enrollment status of Raspberrypi device : " +
|
||||||
|
deviceId.getId();
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return isEnrolled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setActive(DeviceIdentifier deviceId, boolean status)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
|
||||||
|
Device device;
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Getting the details of Raspberrypi device : " + deviceId.getId());
|
||||||
|
}
|
||||||
|
IotDevice iotDevice = iotDeviceManagementDAOFactory.getIotDeviceDAO().
|
||||||
|
getIotDevice(deviceId.getId());
|
||||||
|
device = IotDeviceManagementUtil.convertToDevice(iotDevice);
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
String msg = "Error while fetching the Raspberrypi device : " + deviceId.getId();
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return device;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean isClaimable(DeviceIdentifier deviceIdentifier) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean setStatus(DeviceIdentifier deviceId, String currentOwner,
|
||||||
|
EnrolmentInfo.Status status) throws DeviceManagementException {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public License getLicense(String s) throws LicenseManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addLicense(License license) throws LicenseManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean requireDeviceAuthorization() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
|
||||||
|
boolean status;
|
||||||
|
IotDevice iotDevice = IotDeviceManagementUtil.convertToIotDevice(device);
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug(
|
||||||
|
"updating the details of Raspberrypi device : " + deviceIdentifier);
|
||||||
|
}
|
||||||
|
RaspberrypiDAO.beginTransaction();
|
||||||
|
status = iotDeviceManagementDAOFactory.getIotDeviceDAO()
|
||||||
|
.updateIotDevice(iotDevice);
|
||||||
|
RaspberrypiDAO.commitTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
try {
|
||||||
|
RaspberrypiDAO.rollbackTransaction();
|
||||||
|
} catch (IotDeviceManagementDAOException iotDAOEx) {
|
||||||
|
String msg = "Error occurred while roll back the update device info transaction :" + device.toString();
|
||||||
|
log.warn(msg, iotDAOEx);
|
||||||
|
}
|
||||||
|
String msg =
|
||||||
|
"Error while updating the Raspberrypi device : " + deviceIdentifier;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Device> getAllDevices() throws DeviceManagementException {
|
||||||
|
List<Device> devices = null;
|
||||||
|
try {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Fetching the details of all Raspberrypi devices");
|
||||||
|
}
|
||||||
|
List<IotDevice> iotDevices =
|
||||||
|
iotDeviceManagementDAOFactory.getIotDeviceDAO().getAllIotDevices();
|
||||||
|
if (iotDevices != null) {
|
||||||
|
devices = new ArrayList<Device>();
|
||||||
|
for (IotDevice iotDevice : iotDevices) {
|
||||||
|
devices.add(IotDeviceManagementUtil.convertToDevice(iotDevice));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (IotDeviceManagementDAOException e) {
|
||||||
|
String msg = "Error while fetching all Raspberrypi devices.";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new DeviceManagementException(msg, e);
|
||||||
|
}
|
||||||
|
return devices;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,113 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl;
|
||||||
|
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.DeviceManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
|
||||||
|
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
|
||||||
|
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||||
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.constants.RaspberrypiConstants;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public class RaspberrypiManagerService implements DeviceManagementService {
|
||||||
|
|
||||||
|
private DeviceManager deviceManager;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getType() {
|
||||||
|
return RaspberrypiConstants.DEVICE_TYPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getProviderTenantDomain() {
|
||||||
|
return "carbon.super";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isSharedWithAllTenants() {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String[] getSharedTenantsDomain() {
|
||||||
|
return new String[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws DeviceManagementException {
|
||||||
|
deviceManager = new RaspberrypiManager();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public DeviceManager getDeviceManager() {
|
||||||
|
return deviceManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ApplicationManager getApplicationManager() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void notifyOperationToDevices(Operation operation, List<DeviceIdentifier> deviceIds)
|
||||||
|
throws DeviceManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Application[] getApplications(String domain, int pageNumber, int size)
|
||||||
|
throws ApplicationManagementException {
|
||||||
|
return new Application[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
|
||||||
|
String status) throws ApplicationManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getApplicationStatus(DeviceIdentifier deviceId, Application application)
|
||||||
|
throws ApplicationManagementException {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void installApplicationForDevices(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
|
||||||
|
throws ApplicationManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void installApplicationForUsers(Operation operation, List<String> userNameList)
|
||||||
|
throws ApplicationManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void installApplicationForUserRoles(Operation operation, List<String> userRoleList)
|
||||||
|
throws ApplicationManagementException {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,123 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.dao;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceDAO;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOFactoryInterface;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.constants.RaspberrypiConstants;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.dao.impl.RaspberrypiDeviceDAOImpl;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
|
||||||
|
public class RaspberrypiDAO extends IotDeviceManagementDAOFactory implements IotDeviceManagementDAOFactoryInterface {
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(RaspberrypiDAO.class);
|
||||||
|
static DataSource dataSource;
|
||||||
|
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
|
||||||
|
|
||||||
|
public RaspberrypiDAO() {
|
||||||
|
initRaspberrypiDAO();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public IotDeviceDAO getIotDeviceDAO() {
|
||||||
|
return new RaspberrypiDeviceDAOImpl();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void initRaspberrypiDAO() {
|
||||||
|
dataSource = getDataSourceMap().get(RaspberrypiConstants.DEVICE_TYPE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void beginTransaction() throws IotDeviceManagementDAOException {
|
||||||
|
try {
|
||||||
|
Connection conn = dataSource.getConnection();
|
||||||
|
conn.setAutoCommit(false);
|
||||||
|
currentConnection.set(conn);
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new IotDeviceManagementDAOException("Error occurred while retrieving datasource connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Connection getConnection() throws IotDeviceManagementDAOException {
|
||||||
|
if (currentConnection.get() == null) {
|
||||||
|
try {
|
||||||
|
currentConnection.set(dataSource.getConnection());
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new IotDeviceManagementDAOException("Error occurred while retrieving data source connection", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return currentConnection.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void commitTransaction() throws IotDeviceManagementDAOException {
|
||||||
|
try {
|
||||||
|
Connection conn = currentConnection.get();
|
||||||
|
if (conn != null) {
|
||||||
|
conn.commit();
|
||||||
|
} else {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Datasource connection associated with the current thread is null, hence commit "
|
||||||
|
+ "has not been attempted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new IotDeviceManagementDAOException("Error occurred while committing the transaction", e);
|
||||||
|
} finally {
|
||||||
|
closeConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void closeConnection() throws IotDeviceManagementDAOException {
|
||||||
|
|
||||||
|
Connection con = currentConnection.get();
|
||||||
|
if (con != null) {
|
||||||
|
try {
|
||||||
|
con.close();
|
||||||
|
} catch (SQLException e) {
|
||||||
|
log.error("Error occurred while close the connection");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
currentConnection.remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void rollbackTransaction() throws IotDeviceManagementDAOException {
|
||||||
|
try {
|
||||||
|
Connection conn = currentConnection.get();
|
||||||
|
if (conn != null) {
|
||||||
|
conn.rollback();
|
||||||
|
} else {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Datasource connection associated with the current thread is null, hence rollback "
|
||||||
|
+ "has not been attempted");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
throw new IotDeviceManagementDAOException("Error occurred while rollback the transaction", e);
|
||||||
|
} finally {
|
||||||
|
closeConnection();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,238 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.dao.impl;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceDAO;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.IotDeviceManagementDAOException;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dao.util.IotDeviceManagementDAOUtil;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.util.iotdevice.dto.IotDevice;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.dao.RaspberrypiDAO;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.constants.RaspberrypiConstants;
|
||||||
|
|
||||||
|
import java.sql.Connection;
|
||||||
|
import java.sql.PreparedStatement;
|
||||||
|
import java.sql.ResultSet;
|
||||||
|
import java.sql.SQLException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Implements IotDeviceDAO for Raspberrypi Devices.
|
||||||
|
*/
|
||||||
|
public class RaspberrypiDeviceDAOImpl implements IotDeviceDAO{
|
||||||
|
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(RaspberrypiDeviceDAOImpl.class);
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IotDevice getIotDevice(String iotDeviceId)
|
||||||
|
throws IotDeviceManagementDAOException {
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
IotDevice iotDevice = null;
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
try {
|
||||||
|
conn = RaspberrypiDAO.getConnection();
|
||||||
|
String selectDBQuery =
|
||||||
|
"SELECT RASPBERRYPI_DEVICE_ID, DEVICE_NAME" +
|
||||||
|
" FROM RASPBERRYPI_DEVICE WHERE RASPBERRYPI_DEVICE_ID = ?";
|
||||||
|
stmt = conn.prepareStatement(selectDBQuery);
|
||||||
|
stmt.setString(1, iotDeviceId);
|
||||||
|
resultSet = stmt.executeQuery();
|
||||||
|
|
||||||
|
if (resultSet.next()) {
|
||||||
|
iotDevice = new IotDevice();
|
||||||
|
iotDevice.setIotDeviceName(resultSet.getString(
|
||||||
|
RaspberrypiConstants.DEVICE_PLUGIN_DEVICE_NAME));
|
||||||
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
iotDevice.setDeviceProperties(propertyMap);
|
||||||
|
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Raspberrypi device " + iotDeviceId + " data has been fetched from " +
|
||||||
|
"Raspberrypi database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while fetching Raspberrypi device : '" + iotDeviceId + "'";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new IotDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
IotDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
||||||
|
RaspberrypiDAO.closeConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
return iotDevice;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addIotDevice(IotDevice iotDevice)
|
||||||
|
throws IotDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = RaspberrypiDAO.getConnection();
|
||||||
|
String createDBQuery =
|
||||||
|
"INSERT INTO RASPBERRYPI_DEVICE(RASPBERRYPI_DEVICE_ID, DEVICE_NAME) VALUES (?, ?)";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(createDBQuery);
|
||||||
|
stmt.setString(1, iotDevice.getIotDeviceId());
|
||||||
|
stmt.setString(2,iotDevice.getIotDeviceName());
|
||||||
|
if (iotDevice.getDeviceProperties() == null) {
|
||||||
|
iotDevice.setDeviceProperties(new HashMap<String, String>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Raspberrypi device " + iotDevice.getIotDeviceId() + " data has been" +
|
||||||
|
" added to the Raspberrypi database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while adding the Raspberrypi device '" +
|
||||||
|
iotDevice.getIotDeviceId() + "' to the Raspberrypi db.";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new IotDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateIotDevice(IotDevice iotDevice)
|
||||||
|
throws IotDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = RaspberrypiDAO.getConnection();
|
||||||
|
String updateDBQuery =
|
||||||
|
"UPDATE RASPBERRYPI_DEVICE SET DEVICE_NAME = ? WHERE RASPBERRYPI_DEVICE_ID = ?";
|
||||||
|
|
||||||
|
stmt = conn.prepareStatement(updateDBQuery);
|
||||||
|
|
||||||
|
if (iotDevice.getDeviceProperties() == null) {
|
||||||
|
iotDevice.setDeviceProperties(new HashMap<String, String>());
|
||||||
|
}
|
||||||
|
stmt.setString(1, iotDevice.getIotDeviceName());
|
||||||
|
|
||||||
|
stmt.setString(2, iotDevice.getIotDeviceId());
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Raspberrypi device " + iotDevice.getIotDeviceId() + " data has been" +
|
||||||
|
" modified.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while modifying the Raspberrypi device '" +
|
||||||
|
iotDevice.getIotDeviceId() + "' data.";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new IotDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean deleteIotDevice(String iotDeviceId)
|
||||||
|
throws IotDeviceManagementDAOException {
|
||||||
|
boolean status = false;
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
try {
|
||||||
|
conn = RaspberrypiDAO.getConnection();
|
||||||
|
String deleteDBQuery =
|
||||||
|
"DELETE FROM RASPBERRYPI_DEVICE WHERE RASPBERRYPI_DEVICE_ID = ?";
|
||||||
|
stmt = conn.prepareStatement(deleteDBQuery);
|
||||||
|
stmt.setString(1, iotDeviceId);
|
||||||
|
int rows = stmt.executeUpdate();
|
||||||
|
if (rows > 0) {
|
||||||
|
status = true;
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Raspberrypi device " + iotDeviceId + " data has deleted" +
|
||||||
|
" from the Raspberrypi database.");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while deleting Raspberrypi device " + iotDeviceId;
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new IotDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
IotDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||||
|
}
|
||||||
|
return status;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<IotDevice> getAllIotDevices()
|
||||||
|
throws IotDeviceManagementDAOException {
|
||||||
|
|
||||||
|
Connection conn = null;
|
||||||
|
PreparedStatement stmt = null;
|
||||||
|
ResultSet resultSet = null;
|
||||||
|
IotDevice iotDevice;
|
||||||
|
List<IotDevice> iotDevices = new ArrayList<IotDevice>();
|
||||||
|
|
||||||
|
try {
|
||||||
|
conn = RaspberrypiDAO.getConnection();
|
||||||
|
String selectDBQuery =
|
||||||
|
"SELECT RASPBERRYPI_DEVICE_ID, DEVICE_NAME " +
|
||||||
|
"FROM RASPBERRYPI_DEVICE";
|
||||||
|
stmt = conn.prepareStatement(selectDBQuery);
|
||||||
|
resultSet = stmt.executeQuery();
|
||||||
|
while (resultSet.next()) {
|
||||||
|
iotDevice = new IotDevice();
|
||||||
|
iotDevice.setIotDeviceId(resultSet.getString(RaspberrypiConstants.DEVICE_PLUGIN_DEVICE_ID));
|
||||||
|
iotDevice.setIotDeviceName(resultSet.getString(RaspberrypiConstants.DEVICE_PLUGIN_DEVICE_NAME));
|
||||||
|
|
||||||
|
Map<String, String> propertyMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
iotDevice.setDeviceProperties(propertyMap);
|
||||||
|
iotDevices.add(iotDevice);
|
||||||
|
}
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("All Raspberrypi device details have fetched from Raspberrypi database.");
|
||||||
|
}
|
||||||
|
return iotDevices;
|
||||||
|
} catch (SQLException e) {
|
||||||
|
String msg = "Error occurred while fetching all Raspberrypi device data'";
|
||||||
|
log.error(msg, e);
|
||||||
|
throw new IotDeviceManagementDAOException(msg, e);
|
||||||
|
} finally {
|
||||||
|
IotDeviceManagementDAOUtil.cleanupResources(stmt, resultSet);
|
||||||
|
RaspberrypiDAO.closeConnection();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,45 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.util;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contains utility methods used by Raspberrypi plugin.
|
||||||
|
*/
|
||||||
|
public class RaspberrypiUtils {
|
||||||
|
|
||||||
|
private static Log log = LogFactory.getLog(RaspberrypiUtils.class);
|
||||||
|
|
||||||
|
public static String getDeviceProperty(Map<String, String> deviceProperties, String property) {
|
||||||
|
|
||||||
|
String deviceProperty = deviceProperties.get(property);
|
||||||
|
|
||||||
|
if (deviceProperty == null) {
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
|
return deviceProperty;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,104 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.internal;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.osgi.framework.BundleContext;
|
||||||
|
import org.osgi.framework.ServiceRegistration;
|
||||||
|
import org.osgi.service.component.ComponentContext;
|
||||||
|
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.service.DeviceTypeService;
|
||||||
|
import org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl.RaspberrypiManagerService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @scr.component name="org.wso2.carbon.device.mgt.iot.raspberrypi.internal.RaspberrypiManagementServiceComponent"
|
||||||
|
* immediate="true"
|
||||||
|
* @scr.reference name="org.wso2.carbon.device.mgt.iot.service.DeviceTypeServiceImpl"
|
||||||
|
* interface="org.wso2.carbon.device.mgt.iot.service.DeviceTypeService"
|
||||||
|
* cardinality="1..1"
|
||||||
|
* policy="dynamic"
|
||||||
|
* bind="setDeviceTypeService"
|
||||||
|
* unbind="unsetDeviceTypeService"
|
||||||
|
*/
|
||||||
|
public class RaspberrypiManagementServiceComponent {
|
||||||
|
|
||||||
|
|
||||||
|
private ServiceRegistration raspberrypiServiceRegRef;
|
||||||
|
|
||||||
|
|
||||||
|
private static final Log log = LogFactory.getLog(RaspberrypiManagementServiceComponent.class);
|
||||||
|
|
||||||
|
protected void activate(ComponentContext ctx) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Activating Raspberrypi Device Management Service Component");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
BundleContext bundleContext = ctx.getBundleContext();
|
||||||
|
raspberrypiServiceRegRef =
|
||||||
|
bundleContext.registerService(DeviceManagementService.class.getName(),
|
||||||
|
new RaspberrypiManagerService(), null);
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug(
|
||||||
|
"Raspberrypi Device Management Service Component has been successfully " +
|
||||||
|
"activated");
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error(
|
||||||
|
"Error occurred while activating Raspberrypi Device Management Service " +
|
||||||
|
"Component",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void deactivate(ComponentContext ctx) {
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("De-activating Raspberrypi Device Management Service Component");
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
if (raspberrypiServiceRegRef != null) {
|
||||||
|
raspberrypiServiceRegRef.unregister();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug(
|
||||||
|
"Raspberrypi Device Management Service Component has been successfully " +
|
||||||
|
"de-activated");
|
||||||
|
}
|
||||||
|
} catch (Throwable e) {
|
||||||
|
log.error("Error occurred while de-activating Raspberrypi Device Management bundle",
|
||||||
|
e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void setDeviceTypeService(DeviceTypeService deviceTypeService) {
|
||||||
|
/* This is to avoid this component getting initialized before the
|
||||||
|
common registered */
|
||||||
|
if (log.isDebugEnabled()) {
|
||||||
|
log.debug("Data source service set to mobile service component");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void unsetDeviceTypeService(DeviceTypeService deviceTypeService) {
|
||||||
|
//do nothing
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@ -0,0 +1,62 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>device-mgt-iot-raspberrypi</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Device RaspberryPi Management Component</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl</module>
|
||||||
|
<!--<module>org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl</module>-->
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<pluginManagement>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.felix</groupId>
|
||||||
|
<artifactId>maven-scr-plugin</artifactId>
|
||||||
|
<version>1.7.2</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>generate-scr-scrdescriptor</id>
|
||||||
|
<goals>
|
||||||
|
<goal>scr</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</pluginManagement>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,142 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>device-mgt-iot-raspberrypi-feature</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.feature</artifactId>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<name>WSO2 Carbon - IoT Server RaspberryPi Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
<description>This feature contains the RaspberryPi Device type specific implementations for the IoT Server
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!--<dependency>-->
|
||||||
|
<!--<groupId>org.wso2.carbon.devicemgt-plugins</groupId>-->
|
||||||
|
<!--<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl</artifactId>-->
|
||||||
|
<!--<type>war</type>-->
|
||||||
|
<!--</dependency>-->
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-resources-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-resources</id>
|
||||||
|
<phase>generate-resources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy-resources</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<outputDirectory>src/main/resources</outputDirectory>
|
||||||
|
<resources>
|
||||||
|
<resource>
|
||||||
|
<directory>resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>build.properties</include>
|
||||||
|
<include>p2.inf</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-dependency-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>copy-jaxrs-war</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>copy</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<artifactItems>
|
||||||
|
<artifactItem>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>org.wso2.carbon.device.mgt.iot.raspberrypi.service.impl
|
||||||
|
</artifactId>
|
||||||
|
<type>war</type>
|
||||||
|
<overWrite>true</overWrite>
|
||||||
|
<outputDirectory>${basedir}/src/main/resources/webapps/</outputDirectory>
|
||||||
|
<destFileName>raspberrypi.war</destFileName>
|
||||||
|
</artifactItem>
|
||||||
|
</artifactItems>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.wso2.maven</groupId>
|
||||||
|
<artifactId>carbon-p2-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>p2-feature-generation</id>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>p2-feature-gen</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<id>org.wso2.carbon.device.mgt.iot.raspberrypi</id>
|
||||||
|
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
|
||||||
|
<adviceFile>
|
||||||
|
<properties>
|
||||||
|
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
|
||||||
|
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
|
||||||
|
</properties>
|
||||||
|
</adviceFile>
|
||||||
|
<bundles>
|
||||||
|
<bundleDef>
|
||||||
|
org.wso2.carbon.devicemgt-plugins:org.wso2.carbon.device.mgt.iot.raspberrypi.plugin.impl:${carbon.iot.device.mgt.version}
|
||||||
|
</bundleDef>
|
||||||
|
</bundles>
|
||||||
|
<importFeatures>
|
||||||
|
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
<importFeatureDef>org.wso2.carbon.device.mgt.server:${carbon.device.mgt.version}
|
||||||
|
</importFeatureDef>
|
||||||
|
</importFeatures>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</project>
|
@ -0,0 +1,20 @@
|
|||||||
|
#
|
||||||
|
# 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.
|
||||||
|
#
|
||||||
|
|
||||||
|
templates=RaspberryPi.deb
|
||||||
|
zipfilename=RaspberryPi.zip
|
@ -0,0 +1 @@
|
|||||||
|
custom = true
|
@ -0,0 +1,24 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<DeviceTypeConfigurations>
|
||||||
|
<DeviceTypeConfig type="raspberrypi">
|
||||||
|
<DatasourceName>jdbc/RaspberryPiDM_DB</DatasourceName>
|
||||||
|
</DeviceTypeConfig>
|
||||||
|
</DeviceTypeConfigurations>
|
@ -0,0 +1,48 @@
|
|||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<datasources-configuration xmlns:svns="http://org.wso2.securevault/configuration">
|
||||||
|
<providers>
|
||||||
|
<provider>org.wso2.carbon.ndatasource.rdbms.RDBMSDataSourceReader</provider>
|
||||||
|
</providers>
|
||||||
|
|
||||||
|
<datasources>
|
||||||
|
<datasource>
|
||||||
|
<name>RaspberryPi_DB</name>
|
||||||
|
<description>The datasource used for the RaspberryPi database</description>
|
||||||
|
<jndiConfig>
|
||||||
|
<name>jdbc/RaspberryPiDM_DB</name>
|
||||||
|
</jndiConfig>
|
||||||
|
<definition type="RDBMS">
|
||||||
|
<configuration>
|
||||||
|
<url>jdbc:h2:repository/database/RaspberryPiDM_DB;DB_CLOSE_ON_EXIT=FALSE
|
||||||
|
</url>
|
||||||
|
<username>wso2carbon</username>
|
||||||
|
<password>wso2carbon</password>
|
||||||
|
<driverClassName>org.h2.Driver</driverClassName>
|
||||||
|
<maxActive>50</maxActive>
|
||||||
|
<maxWait>60000</maxWait>
|
||||||
|
<testOnBorrow>true</testOnBorrow>
|
||||||
|
<validationQuery>SELECT 1</validationQuery>
|
||||||
|
<validationInterval>30000</validationInterval>
|
||||||
|
</configuration>
|
||||||
|
</definition>
|
||||||
|
</datasource>
|
||||||
|
</datasources>
|
||||||
|
</datasources-configuration>
|
||||||
|
|
@ -0,0 +1,11 @@
|
|||||||
|
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `RASPBERRYPI_DEVICE`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `RASPBERRYPI_DEVICE` (
|
||||||
|
`RASPBERRYPI_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||||
|
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`RASPBERRYPI_DEVICE_ID`) );
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,12 @@
|
|||||||
|
-- -----------------------------------------------------
|
||||||
|
-- Table `RASPBERRYPI_DEVICE`
|
||||||
|
-- -----------------------------------------------------
|
||||||
|
CREATE TABLE IF NOT EXISTS `RASPBERRYPI_DEVICE` (
|
||||||
|
`RASPBERRYPI_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||||
|
`DEVICE_NAME` VARCHAR(100) NULL DEFAULT NULL,
|
||||||
|
PRIMARY KEY (`RASPBERRYPI_DEVICE_ID`) )
|
||||||
|
ENGINE = InnoDB;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -0,0 +1,126 @@
|
|||||||
|
{{unit "cdmf.unit.lib.service-invoker-utility"}}
|
||||||
|
{{unit "cdmf.unit.lib.handlebars"}}
|
||||||
|
{{#defineZone "device-detail-top"}}
|
||||||
|
<div class="row wr-device-board">
|
||||||
|
<div class="col-lg-12 wr-secondary-bar">
|
||||||
|
<label class="device-id device-select" data-deviceid="{{device.deviceIdentifier}}" data-type="{{device.type}}">
|
||||||
|
Device {{device.name}}
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/defineZone}}
|
||||||
|
|
||||||
|
<!-- #page-content-wrapper -->
|
||||||
|
<div class="page-content-wrapper">
|
||||||
|
<!-- content/body -->
|
||||||
|
<div class="container-fluid body-wrapper">
|
||||||
|
<div class="row no-gutter add-padding-5x add-margin-top-5x" style="border: 1px solid #e4e4e4;">
|
||||||
|
<div class="media">
|
||||||
|
<div id="device_overview">
|
||||||
|
<div class="media-left media-middle asset-image col-xs-2 col-sm-2 col-md-2 col-lg-2">
|
||||||
|
<div class="thumbnail icon">
|
||||||
|
<img src="{{@unit.publicUri}}/images/thumb.png"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="media-body asset-desc add-padding-left-5x">
|
||||||
|
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Device Overview - RaspberryPi</div>
|
||||||
|
{{#defineZone "device-detail-properties"}}
|
||||||
|
<table class="table table-responsive table-striped" id="members">
|
||||||
|
<tbody>
|
||||||
|
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px; width: 1%;;">Device</td><td style="padding:10px 15px;">{{device.viewModel.vendor}} {{device.properties.model}}</td></tr>
|
||||||
|
<tr role="row" class="odd"><td class="sorting_1" style="padding:10px 15px;">Model</td><td style="padding:10px 15px;">{{device.viewModel.model}}</td></tr>
|
||||||
|
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px;">IMEI</td><td style="padding:10px 15px;">{{device.viewModel.imei}}</td></tr>
|
||||||
|
{{#if device.viewModel.udid}}
|
||||||
|
<tr role="row" class="even"><td class="sorting_1" style="padding:10px 15px;">UDID</td><td style="padding:10px 15px;">{{device.viewModel.udid}}</td></tr>
|
||||||
|
{{/if}}
|
||||||
|
<tr role="row" class="even">
|
||||||
|
<td class="sorting_1" style="padding:10px 15px;">Status</td>
|
||||||
|
<td style="padding:10px 15px;">
|
||||||
|
{{#equal device.status "ACTIVE"}}<span><i class="fw fw-ok icon-success"></i> Active</span>{{/equal}}
|
||||||
|
{{#equal device.status "INACTIVE"}}<span><i class="fw fw-warning icon-warning"></i> Inactive</span>{{/equal}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
{{/defineZone}}
|
||||||
|
<div style="background: #11375B; color: #fff; padding: 10px; margin-bottom: 5px">Operations</div>
|
||||||
|
<div class="add-margin-top-4x">
|
||||||
|
{{unit "iot.unit.device.operation" device=device}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="media">
|
||||||
|
<div class="media-left col-xs-12 col-sm-2 col-md-2 col-lg-2">
|
||||||
|
<ul class="list-group" role="tablist">
|
||||||
|
<li class="active"><a class="list-group-item" href="#device_details" role="tab" data-toggle="tab" aria-controls="device_details">Device Details</a></li>
|
||||||
|
<li><a class="list-group-item" href="#policy_compliance" role="tab" data-toggle="tab" aria-controls="policy_compliance">Policy Compliance</a></li>
|
||||||
|
<li><a class="list-group-item" href="#device_location" role="tab" data-toggle="tab" aria-controls="device_location">Device Location</a></li>
|
||||||
|
<li><a class="list-group-item" href="#event_log" role="tab" data-toggle="tab" aria-controls="event_log">Operations Log</a></li>
|
||||||
|
<li><a class="list-group-item" href="{{@app.context}}/analytics?deviceType={{device.type}}&deviceName={{device.name}}&deviceId={{device.deviceIdentifier}}">Device Analytics</a></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
{{#defineZone "device-detail-properties"}}
|
||||||
|
<div class="media-body add-padding-left-5x remove-padding-xs tab-content">
|
||||||
|
<div class="panel-group tab-content">
|
||||||
|
|
||||||
|
<div id="deviceDetails" class="panel panel-default tab-pane active" id="device_details" role="tabpanel" aria-labelledby="device_details">
|
||||||
|
<div class="panel-heading">Device Details</div>
|
||||||
|
{{unit "iot.unit.device.stats" device=device}}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="panel panel-default tab-pane" id="policy_compliance" role="tabpanel" aria-labelledby="policy_compliance">
|
||||||
|
<div class="panel-heading">Policy Compliance <span><a href="#" id="refresh-policy"><i class="fw fw-refresh"></i></a></span></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="policy-spinner" class="wr-advance-operations-init hidden">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||||
|
|
||||||
|
Loading Policy Compliance . . .
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<div id="policy-list-container">
|
||||||
|
<div class="panel-body">
|
||||||
|
Not available yet
|
||||||
|
</div>
|
||||||
|
<br class="c-both" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="panel panel-default tab-pane" id="event_log" role="tabpanel" aria-labelledby="event_log">
|
||||||
|
<div class="panel-heading">Operations Log <span><a href="#" id="refresh-operations"><i class="fw fw-refresh"></i></a></span></div>
|
||||||
|
<div class="panel-body">
|
||||||
|
<div id="operations-spinner" class="wr-advance-operations-init hidden">
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<i class="fw fw-settings fw-spin fw-2x"></i>
|
||||||
|
|
||||||
|
Loading Operations Log . . .
|
||||||
|
<br>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
<div id="operations-log-container">
|
||||||
|
<div class="panel-body">
|
||||||
|
Not available yet
|
||||||
|
</div>
|
||||||
|
<br class="c-both" />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/defineZone}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<!-- /content/body -->
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#zone "bottomJs"}}
|
||||||
|
<script id="policy-view" src="{{@unit.publicUri}}/templates/policy-compliance.hbs" data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}" type="text/x-handlebars-template" ></script>
|
||||||
|
<script id="applications-list" src="{{@unit.publicUri}}/templates/applications-list.hbs" data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}" type="text/x-handlebars-template" ></script>
|
||||||
|
<script id="operations-log" src="{{@unit.publicUri}}/templates/operations-log.hbs" data-device-id="{{device.deviceIdentifier}}" data-device-type="{{device.type}}" type="text/x-handlebars-template" ></script>
|
||||||
|
{{/zone}}
|
@ -0,0 +1,43 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
function onRequest(context) {
|
||||||
|
var log = new Log("device-view.js");
|
||||||
|
var deviceType = context.uriParams.deviceType;
|
||||||
|
var deviceId = request.getParameter("id");
|
||||||
|
|
||||||
|
if (deviceType != null && deviceType != undefined && deviceId != null && deviceId != undefined) {
|
||||||
|
var deviceModule = require("/app/modules/device.js").deviceModule;
|
||||||
|
var device = deviceModule.viewDevice(deviceType, deviceId);
|
||||||
|
|
||||||
|
if (device) {
|
||||||
|
var viewModel = {};
|
||||||
|
var deviceInfo = device.properties.DEVICE_INFO;
|
||||||
|
if (deviceInfo != undefined && String(deviceInfo.toString()).length > 0) {
|
||||||
|
deviceInfo = parse(stringify(deviceInfo));
|
||||||
|
viewModel.system = device.properties.IMEI;
|
||||||
|
viewModel.machine = "RaspberryPi";
|
||||||
|
viewModel.vendor = device.properties.VENDOR;
|
||||||
|
}
|
||||||
|
device.viewModel = viewModel;
|
||||||
|
}
|
||||||
|
context.device = device;
|
||||||
|
|
||||||
|
return context;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
After Width: | Height: | Size: 61 KiB |
@ -0,0 +1,197 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
(function () {
|
||||||
|
var deviceId = $(".device-id");
|
||||||
|
var deviceIdentifier = deviceId.data("deviceid");
|
||||||
|
var deviceType = deviceId.data("type");
|
||||||
|
var payload = [deviceIdentifier];
|
||||||
|
var operationTable;
|
||||||
|
if (deviceType == "ios") {
|
||||||
|
var serviceUrl = "/ios/operation/deviceinfo";
|
||||||
|
} else if (deviceType == "android") {
|
||||||
|
var serviceUrl = "/mdm-android-agent/operation/device-info";
|
||||||
|
}
|
||||||
|
if(serviceUrl){
|
||||||
|
invokerUtil.post(serviceUrl, payload,
|
||||||
|
function(message){
|
||||||
|
console.log(message);
|
||||||
|
}, function (message) {
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
$(document).ready(function(){
|
||||||
|
$(".panel-body").removeClass("hidden");
|
||||||
|
$("#loading-content").remove();
|
||||||
|
loadOperationBar(deviceType);
|
||||||
|
loadOperationsLog();
|
||||||
|
loadApplicationsList();
|
||||||
|
loadPolicyCompliance();
|
||||||
|
|
||||||
|
$("#refresh-policy").click(function () {
|
||||||
|
$('#policy-spinner').removeClass('hidden');
|
||||||
|
loadPolicyCompliance();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#refresh-apps").click(function () {
|
||||||
|
$('#apps-spinner').removeClass('hidden');
|
||||||
|
loadApplicationsList();
|
||||||
|
});
|
||||||
|
|
||||||
|
$("#refresh-operations").click(function () {
|
||||||
|
$('#operations-spinner').removeClass('hidden');
|
||||||
|
loadOperationsLog(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadOperationsLog(update) {
|
||||||
|
var operationsLog = $("#operations-log");
|
||||||
|
var deviceListingSrc = operationsLog.attr("src");
|
||||||
|
var deviceId = operationsLog.data("device-id");
|
||||||
|
var deviceType = operationsLog.data("device-type");
|
||||||
|
|
||||||
|
$.template("operations-log", deviceListingSrc, function (template) {
|
||||||
|
var serviceURL = "/devicemgt_admin/operations/"+deviceType+"/"+deviceId;
|
||||||
|
|
||||||
|
var successCallback = function (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
$('#operations-spinner').addClass('hidden');
|
||||||
|
var viewModel = {};
|
||||||
|
viewModel.operations = data;
|
||||||
|
if(data.length > 0){
|
||||||
|
var content = template(viewModel);
|
||||||
|
if(!update) {
|
||||||
|
$("#operations-log-container").html(content);
|
||||||
|
operationTable = $('#operations-log-table').datatables_extended();
|
||||||
|
}else{
|
||||||
|
$('#operations-log-table').dataTable().fnClearTable();
|
||||||
|
for(var i=0; i < data.length; i++) {
|
||||||
|
var status;
|
||||||
|
if(data[i].status == "COMPLETED") {
|
||||||
|
status = "<span><i class='fw fw-ok icon-success'></i> Completed</span>";
|
||||||
|
} else if(data[i].status == "PENDING") {
|
||||||
|
status = "<span><i class='fw fw-warning icon-warning'></i> Pending</span>";
|
||||||
|
} else if(data[i].status == "ERROR") {
|
||||||
|
status = "<span><i class='fw fw-error icon-danger'></i> Error</span>";
|
||||||
|
} else if(data[i].status == "IN_PROGRESS") {
|
||||||
|
status = "<span><i class='fw fw-ok icon-warning'></i> In Progress</span>";
|
||||||
|
}
|
||||||
|
|
||||||
|
$('#operations-log-table').dataTable().fnAddData([
|
||||||
|
data[i].code,
|
||||||
|
status,
|
||||||
|
data[i].createdTimeStamp
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
invokerUtil.get(serviceURL,
|
||||||
|
successCallback, function(message){
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadApplicationsList() {
|
||||||
|
var applicationsList = $("#applications-list");
|
||||||
|
var deviceListingSrc = applicationsList.attr("src");
|
||||||
|
var deviceId = applicationsList.data("device-id");
|
||||||
|
var deviceType = applicationsList.data("device-type");
|
||||||
|
|
||||||
|
$.template("application-list", deviceListingSrc, function (template) {
|
||||||
|
var serviceURL = "/devicemgt_admin/operations/"+deviceType+"/"+deviceId+"/apps";
|
||||||
|
|
||||||
|
var successCallback = function (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
$('#apps-spinner').addClass('hidden');
|
||||||
|
var viewModel = {};
|
||||||
|
if(data != null && data.length > 0) {
|
||||||
|
for (var i = 0; i < data.length; i++) {
|
||||||
|
data[i].name = data[i].name.replace(/[^\w\s]/gi, ' ');
|
||||||
|
data[i].name = data[i].name.replace(/[0-9]/g, ' ');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
viewModel.applications = data;
|
||||||
|
viewModel.deviceType = deviceType;
|
||||||
|
if(data.length > 0){
|
||||||
|
var content = template(viewModel);
|
||||||
|
$("#applications-list-container").html(content);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
invokerUtil.get(serviceURL,
|
||||||
|
successCallback, function(message){
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadPolicyCompliance() {
|
||||||
|
var policyCompliance = $("#policy-view");
|
||||||
|
var policySrc = policyCompliance.attr("src");
|
||||||
|
var deviceId = policyCompliance.data("device-id");
|
||||||
|
var deviceType = policyCompliance.data("device-type");
|
||||||
|
var activePolicy = null;
|
||||||
|
|
||||||
|
$.template("policy-view", policySrc, function (template) {
|
||||||
|
var serviceURLPolicy ="/devicemgt_admin/policies/"+deviceType+"/"+deviceId+"/active-policy"
|
||||||
|
var serviceURLCompliance = "/devicemgt_admin/policies/"+deviceType+"/"+deviceId;
|
||||||
|
|
||||||
|
var successCallbackCompliance = function (data) {
|
||||||
|
var viewModel = {};
|
||||||
|
viewModel.policy = activePolicy;
|
||||||
|
viewModel.deviceType = deviceType;
|
||||||
|
if(data != null && data.complianceFeatures!= null && data.complianceFeatures != undefined && data.complianceFeatures.length > 0) {
|
||||||
|
viewModel.compliance = "NON-COMPLIANT";
|
||||||
|
viewModel.complianceFeatures = data.complianceFeatures;
|
||||||
|
var content = template(viewModel);
|
||||||
|
$("#policy-list-container").html(content);
|
||||||
|
} else {
|
||||||
|
viewModel.compliance = "COMPLIANT";
|
||||||
|
var content = template(viewModel);
|
||||||
|
$("#policy-list-container").html(content);
|
||||||
|
$("#policy-compliance-table").addClass("hidden");
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
var successCallbackPolicy = function (data) {
|
||||||
|
data = JSON.parse(data);
|
||||||
|
$('#policy-spinner').addClass('hidden');
|
||||||
|
if(data != null && data.active == true){
|
||||||
|
activePolicy = data;
|
||||||
|
invokerUtil.get(serviceURLCompliance,
|
||||||
|
successCallbackCompliance, function(message){
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
invokerUtil.get(serviceURLPolicy,
|
||||||
|
successCallbackPolicy, function(message){
|
||||||
|
console.log(message);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}());
|
@ -0,0 +1,55 @@
|
|||||||
|
/*
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
|
||||||
|
$(document).ready(function(){
|
||||||
|
if (document.getElementById('device-location')){
|
||||||
|
loadMap();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
function loadMap() {
|
||||||
|
var map;
|
||||||
|
function initialize() {
|
||||||
|
var mapOptions = {
|
||||||
|
zoom: 18
|
||||||
|
};
|
||||||
|
var lat = $("#device-location").data("lat");
|
||||||
|
var long = $("#device-location").data("long");
|
||||||
|
|
||||||
|
if(lat != null && lat != undefined && lat != "" && long != null && long != undefined && long != "") {
|
||||||
|
$("#map-error").hide();
|
||||||
|
$("#device-location").show();
|
||||||
|
map = new google.maps.Map(document.getElementById('device-location'),
|
||||||
|
mapOptions);
|
||||||
|
|
||||||
|
var pos = new google.maps.LatLng(lat,
|
||||||
|
long);
|
||||||
|
var marker = new google.maps.Marker({
|
||||||
|
position: pos,
|
||||||
|
map: map
|
||||||
|
});
|
||||||
|
|
||||||
|
map.setCenter(pos);
|
||||||
|
}else{
|
||||||
|
$("#device-location").hide();
|
||||||
|
$("#map-error").show();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
google.maps.event.addDomListener(window, 'load', initialize);
|
||||||
|
}
|
@ -0,0 +1,12 @@
|
|||||||
|
<div class="wr-app-listing">
|
||||||
|
<div class="wr-applist">
|
||||||
|
{{#each applications}}
|
||||||
|
<a style="text-align: center;width: 100px;height: 100px;">
|
||||||
|
{{#equal platform "android"}}<i class="fw fw-android"></i>{{/equal}}
|
||||||
|
{{#equal platform "ios"}}<i class="fw fw-apple"></i>{{/equal}}
|
||||||
|
{{#equal platform "windows"}}<i class="fw fw-windows"></i>{{/equal}}
|
||||||
|
<span>{{name}}</span>
|
||||||
|
</a>
|
||||||
|
{{/each}}
|
||||||
|
</div>
|
||||||
|
</div>
|
@ -0,0 +1,24 @@
|
|||||||
|
<table class="table table-striped table-hover table-bordered display data-table" id="operations-log-table">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-row">
|
||||||
|
<th>Operation Code</th>
|
||||||
|
<th>Status</th>
|
||||||
|
<th>Request created at</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each operations}}
|
||||||
|
<tr data-type="selectable" data-id="{{id}}">
|
||||||
|
<td data-display="{{code}}" data-grid-label="Code">{{code}}</td>
|
||||||
|
<td data-display="{{status}}" data-grid-label="Status">
|
||||||
|
{{#equal status "COMPLETED"}}<span><i class="fw fw-ok icon-success"></i> Completed</span>{{/equal}}
|
||||||
|
{{#equal status "PENDING"}}<span><i class="fw fw-warning icon-warning"></i> Pending</span>{{/equal}}
|
||||||
|
{{#equal status "ERROR"}}<span><i class="fw fw-error icon-danger"></i> Error</span>{{/equal}}
|
||||||
|
{{#equal status "IN_PROGRESS"}}<span><i class="fw fw-ok icon-warning"></i> In Progress</span>{{/equal}}
|
||||||
|
</td>
|
||||||
|
<td data-display="{{createdTimeStamp}}" data-grid-label="Created Timestamp">{{createdTimeStamp}}</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
<br class="c-both" />
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@ -0,0 +1,79 @@
|
|||||||
|
<div class="wr-list-group wr-sortable policy-list">
|
||||||
|
<span class="list-group-item" id="{{id}}">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-lg-3 clearfix">
|
||||||
|
<span class="wr-list-icon">
|
||||||
|
{{#equal deviceType "android"}}
|
||||||
|
<i class=" fw fw-android"></i>
|
||||||
|
{{/equal}}
|
||||||
|
{{#equal deviceType "ios"}}
|
||||||
|
<i class=" fw fw-apple"></i>
|
||||||
|
{{/equal}}
|
||||||
|
{{#equal deviceType "windows"}}
|
||||||
|
<i class=" fw fw-windows"></i>
|
||||||
|
{{/equal}}
|
||||||
|
</span>
|
||||||
|
<span class="wr-list-desc">
|
||||||
|
<h3 class="wr-list-name">{{policy.policyName}}</h3>
|
||||||
|
<span class="wr-list-username">{{deviceType}}</span>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-6">
|
||||||
|
<div class="row no-gutter">
|
||||||
|
<div class="wr-desc-list-configs col-lg-4">
|
||||||
|
<div>
|
||||||
|
<b>Ownership Type : </b> {{policy.ownershipType}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="wr-desc-list-configs col-lg-4">
|
||||||
|
<div>
|
||||||
|
<b>Compliance Type :</b> {{policy.compliance}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="wr-desc-list-configs col-lg-4">
|
||||||
|
<div>
|
||||||
|
<b>Compliance :</b>
|
||||||
|
{{#equal compliance "COMPLIANT"}}
|
||||||
|
<span><i class="fw fw-ok icon-success"></i> Compliant</span>
|
||||||
|
{{/equal}}
|
||||||
|
{{#equal compliance "NON-COMPLIANT"}}
|
||||||
|
<span><i class="fw fw-warning icon-danger"></i> Not Compliant</span>
|
||||||
|
{{/equal}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="col-lg-3">
|
||||||
|
<span class="list-group-item-actions">
|
||||||
|
<a href="/mdm/policies/view?id={{policy.id}}" class="cu-btn-inner policy-view-link" data-id="{{id}}">
|
||||||
|
<span class="fw-stack">
|
||||||
|
<i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-view fw-stack-1x"></i>
|
||||||
|
</span>
|
||||||
|
View
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<table class="table table-striped table-hover table-bordered display data-table" id="policy-compliance-table">
|
||||||
|
<thead>
|
||||||
|
<tr class="sort-row">
|
||||||
|
<th>Feature</th>
|
||||||
|
<th>Compliance</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
{{#each complianceFeatures}}
|
||||||
|
<tr data-type="selectable">
|
||||||
|
<td data-display="{{featureCode}}" data-grid-label="Feature Code">{{featureCode}}</td>
|
||||||
|
<td data-display="{{compliance}}" data-grid-label="Status">
|
||||||
|
{{#equal compliance true}}<span><i class="fw fw-ok icon-success"></i> Compliant</span>{{/equal}}
|
||||||
|
{{#equal compliance false}}<span><i class="fw fw-warning icon-danger"></i> Not Compliant</span>{{/equal}}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{{/each}}
|
||||||
|
<br class="c-both" />
|
||||||
|
</tbody>
|
||||||
|
</table>
|
@ -0,0 +1,8 @@
|
|||||||
|
{
|
||||||
|
"deviceType": {
|
||||||
|
"label": "RaspberryPi",
|
||||||
|
"category": "iot",
|
||||||
|
"downloadAgentUri": "https://localhost:9443/raspberrypi/RaspberryPiDeviceManager/manager/device/raspberrypi/download",
|
||||||
|
"downloadAgentLinkGenUri" : "https://localhost:9443/raspberrypi/RaspberryPiDeviceManager/manager/device/raspberrypi/generate_link"
|
||||||
|
}
|
||||||
|
}
|
After Width: | Height: | Size: 7.8 KiB |
@ -0,0 +1,174 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (c) 2015, 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.
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
var modalPopup = ".wr-modalpopup";
|
||||||
|
var modalPopupContainer = modalPopup + " .modalpopup-container";
|
||||||
|
var modalPopupContent = modalPopup + " .modalpopup-content";
|
||||||
|
var body = "body";
|
||||||
|
|
||||||
|
/*
|
||||||
|
* set popup maximum height function.
|
||||||
|
*/
|
||||||
|
function setPopupMaxHeight() {
|
||||||
|
$(modalPopupContent).css('max-height', ($(body).height() - ($(body).height() / 100 * 30)));
|
||||||
|
$(modalPopupContainer).css('margin-top', (-($(modalPopupContainer).height() / 2)));
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* show popup function.
|
||||||
|
*/
|
||||||
|
function showPopup() {
|
||||||
|
$(modalPopup).show();
|
||||||
|
setPopupMaxHeight();
|
||||||
|
$('#downloadForm').validate({
|
||||||
|
rules: {
|
||||||
|
deviceName: {
|
||||||
|
minlength: 4,
|
||||||
|
required: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
highlight: function (element) {
|
||||||
|
$(element).closest('.control-group').removeClass('success').addClass('error');
|
||||||
|
},
|
||||||
|
success: function (element) {
|
||||||
|
$(element).closest('.control-group').removeClass('error').addClass('success');
|
||||||
|
$('label[for=deviceName]').remove();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
var deviceType = "";
|
||||||
|
$('.deviceType').each(function () {
|
||||||
|
if (this.value != "") {
|
||||||
|
deviceType = this.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* hide popup function.
|
||||||
|
*/
|
||||||
|
function hidePopup() {
|
||||||
|
$('label[for=deviceName]').remove();
|
||||||
|
$('.control-group').removeClass('success').removeClass('error');
|
||||||
|
$(modalPopupContent).html('');
|
||||||
|
$(modalPopup).hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* DOM ready functions.
|
||||||
|
*/
|
||||||
|
$(document).ready(function () {
|
||||||
|
attachEvents();
|
||||||
|
});
|
||||||
|
|
||||||
|
function attachEvents() {
|
||||||
|
/**
|
||||||
|
* Following click function would execute
|
||||||
|
* when a user clicks on "Download" link
|
||||||
|
* on Device Management page in WSO2 DC Console.
|
||||||
|
*/
|
||||||
|
$("a.download-link").click(function () {
|
||||||
|
var sketchType = $(this).data("sketchtype");
|
||||||
|
var deviceType = $(this).data("devicetype");
|
||||||
|
var downloadDeviceAPI = "/devicemgt/api/devices/sketch/generate_link";
|
||||||
|
var payload = {"sketchType": sketchType, "deviceType": deviceType};
|
||||||
|
$(modalPopupContent).html($('#download-device-modal-content').html());
|
||||||
|
showPopup();
|
||||||
|
var deviceName;
|
||||||
|
$("a#download-device-download-link").click(function () {
|
||||||
|
$('.new-device-name').each(function () {
|
||||||
|
if (this.value != "") {
|
||||||
|
deviceName = this.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$('label[for=deviceName]').remove();
|
||||||
|
if (deviceName && deviceName.length >= 4) {
|
||||||
|
payload.deviceName = deviceName;
|
||||||
|
invokerUtil.post(
|
||||||
|
downloadDeviceAPI,
|
||||||
|
payload,
|
||||||
|
function (data, textStatus, jqxhr) {
|
||||||
|
doAction(data);
|
||||||
|
},
|
||||||
|
function (data) {
|
||||||
|
doAction(data);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}else if(deviceName){
|
||||||
|
$('.controls').append('<label for="deviceName" generated="true" class="error" style="display: inline-block;">Please enter at least 4 characters.</label>');
|
||||||
|
$('.control-group').removeClass('success').addClass('error');
|
||||||
|
} else {
|
||||||
|
$('.controls').append('<label for="deviceName" generated="true" class="error" style="display: inline-block;">This field is required.</label>');
|
||||||
|
$('.control-group').removeClass('success').addClass('error');
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
$("a#download-device-cancel-link").click(function () {
|
||||||
|
hidePopup();
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function downloadAgent() {
|
||||||
|
$('#downloadForm').submit();
|
||||||
|
|
||||||
|
var deviceName;
|
||||||
|
$('.new-device-name').each(function () {
|
||||||
|
if (this.value != "") {
|
||||||
|
deviceName = this.value;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (deviceName && deviceName.length >= 4) {
|
||||||
|
setTimeout(function () {
|
||||||
|
hidePopup();
|
||||||
|
}, 1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function doAction(data) {
|
||||||
|
//if it is saml redirection response
|
||||||
|
if (data.status == null) {
|
||||||
|
document.write(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (data.status == "200") {
|
||||||
|
$(modalPopupContent).html($('#download-device-modal-content-links').html());
|
||||||
|
$("input#download-device-url").val(data.responseText);
|
||||||
|
$("input#download-device-url").focus(function () {
|
||||||
|
$(this).select();
|
||||||
|
});
|
||||||
|
showPopup();
|
||||||
|
} else if (data.status == "401") {
|
||||||
|
$(modalPopupContent).html($('#device-401-content').html());
|
||||||
|
$("#device-401-link").click(function () {
|
||||||
|
window.location = "/devicemgt/login";
|
||||||
|
});
|
||||||
|
showPopup();
|
||||||
|
} else if (data == "403") {
|
||||||
|
$(modalPopupContent).html($('#device-403-content').html());
|
||||||
|
$("#device-403-link").click(function () {
|
||||||
|
window.location = "/devicemgt/login";
|
||||||
|
});
|
||||||
|
showPopup();
|
||||||
|
} else {
|
||||||
|
$(modalPopupContent).html($('#device-unexpected-error-content').html());
|
||||||
|
$("a#device-unexpected-error-link").click(function () {
|
||||||
|
hidePopup();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
@ -0,0 +1,242 @@
|
|||||||
|
<div>
|
||||||
|
<div class="col-lg-12 margin-top-double">
|
||||||
|
<h1 class="grey ">RaspberryPi</h1>
|
||||||
|
<hr>
|
||||||
|
<p class="margin-bottom-double light-grey ">Connect your RaspberryPi device to the WSO2 IoT Server.</p>
|
||||||
|
</div>
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-4 col-lg-4 padding-top">
|
||||||
|
<img src="{{@unit.publicUri}}/images/thumb.png" class="img-responsive">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-8 col-lg-8 padding-top">
|
||||||
|
<h3 class="uppercase">Ingredients</h3>
|
||||||
|
<hr>
|
||||||
|
<p class="grey margin-top">Hardware Requirements </p>
|
||||||
|
<br>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li><span class="fw-stack fw-lg margin-right"><i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-right-arrow fw-stack-1x"></i></span> Raspberry Pi (Internet Enabled)
|
||||||
|
</li>
|
||||||
|
<li><span class="fw-stack fw-lg margin-right"><i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-right-arrow fw-stack-1x"></i></span> DHT11 Temperature Sensor
|
||||||
|
</li>
|
||||||
|
<li><span class="fw-stack fw-lg margin-right"><i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-right-arrow fw-stack-1x"></i></span> LED
|
||||||
|
</li>
|
||||||
|
<li><span class="fw-stack fw-lg margin-right"><i class="fw fw-ring fw-stack-2x"></i>
|
||||||
|
<i class="fw fw-right-arrow fw-stack-1x"></i></span> Buzzer(3v)
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
|
||||||
|
<a href="/api-store/apis/info?name={{@uriParams.deviceType}}&version=1.0.0&provider=admin"
|
||||||
|
class="btn-operations" target="_blank"><i class="fw fw-api"></i> View API</i> </a>
|
||||||
|
<a href="#" class="download-link btn-operations"><i class="fw fw-download"></i>Download</a>
|
||||||
|
|
||||||
|
<div id="download-device-modal-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 center-container">
|
||||||
|
<h3>Name your device and download the agent from following link.</h3>
|
||||||
|
<br/>
|
||||||
|
|
||||||
|
<form id="downloadForm" method="GET" action="{{@app.context}}/api/devices/sketch/download">
|
||||||
|
<div class="control-group">
|
||||||
|
<div class="controls">
|
||||||
|
<input class="new-device-name" style="color:#3f3f3f;padding:5px"
|
||||||
|
type="text"
|
||||||
|
placeholder="Ex. Home_RaspberryPi"
|
||||||
|
name="deviceName" size="60" required>
|
||||||
|
<br/><br/>
|
||||||
|
<input type="hidden" class="deviceType" name="deviceType"
|
||||||
|
value="{{@uriParams.deviceType}}"/>
|
||||||
|
<input type="hidden" class="sketchType" name="sketchType"
|
||||||
|
value="{{@uriParams.deviceType}}"/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="buttons" style="padding-bottom: 0px">
|
||||||
|
<a class="btn btn-operations" onclick="downloadAgent()">Download
|
||||||
|
Now</a>
|
||||||
|
|
||||||
|
<a href="#" id="download-device-download-link" class="btn btn-operations">
|
||||||
|
Copy Link
|
||||||
|
</a>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="device-400-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 col-centered center-container">
|
||||||
|
<h3>Exception at backend. Try Later.</h3>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" id="device-400-link" class="btn-operations">
|
||||||
|
OK
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="device-401-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 col-centered center-container">
|
||||||
|
<h3>You have to log in first.</h3><br/>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" id="device-401-link" class="blue-button">
|
||||||
|
Goto Login Page
|
||||||
|
</a>
|
||||||
|
<a href="#" onclick="hidePopup();" class="btn-operations">
|
||||||
|
Cancel
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="device-403-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 col-centered center-container">
|
||||||
|
<h3>Action not permitted.</h3><br/>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" id="device-403-link" class="btn-operations">
|
||||||
|
OK
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="device-409-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 col-centered center-container">
|
||||||
|
<h3>Device Sketch does not exist.</h3><br/>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" id="device-409-link" class="btn-operations">
|
||||||
|
OK
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div id="device-unexpected-error-content" class="hide">
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-7 col-centered center-container">
|
||||||
|
<h3>Unexpected error.</h3><br/>
|
||||||
|
|
||||||
|
<div class="buttons">
|
||||||
|
<a href="#" id="device-unexpected-error-link" class="btn-operations">
|
||||||
|
OK
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<br/><br/>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-xs-12 col-sm-6 col-md-3 col-lg-12 padding-double grey-bg ">
|
||||||
|
<h3 class="uppercase">Prepare</h3>
|
||||||
|
<hr>
|
||||||
|
<p class="grey margin-top">Get your device ready</p>
|
||||||
|
<br/>
|
||||||
|
<ul class="list-unstyled">
|
||||||
|
<li class="padding-top-double"><span class="circle">01</span> Get your RaspberryPi device and download the Agent
|
||||||
|
Sketch.
|
||||||
|
</li>
|
||||||
|
<li class="padding-top-double"><span class="circle">02</span> Open the downloaded RaspberryPi sketch and fill in
|
||||||
|
the pins that you wish to read/control.
|
||||||
|
</li>
|
||||||
|
<li class="padding-top-double"><span class="circle">03</span> Burn the sketch onto your RaspberryPi board and
|
||||||
|
let the program run.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
<br>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{{#zone "topCss"}}
|
||||||
|
<style type="text/css">
|
||||||
|
.circle {
|
||||||
|
background: none repeat scroll 0 0 #191919;
|
||||||
|
border-radius: 50px;
|
||||||
|
height: 50px;
|
||||||
|
padding: 10px;
|
||||||
|
width: 50px;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
.padding-top-double {
|
||||||
|
padding-top: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.padding-double {
|
||||||
|
padding: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grey {
|
||||||
|
color: #333;
|
||||||
|
}
|
||||||
|
|
||||||
|
hr {
|
||||||
|
display: block;
|
||||||
|
height: 1px;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #7f7f7f;
|
||||||
|
margin: 1em 0;
|
||||||
|
padding: 0;
|
||||||
|
opacity: 0.2;
|
||||||
|
}
|
||||||
|
|
||||||
|
.light-grey {
|
||||||
|
color: #7c7c7c;
|
||||||
|
}
|
||||||
|
|
||||||
|
.uppercase {
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.grey-bg {
|
||||||
|
background-color: #f6f4f4;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
{{/zone}}
|
||||||
|
|
||||||
|
{{#zone "bottomJs"}}
|
||||||
|
{{js "/js/download.js"}}
|
||||||
|
{{js "/js/jquery.validate.js"}}
|
||||||
|
<script type="text/javascript">
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
toggleEnrollment();
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
function toggleEnrollment() {
|
||||||
|
$(".modalpopup-content").html($("#qr-code-modal").html());
|
||||||
|
//generateQRCode(".modalpopup-content .qr-code");
|
||||||
|
//showPopup();
|
||||||
|
}
|
||||||
|
|
||||||
|
</script>
|
||||||
|
{{/zone}}
|
@ -0,0 +1,3 @@
|
|||||||
|
{
|
||||||
|
"version": "1.0.0"
|
||||||
|
}
|
@ -0,0 +1,13 @@
|
|||||||
|
instructions.configure = \
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/devicetype-conf/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/configs/,target:${installFolder}/../../conf/devicetype-conf/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/webapps/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/webapps/,target:${installFolder}/../../deployment/server/webapps/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../resources/sketches/raspberrypi/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/agent/,target:${installFolder}/../../resources/sketches/raspberrypi/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/dbscripts/,target:${installFolder}/../../../dbscripts/cdm/plugins/raspberrypi,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../deployment/server/jaggeryapps/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/jaggeryapps/,target:${installFolder}/../../deployment/server/jaggeryapps/,overwrite:true);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.mkdir(path:${installFolder}/../../conf/datasources/devicemgt/);\
|
||||||
|
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.iot.raspberrypi_${feature.version}/datasources/,target:${installFolder}/../../conf/datasources/devicemgt,overwrite:true);\
|
@ -0,0 +1,41 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!--
|
||||||
|
~ 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.
|
||||||
|
-->
|
||||||
|
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
|
||||||
|
<parent>
|
||||||
|
<groupId>org.wso2.carbon.devicemgt-plugins</groupId>
|
||||||
|
<artifactId>carbon-device-mgt-plugins-parent</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<relativePath>../../pom.xml</relativePath>
|
||||||
|
</parent>
|
||||||
|
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<artifactId>device-mgt-iot-raspberrypi-feature</artifactId>
|
||||||
|
<version>1.9.2-SNAPSHOT</version>
|
||||||
|
<packaging>pom</packaging>
|
||||||
|
<name>WSO2 Carbon - IoT Server RaspberryPi Device Feature</name>
|
||||||
|
<url>http://wso2.org</url>
|
||||||
|
|
||||||
|
<modules>
|
||||||
|
<module>org.wso2.carbon.device.mgt.iot.raspberrypi.feature</module>
|
||||||
|
</modules>
|
||||||
|
|
||||||
|
</project>
|
Loading…
Reference in new issue