mirror of
https://repository.entgra.net/community/device-mgt-plugins.git
synced 2025-09-16 23:42:15 +00:00
Merge branch 'master' of https://github.com/wso2/product-mdm
This commit is contained in:
commit
53c2abd574
@ -73,6 +73,9 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.18</version>
|
||||
<configuration>
|
||||
<systemPropertyVariables>
|
||||
<log4j.configuration>file:src/test/resources/log4j.properties</log4j.configuration>
|
||||
</systemPropertyVariables>
|
||||
<suiteXmlFiles>
|
||||
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
|
||||
</suiteXmlFiles>
|
||||
|
||||
@ -0,0 +1,84 @@
|
||||
/**
|
||||
* Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.wso2.carbon.device.mgt.mobile;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.apimgt.api.APIManagementException;
|
||||
import org.wso2.carbon.apimgt.api.APIProvider;
|
||||
import org.wso2.carbon.apimgt.impl.APIManagerFactory;
|
||||
import org.wso2.carbon.core.ServerStartupObserver;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class MobileDeviceManagementStartupObserver implements ServerStartupObserver {
|
||||
|
||||
private static final Log log = LogFactory.getLog(MobileDeviceManagementStartupObserver.class);
|
||||
|
||||
public void completingServerStartup() {
|
||||
|
||||
}
|
||||
|
||||
public void completedServerStartup() {
|
||||
try {
|
||||
this.initAPIConfigs();
|
||||
/* Publish all mobile device management related JAX-RS services as APIs */
|
||||
this.publishAPIs();
|
||||
} catch (DeviceManagementException e) {
|
||||
log.error("Error occurred while publishing Mobile Device Management related APIs", e);
|
||||
}
|
||||
}
|
||||
|
||||
private void initAPIConfigs() throws DeviceManagementException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Initializing Mobile Device Management related APIs");
|
||||
}
|
||||
List<APIConfig> apiConfigs =
|
||||
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
|
||||
getApiPublisherConfig().getAPIs();
|
||||
for (APIConfig apiConfig : apiConfigs) {
|
||||
try {
|
||||
APIProvider provider =
|
||||
APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner());
|
||||
apiConfig.init(provider);
|
||||
} catch (APIManagementException e) {
|
||||
throw new DeviceManagementException("Error occurred while initializing API Config '" +
|
||||
apiConfig.getName() + "'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void publishAPIs() throws DeviceManagementException {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Publishing Mobile Device Management related APIs");
|
||||
}
|
||||
List<APIConfig> apiConfigs =
|
||||
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
|
||||
getApiPublisherConfig().getAPIs();
|
||||
for (APIConfig apiConfig : apiConfigs) {
|
||||
DeviceManagementAPIPublisherUtil.publishAPI(apiConfig);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Successfully published API '" + apiConfig.getName() + "' with the context '" +
|
||||
apiConfig.getContext() + "' and version '" + apiConfig.getVersion() + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -86,5 +86,14 @@ public interface MobileFeatureDAO {
|
||||
* @return Feature object list.
|
||||
* @throws MobileDeviceManagementDAOException
|
||||
*/
|
||||
|
||||
/**
|
||||
* Retrieve all the features from plugin specific database for a Device Type.
|
||||
* @param deviceType - Device type.
|
||||
* @return Feature object list.
|
||||
* @throws MobileDeviceManagementDAOException
|
||||
*/
|
||||
List<MobileFeature> getMobileFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException;
|
||||
|
||||
List<MobileFeature> getAllMobileFeatures() throws MobileDeviceManagementDAOException;
|
||||
}
|
||||
|
||||
@ -70,7 +70,7 @@ public interface MobileFeaturePropertyDAO {
|
||||
* @return Feature property object that holds data of the feature property represented by propertyId.
|
||||
* @throws MobileDeviceManagementDAOException
|
||||
*/
|
||||
List<MobileFeatureProperty> getFeaturePropertyOfFeature(String featureId)
|
||||
List<MobileFeatureProperty> getFeaturePropertyOfFeature(Integer featureId)
|
||||
throws MobileDeviceManagementDAOException;
|
||||
|
||||
}
|
||||
|
||||
@ -18,8 +18,8 @@ package org.wso2.carbon.device.mgt.mobile.dao.impl;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileFeature;
|
||||
|
||||
@ -51,12 +51,13 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String createDBQuery =
|
||||
"INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
|
||||
"INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION, DEVICE_TYPE) VALUES (?, ?, ?, ?)";
|
||||
|
||||
stmt = conn.prepareStatement(createDBQuery);
|
||||
stmt.setString(1, mobileFeature.getCode());
|
||||
stmt.setString(2, mobileFeature.getName());
|
||||
stmt.setString(3, mobileFeature.getDescription());
|
||||
stmt.setString(4, mobileFeature.getDeviceType());
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
@ -81,12 +82,13 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String updateDBQuery =
|
||||
"UPDATE MBL_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ? WHERE FEATURE_ID = ?";
|
||||
"UPDATE MBL_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ?, DEVICE_TYPE = ? WHERE FEATURE_ID = ?";
|
||||
stmt = conn.prepareStatement(updateDBQuery);
|
||||
stmt.setString(1, mobileFeature.getCode());
|
||||
stmt.setString(2, mobileFeature.getName());
|
||||
stmt.setString(3, mobileFeature.getDescription());
|
||||
stmt.setInt(4, mobileFeature.getId());
|
||||
stmt.setString(4, mobileFeature.getDeviceType());
|
||||
stmt.setInt(5, mobileFeature.getId());
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
@ -163,16 +165,17 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = ?";
|
||||
"SELECT FEATURE_ID,DEVICE_TYPE, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = ?";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
stmt.setString(1, featureCode);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
mobileFeature = new MobileFeature();
|
||||
mobileFeature.setId(resultSet.getInt(1));
|
||||
mobileFeature.setCode(resultSet.getString(2));
|
||||
mobileFeature.setName(resultSet.getString(3));
|
||||
mobileFeature.setDescription(resultSet.getString(4));
|
||||
mobileFeature.setDeviceType(resultSet.getString(2));
|
||||
mobileFeature.setCode(resultSet.getString(3));
|
||||
mobileFeature.setName(resultSet.getString(4));
|
||||
mobileFeature.setDescription(resultSet.getString(5));
|
||||
break;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@ -195,16 +198,17 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE FEATURE_ID = ?";
|
||||
"SELECT FEATURE_ID,DEVICE_TYPE, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE FEATURE_ID = ?";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
stmt.setInt(1, featureID);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
mobileFeature = new MobileFeature();
|
||||
mobileFeature.setId(resultSet.getInt(1));
|
||||
mobileFeature.setCode(resultSet.getString(2));
|
||||
mobileFeature.setName(resultSet.getString(3));
|
||||
mobileFeature.setDescription(resultSet.getString(4));
|
||||
mobileFeature.setDeviceType(resultSet.getString(2));
|
||||
mobileFeature.setCode(resultSet.getString(3));
|
||||
mobileFeature.setName(resultSet.getString(4));
|
||||
mobileFeature.setDescription(resultSet.getString(5));
|
||||
break;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@ -227,15 +231,16 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE";
|
||||
"SELECT FEATURE_ID,DEVICE_TYPE, CODE, NAME, DESCRIPTION FROM MBL_FEATURE";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
mobileFeature = new MobileFeature();
|
||||
mobileFeature.setId(resultSet.getInt(1));
|
||||
mobileFeature.setCode(resultSet.getString(2));
|
||||
mobileFeature.setName(resultSet.getString(3));
|
||||
mobileFeature.setDescription(resultSet.getString(4));
|
||||
mobileFeature.setDeviceType(resultSet.getString(2));
|
||||
mobileFeature.setCode(resultSet.getString(3));
|
||||
mobileFeature.setName(resultSet.getString(4));
|
||||
mobileFeature.setDescription(resultSet.getString(5));
|
||||
mobileFeatures.add(mobileFeature);
|
||||
}
|
||||
return mobileFeatures;
|
||||
@ -248,6 +253,38 @@ public class MobileFeatureDAOImpl implements MobileFeatureDAO {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileFeature> getMobileFeatureByDeviceType(String deviceType) throws MobileDeviceManagementDAOException {
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
MobileFeature mobileFeature;
|
||||
List<MobileFeature> mobileFeatures = new ArrayList<MobileFeature>();
|
||||
try {
|
||||
conn = this.getConnection();
|
||||
String selectDBQuery =
|
||||
"SELECT FEATURE_ID, DEVICE_TYPE, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE DEVICE_TYPE = ?";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
stmt.setString(1, deviceType);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
mobileFeature = new MobileFeature();
|
||||
mobileFeature.setId(resultSet.getInt(1));
|
||||
mobileFeature.setDeviceType(resultSet.getString(2));
|
||||
mobileFeature.setCode(resultSet.getString(3));
|
||||
mobileFeature.setName(resultSet.getString(4));
|
||||
mobileFeature.setDescription(resultSet.getString(5));
|
||||
mobileFeatures.add(mobileFeature);
|
||||
}
|
||||
return mobileFeatures;
|
||||
} catch (SQLException e) {
|
||||
String msg = "Error occurred while fetching all features.'";
|
||||
log.error(msg, e);
|
||||
throw new MobileDeviceManagementDAOException(msg, e);
|
||||
}finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
|
||||
}
|
||||
}
|
||||
|
||||
private Connection getConnection() throws MobileDeviceManagementDAOException {
|
||||
try {
|
||||
return dataSource.getConnection();
|
||||
|
||||
@ -56,7 +56,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
|
||||
|
||||
stmt = conn.prepareStatement(createDBQuery);
|
||||
stmt.setString(1, mobileFeatureProperty.getProperty());
|
||||
stmt.setString(2, mobileFeatureProperty.getFeatureID());
|
||||
stmt.setInt(2, mobileFeatureProperty.getFeatureID());
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
status = true;
|
||||
@ -83,7 +83,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
|
||||
String updateDBQuery =
|
||||
"UPDATE MBL_FEATURE_PROPERTY SET FEATURE_ID = ? WHERE PROPERTY = ?";
|
||||
stmt = conn.prepareStatement(updateDBQuery);
|
||||
stmt.setString(1, mobileFeatureProperty.getFeatureID());
|
||||
stmt.setInt(1, mobileFeatureProperty.getFeatureID());
|
||||
stmt.setString(2, mobileFeatureProperty.getProperty());
|
||||
int rows = stmt.executeUpdate();
|
||||
if (rows > 0) {
|
||||
@ -143,7 +143,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
|
||||
while (resultSet.next()) {
|
||||
mobileFeatureProperty = new MobileFeatureProperty();
|
||||
mobileFeatureProperty.setProperty(resultSet.getString(1));
|
||||
mobileFeatureProperty.setFeatureID(resultSet.getString(2));
|
||||
mobileFeatureProperty.setFeatureID(resultSet.getInt(2));
|
||||
break;
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
@ -158,7 +158,7 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MobileFeatureProperty> getFeaturePropertyOfFeature(String featureId)
|
||||
public List<MobileFeatureProperty> getFeaturePropertyOfFeature(Integer featureId)
|
||||
throws MobileDeviceManagementDAOException {
|
||||
Connection conn = null;
|
||||
PreparedStatement stmt = null;
|
||||
@ -169,12 +169,12 @@ public class MobileFeaturePropertyDAOImpl implements MobileFeaturePropertyDAO {
|
||||
String selectDBQuery =
|
||||
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
|
||||
stmt = conn.prepareStatement(selectDBQuery);
|
||||
stmt.setString(1, featureId);
|
||||
stmt.setInt(1, featureId);
|
||||
ResultSet resultSet = stmt.executeQuery();
|
||||
while (resultSet.next()) {
|
||||
mobileFeatureProperty = new MobileFeatureProperty();
|
||||
mobileFeatureProperty.setProperty(resultSet.getString(1));
|
||||
mobileFeatureProperty.setFeatureID(resultSet.getString(2));
|
||||
mobileFeatureProperty.setFeatureID(resultSet.getInt(2));
|
||||
FeatureProperties.add(mobileFeatureProperty);
|
||||
}
|
||||
return FeatureProperties;
|
||||
|
||||
@ -24,6 +24,7 @@ import java.io.Serializable;
|
||||
public class MobileFeature implements Serializable {
|
||||
|
||||
private int id;
|
||||
private String deviceType;
|
||||
private String code;
|
||||
private String name;
|
||||
private String description;
|
||||
@ -60,4 +61,11 @@ public class MobileFeature implements Serializable {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDeviceType() {
|
||||
return deviceType;
|
||||
}
|
||||
|
||||
public void setDeviceType(String deviceType) {
|
||||
this.deviceType = deviceType;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,13 +22,13 @@ package org.wso2.carbon.device.mgt.mobile.dto;
|
||||
public class MobileFeatureProperty {
|
||||
|
||||
private String property;
|
||||
private String featureID;
|
||||
private Integer featureID;
|
||||
|
||||
public String getFeatureID() {
|
||||
public Integer getFeatureID() {
|
||||
return featureID;
|
||||
}
|
||||
|
||||
public void setFeatureID(String featureID) {
|
||||
public void setFeatureID(Integer featureID) {
|
||||
this.featureID = featureID;
|
||||
}
|
||||
|
||||
|
||||
@ -17,15 +17,13 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
import org.wso2.carbon.device.mgt.common.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperationMapping;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperationProperty;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileFeaturePropertyDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.dto.*;
|
||||
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@ -155,4 +153,39 @@ public class AndroidMobileOperationManager extends AbstractMobileOperationManage
|
||||
}
|
||||
return operations;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getFeaturesForDeviceType(String deviceType) throws FeatureManagementException {
|
||||
MobileFeatureDAO featureDAO = MobileDeviceManagementDAOFactory.getFeatureDAO();
|
||||
MobileFeaturePropertyDAO featurePropertyDAO = MobileDeviceManagementDAOFactory.getFeaturePropertyDAO();
|
||||
List<Feature> features = new ArrayList<Feature>();
|
||||
try {
|
||||
List<MobileFeature> mobileFeatures = featureDAO.getMobileFeatureByDeviceType(deviceType);
|
||||
for (MobileFeature mobileFeature : mobileFeatures) {
|
||||
Feature feature = new Feature();
|
||||
feature.setId(mobileFeature.getId());
|
||||
feature.setDeviceType(mobileFeature.getDeviceType());
|
||||
feature.setName(mobileFeature.getName());
|
||||
feature.setDescription(mobileFeature.getDescription());
|
||||
List<Feature.MetadataEntry> metadataEntries = new ArrayList<Feature.MetadataEntry>();
|
||||
List<MobileFeatureProperty> properties =
|
||||
featurePropertyDAO.getFeaturePropertyOfFeature(mobileFeature.getId());
|
||||
for (MobileFeatureProperty property : properties) {
|
||||
Feature.MetadataEntry metaEntry = new Feature.MetadataEntry();
|
||||
metaEntry.setId(property.getFeatureID());
|
||||
metaEntry.setValue(property.getProperty());
|
||||
metadataEntries.add(metaEntry);
|
||||
}
|
||||
feature.setMetadataEntries(metadataEntries);
|
||||
features.add(feature);
|
||||
}
|
||||
} catch (MobileDeviceManagementDAOException e) {
|
||||
String msg =
|
||||
"Error while fetching the features for the device type " +
|
||||
deviceType;
|
||||
log.error(msg, e);
|
||||
throw new FeatureManagementException(msg, e);
|
||||
}
|
||||
return features;
|
||||
}
|
||||
}
|
||||
@ -24,8 +24,11 @@ import org.wso2.carbon.apimgt.api.APIManagementException;
|
||||
import org.wso2.carbon.apimgt.api.APIProvider;
|
||||
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
|
||||
import org.wso2.carbon.apimgt.impl.APIManagerFactory;
|
||||
import org.wso2.carbon.apimgt.impl.utils.APIMgtDBUtil;
|
||||
import org.wso2.carbon.core.ServerStartupObserver;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
|
||||
import org.wso2.carbon.device.mgt.mobile.MobileDeviceManagementStartupObserver;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
|
||||
@ -55,10 +58,10 @@ import java.util.List;
|
||||
*/
|
||||
public class MobileDeviceManagementServiceComponent {
|
||||
|
||||
private static final String SETUP_COMMAND = "setup";
|
||||
private ServiceRegistration androidServiceRegRef;
|
||||
private ServiceRegistration iOSServiceRegRef;
|
||||
private ServiceRegistration windowsServiceRegRef;
|
||||
private ServiceRegistration serverStartupObserverRef;
|
||||
|
||||
private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class);
|
||||
|
||||
@ -78,7 +81,7 @@ public class MobileDeviceManagementServiceComponent {
|
||||
|
||||
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig);
|
||||
MobileDeviceManagementDAOFactory.init();
|
||||
String setupOption = System.getProperty(SETUP_COMMAND);
|
||||
String setupOption = System.getProperty("setup");
|
||||
if (setupOption != null) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
@ -89,9 +92,7 @@ public class MobileDeviceManagementServiceComponent {
|
||||
MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema(
|
||||
MobileDeviceManagementDAOFactory.getDataSource());
|
||||
} catch (DeviceManagementException e) {
|
||||
log.error(
|
||||
"Exception occurred while initializing mobile device management database schema",
|
||||
e);
|
||||
log.error("Exception occurred while initializing mobile device management database schema", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -105,18 +106,13 @@ public class MobileDeviceManagementServiceComponent {
|
||||
bundleContext.registerService(DeviceManagerService.class.getName(),
|
||||
new WindowsDeviceManagerService(), null);
|
||||
|
||||
/* Initialize all API configurations with corresponding API Providers */
|
||||
this.initAPIConfigs();
|
||||
/* Publish all mobile device management related JAX-RS services as APIs */
|
||||
this.publishAPIs();
|
||||
|
||||
serverStartupObserverRef = bundleContext.registerService(ServerStartupObserver.class,
|
||||
new MobileDeviceManagementStartupObserver(), null);
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug(
|
||||
"Mobile Device Management Service Component has been successfully activated");
|
||||
log.debug("Mobile Device Management Service Component has been successfully activated");
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
log.error("Error occurred while activating Mobile Device Management Service Component",
|
||||
e);
|
||||
log.error("Error occurred while activating Mobile Device Management Service Component", e);
|
||||
}
|
||||
}
|
||||
|
||||
@ -125,11 +121,10 @@ public class MobileDeviceManagementServiceComponent {
|
||||
log.debug("De-activating Mobile Device Management Service Component");
|
||||
}
|
||||
try {
|
||||
BundleContext bundleContext = ctx.getBundleContext();
|
||||
|
||||
androidServiceRegRef.unregister();
|
||||
iOSServiceRegRef.unregister();
|
||||
windowsServiceRegRef.unregister();
|
||||
serverStartupObserverRef.unregister();
|
||||
|
||||
/* Removing all APIs published upon start-up for mobile device management related JAX-RS
|
||||
services */
|
||||
@ -143,32 +138,6 @@ public class MobileDeviceManagementServiceComponent {
|
||||
}
|
||||
}
|
||||
|
||||
private void initAPIConfigs() throws DeviceManagementException {
|
||||
List<APIConfig> apiConfigs =
|
||||
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
|
||||
getApiPublisherConfig().getAPIs();
|
||||
for (APIConfig apiConfig : apiConfigs) {
|
||||
try {
|
||||
APIProvider provider =
|
||||
APIManagerFactory.getInstance().getAPIProvider(apiConfig.getOwner());
|
||||
apiConfig.init(provider);
|
||||
} catch (APIManagementException e) {
|
||||
throw new DeviceManagementException(
|
||||
"Error occurred while initializing API Config '" +
|
||||
apiConfig.getName() + "'", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void publishAPIs() throws DeviceManagementException {
|
||||
List<APIConfig> apiConfigs =
|
||||
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
|
||||
getApiPublisherConfig().getAPIs();
|
||||
for (APIConfig apiConfig : apiConfigs) {
|
||||
DeviceManagementAPIPublisherUtil.publishAPI(apiConfig);
|
||||
}
|
||||
}
|
||||
|
||||
private void removeAPIs() throws DeviceManagementException {
|
||||
List<APIConfig> apiConfigs =
|
||||
MobileDeviceConfigurationManager.getInstance().getMobileDeviceManagementConfig().
|
||||
|
||||
@ -19,6 +19,8 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.dao;
|
||||
|
||||
import org.apache.commons.dbcp.BasicDataSource;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.testng.Assert;
|
||||
import org.testng.annotations.BeforeClass;
|
||||
import org.testng.annotations.Parameters;
|
||||
@ -44,6 +46,7 @@ import java.util.List;
|
||||
|
||||
public class MobileFeatureDAOTestSuite {
|
||||
|
||||
private static final Log log = LogFactory.getLog(MobileFeatureDAOTestSuite.class);
|
||||
public static final String MBL_FEATURE_NAME = "Camera";
|
||||
private static final String MBL_FEATURE_CODE = "500A";
|
||||
public static final String MBL_FEATURE_DESCRIPTION = "Camera enable or disable";
|
||||
@ -139,6 +142,7 @@ public class MobileFeatureDAOTestSuite {
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error in retrieving Mobile Feature data ", e);
|
||||
throw new MobileDeviceManagementDAOException("Error in retrieving Mobile Feature data ",
|
||||
e);
|
||||
} finally {
|
||||
@ -182,6 +186,7 @@ public class MobileFeatureDAOTestSuite {
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error in deleting Mobile Feature data ", e);
|
||||
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
|
||||
e);
|
||||
} finally {
|
||||
@ -228,6 +233,7 @@ public class MobileFeatureDAOTestSuite {
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error in deleting Mobile Feature data ", e);
|
||||
throw new MobileDeviceManagementDAOException("Error in deleting Mobile Feature data ",
|
||||
e);
|
||||
} finally {
|
||||
@ -252,8 +258,8 @@ public class MobileFeatureDAOTestSuite {
|
||||
stmt = conn.createStatement();
|
||||
ResultSet resultSet = stmt
|
||||
.executeQuery(
|
||||
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = " +
|
||||
MBL_FEATURE_UPDATED_CODE);
|
||||
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = '" +
|
||||
MBL_FEATURE_UPDATED_CODE + "'");
|
||||
while (resultSet.next()) {
|
||||
testMblFeature.setId(resultSet.getInt(1));
|
||||
testMblFeature.setCode(resultSet.getString(2));
|
||||
@ -262,6 +268,7 @@ public class MobileFeatureDAOTestSuite {
|
||||
}
|
||||
conn.close();
|
||||
} catch (SQLException e) {
|
||||
log.error("Error in updating Mobile Feature data ", e);
|
||||
throw new MobileDeviceManagementDAOException("Error in updating Mobile Feature data ",
|
||||
e);
|
||||
} finally {
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
#
|
||||
# Copyright 2009 WSO2, Inc. (http://wso2.com)
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
#
|
||||
|
||||
#
|
||||
# This is the log4j configuration file used by WSO2 Carbon
|
||||
#
|
||||
# IMPORTANT : Please do not remove or change the names of any
|
||||
# of the Appenders defined here. The layout pattern & log file
|
||||
# can be changed using the WSO2 Carbon Management Console, and those
|
||||
# settings will override the settings in this file.
|
||||
#
|
||||
|
||||
log4j.rootLogger=DEBUG, STD_OUT
|
||||
|
||||
# Redirect log messages to console
|
||||
log4j.appender.STD_OUT=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.STD_OUT.Target=System.out
|
||||
log4j.appender.STD_OUT.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.STD_OUT.layout.ConversionPattern=%d{yyyy-MM-dd HH:mm:ss} %-5p %c{1}:%L - %m%n
|
||||
@ -127,13 +127,6 @@
|
||||
</includes>
|
||||
</fileSet>
|
||||
|
||||
<fileSet>
|
||||
<directory>
|
||||
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/resources/rxts/
|
||||
</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/repository/resources/rxts/</outputDirectory>
|
||||
</fileSet>
|
||||
|
||||
<fileSet>
|
||||
<directory>src/repository/conf/datasources</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/repository/conf/datasources
|
||||
@ -210,7 +203,7 @@
|
||||
|
||||
<!-- Copying Device Management related dbscripts -->
|
||||
<fileSet>
|
||||
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm</directory>
|
||||
<directory>../distribution/src/repository/dbscripts/cdm</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/dbscripts/cdm</outputDirectory>
|
||||
<includes>
|
||||
<include>*/**</include>
|
||||
@ -223,13 +216,38 @@
|
||||
<outputDirectory>${project.artifactId}-${project.version}/repository/resources
|
||||
</outputDirectory>
|
||||
</fileSet>
|
||||
<!-- copy cdm jaggery app -->
|
||||
|
||||
<!-- Copying CDM Jaggery app -->
|
||||
<fileSet>
|
||||
<directory>src/repository/jaggeryapps</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/repository/deployment/server/jaggeryapps
|
||||
</outputDirectory>
|
||||
<fileMode>755</fileMode>
|
||||
</fileSet>
|
||||
|
||||
<!-- Copying API Manager Publisher and Store Jaggery apps -->
|
||||
<fileSet>
|
||||
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps/publisher/</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/repository/deployment/server/jaggeryapps/publisher</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>publisherLogo/**</exclude>
|
||||
<exclude>publisherTheme/**</exclude>
|
||||
<exclude>publisherSite/**</exclude>
|
||||
<exclude>footer/**</exclude>
|
||||
<exclude>localstyles.css</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
<fileSet>
|
||||
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps/store/</directory>
|
||||
<outputDirectory>wso2mdm-${project.version}/repository/deployment/server/jaggeryapps/store</outputDirectory>
|
||||
<excludes>
|
||||
<exclude>storeLogo/**</exclude>
|
||||
<exclude>storeSite/**</exclude>
|
||||
<exclude>base-page/**</exclude>
|
||||
<exclude>login/**</exclude>
|
||||
<exclude>styles-layout.css</exclude>
|
||||
</excludes>
|
||||
</fileSet>
|
||||
</fileSets>
|
||||
|
||||
<dependencySets>
|
||||
@ -470,5 +488,11 @@
|
||||
<fileMode>644</fileMode>
|
||||
</file>
|
||||
|
||||
<file>
|
||||
<source>target/wso2carbon-core-${carbon.kernel.version}/repository/conf/carbon.xml</source>
|
||||
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/</outputDirectory>
|
||||
<filtered>true</filtered>
|
||||
</file>
|
||||
|
||||
</files>
|
||||
</assembly>
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
product.name=WSO2 Mobile Device Manager
|
||||
product.version=1.0.0-SNAPSHOT
|
||||
product.version=2.0.0-SNAPSHOT
|
||||
product.key=MDM
|
||||
hotdeployment=true
|
||||
hotupdate=true
|
||||
|
||||
Binary file not shown.
@ -20,6 +20,7 @@ CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||
`DEVICE_TYPE` VARCHAR(45) NOT NULL ,
|
||||
`CODE` VARCHAR(45) NOT NULL ,
|
||||
`NAME` VARCHAR(100) NULL ,
|
||||
`DESCRIPTION` VARCHAR(200) NULL ,
|
||||
@ -74,10 +75,15 @@ CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||
`FEATURE_ID` VARCHAR(45) NOT NULL ,
|
||||
`FEATURE_ID` INT NOT NULL ,
|
||||
PRIMARY KEY (`PROPERTY`) ,
|
||||
CONSTRAINT `fk_MBL_FEATURE_PROPERTY_MBL_FEATURE1`
|
||||
FOREIGN KEY (`FEATURE_ID` )
|
||||
REFERENCES `MBL_FEATURE` (`FEATURE_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Inserts
|
||||
-- -----------------------------------------------------
|
||||
Insert into MBL_FEATURE (DEVICE_TYPE_ID,CODE, NAME, DESCRIPTION) VALUES ('android', "503A", "DEVICE_LOCK", "Device lock");
|
||||
@ -20,6 +20,7 @@ ENGINE = InnoDB;
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`DEVICE_TYPE_ID` INT NOT NULL,
|
||||
`CODE` VARCHAR(45) NULL,
|
||||
`NAME` VARCHAR(100) NULL,
|
||||
`DESCRIPTION` VARCHAR(200) NULL,
|
||||
@ -97,4 +98,8 @@ CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Inserts
|
||||
-- -----------------------------------------------------
|
||||
Insert into MBL_FEATURE (DEVICE_TYPE_ID,CODE, NAME, DESCRIPTION) VALUES ('android', "503A", "DEVICE_LOCK", "Device lock");
|
||||
|
||||
|
||||
@ -22,6 +22,7 @@ var uri = request.getRequestURI();
|
||||
var callPath=uri.replace("/cdm/api/","");
|
||||
var log = new Log();
|
||||
var deviceModule = require("/modules/device.js");
|
||||
|
||||
if (uri != null) {
|
||||
var uriMatcher = new URIMatcher(callPath);
|
||||
log.info(callPath);
|
||||
|
||||
@ -0,0 +1,40 @@
|
||||
<%
|
||||
/*
|
||||
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
var verb = request.getMethod();
|
||||
var uri = request.getRequestURI();
|
||||
var callPath=uri.replace("/cdm/api/","");
|
||||
var log = new Log();
|
||||
var deviceModule = require("/modules/device.js");
|
||||
|
||||
if (uri != null) {
|
||||
var uriMatcher = new URIMatcher(callPath);
|
||||
//log.info(callPath);
|
||||
log.info(uriMatcher.match("operation/{type}/{deviceid}/{operation}"));
|
||||
if (uriMatcher.match("operation/{type}/{deviceid}/{operation}")) {
|
||||
|
||||
var deviceId = uriMatcher.elements().deviceid;
|
||||
var type = uriMatcher.elements().type;
|
||||
var operation = uriMatcher.elements().operation;
|
||||
var result = deviceModule.performOperation(deviceId, operation,[],type);
|
||||
<!--log.info(result);-->
|
||||
<!--print(result);-->
|
||||
}
|
||||
}
|
||||
%>
|
||||
@ -22,3 +22,21 @@ function identifierFormatter(value, row, index) {
|
||||
'</a>'
|
||||
].join('');
|
||||
}
|
||||
|
||||
var currentDeviceOperation;
|
||||
var currentDevice;
|
||||
var currentDeviceType;
|
||||
function performOperation(){
|
||||
currentDevice = $("#deviceMain").data("deviceid");
|
||||
currentDeviceType = $("#deviceMain").data("devicetype");
|
||||
$.post("/cdm/api/operation/"+currentDeviceType+"/"+currentDevice+"/"+currentDeviceOperation,function(){
|
||||
$('#confirmModel').modal('hide');
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$(".device-operation").click(function(){
|
||||
currentDeviceOperation = $(this).data("operation");
|
||||
$('#confirmModel').modal('show');
|
||||
});
|
||||
});
|
||||
@ -1,3 +1,21 @@
|
||||
<%
|
||||
// footer includes
|
||||
%>
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="confirmModel" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">Operation Confirmation</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Do you wish to perform this operation?
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancel</button>
|
||||
<button type="button" class="btn btn-primary" onclick="performOperation()">Confirm</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@ -10,6 +10,10 @@
|
||||
"url": "/dashboard",
|
||||
"path": "/pages/dashboard.jag"
|
||||
},
|
||||
{
|
||||
"url" : "/api/operation/*",
|
||||
"path": "/api/mobile/operation-api.jag"
|
||||
},
|
||||
{
|
||||
"url": "/api/devices/mobile/*",
|
||||
"path": "/api/mobile/device-api.jag"
|
||||
|
||||
@ -19,16 +19,16 @@
|
||||
var utility = require("/modules/utility.js");
|
||||
var DeviceIdentifier = Packages.org.wso2.carbon.device.mgt.common.DeviceIdentifier;
|
||||
var DeviceManagerUtil = Packages.org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
|
||||
var Operation = Packages.org.wso2.carbon.device.mgt.common.Operation;
|
||||
var Type = Packages.org.wso2.carbon.device.mgt.common.Operation.Type;
|
||||
var Properties = Packages.java.util.Properties;
|
||||
var ArrayList = Packages.java.util.ArrayList;
|
||||
var log = new Log();
|
||||
var deviceManagementService = utility.getDeviceManagementService();
|
||||
|
||||
var listDevices = function () {
|
||||
|
||||
var devices = deviceManagementService.getAllDevices("android");
|
||||
|
||||
var deviceList = [];
|
||||
|
||||
|
||||
for (i = 0; i < devices.size(); i++) {
|
||||
var device = devices.get(i);
|
||||
|
||||
@ -54,10 +54,38 @@ var getDevice = function(type, deviceId){
|
||||
return device;
|
||||
}
|
||||
|
||||
var getOperations = function(type){
|
||||
var features = deviceManagementService.getOperationManager("android").getFeaturesForDeviceType(type);
|
||||
var featuresConverted = [];
|
||||
for (i = 0; i < features.size(); i++) {
|
||||
var feature = features.get(i);
|
||||
featuresConverted.push({
|
||||
"featureName": feature.getName(),
|
||||
"featureDescription": feature.getDescription()
|
||||
});
|
||||
}
|
||||
return featuresConverted;
|
||||
}
|
||||
var performOperation = function(deviceId, featureName, properties, type){
|
||||
var operation = new Operation();
|
||||
operation.setCode(featureName);
|
||||
operation.setType(Type.COMMAND);
|
||||
var props = new Properties();
|
||||
for (i = 0; i < properties.length; i++) {
|
||||
var object = properties[i];
|
||||
props.setProperty(object.key,object.value);
|
||||
}
|
||||
operation.setProperties(props);
|
||||
var deviceIdentifier = new DeviceIdentifier();
|
||||
deviceIdentifier.setId(deviceId)
|
||||
deviceIdentifier.setType(type);
|
||||
var deviceList = new ArrayList();
|
||||
deviceList.add(deviceIdentifier);
|
||||
deviceManagementService.getOperationManager("android").addOperation(operation, deviceList);
|
||||
}
|
||||
|
||||
var viewDevice = function(type, deviceId){
|
||||
|
||||
var device = this.getDevice(type, deviceId);
|
||||
|
||||
var propertiesList = DeviceManagerUtil.convertPropertiesToMap(device.getProperties());
|
||||
var entries = propertiesList.entrySet();
|
||||
var iterator = entries.iterator();
|
||||
|
||||
@ -73,6 +73,7 @@ var title="WSO2 CDM";
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
include("/includes/footer.jag");
|
||||
include("/includes/layout-footer.jag");
|
||||
%>
|
||||
</body>
|
||||
|
||||
@ -35,22 +35,26 @@ var title="WSO2 CDM";
|
||||
var deviceId = uriMatcher.elements().deviceid;
|
||||
var type = uriMatcher.elements().type;
|
||||
var device = deviceModule.viewDevice(type, deviceId);
|
||||
var operations = deviceModule.getOperations("android");
|
||||
%>
|
||||
<div class="container-fluid">
|
||||
<div id="deviceMain" data-deviceId="<%=deviceId%>" data-deviceType="<%=type%>" class="container-fluid">
|
||||
<div class="row">
|
||||
<div class="col-sm-9 main col-centered">
|
||||
<h2 class="sub-header"><%=device.name%></h2>
|
||||
<div class="row">
|
||||
</div>
|
||||
<div class="row">
|
||||
<button class="device-operation btn btn-default">
|
||||
<%
|
||||
for (i = 0; i < operations.length; i++) {
|
||||
var operation = operations[i]
|
||||
%>
|
||||
<button data-operation="<%=operation.featureName%>" class="device-operation btn btn-default">
|
||||
<img src="/cdm/client/img/operations/lock.png" />
|
||||
<p>Lock</p>
|
||||
</button>
|
||||
<button class="device-operation btn btn-default">
|
||||
<img src="/cdm/client/img/operations/lock.png" />
|
||||
<p>Lock</p>
|
||||
<p><%=operation.featureDescription %></p>
|
||||
</button>
|
||||
<%
|
||||
}
|
||||
%>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-3 device-model-holder well well-lg">
|
||||
@ -97,6 +101,7 @@ var title="WSO2 CDM";
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
include("/includes/footer.jag");
|
||||
include("/includes/layout-footer.jag");
|
||||
%>
|
||||
</body>
|
||||
|
||||
@ -1,47 +0,0 @@
|
||||
<?xml version="1.0"?>
|
||||
<artifactType type="application/vnd.wso2-license+xml" shortName="license" singularLabel="License" pluralLabel="Licenses"
|
||||
hasNamespace="false" iconSet="10">
|
||||
<storagePath>/license/@{overview_provider}/@{overview_name}/@{overview_language}/@{overview_version}</storagePath>
|
||||
<nameAttribute>overview_name</nameAttribute>
|
||||
<ui>
|
||||
<list>
|
||||
<column name="Device Type">
|
||||
<data type="path" value="overview_provider" href="@{storagePath}"/>
|
||||
</column>
|
||||
<column name="Name">
|
||||
<data type="path" value="overview_name" href="@{storagePath}"/>
|
||||
</column>
|
||||
<column name="Language">
|
||||
<data type="path" value="overview_language" href="@{storagePath}"/>
|
||||
</column>
|
||||
<column name="Version">
|
||||
<data type="path" value="overview_version" href="@{storagePath}"/>
|
||||
</column>
|
||||
</list>
|
||||
</ui>
|
||||
<content>
|
||||
<table name="Overview">
|
||||
<field type="text" required="true">
|
||||
<name>Provider</name>
|
||||
</field>
|
||||
<field type="text" required="true">
|
||||
<name>Name</name>
|
||||
</field>
|
||||
<field type="text" required="true">
|
||||
<name>Language</name>
|
||||
</field>
|
||||
<field type="text" required="true">
|
||||
<name>Version</name>
|
||||
</field>
|
||||
<field type="text">
|
||||
<name>Validity From</name>
|
||||
</field>
|
||||
<field type="text">
|
||||
<name>Validity To</name>
|
||||
</field>
|
||||
<field type="text-area">
|
||||
<name>License</name>
|
||||
</field>
|
||||
</table>
|
||||
</content>
|
||||
</artifactType>
|
||||
@ -1,45 +0,0 @@
|
||||
/*
|
||||
*
|
||||
* * 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.
|
||||
* /
|
||||
*/
|
||||
|
||||
import org.wso2.cdmserver.mobileservices.android.common.AndroidAgentException;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.License;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Produces;
|
||||
|
||||
/**
|
||||
* License Management related JAX RS APIs
|
||||
*/
|
||||
|
||||
@Produces({ "application/json", "application/xml" })
|
||||
@Consumes({ "application/json", "application/xml" })
|
||||
public class Licenses {
|
||||
|
||||
private static Log log = LogFactory.getLog(Licenses.class);
|
||||
|
||||
@GET
|
||||
public License getLicense(String deviceType) throws AndroidAgentException {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,35 +0,0 @@
|
||||
package org.wso2.cdmserver.mobileservices.android;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.*;
|
||||
import org.wso2.carbon.device.mgt.common.Device;
|
||||
|
||||
import javax.ws.rs.Consumes;
|
||||
import javax.ws.rs.GET;
|
||||
import javax.ws.rs.Path;
|
||||
import javax.ws.rs.Produces;
|
||||
import javax.ws.rs.core.Response;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is a Test class
|
||||
*/
|
||||
@Produces({"application/json", "application/xml"})
|
||||
@Consumes({"application/json", "application/xml"})
|
||||
public class Test {
|
||||
|
||||
@GET
|
||||
public List<org.wso2.carbon.device.mgt.common.Device> getAllDevices() throws DeviceManagementException{
|
||||
|
||||
Device dev = new Device();
|
||||
dev.setName("test1");
|
||||
dev.setDateOfEnrolment(11111111L);
|
||||
dev.setDateOfLastUpdate(992093209L);
|
||||
dev.setDescription("sassasaas");
|
||||
|
||||
ArrayList<Device> listdevices = new ArrayList<Device>();
|
||||
listdevices.add(dev);
|
||||
throw new DeviceManagementException("test ex");
|
||||
|
||||
}
|
||||
}
|
||||
@ -182,7 +182,7 @@
|
||||
org.wso2.carbon:org.wso2.carbon.identity.thrift.authentication.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.core.server.feature:${carbon.platform.version}
|
||||
org.wso2.carbon:org.wso2.carbon.identity.core.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.logging.mgt.feature:${carbon.platform.version}
|
||||
@ -260,12 +260,52 @@
|
||||
org.wso2.carbon:org.wso2.carbon.governance.lifecycle.management.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
|
||||
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.self.registration.server.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
|
||||
<!-- API Manager Publisher and Store Features -->
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.apimgt.publisher.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.apimgt.store.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
|
||||
<!-- SSO -->
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.security.mgt.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.application.authenticator.basicauth.server.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.application.authentication.framework.server.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.authenticator.saml2.sso.server.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<feaureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.sso.saml.feature:${carbon.platform.version}
|
||||
</feaureArtifactDef>
|
||||
|
||||
<!-- SSO Fix-->
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.user.profile.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.application.mgt.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.idp.mgt.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<featureArtifactDef>
|
||||
org.wso2.carbon:org.wso2.carbon.identity.mgt.feature:${carbon.platform.version}
|
||||
</featureArtifactDef>
|
||||
<!-- End of SSO Fixes -->
|
||||
|
||||
</featureArtifacts>
|
||||
</configuration>
|
||||
@ -378,7 +418,7 @@
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.core.server.feature.group</id>
|
||||
<id>org.wso2.carbon.identity.core.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
@ -429,14 +469,12 @@
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.self.registration.server.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
<!-- registry features -->
|
||||
|
||||
<feature>
|
||||
<id>org.wso2.carbon.registry.core.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
@ -494,6 +532,59 @@
|
||||
<id>org.wso2.carbon.um.ws.service.client.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
<!-- API Manager Publisher and Store Features -->
|
||||
<feature>
|
||||
<id>org.wso2.carbon.apimgt.publisher.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.apimgt.store.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
<!-- SSO Features -->
|
||||
<feature>
|
||||
<id>
|
||||
org.wso2.carbon.identity.application.authenticator.basicauth.server.feature.group
|
||||
</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>
|
||||
org.wso2.carbon.identity.application.authentication.framework.server.feature.group
|
||||
</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.authenticator.saml2.sso.server.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.authenticator.saml2.sso.ui.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
<!-- SSO Fix-->
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.user.profile.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.application.mgt.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.idp.mgt.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
<feature>
|
||||
<id>org.wso2.carbon.identity.mgt.feature.group</id>
|
||||
<version>${carbon.platform.version}</version>
|
||||
</feature>
|
||||
|
||||
<!--SSO FIX OVER-->
|
||||
|
||||
</features>
|
||||
</configuration>
|
||||
</execution>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user