forked from community/device-mgt-plugins
commit
2ece5764d3
@ -1,87 +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.
|
||||
*/
|
||||
|
||||
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() + "'");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -1,101 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.config;
|
||||
|
||||
import org.wso2.carbon.apimgt.api.APIProvider;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import javax.xml.bind.annotation.XmlTransient;
|
||||
|
||||
@XmlRootElement(name = "API")
|
||||
public class APIConfig {
|
||||
|
||||
private String name;
|
||||
private String owner;
|
||||
private String context;
|
||||
private String endpoint;
|
||||
private String version;
|
||||
private String transports;
|
||||
private APIProvider provider;
|
||||
|
||||
public void init(APIProvider provider) {
|
||||
this.provider = provider;
|
||||
}
|
||||
|
||||
@XmlTransient
|
||||
public APIProvider getProvider() {
|
||||
return provider;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Name", nillable = false)
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Owner", nillable = false)
|
||||
public String getOwner() {
|
||||
return owner;
|
||||
}
|
||||
|
||||
public void setOwner(String owner) {
|
||||
this.owner = owner;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Context", nillable = false)
|
||||
public String getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
public void setContext(String context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Endpoint", nillable = false)
|
||||
public String getEndpoint() {
|
||||
return endpoint;
|
||||
}
|
||||
|
||||
public void setEndpoint(String endpoint) {
|
||||
this.endpoint = endpoint;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Version", nillable = false)
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@XmlElement(name = "Transports", nillable = false)
|
||||
public String getTransports() {
|
||||
return transports;
|
||||
}
|
||||
|
||||
public void setTransports(String transports) {
|
||||
this.transports = transports;
|
||||
}
|
||||
|
||||
}
|
@ -1,41 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* you may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.config;
|
||||
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlElementWrapper;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
import java.util.List;
|
||||
|
||||
@XmlRootElement(name = "APIPublisher")
|
||||
public class APIPublisherConfig {
|
||||
|
||||
private List<APIConfig> apis;
|
||||
|
||||
@XmlElementWrapper(name = "APIs", nillable = false, required = true)
|
||||
@XmlElement(name = "API", nillable = false)
|
||||
public List<APIConfig> getAPIs() {
|
||||
return apis;
|
||||
}
|
||||
|
||||
public void setAPIs(List<APIConfig> apis) {
|
||||
this.apis = apis;
|
||||
}
|
||||
|
||||
}
|
8
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java
8
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManager.java
@ -0,0 +1,96 @@
|
||||
/*
|
||||
* 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.mobile.impl.android;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
import org.wso2.carbon.device.mgt.common.FeatureManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.FeatureManager;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class AndroidFeatureManager implements FeatureManager {
|
||||
|
||||
private FeatureDAO featureDAO;
|
||||
private static final Log log = LogFactory.getLog(AndroidFeatureManager.class);
|
||||
|
||||
public AndroidFeatureManager() {
|
||||
this.featureDAO = FeatureManagementDAOFactory.getFeatureDAO();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addFeature(Feature feature) throws DeviceManagementException {
|
||||
try {
|
||||
FeatureManagementDAOFactory.beginTransaction();
|
||||
featureDAO.addFeature(feature);
|
||||
FeatureManagementDAOFactory.commitTransaction();
|
||||
return true;
|
||||
} catch (FeatureManagementDAOException e) {
|
||||
try {
|
||||
FeatureManagementDAOFactory.rollbackTransaction();
|
||||
} catch (FeatureManagementDAOException e1) {
|
||||
log.warn("Error occurred while roll-backing the transaction", e);
|
||||
}
|
||||
throw new DeviceManagementException("Error occurred while adding the feature", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feature getFeature(String name) throws DeviceManagementException {
|
||||
try {
|
||||
FeatureManagementDAOFactory.beginTransaction();
|
||||
Feature feature = featureDAO.getFeature(name);
|
||||
FeatureManagementDAOFactory.commitTransaction();
|
||||
return feature;
|
||||
} catch (FeatureManagementDAOException e) {
|
||||
try {
|
||||
FeatureManagementDAOFactory.rollbackTransaction();
|
||||
} catch (FeatureManagementDAOException e1) {
|
||||
log.warn("Error occurred while roll-backing the transaction", e);
|
||||
}
|
||||
throw new DeviceManagementException("Error occurred while retrieving the feature", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getFeatures() throws DeviceManagementException {
|
||||
try {
|
||||
return featureDAO.getFeatures();
|
||||
} catch (FeatureManagementDAOException e) {
|
||||
throw new DeviceManagementException("Error occurred while retrieving the list of features registered " +
|
||||
"for Android platform", e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean removeFeature(String name) throws DeviceManagementException {
|
||||
try {
|
||||
featureDAO.removeFeature(name);
|
||||
return true;
|
||||
} catch (FeatureManagementDAOException e) {
|
||||
throw new DeviceManagementException("Error occurred while removing the feature", e);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,35 @@
|
||||
/*
|
||||
* 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.mobile.impl.android.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface FeatureDAO {
|
||||
|
||||
void addFeature(Feature feature) throws FeatureManagementDAOException;
|
||||
|
||||
void removeFeature(String name) throws FeatureManagementDAOException;
|
||||
|
||||
Feature getFeature(String name) throws FeatureManagementDAOException;
|
||||
|
||||
List<Feature> getFeatures() throws FeatureManagementDAOException;
|
||||
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
/*
|
||||
* 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.mobile.impl.android.dao;
|
||||
|
||||
public class FeatureManagementDAOException extends Exception {
|
||||
|
||||
private String message;
|
||||
private static final long serialVersionUID = 2021891706072918865L;
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message and
|
||||
* nested exception.
|
||||
*
|
||||
* @param message error message
|
||||
* @param nestedException exception
|
||||
*/
|
||||
public FeatureManagementDAOException(String message, Exception nestedException) {
|
||||
super(message, nestedException);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message
|
||||
* and cause.
|
||||
*
|
||||
* @param message the detail message.
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public FeatureManagementDAOException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified detail message.
|
||||
*
|
||||
* @param message the detail message.
|
||||
*/
|
||||
public FeatureManagementDAOException(String message) {
|
||||
super(message);
|
||||
setErrorMessage(message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs a new MobileDeviceManagementDAOException with the specified and cause.
|
||||
*
|
||||
* @param cause the cause of this exception.
|
||||
*/
|
||||
public FeatureManagementDAOException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setErrorMessage(String errorMessage) {
|
||||
this.message = errorMessage;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,93 @@
|
||||
/*
|
||||
* 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.mobile.impl.android.dao;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.impl.FeatureDAOImpl;
|
||||
|
||||
import javax.sql.DataSource;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class FeatureManagementDAOFactory {
|
||||
|
||||
private static DataSource dataSource;
|
||||
private static ThreadLocal<Connection> currentConnection = new ThreadLocal<Connection>();
|
||||
private static final Log log = LogFactory.getLog(FeatureManagementDAOFactory.class);
|
||||
|
||||
public static FeatureDAO getFeatureDAO() {
|
||||
return new FeatureDAOImpl();
|
||||
}
|
||||
|
||||
public static void init(DataSource dtSource) {
|
||||
dataSource = dtSource;
|
||||
}
|
||||
|
||||
public static void beginTransaction() throws FeatureManagementDAOException {
|
||||
try {
|
||||
Connection conn = dataSource.getConnection();
|
||||
conn.setAutoCommit(false);
|
||||
currentConnection.set(conn);
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while retrieving datasource connection", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static Connection getConnection() {
|
||||
return currentConnection.get();
|
||||
}
|
||||
|
||||
public static void commitTransaction() throws FeatureManagementDAOException {
|
||||
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 FeatureManagementDAOException("Error occurred while committing the transaction", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void rollbackTransaction() throws FeatureManagementDAOException {
|
||||
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 FeatureManagementDAOException("Error occurred while rollbacking the transaction", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static DataSource getDataSource() {
|
||||
return dataSource;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,128 @@
|
||||
/*
|
||||
* 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.mobile.impl.android.dao.impl;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureDAO;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOException;
|
||||
import org.wso2.carbon.device.mgt.mobile.impl.android.dao.FeatureManagementDAOFactory;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class FeatureDAOImpl implements FeatureDAO {
|
||||
|
||||
@Override
|
||||
public void addFeature(Feature feature) throws FeatureManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
Connection conn = FeatureManagementDAOFactory.getConnection();
|
||||
String sql = "INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, feature.getCode());
|
||||
stmt.setString(2, feature.getName());
|
||||
stmt.setString(3, feature.getDescription());
|
||||
stmt.executeUpdate();
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
|
||||
feature.getName() + "' into the metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFeature(String code) throws FeatureManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
try {
|
||||
Connection conn = FeatureManagementDAOFactory.getConnection();
|
||||
String sql = "DELETE FROM MBL_FEATURE WHERE CODE = ?";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, code);
|
||||
stmt.execute();
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while adding feature '" +
|
||||
code + "' into the metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Feature getFeature(String code) throws FeatureManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
Connection conn = FeatureManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE WHERE CODE = ?";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
stmt.setString(1, code);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
Feature feature = null;
|
||||
if (rs.next()) {
|
||||
feature = new Feature();
|
||||
feature.setId(rs.getInt("ID"));
|
||||
feature.setCode(rs.getString("CODE"));
|
||||
feature.setName(rs.getString("NAME"));
|
||||
feature.setDescription(rs.getString("DESCRIPTION"));
|
||||
}
|
||||
return feature;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while retrieving feature metadata '" +
|
||||
code + "' from the feature metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getFeatures() throws FeatureManagementDAOException {
|
||||
PreparedStatement stmt = null;
|
||||
ResultSet rs = null;
|
||||
List<Feature> features = new ArrayList<Feature>();
|
||||
try {
|
||||
Connection conn = FeatureManagementDAOFactory.getConnection();
|
||||
String sql = "SELECT ID, CODE, NAME, DESCRIPTION FROM AD_FEATURE";
|
||||
stmt = conn.prepareStatement(sql);
|
||||
rs = stmt.executeQuery();
|
||||
|
||||
while (rs.next()) {
|
||||
Feature feature = new Feature();
|
||||
feature.setId(rs.getInt("ID"));
|
||||
feature.setCode(rs.getString("CODE"));
|
||||
feature.setName(rs.getString("NAME"));
|
||||
feature.setDescription(rs.getString("DESCRIPTION"));
|
||||
}
|
||||
return features;
|
||||
} catch (SQLException e) {
|
||||
throw new FeatureManagementDAOException("Error occurred while retrieving all feature metadata from the " +
|
||||
"feature metadata repository", e);
|
||||
} finally {
|
||||
MobileDeviceManagementDAOUtil.cleanupResources(stmt, rs);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
6
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java
6
components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java → components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManager.java
@ -1,112 +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.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.device.mgt.mobile.util;
|
||||
|
||||
import org.wso2.carbon.apimgt.api.APIManagementException;
|
||||
import org.wso2.carbon.apimgt.api.APIProvider;
|
||||
import org.wso2.carbon.apimgt.api.model.API;
|
||||
import org.wso2.carbon.apimgt.api.model.APIIdentifier;
|
||||
import org.wso2.carbon.apimgt.api.model.APIStatus;
|
||||
import org.wso2.carbon.apimgt.api.model.URITemplate;
|
||||
import org.wso2.carbon.apimgt.impl.APIConstants;
|
||||
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
|
||||
import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class DeviceManagementAPIPublisherUtil {
|
||||
|
||||
enum HTTPMethod {
|
||||
GET, POST, DELETE, PUT, OPTIONS
|
||||
}
|
||||
|
||||
private static List<HTTPMethod> httpMethods;
|
||||
|
||||
static {
|
||||
httpMethods = new ArrayList<HTTPMethod>();
|
||||
httpMethods.add(HTTPMethod.GET);
|
||||
httpMethods.add(HTTPMethod.POST);
|
||||
httpMethods.add(HTTPMethod.DELETE);
|
||||
httpMethods.add(HTTPMethod.PUT);
|
||||
httpMethods.add(HTTPMethod.OPTIONS);
|
||||
}
|
||||
|
||||
public static void publishAPI(APIConfig config) throws DeviceManagementException {
|
||||
APIProvider provider = config.getProvider();
|
||||
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
|
||||
API api = new API(id);
|
||||
try {
|
||||
api.setContext(config.getContext());
|
||||
api.setUrl(config.getVersion());
|
||||
api.setUriTemplates(getURITemplates(config.getEndpoint(),
|
||||
APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN));
|
||||
api.setVisibility(APIConstants.API_GLOBAL_VISIBILITY);
|
||||
api.addAvailableTiers(provider.getTiers());
|
||||
api.setEndpointSecured(false);
|
||||
api.setStatus(APIStatus.PUBLISHED);
|
||||
api.setTransports(config.getTransports());
|
||||
|
||||
provider.addAPI(api);
|
||||
} catch (APIManagementException e) {
|
||||
throw new DeviceManagementException("Error occurred while registering the API", e);
|
||||
}
|
||||
}
|
||||
|
||||
public static void removeAPI(APIConfig config) throws DeviceManagementException {
|
||||
try {
|
||||
APIProvider provider = config.getProvider();
|
||||
APIIdentifier id = new APIIdentifier(config.getOwner(), config.getName(), config.getVersion());
|
||||
provider.deleteAPI(id);
|
||||
} catch (APIManagementException e) {
|
||||
throw new DeviceManagementException("Error occurred while removing API", e);
|
||||
}
|
||||
}
|
||||
|
||||
private static Set<URITemplate> getURITemplates(String endpoint, String authType) {
|
||||
Set<URITemplate> uriTemplates = new LinkedHashSet<URITemplate>();
|
||||
if (APIConstants.AUTH_NO_AUTHENTICATION.equals(authType)) {
|
||||
for (HTTPMethod method : httpMethods) {
|
||||
URITemplate template = new URITemplate();
|
||||
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
|
||||
template.setHTTPVerb(method.toString());
|
||||
template.setResourceURI(endpoint);
|
||||
template.setUriTemplate("/*");
|
||||
uriTemplates.add(template);
|
||||
}
|
||||
} else {
|
||||
for (HTTPMethod method : httpMethods) {
|
||||
URITemplate template = new URITemplate();
|
||||
if (HTTPMethod.OPTIONS.equals(method)) {
|
||||
template.setAuthType(APIConstants.AUTH_NO_AUTHENTICATION);
|
||||
} else {
|
||||
template.setAuthType(APIConstants.AUTH_APPLICATION_OR_USER_LEVEL_TOKEN);
|
||||
}
|
||||
template.setHTTPVerb(method.toString());
|
||||
template.setResourceURI(endpoint);
|
||||
template.setUriTemplate("/*");
|
||||
uriTemplates.add(template);
|
||||
}
|
||||
}
|
||||
return uriTemplates;
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,98 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
|
||||
CREATE TABLE IF NOT EXISTS AD_FEATURE(
|
||||
ID INTEGER NOT NULL,
|
||||
CODE VARCHAR(50) NOT NULL,
|
||||
NAME VARCHAR(100) NOT NULL,
|
||||
DESCRIPTION VARCHAR(200) NOT NULL,
|
||||
)
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_DEVICE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_DEVICE (
|
||||
MOBILE_DEVICE_ID VARCHAR(45) NOT NULL ,
|
||||
PUSH_TOKEN VARCHAR(45) NULL DEFAULT NULL ,
|
||||
IMEI VARCHAR(45) NULL DEFAULT NULL ,
|
||||
IMSI VARCHAR(45) NULL DEFAULT NULL ,
|
||||
OS_VERSION VARCHAR(45) NULL DEFAULT NULL ,
|
||||
DEVICE_MODEL VARCHAR(45) NULL DEFAULT NULL ,
|
||||
VENDOR VARCHAR(45) NULL DEFAULT NULL ,
|
||||
LATITUDE VARCHAR(45) NULL DEFAULT NULL,
|
||||
LONGITUDE VARCHAR(45) NULL DEFAULT NULL,
|
||||
CHALLENGE VARCHAR(45) NULL DEFAULT NULL,
|
||||
TOKEN VARCHAR(500) NULL DEFAULT NULL,
|
||||
UNLOCK_TOKEN VARCHAR(500) NULL DEFAULT NULL,
|
||||
SERIAL VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (MOBILE_DEVICE_ID) );
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_FEATURE
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_FEATURE (
|
||||
FEATURE_ID INT NOT NULL AUTO_INCREMENT ,
|
||||
CODE VARCHAR(45) NOT NULL,
|
||||
NAME VARCHAR(100) NULL ,
|
||||
DESCRIPTION VARCHAR(200) NULL ,
|
||||
DEVICE_TYPE VARCHAR(50) NULL ,
|
||||
PRIMARY KEY (FEATURE_ID) );
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_OPERATION
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_OPERATION (
|
||||
OPERATION_ID INT NOT NULL AUTO_INCREMENT ,
|
||||
FEATURE_CODE VARCHAR(45) NOT NULL ,
|
||||
CREATED_DATE BIGINT NULL ,
|
||||
PRIMARY KEY (OPERATION_ID));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_DEVICE_OPERATION_MAPPING
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_DEVICE_OPERATION_MAPPING (
|
||||
DEVICE_ID VARCHAR(45) NOT NULL ,
|
||||
OPERATION_ID INT NOT NULL ,
|
||||
SENT_DATE BIGINT NULL ,
|
||||
RECEIVED_DATE BIGINT NULL ,
|
||||
STATUS VARCHAR(10) NOT NULL ,
|
||||
PRIMARY KEY (DEVICE_ID, OPERATION_ID) ,
|
||||
CONSTRAINT fk_AD_DEVICE_OPERATION_AD_DEVICE
|
||||
FOREIGN KEY (DEVICE_ID )
|
||||
REFERENCES AD_DEVICE (MOBILE_DEVICE_ID )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT fk_AD_DEVICE_OPERATION_AD_OPERATION1
|
||||
FOREIGN KEY (OPERATION_ID )
|
||||
REFERENCES AD_OPERATION (OPERATION_ID )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_OPERATION_PROPERTY
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_OPERATION_PROPERTY (
|
||||
OPERATION_ID INT NOT NULL ,
|
||||
PROPERTY VARCHAR(45) NOT NULL ,
|
||||
VALUE TEXT NULL ,
|
||||
PRIMARY KEY (OPERATION_ID, PROPERTY) ,
|
||||
CONSTRAINT fk_AD_OPERATION_PROPERTY_AD_OPERATION1
|
||||
FOREIGN KEY (OPERATION_ID )
|
||||
REFERENCES AD_OPERATION (OPERATION_ID )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table AD_FEATURE_PROPERTY
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS AD_FEATURE_PROPERTY (
|
||||
PROPERTY VARCHAR(45) NOT NULL ,
|
||||
FEATURE_ID INT NOT NULL ,
|
||||
PRIMARY KEY (PROPERTY) ,
|
||||
CONSTRAINT fk_AD_FEATURE_PROPERTY_AD_FEATURE1
|
||||
FOREIGN KEY (FEATURE_ID )
|
||||
REFERENCES AD_FEATURE (FEATURE_ID )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
@ -0,0 +1,93 @@
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`IMEI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`IMSI` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`VENDOR` VARCHAR(45) NULL DEFAULT NULL ,
|
||||
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CHALLENGE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`TOKEN` VARCHAR(50) NULL DEFAULT NULL,
|
||||
`UNLOCK_TOKEN` VARCHAR(2000) NULL DEFAULT NULL,
|
||||
`SERIAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`MOBILE_DEVICE_ID`) );
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE`
|
||||
-- -----------------------------------------------------
|
||||
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 ,
|
||||
PRIMARY KEY (`FEATURE_ID`) );
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
|
||||
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT ,
|
||||
`FEATURE_CODE` VARCHAR(45) NOT NULL ,
|
||||
`CREATED_DATE` BIGINT NULL ,
|
||||
PRIMARY KEY (`OPERATION_ID`));
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE_OPERATION_MAPPING`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
|
||||
`DEVICE_ID` VARCHAR(45) NOT NULL ,
|
||||
`OPERATION_ID` INT NOT NULL ,
|
||||
`SENT_DATE` BIGINT NULL ,
|
||||
`RECEIVED_DATE` BIGINT NULL ,
|
||||
`STATUS` VARCHAR(10) NOT NULL ,
|
||||
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`) ,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
|
||||
FOREIGN KEY (`DEVICE_ID` )
|
||||
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID` )
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||
`OPERATION_ID` INT NOT NULL ,
|
||||
`PROPERTY` VARCHAR(45) NOT NULL ,
|
||||
`VALUE` TEXT NULL ,
|
||||
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`) ,
|
||||
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID` )
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID` )
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION);
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
`PROPERTY` 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,NAME,CODE, DESCRIPTION) VALUES ('android','DEVICE_LOCK','503A','Device Lock'),('android','WIPE','504A','Device Wipe'),('android','CLEARPASSCODE','505A','Clear Passcode'),('android','APPLIST','502A','Get All Applications'),('android','LOCATION','501A','Location'),('android','INFO','500A','Device Information'),('android','NOTIFICATION','506A','Message'),('android','WIFI','507A','Setup Wifi'),('android','CAMERA','508A','Camera Control'),('android','MUTE','513A','Mute Device'),('android','INSTALLAPP','509A','Install Application'),('android','UNINSTALLAPP','510A','Uninstall Application'),('android','ENCRYPT','511A','Encrypt Storage'),('android','APN','512A','APN'),('android','WEBCLIP','518A','Create Webclips'),('android','PASSWORDPOLICY','519A','Passcode Policy'),('android','EMAIL','520A','Email Configuration'),('android','GOOGLECALENDAR','521A','Calender Subscription'),('android','VPN','523A','VPN'),('android','LDAP','524A','LDAP'),('android','CHANGEPASSWORD','526A','Set Passcode'),('android','ENTERPRISEWIPE','527A','Enterprise Wipe'),('android','POLICY','500P','Policy Enforcement'),('android','MONITORING','501P','Policy Monitoring '),('android','BLACKLISTAPPS','528B','Blacklist Apps'),('android','REVOKEPOLICY','502P','Revoke Policy');
|
@ -0,0 +1,103 @@
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE` (
|
||||
`MOBILE_DEVICE_ID` VARCHAR(45) NOT NULL,
|
||||
`PUSH_TOKEN` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMEI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`IMSI` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`OS_VERSION` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`DEVICE_MODEL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`VENDOR` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LATITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`LONGITUDE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`CHALLENGE` VARCHAR(45) NULL DEFAULT NULL,
|
||||
`TOKEN` VARCHAR(50) NULL DEFAULT NULL,
|
||||
`UNLOCK_TOKEN` VARCHAR(2000) NULL DEFAULT NULL,
|
||||
`SERIAL` VARCHAR(45) NULL DEFAULT NULL,
|
||||
PRIMARY KEY (`MOBILE_DEVICE_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE` (
|
||||
`FEATURE_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`DEVICE_TYPE` VARCHAR(45) NOT NULL ,
|
||||
`CODE` VARCHAR(45) NULL,
|
||||
`NAME` VARCHAR(100) NULL,
|
||||
`DESCRIPTION` VARCHAR(200) NULL,
|
||||
PRIMARY KEY (`FEATURE_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION` (
|
||||
`OPERATION_ID` INT NOT NULL AUTO_INCREMENT,
|
||||
`FEATURE_CODE` VARCHAR(45) NULL,
|
||||
`CREATED_DATE` INT NULL,
|
||||
PRIMARY KEY (`OPERATION_ID`))
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_DEVICE_OPERATION_MAPING`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_DEVICE_OPERATION_MAPPING` (
|
||||
`DEVICE_ID` VARCHAR(45) NOT NULL,
|
||||
`OPERATION_ID` INT NOT NULL,
|
||||
`SENT_DATE` INT NULL,
|
||||
`RECEIVED_DATE` INT NULL,
|
||||
`STATUS` VARCHAR(10) NOT NULL,
|
||||
PRIMARY KEY (`DEVICE_ID`, `OPERATION_ID`),
|
||||
INDEX `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1_idx` (`OPERATION_ID` ASC),
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_DEVICE`
|
||||
FOREIGN KEY (`DEVICE_ID`)
|
||||
REFERENCES `MBL_DEVICE` (`MOBILE_DEVICE_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION,
|
||||
CONSTRAINT `fk_MBL_DEVICE_OPERATION_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID`)
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_OPERATION_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_OPERATION_PROPERTY` (
|
||||
`OPERATION_ID` INT NULL,
|
||||
`PROPERTY` VARCHAR(45) NOT NULL ,,
|
||||
`VALUE` TEXT NULL,
|
||||
PRIMARY KEY (`OPERATION_ID`, `PROPERTY`),
|
||||
CONSTRAINT `fk_MBL_OPERATION_PROPERTY_MBL_OPERATION1`
|
||||
FOREIGN KEY (`OPERATION_ID`)
|
||||
REFERENCES `MBL_OPERATION` (`OPERATION_ID`)
|
||||
ON DELETE NO ACTION
|
||||
ON UPDATE NO ACTION)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Table `MBL_FEATURE_PROPERTY`
|
||||
-- -----------------------------------------------------
|
||||
CREATE TABLE IF NOT EXISTS `MBL_FEATURE_PROPERTY` (
|
||||
`PROPERTY` 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)
|
||||
ENGINE = InnoDB;
|
||||
|
||||
-- -----------------------------------------------------
|
||||
-- Inserts
|
||||
-- -----------------------------------------------------
|
||||
INSERT INTO MBL_FEATURE (DEVICE_TYPE,NAME,CODE, DESCRIPTION) VALUES ('android','DEVICE_LOCK','503A','Device Lock'),('android','WIPE','504A','Device Wipe'),('android','CLEARPASSCODE','505A','Clear Passcode'),('android','APPLIST','502A','Get All Applications'),('android','LOCATION','501A','Location'),('android','INFO','500A','Device Information'),('android','NOTIFICATION','506A','Message'),('android','WIFI','507A','Setup Wifi'),('android','CAMERA','508A','Camera Control'),('android','MUTE','513A','Mute Device'),('android','INSTALLAPP','509A','Install Application'),('android','UNINSTALLAPP','510A','Uninstall Application'),('android','ENCRYPT','511A','Encrypt Storage'),('android','APN','512A','APN'),('android','WEBCLIP','518A','Create Webclips'),('android','PASSWORDPOLICY','519A','Passcode Policy'),('android','EMAIL','520A','Email Configuration'),('android','GOOGLECALENDAR','521A','Calender Subscription'),('android','VPN','523A','VPN'),('android','LDAP','524A','LDAP'),('android','CHANGEPASSWORD','526A','Set Passcode'),('android','ENTERPRISEWIPE','527A','Enterprise Wipe'),('android','POLICY','500P','Policy Enforcement'),('android','MONITORING','501P','Policy Monitoring '),('android','BLACKLISTAPPS','528B','Blacklist Apps'),('android','REVOKEPOLICY','502P','Revoke Policy');
|
||||
|
@ -1,2 +1,3 @@
|
||||
instructions.configure = \
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/conf/mobile-config.xml,target:${installFolder}/../../conf/mobile-config.xml,overwrite:true);\
|
||||
org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.mgt.mobile_${feature.version}/dbscripts/plugins/,target:${installFolder}/../../../dbscripts/cdm/plugins,overwrite:true);\
|
@ -0,0 +1,47 @@
|
||||
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
|
||||
index 719a38b..5a63eef 100644
|
||||
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
|
||||
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/AbstractMobileOperationManager.java
|
||||
@@ -28,15 +28,13 @@ import java.util.List;
|
||||
public abstract class AbstractMobileOperationManager implements OperationManager {
|
||||
|
||||
@Override
|
||||
- public List<Operation> getOperations(DeviceIdentifier deviceIdentifier)
|
||||
- throws OperationManagementException {
|
||||
+ public List<Operation> getOperations(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addOperation(Operation operation,
|
||||
- List<DeviceIdentifier> devices)
|
||||
- throws OperationManagementException {
|
||||
+ List<DeviceIdentifier> devices) throws OperationManagementException {
|
||||
return true;
|
||||
}
|
||||
|
||||
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
|
||||
index 17b347b..1aa3289 100644
|
||||
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
|
||||
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/dao/FeatureDAO.java
|
||||
@@ -19,7 +19,6 @@
|
||||
package org.wso2.carbon.device.mgt.mobile.impl.android.dao;
|
||||
|
||||
import org.wso2.carbon.device.mgt.common.Feature;
|
||||
-import org.wso2.carbon.device.mgt.common.FeatureManagementException;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
|
||||
index 38280e2..6607600 100644
|
||||
--- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
|
||||
+++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSMobileOperationManager.java
|
||||
@@ -20,8 +20,6 @@ package org.wso2.carbon.device.mgt.mobile.impl.ios;
|
||||
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.Feature;
|
||||
-import org.wso2.carbon.device.mgt.common.FeatureManagementException;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
|
||||
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
|
||||
import org.wso2.carbon.device.mgt.mobile.AbstractMobileOperationManager;
|
Loading…
Reference in new issue