Merge branch 'master' of github.com:dulichan/product-cdm

Conflicts:
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/config/datasource/MobileDataSourceConfig.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/MobileDeviceManagementDAOFactory.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileDeviceOperationDAOImpl.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/impl/MobileOperationDAOImpl.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/dao/util/MobileDeviceManagementDAOUtil.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidMobileOperationManager.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/internal/MobileDeviceManagementServiceComponent.java
	components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/util/MobileDeviceManagementUtil.java
	product/modules/mobileservices/agents/android/jax-rs/src/main/java/org/wso2/cdmserver/mobileservices/android/Enrollment.java
	product/modules/mobileservices/agents/android/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml
	product/modules/mobileservices/agents/windows/jax-rs/pom.xml
	product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/cxf-servlet.xml
	product/modules/mobileservices/agents/windows/jax-rs/src/main/webapp/WEB-INF/web.xml
	product/modules/p2-profile-gen/pom.xml
revert-70aa11f8
Dulitha Wijewantha 10 years ago
commit 49c490a183

11
.gitignore vendored

@ -10,3 +10,14 @@ target
# Mac crap
.DS_Store
*.class
# Mobile Tools for Java (J2ME)
.mtj.tmp/
# Package Files #
*.jar
*.war
*.ear

@ -1,5 +1,4 @@
Apache License
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
@ -179,7 +178,7 @@
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
boilerplate notice, with the fields enclosed by brackets "{}"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
@ -187,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Copyright {yyyy} {name of copyright owner}
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@ -200,3 +199,4 @@
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.

@ -2,6 +2,6 @@ product-cdm
===========
WSO2 CONNECTED DEVICE MANAGER
WSO2 Enterprise Mobility Manager (WSO2 EMM) is a comprehensive platform that helps solve mobile computing challenges enterprises face today when dealing with both corporate owned, personally enabled (COPE) devices and employee owned devices as part of a bring your own device (BYOD) program.
WSO2 Connected Device Manager (WSO2 CDM) is a comprehensive platform that helps solve mobile computing challenges enterprises face today when dealing with both corporate owned, personally enabled (COPE) devices and employee owned devices as part of a bring your own device (BYOD) program.
Whether it is device provisioning, device configuration management, policy enforcement, mobile application management, device data security, or compliance monitoring, WSO2 EMM offers a single enterprise-grade platform.

@ -1,112 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>device-mgt</artifactId>
<groupId>org.wso2.carbon</groupId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.impl</artifactId>
<version>2.0.0-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Mobile Device Management Impl</name>
<description>WSO2 Carbon - Mobile Device Management Impl</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>Device Management Mobile Impl Bundle</Bundle-Description>
<!--<Bundle-Activator>org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementBundleActivator</Bundle-Activator>-->
<Private-Package>org.wso2.carbon.device.mgt.mobile.internal</Private-Package>
<Import-Package>
org.osgi.framework,
org.osgi.service.component,
org.apache.commons.logging,
</Import-Package>
<Export-Package>
!org.wso2.carbon.device.mgt.mobile.internal,
org.wso2.carbon.device.mgt.mobile.*
</Export-Package>
<DynamicImport-Package>*</DynamicImport-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.utils</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
</dependency>
</dependencies>
</project>

@ -1,36 +0,0 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile;
import org.wso2.carbon.device.mgt.common.*;
import java.util.List;
public abstract class AbstractMobileOperationManager implements OperationManager {
@Override
public List<Operation> getOperations(DeviceIdentifier deviceIdentifier) throws OperationManagementException {
return null;
}
@Override
public boolean addOperation(Operation operation,
List<DeviceIdentifier> devices) throws OperationManagementException {
return true;
}
}

@ -1,22 +0,0 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile;
public interface DataSourceListener {
void notifyObserver();
}

@ -1,98 +0,0 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.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,38 +0,0 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.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;
}
}

@ -1,77 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.config;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.utils.CarbonUtils;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import java.io.File;
/**
* Class responsible for the mobile device manager configuration initialization.
*/
public class MobileDeviceConfigurationManager {
private static final String MOBILE_DEVICE_CONFIG_XML_NAME = "mobile-config.xml";
private static final String MOBILE_DEVICE_PLUGIN_DIRECTORY = "mobile";
private MobileDeviceManagementConfig currentMobileDeviceConfig;
private static MobileDeviceConfigurationManager mobileDeviceConfigManager;
private final String mobileDeviceMgtConfigXMLPath =
CarbonUtils.getEtcCarbonConfigDirPath() + File.separator + "device-mgt-plugin-configs" + File.separator +
MOBILE_DEVICE_PLUGIN_DIRECTORY + File.separator + MOBILE_DEVICE_CONFIG_XML_NAME;
public static MobileDeviceConfigurationManager getInstance() {
if (mobileDeviceConfigManager == null) {
synchronized (MobileDeviceConfigurationManager.class) {
if (mobileDeviceConfigManager == null) {
mobileDeviceConfigManager = new MobileDeviceConfigurationManager();
}
}
}
return mobileDeviceConfigManager;
}
public synchronized void initConfig() throws DeviceManagementException {
try {
File mobileDeviceMgtConfig = new File(mobileDeviceMgtConfigXMLPath);
Document doc = MobileDeviceManagementUtil.convertToDocument(mobileDeviceMgtConfig);
JAXBContext mobileDeviceMgmtContext =
JAXBContext.newInstance(MobileDeviceManagementConfig.class);
Unmarshaller unmarshaller = mobileDeviceMgmtContext.createUnmarshaller();
this.currentMobileDeviceConfig =
(MobileDeviceManagementConfig) unmarshaller.unmarshal(doc);
} catch (Exception e) {
throw new DeviceManagementException(
"Error occurred while initializing Mobile Device Management config", e);
}
}
public MobileDeviceManagementConfig getMobileDeviceManagementConfig() {
return currentMobileDeviceConfig;
}
public MobileDataSourceConfig getMobileDataSourceConfig() {
return currentMobileDeviceConfig.getMobileDeviceMgtRepository().getMobileDataSourceConfig();
}
}

@ -1,49 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.config;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Represents Mobile Device Mgt configuration.
*/
@XmlRootElement(name = "MobileDeviceMgtConfiguration")
public final class MobileDeviceManagementConfig {
private MobileDeviceManagementRepository mobileDeviceMgtRepository;
private APIPublisherConfig apiPublisherConfig;
@XmlElement(name = "ManagementRepository", nillable = false)
public MobileDeviceManagementRepository getMobileDeviceMgtRepository() {
return mobileDeviceMgtRepository;
}
public void setMobileDeviceMgtRepository(
MobileDeviceManagementRepository mobileDeviceMgtRepository) {
this.mobileDeviceMgtRepository = mobileDeviceMgtRepository;
}
@XmlElement(name = "APIPublisher")
public APIPublisherConfig getApiPublisherConfig() {
return apiPublisherConfig;
}
public void setApiPublisherConfig(APIPublisherConfig apiPublisherConfig) {
this.apiPublisherConfig = apiPublisherConfig;
}
}

@ -1,40 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.config;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Class for holding management repository data.
*/
@XmlRootElement(name = "ManagementRepository")
public class MobileDeviceManagementRepository {
private MobileDataSourceConfig mobileDataSourceConfig;
@XmlElement(name = "DataSourceConfiguration", nillable = false)
public MobileDataSourceConfig getMobileDataSourceConfig() {
return mobileDataSourceConfig;
}
public void setMobileDataSourceConfig(MobileDataSourceConfig mobileDataSourceConfig) {
this.mobileDataSourceConfig = mobileDataSourceConfig;
}
}

@ -1,77 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.config.datasource;
import javax.xml.bind.annotation.*;
import java.util.List;
/**
* Class for hold JndiLookupDefinition of mobile-config.xml at parsing with JAXB.
*/
@XmlRootElement(name = "JndiLookupDefinition")
public class JNDILookupDefinition {
private String jndiName;
private List<JNDIProperty> jndiProperties;
@XmlElement(name = "Name", nillable = false)
public String getJndiName() {
return jndiName;
}
public void setJndiName(String jndiName) {
this.jndiName = jndiName;
}
@XmlElementWrapper(name = "Environment", nillable = false)
@XmlElement(name = "Property", nillable = false)
public List<JNDIProperty> getJndiProperties() {
return jndiProperties;
}
public void setJndiProperties(List<JNDIProperty> jndiProperties) {
this.jndiProperties = jndiProperties;
}
@XmlRootElement(name = "Property")
public static class JNDIProperty {
private String name;
private String value;
@XmlAttribute(name = "Name")
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@XmlValue
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
}
}

@ -1,38 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.config.datasource;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Class for holding data source configuration in mobile-config.xml at parsing with JAXB.
*/
@XmlRootElement(name = "DataSourceConfiguration")
public class MobileDataSourceConfig {
private JNDILookupDefinition jndiLookupDefinition;
@XmlElement(name = "JndiLookupDefinition", nillable = true)
public JNDILookupDefinition getJndiLookupDefinition() {
return jndiLookupDefinition;
}
public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) {
this.jndiLookupDefinition = jndiLookupDefinition;
}
}

@ -1,90 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.Feature;
import java.util.List;
/**
* This class represents the key operations associated with persisting feature related
* information.
*/
public interface FeatureDAO {
/**
* Add a new feature to feature table.
*
* @param feature Feature object that holds data related to the feature to be inserted.
* @return The status of the operation. If the insert was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean addFeature(Feature feature) throws MobileDeviceManagementDAOException;
/**
* Update a feature in the feature table.
*
* @param feature Feature object that holds data has to be updated.
* @return The status of the operation. If the update was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean updateFeature(Feature feature) throws MobileDeviceManagementDAOException;
/**
* Delete a feature from feature table when the feature id is given.
*
* @param featureId Feature id of the feature to be deleted.
* @return The status of the operation. If the operationId was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteFeatureById(String featureId) throws MobileDeviceManagementDAOException;
/**
* Delete a feature from feature table when the feature code is given.
*
* @param featureCode Feature code of the feature to be deleted.
* @return The status of the operation. If the operationId was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteFeatureByCode(String featureCode) throws MobileDeviceManagementDAOException;
/**
* Retrieve a given feature from feature table when the feature id is given.
*
* @param featureId Feature id of the feature to be retrieved.
* @return Feature object that holds data of the feature represented by featureId.
* @throws MobileDeviceManagementDAOException
*/
Feature getFeatureById(String featureId) throws MobileDeviceManagementDAOException;
/**
* Retrieve a given feature from feature table when the feature code is given.
*
* @param featureCode Feature code of the feature to be retrieved.
* @return Feature object that holds data of the feature represented by featureCode.
* @throws MobileDeviceManagementDAOException
*/
Feature getFeatureByCode(String featureCode) throws MobileDeviceManagementDAOException;
/**
* Retrieve all the features from plugin specific database.
*
* @return Feature object list.
* @throws MobileDeviceManagementDAOException
*/
List<Feature> getAllFeatures() throws MobileDeviceManagementDAOException;
}

@ -1,76 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.FeatureProperty;
import java.util.List;
/**
* This class represents the key operations associated with persisting feature property related
* information.
*/
public interface FeaturePropertyDAO {
/**
* Add a new feature property to feature property table.
*
* @param featureProperty Feature property object that holds data related to the feature property to be inserted.
* @return The status of the operation. If the insert was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean addFeatureProperty(FeatureProperty featureProperty)
throws MobileDeviceManagementDAOException;
/**
* Update a feature property in the feature property table.
*
* @param featureProperty Feature property object that holds data has to be updated.
* @return The status of the operation. If the update was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean updateFeatureProperty(FeatureProperty featureProperty)
throws MobileDeviceManagementDAOException;
/**
* Delete a given feature property from feature property table.
*
* @param property Property of the feature property to be deleted.
* @return The status of the operation. If the operationId was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteFeatureProperty(String property) throws MobileDeviceManagementDAOException;
/**
* Retrieve a given feature property from feature property table.
*
* @param property Property of the feature property to be retrieved.
* @return Feature property object that holds data of the feature property represented by propertyId.
* @throws MobileDeviceManagementDAOException
*/
FeatureProperty getFeatureProperty(String property) throws MobileDeviceManagementDAOException;
/**
* Retrieve a list of feature property corresponds to a feature id .
*
* @param featureId feature id of the feature property to be retrieved.
* @return Feature property object that holds data of the feature property represented by propertyId.
* @throws MobileDeviceManagementDAOException
*/
List<FeatureProperty> getFeaturePropertyOfFeature(String featureId)
throws MobileDeviceManagementDAOException;
}

@ -1,38 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import java.util.List;
/**
* This class represents the key operations associated with persisting mobile-device related
* information.
*/
public interface MobileDeviceDAO {
MobileDevice getMobileDevice(String deviceId) throws MobileDeviceManagementDAOException;
boolean addMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException;
boolean updateMobileDevice(MobileDevice mobileDevice) throws MobileDeviceManagementDAOException;
boolean deleteMobileDevice(String deviceId) throws MobileDeviceManagementDAOException;
List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException;
}

@ -1,77 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
/**
* Custom exception class for mobile device specific data access related exceptions.
*/
public class MobileDeviceManagementDAOException extends Exception {
private String message;
private static final long serialVersionUID = 2021891706072918865L;
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message and
* nested exception.
*
* @param message error message
* @param nestedException exception
*/
public MobileDeviceManagementDAOException(String message, Exception nestedException) {
super(message, nestedException);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message
* and cause.
*
* @param message the detail message.
* @param cause the cause of this exception.
*/
public MobileDeviceManagementDAOException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified detail message.
*
* @param message the detail message.
*/
public MobileDeviceManagementDAOException(String message) {
super(message);
setErrorMessage(message);
}
/**
* Constructs a new MobileDeviceManagementDAOException with the specified and cause.
*
* @param cause the cause of this exception.
*/
public MobileDeviceManagementDAOException(Throwable cause) {
super(cause);
}
public String getMessage() {
return message;
}
public void setErrorMessage(String errorMessage) {
this.message = errorMessage;
}
}

@ -1,126 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
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.mobile.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.impl.*;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import javax.sql.DataSource;
import java.util.Hashtable;
import java.util.List;
/**
* Factory class used to create MobileDeviceManagement related DAO objects.
*/
public class MobileDeviceManagementDAOFactory {
private static DataSource dataSource;
private static MobileDataSourceConfig mobileDataSourceConfig;
private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOFactory.class);
public MobileDeviceManagementDAOFactory() {
}
public static void init() {
try {
dataSource = MobileDeviceManagementDAOFactory.resolveDataSource(mobileDataSourceConfig);
} catch (DeviceManagementException e) {
log.error("Exception occurred while initializing the mobile datasource.",e);
}
}
/**
* Resolve data source from the data source definition.
*
* @param config Mobile data source configuration
* @return data source resolved from the data source definition
*/
private static DataSource resolveDataSource(MobileDataSourceConfig config)
throws DeviceManagementException {
DataSource dataSource = null;
if (config == null) {
throw new RuntimeException("Device Management Repository data source configuration " +
"is null and thus, is not initialized");
}
JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition();
if (jndiConfig != null) {
if (log.isDebugEnabled()) {
log.debug("Initializing Device Management Repository data source using the JNDI " +
"Lookup Definition");
}
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList =
jndiConfig.getJndiProperties();
if (jndiPropertyList != null) {
Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>();
for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) {
jndiProperties.put(prop.getName(), prop.getValue());
}
dataSource =
MobileDeviceManagementDAOUtil
.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
} else {
dataSource = MobileDeviceManagementDAOUtil
.lookupDataSource(jndiConfig.getJndiName(), null);
}
}
return dataSource;
}
public static MobileDeviceDAO getMobileDeviceDAO() {
return new MobileDeviceDAOImpl(dataSource);
}
public static MobileOperationDAO getMobileOperationDAO() {
return new MobileOperationDAOImpl(dataSource);
}
public static MobileOperationPropertyDAO getMobileOperationPropertyDAO() {
return new MobileOperationPropertyDAOImpl(dataSource);
}
public static MobileDeviceOperationDAO getMobileDeviceOperationDAO() {
return new MobileDeviceOperationDAOImpl(dataSource);
}
public static FeatureDAO getFeatureDAO() {
return new FeatureDAOImpl(dataSource);
}
public static FeaturePropertyDAO getFeaturePropertyDAO() {
return new FeaturePropertyDAOImpl(dataSource);
}
public static MobileDataSourceConfig getMobileDeviceManagementConfig() {
return mobileDataSourceConfig;
}
public static void setMobileDataSourceConfig(
MobileDataSourceConfig mobileDataSourceConfig) {
MobileDeviceManagementDAOFactory.mobileDataSourceConfig =
mobileDataSourceConfig;
}
public static DataSource getDataSource() {
return dataSource;
}
}

@ -1,79 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperation;
import java.util.List;
/**
* This class represents the mapping between device and operations.
*/
public interface MobileDeviceOperationDAO {
/**
* Add a new mapping to plugin device_operation table.
*
* @param deviceOperation DeviceOperation object that holds data related to the DeviceOperation
* to be inserted.
* @return The status of the operation. If the insert was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean addMobileDeviceOperation(MobileDeviceOperation deviceOperation)
throws MobileDeviceManagementDAOException;
/**
* Update a feature in the feature table.
*
* @param deviceOperation DeviceOperation object that holds data has to be updated.
* @return The status of the operation. If the update was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean updateMobileDeviceOperation(MobileDeviceOperation deviceOperation)
throws MobileDeviceManagementDAOException;
/**
* Delete a given device operation from device operation table.
*
* @param deviceId Device id of the mapping to be deleted.
* @param operationId Operation id of the mapping to be deleted.
* @return The status of the operation. If the deletion was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteMobileDeviceOperation(String deviceId, int operationId)
throws MobileDeviceManagementDAOException;
/**
* Retrieve a given device operation from plugin database.
*
* @param deviceId Device id of the mapping to be retrieved.
* @param operationId Operation id of the mapping to be retrieved.
* @return DeviceOperation object that holds data of the device operation mapping represented by
* deviceId and operationId.
* @throws MobileDeviceManagementDAOException
*/
MobileDeviceOperation getMobileDeviceOperation(String deviceId, int operationId)
throws MobileDeviceManagementDAOException;
/**
* Retrieve all the device operation mapping from plugin database.
*
* @return Device operation mapping object list.
* @throws MobileDeviceManagementDAOException
*/
List<MobileDeviceOperation> getAllMobileDeviceOperationsOfDevice(String deviceId)
throws MobileDeviceManagementDAOException;
}

@ -1,59 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
/**
* This class represents the key operations associated with persisting operation related
* information.
*/
public interface MobileOperationDAO {
/**
* Add a new Mobile operation to plugin operation table.
* @param operation Operation object that holds data related to the operation to be inserted.
* @return The last inserted Id is returned, if the insertion was unsuccessful -1 is returned.
* @throws MobileDeviceManagementDAOException
*/
int addMobileOperation(MobileOperation operation) throws MobileDeviceManagementDAOException;
/**
* Update a Mobile operation in the operation table.
* @param operation Operation object that holds data has to be updated.
* @return The status of the operation. If the update was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean updateMobileOperation(MobileOperation operation) throws MobileDeviceManagementDAOException;
/**
* Delete a given Mobile operation from plugin database.
* @param operationId Operation code of the operation to be deleted.
* @return The status of the operation. If the operationId was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteMobileOperation(int operationId) throws MobileDeviceManagementDAOException;
/**
* Retrieve a given Mobile operation from plugin database.
* @param operationId Operation id of the operation to be retrieved.
* @return Operation object that holds data of the feature represented by operationId.
* @throws MobileDeviceManagementDAOException
*/
MobileOperation getMobileOperation(int operationId) throws MobileDeviceManagementDAOException;
}

@ -1,80 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperationProperty;
import java.util.List;
/**
* This class represents the key operations associated with persisting operation property related
* information.
*/
public interface MobileOperationPropertyDAO {
/**
* Add a new mapping to plugin operation property table.
*
* @param operationProperty OperationProperty object that holds data related to the operation
* property to be inserted.
* @return The status of the operation. If the insert was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean addMobileOperationProperty(MobileOperationProperty operationProperty)
throws MobileDeviceManagementDAOException;
/**
* Update a feature in the feature table.
*
* @param operationProperty DeviceOperation object that holds data has to be updated.
* @return The status of the operation. If the update was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean updateMobileOperationProperty(MobileOperationProperty operationProperty)
throws MobileDeviceManagementDAOException;
/**
* Deletes mobile operation properties of a given operation id from the plugin database.
*
* @param operationId Operation id of the mapping to be deleted.
* @return The status of the operation. If the deletion was successful or not.
* @throws MobileDeviceManagementDAOException
*/
boolean deleteMobileOperationProperties(int operationId)
throws MobileDeviceManagementDAOException;
/**
* Retrieve a given mobile operation property from plugin database.
*
* @param operationId Operation id of the mapping to be retrieved.
* @param property Property of the mapping to be retrieved.
* @return DeviceOperation object that holds data of the device operation mapping represented by
* deviceId and operationId.
* @throws MobileDeviceManagementDAOException
*/
MobileOperationProperty getMobileOperationProperty(int operationId, String property)
throws MobileDeviceManagementDAOException;
/**
* Retrieve all the mobile operation properties related to the a operation id.
*
* @param operationId Operation id of the mapping to be retrieved.
* @return Device operation mapping object list.
* @throws MobileDeviceManagementDAOException
*/
List<MobileOperationProperty> getAllMobileOperationPropertiesOfOperation(int operationId)
throws MobileDeviceManagementDAOException;
}

@ -1,261 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.FeatureDAO;
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.dto.Feature;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of FeatureDAO.
*/
public class FeatureDAOImpl implements FeatureDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(FeatureDAOImpl.class);
public FeatureDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public boolean addFeature(Feature feature) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_FEATURE(CODE, NAME, DESCRIPTION) VALUES (?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, feature.getCode());
stmt.setString(2, feature.getName());
stmt.setString(3, feature.getDescription());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while adding feature code - '" +
feature.getCode() + "' to feature table";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateFeature(Feature feature)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_FEATURE SET CODE = ?, NAME = ?, DESCRIPTION = ? WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, feature.getCode());
stmt.setString(2, feature.getName());
stmt.setString(3, feature.getDescription());
stmt.setInt(4, feature.getId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while updating the feature with feature code - '" +
feature.getId() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteFeatureByCode(String featureCode)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, featureCode);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting feature with code - " + featureCode;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteFeatureById(String featureId)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_FEATURE WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, featureId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting feature with id - " + featureId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public Feature getFeatureByCode(String featureCode)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
Feature feature = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE CODE = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, featureCode);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
feature = new Feature();
feature.setId(resultSet.getInt(1));
feature.setCode(resultSet.getString(2));
feature.setName(resultSet.getString(3));
feature.setDescription(resultSet.getString(4));
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching feature code - '" +
featureCode + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return feature;
}
@Override
public Feature getFeatureById(String featureID)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
Feature feature = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, featureID);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
feature = new Feature();
feature.setId(resultSet.getInt(1));
feature.setCode(resultSet.getString(2));
feature.setName(resultSet.getString(3));
feature.setDescription(resultSet.getString(4));
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching feature id - '" +
featureID + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return feature;
}
@Override
public List<Feature> getAllFeatures() throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
Feature feature;
List<Feature> features = new ArrayList<Feature>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT FEATURE_ID, CODE, NAME, DESCRIPTION FROM MBL_FEATURE";
stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
feature = new Feature();
feature.setId(resultSet.getInt(1));
feature.setCode(resultSet.getString(2));
feature.setName(resultSet.getString(3));
feature.setDescription(resultSet.getString(4));
features.add(feature);
}
return features;
} 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();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile specific " +
"datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,200 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.FeaturePropertyDAO;
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.dto.FeatureProperty;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of FeaturePropertyDAO.
*/
public class FeaturePropertyDAOImpl implements FeaturePropertyDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(FeaturePropertyDAOImpl.class);
public FeaturePropertyDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public boolean addFeatureProperty(FeatureProperty featureProperty)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_FEATURE_PROPERTY(PROPERTY, FEATURE_ID) VALUES (?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, featureProperty.getProperty());
stmt.setString(2, featureProperty.getFeatureID());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while adding property id - '" +
featureProperty.getFeatureID() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateFeatureProperty(FeatureProperty featureProperty)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_FEATURE_PROPERTY SET FEATURE_ID = ? WHERE PROPERTY = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, featureProperty.getFeatureID());
stmt.setString(2, featureProperty.getProperty());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while updating the feature property with property - '" +
featureProperty.getProperty() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteFeatureProperty(String property)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_FEATURE_PROPERTY WHERE PROPERTY = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, property);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting feature property with property - " +
property;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public FeatureProperty getFeatureProperty(String property)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
FeatureProperty featureProperty = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE PROPERTY = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, property);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
featureProperty = new FeatureProperty();
featureProperty.setProperty(resultSet.getString(1));
featureProperty.setFeatureID(resultSet.getString(2));
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching property - '" +
property + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return featureProperty;
}
@Override
public List<FeatureProperty> getFeaturePropertyOfFeature(String featureId)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
FeatureProperty featureProperty = null;
List<FeatureProperty> FeatureProperties = new ArrayList<FeatureProperty>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT PROPERTY, FEATURE_ID FROM MBL_FEATURE_PROPERTY WHERE FEATURE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, featureId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
featureProperty = new FeatureProperty();
featureProperty.setProperty(resultSet.getString(1));
featureProperty.setFeatureID(resultSet.getString(2));
FeatureProperties.add(featureProperty);
}
return FeatureProperties;
} catch (SQLException e) {
String msg = "Error occurred while fetching all feature property.'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,225 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
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.dto.MobileDevice;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of MobileDeviceDAO.
*/
public class MobileDeviceDAOImpl implements MobileDeviceDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(MobileDeviceDAOImpl.class);
public MobileDeviceDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public MobileDevice getMobileDevice(String deviceId) throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileDevice mobileDevice = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT * FROM MBL_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(resultSet.getString(1));
mobileDevice.setRegId(resultSet.getString(2));
mobileDevice.setImei(resultSet.getString(3));
mobileDevice.setImsi(resultSet.getString(4));
mobileDevice.setOsVersion(resultSet.getString(5));
mobileDevice.setModel(resultSet.getString(6));
mobileDevice.setVendor(resultSet.getString(7));
mobileDevice.setLatitude(resultSet.getString(8));
mobileDevice.setLongitude(resultSet.getString(9));
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching mobile device '" +
deviceId + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return mobileDevice;
}
@Override
public boolean addMobileDevice(MobileDevice mobileDevice)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_DEVICE(MOBILE_DEVICE_ID, REG_ID, IMEI, IMSI, OS_VERSION," +
"DEVICE_MODEL, VENDOR, LATITUDE, LONGITUDE) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, mobileDevice.getMobileDeviceId());
stmt.setString(2, mobileDevice.getRegId());
stmt.setString(3, mobileDevice.getImei());
stmt.setString(4, mobileDevice.getImsi());
stmt.setString(5, mobileDevice.getOsVersion());
stmt.setString(6, mobileDevice.getModel());
stmt.setString(7, mobileDevice.getVendor());
stmt.setString(8, mobileDevice.getLatitude());
stmt.setString(8, mobileDevice.getLongitude());
int rows = stmt.executeUpdate();
if(rows>0){
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while adding the mobile device '" +
mobileDevice.getMobileDeviceId() + "' to the mobile db.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateMobileDevice(MobileDevice mobileDevice)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_DEVICE SET REG_ID = ?, IMEI = ?, IMSI = ?, OS_VERSION = ?," +
"DEVICE_MODEL = ?, VENDOR = ? , LATITUDE = ?, LONGITUDE = ? WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, mobileDevice.getRegId());
stmt.setString(2, mobileDevice.getImei());
stmt.setString(3, mobileDevice.getImsi());
stmt.setString(4, mobileDevice.getOsVersion());
stmt.setString(5, mobileDevice.getModel());
stmt.setString(6, mobileDevice.getVendor());
stmt.setString(7, mobileDevice.getLatitude());
stmt.setString(8, mobileDevice.getLongitude());
stmt.setString(9, mobileDevice.getMobileDeviceId());
int rows = stmt.executeUpdate();
if(rows>0){
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while updating the mobile device '" +
mobileDevice.getMobileDeviceId() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteMobileDevice(String deviceId) throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_DEVICE WHERE MOBILE_DEVICE_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1,deviceId);
int rows = stmt.executeUpdate();
if(rows>0){
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting mobile device " + deviceId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public List<MobileDevice> getAllMobileDevices() throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileDevice mobileDevice;
List<MobileDevice> mobileDevices=new ArrayList<MobileDevice>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT * FROM MBL_DEVICE";
stmt = conn.prepareStatement(selectDBQuery);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(resultSet.getString(1));
mobileDevice.setRegId(resultSet.getString(2));
mobileDevice.setImei(resultSet.getString(3));
mobileDevice.setImsi(resultSet.getString(4));
mobileDevice.setOsVersion(resultSet.getString(5));
mobileDevice.setModel(resultSet.getString(6));
mobileDevice.setVendor(resultSet.getString(7));
mobileDevice.setLatitude(resultSet.getString(8));
mobileDevice.setLongitude(resultSet.getString(9));
mobileDevices.add(mobileDevice);
}
return mobileDevices;
} catch (SQLException e) {
String msg = "Error occurred while fetching all mobile device data'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,218 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.MobileDeviceOperationDAO;
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.dto.MobileDeviceOperation;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of MobileDeviceOperationDAO.
*/
public class MobileDeviceOperationDAOImpl implements MobileDeviceOperationDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(MobileDeviceOperationDAOImpl.class);
public MobileDeviceOperationDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public boolean addMobileDeviceOperation(MobileDeviceOperation deviceOperation)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_DEVICE_OPERATION_MAPPING (DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE) VALUES (?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, deviceOperation.getDeviceId());
stmt.setLong(2, deviceOperation.getOperationId());
stmt.setLong(3, deviceOperation.getSentDate());
stmt.setLong(4, deviceOperation.getReceivedDate());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while adding device id - '" +
deviceOperation.getDeviceId() + " and operation id - " +
deviceOperation.getOperationId() +
" to mapping table MBL_DEVICE_OPERATION";
;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateMobileDeviceOperation(MobileDeviceOperation deviceOperation)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_DEVICE_OPERATION_MAPPING SET SENT_DATE = ?, RECEIVED_DATE = ? WHERE DEVICE_ID = ? AND OPERATION_ID=?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setLong(1, deviceOperation.getSentDate());
stmt.setLong(2, deviceOperation.getReceivedDate());
stmt.setString(3, deviceOperation.getDeviceId());
stmt.setInt(4, deviceOperation.getOperationId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while updating device id - '" +
deviceOperation.getDeviceId() + " and operation id - " +
deviceOperation.getOperationId() + " in table MBL_DEVICE_OPERATION";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteMobileDeviceOperation(String deviceId, int operationId)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setString(1, deviceId);
stmt.setInt(2, operationId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg =
"Error occurred while deleting the table entry MBL_DEVICE_OPERATION with device id - '" +
deviceId + " and operation id - " + operationId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public MobileDeviceOperation getMobileDeviceOperation(String deviceId, int operationId)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileDeviceOperation deviceOperation = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ? AND OPERATION_ID=?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceId);
stmt.setInt(2, operationId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
deviceOperation = new MobileDeviceOperation();
deviceOperation.setDeviceId(resultSet.getString(1));
deviceOperation.setOperationId(resultSet.getInt(2));
deviceOperation.setSentDate(resultSet.getInt(3));
deviceOperation.setReceivedDate(resultSet.getInt(4));
break;
}
} catch (SQLException e) {
String msg =
"Error occurred while fetching table MBL_DEVICE_OPERATION entry with device id - '" +
deviceId + " and operation id - " + operationId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return deviceOperation;
}
@Override
public List<MobileDeviceOperation> getAllMobileDeviceOperationsOfDevice(String deviceId)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileDeviceOperation deviceOperation = null;
List<MobileDeviceOperation> deviceOperations = new ArrayList<MobileDeviceOperation>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT DEVICE_ID, OPERATION_ID, SENT_DATE, RECEIVED_DATE FROM MBL_DEVICE_OPERATION_MAPPING WHERE DEVICE_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setString(1, deviceId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
deviceOperation = new MobileDeviceOperation();
deviceOperation.setDeviceId(resultSet.getString(1));
deviceOperation.setOperationId(resultSet.getInt(2));
deviceOperation.setSentDate(resultSet.getInt(3));
deviceOperation.setReceivedDate(resultSet.getInt(4));
deviceOperations.add(deviceOperation);
}
} catch (SQLException e) {
String msg =
"Error occurred while fetching mapping table MBL_DEVICE_OPERATION entries of device id - '" +
deviceId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return deviceOperations;
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,171 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileOperationDAO;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
/**
* Implementation of MobileOperationDAO.
*/
public class MobileOperationDAOImpl implements MobileOperationDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(MobileOperationDAOImpl.class);
public MobileOperationDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public int addMobileOperation(MobileOperation operation)
throws MobileDeviceManagementDAOException {
int status = -1;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_OPERATION(FEATURE_CODE, CREATED_DATE) VALUES ( ?, ?)";
stmt = conn.prepareStatement(createDBQuery, new String[] { "OPERATION_ID" });
stmt.setString(1, operation.getFeatureCode());
stmt.setLong(2, operation.getCreatedDate());
int rows = stmt.executeUpdate();
if (rows > 0) {
ResultSet rs = stmt.getGeneratedKeys();
if (rs != null && rs.next()) {
status = rs.getInt(1);
}
}
} catch (SQLException e) {
String msg = "Error occurred while adding the operation - '" +
operation.getFeatureCode() + "' to MBL_OPERATION table";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateMobileOperation(MobileOperation operation)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String updateDBQuery =
"UPDATE MBL_OPERATION SET FEATURE_CODE = ?, CREATED_DATE = ? WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(updateDBQuery);
stmt.setString(1, operation.getFeatureCode());
stmt.setLong(2, operation.getCreatedDate());
stmt.setInt(3, operation.getOperationId());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while updating the MBL_OPERATION table entry with operation id - '" +
operation.getOperationId() + "'";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteMobileOperation(int operationId)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_OPERATION WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, operationId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg = "Error occurred while deleting MBL_OPERATION entry with operation Id - ";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public MobileOperation getMobileOperation(int operationId)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileOperation operation = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT OPERATION_ID, FEATURE_CODE, CREATED_DATE FROM MBL_OPERATION WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, operationId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
operation = new MobileOperation();
operation.setOperationId(resultSet.getInt(1));
operation.setFeatureCode(resultSet.getString(2));
operation.setCreatedDate(resultSet.getLong(3));
break;
}
} catch (SQLException e) {
String msg = "Error occurred while fetching operationId - '" +
operationId + "' from MBL_OPERATION";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return operation;
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,212 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.MobileOperationPropertyDAO;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperationProperty;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;
/**
* Implementation of MobileOperationPropertyDAO.
*/
public class MobileOperationPropertyDAOImpl implements MobileOperationPropertyDAO {
private DataSource dataSource;
private static final Log log = LogFactory.getLog(MobileOperationPropertyDAOImpl.class);
public MobileOperationPropertyDAOImpl(DataSource dataSource) {
this.dataSource = dataSource;
}
@Override
public boolean addMobileOperationProperty(MobileOperationProperty operationProperty)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO MBL_OPERATION_PROPERTY(OPERATION_ID, PROPERTY, VALUE) VALUES ( ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setInt(1, operationProperty.getOperationId());
stmt.setString(2, operationProperty.getProperty());
stmt.setString(3, operationProperty.getValue());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg =
"Error occurred while adding mobile operation property to MBL_OPERATION_PROPERTY table";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean updateMobileOperationProperty(
MobileOperationProperty operationProperty)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"UPDATE MBL_OPERATION_PROPERTY SET VALUE = ? WHERE OPERATION_ID = ? AND PROPERTY = ?";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, operationProperty.getValue());
stmt.setInt(2, operationProperty.getOperationId());
stmt.setString(3, operationProperty.getProperty());
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg =
"Error occurred while updating the mobile operation property in MBL_OPERATION_PROPERTY table.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public boolean deleteMobileOperationProperties(int operationId)
throws MobileDeviceManagementDAOException {
boolean status = false;
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String deleteDBQuery =
"DELETE FROM MBL_OPERATION_PROPERTY WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(deleteDBQuery);
stmt.setInt(1, operationId);
int rows = stmt.executeUpdate();
if (rows > 0) {
status = true;
}
} catch (SQLException e) {
String msg =
"Error occurred while deleting MBL_OPERATION_PROPERTY entry with operation Id - ";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return status;
}
@Override
public MobileOperationProperty getMobileOperationProperty(int operationId,
String property)
throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileOperationProperty mobileOperationProperty = null;
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE OPERATION_ID = ? AND PROPERTY = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, operationId);
stmt.setString(2, property);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileOperationProperty = new MobileOperationProperty();
mobileOperationProperty.setOperationId(resultSet.getInt(1));
mobileOperationProperty.setProperty(resultSet.getString(2));
mobileOperationProperty.setValue(resultSet.getString(3));
break;
}
} catch (SQLException e) {
String msg =
"Error occurred while fetching the mobile operation property of Operation_id : " +
operationId + " and Property : " + property;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return mobileOperationProperty;
}
@Override
public List<MobileOperationProperty> getAllMobileOperationPropertiesOfOperation(
int operationId) throws MobileDeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
MobileOperationProperty mobileOperationProperty = null;
List<MobileOperationProperty> properties = new ArrayList<MobileOperationProperty>();
try {
conn = this.getConnection();
String selectDBQuery =
"SELECT OPERATION_ID, PROPERTY, VALUE FROM MBL_OPERATION_PROPERTY WHERE OPERATION_ID = ?";
stmt = conn.prepareStatement(selectDBQuery);
stmt.setInt(1, operationId);
ResultSet resultSet = stmt.executeQuery();
while (resultSet.next()) {
mobileOperationProperty = new MobileOperationProperty();
mobileOperationProperty.setOperationId(resultSet.getInt(1));
mobileOperationProperty.setProperty(resultSet.getString(2));
mobileOperationProperty.setValue(resultSet.getString(3));
properties.add(mobileOperationProperty);
}
} catch (SQLException e) {
String msg =
"Error occurred while fetching the mobile operation properties of Operation_id " +
operationId;
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
} finally {
MobileDeviceManagementDAOUtil.cleanupResources(conn, stmt, null);
}
return properties;
}
private Connection getConnection() throws MobileDeviceManagementDAOException {
try {
return dataSource.getConnection();
} catch (SQLException e) {
String msg = "Error occurred while obtaining a connection from the mobile device " +
"management metadata repository datasource.";
log.error(msg, e);
throw new MobileDeviceManagementDAOException(msg, e);
}
}
}

@ -1,100 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dao.util;
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.mobile.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementSchemaInitializer;
import javax.naming.InitialContext;
import javax.sql.DataSource;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.Hashtable;
import java.util.List;
/**
* Utility method required by MobileDeviceManagement DAO classes.
*/
public class MobileDeviceManagementDAOUtil {
private static final Log log = LogFactory.getLog(MobileDeviceManagementDAOUtil.class);
public static DataSource lookupDataSource(String dataSourceName,
final Hashtable<Object, Object> jndiProperties)
throws DeviceManagementException {
try {
if (jndiProperties == null || jndiProperties.isEmpty()) {
return (DataSource) InitialContext.doLookup(dataSourceName);
}
final InitialContext context = new InitialContext(jndiProperties);
return (DataSource) context.lookup(dataSourceName);
} catch (Exception e) {
String msg = "Error in looking up data source: " + e.getMessage();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
}
public static void cleanupResources(Connection conn, PreparedStatement stmt, ResultSet rs) {
if (rs != null) {
try {
rs.close();
} catch (SQLException e) {
log.warn("Error occurred while closing result set", e);
}
}
if (stmt != null) {
try {
stmt.close();
} catch (SQLException e) {
log.warn("Error occurred while closing prepared statement", e);
}
}
if (conn != null) {
try {
conn.close();
} catch (SQLException e) {
log.warn("Error occurred while closing database connection", e);
}
}
}
/**
* Creates the mobile device management schema.
*
* @param dataSource Mobile data source
*/
public static void setupMobileDeviceManagementSchema(DataSource dataSource) throws
DeviceManagementException {
MobileDeviceManagementSchemaInitializer initializer =
new MobileDeviceManagementSchemaInitializer(dataSource);
log.info("Initializing mobile device management repository database schema");
try {
initializer.createRegistryDatabase();
} catch (Exception e) {
throw new DeviceManagementException("Error occurred while initializing Mobile Device Management " +
"database schema", e);
}
}
}

@ -1,63 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
import java.io.Serializable;
/**
* DTO of features.
*/
public class Feature implements Serializable {
private int id;
private String code;
private String name;
private String description;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getDescription() {
return description;
}
public void setDescription(String description) {
this.description = description;
}
}

@ -1,43 +0,0 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of feature property. Represents a property of a feature.
*/
public class FeatureProperty {
private String property;
private String featureID;
public String getFeatureID() {
return featureID;
}
public void setFeatureID(String featureID) {
this.featureID = featureID;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
}

@ -1,107 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
import java.io.Serializable;
/**
* DTO of MobileDevice.
*/
public class MobileDevice implements Serializable {
private String mobileDeviceId;
private String regId;
private String imei;
private String imsi;
private String osVersion;
private String model;
private String vendor;
private String latitude;
private String longitude;
public String getMobileDeviceId() {
return mobileDeviceId;
}
public void setMobileDeviceId(String mobileDeviceId) {
this.mobileDeviceId = mobileDeviceId;
}
public String getRegId() {
return regId;
}
public void setRegId(String regId) {
this.regId = regId;
}
public String getImei() {
return imei;
}
public void setImei(String imei) {
this.imei = imei;
}
public String getImsi() {
return imsi;
}
public void setImsi(String imsi) {
this.imsi = imsi;
}
public String getOsVersion() {
return osVersion;
}
public void setOsVersion(String osVersion) {
this.osVersion = osVersion;
}
public String getModel() {
return model;
}
public void setModel(String model) {
this.model = model;
}
public String getVendor() {
return vendor;
}
public void setVendor(String vendor) {
this.vendor = vendor;
}
public String getLatitude() {
return latitude;
}
public void setLatitude(String latitude) {
this.latitude = latitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
}

@ -1,61 +0,0 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of Mobile Device Operations.
*/
public class MobileDeviceOperation {
private String deviceId;
private int operationId;
private long sentDate;
private long receivedDate;
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public int getOperationId() {
return operationId;
}
public void setOperationId(int operationId) {
this.operationId = operationId;
}
public long getSentDate() {
return sentDate;
}
public void setSentDate(long sentDate) {
this.sentDate = sentDate;
}
public long getReceivedDate() {
return receivedDate;
}
public void setReceivedDate(long receivedDate) {
this.receivedDate = receivedDate;
}
}

@ -1,62 +0,0 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
import java.util.List;
/**
* DTO of MobileOperation.
*/
public class MobileOperation {
private int operationId;
private String featureCode;
private long createdDate;
private List<MobileOperationProperty> properties;
public int getOperationId() {
return operationId;
}
public void setOperationId(int operationId) {
this.operationId = operationId;
}
public List<MobileOperationProperty> getProperties() {
return properties;
}
public void setProperties(List<MobileOperationProperty> properties) {
this.properties = properties;
}
public String getFeatureCode() {
return featureCode;
}
public void setFeatureCode(String featureCode) {
this.featureCode = featureCode;
}
public long getCreatedDate() {
return createdDate;
}
public void setCreatedDate(long createdDate) {
this.createdDate = createdDate;
}
}

@ -1,52 +0,0 @@
/*
* Copyright (c) 2014 - 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.dto;
/**
* DTO of Mobile Operation property.
*/
public class MobileOperationProperty {
private int operationId;
private String property;
private String value;
public String getValue() {
return value;
}
public void setValue(String value) {
this.value = value;
}
public int getOperationId() {
return operationId;
}
public void setOperationId(int operationId) {
this.operationId = operationId;
}
public String getProperty() {
return property;
}
public void setProperty(String property) {
this.property = property;
}
}

@ -1,186 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
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.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import java.util.ArrayList;
import java.util.List;
/**
* This represents the Android implementation of DeviceManagerService.
*/
public class AndroidDeviceManagerService implements DeviceManagerService {
private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class);
private OperationManager operationManager;
public AndroidDeviceManagerService() {
this.operationManager = new AndroidMobileOperationManager();
}
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_ANDROID;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().addMobileDevice(
mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while enrolling the Android device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the enrollment of the Android device : " +
device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
boolean status;
try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.deleteMobileDevice(deviceId.getId());
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while removing the Android device : " + deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
boolean isEnrolled = false;
try {
MobileDevice mobileDevice =
MobileDeviceManagementDAOFactory.getMobileDeviceDAO().getMobileDevice(
deviceId.getId());
if (mobileDevice != null) {
isEnrolled = true;
}
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while checking the enrollment status of Android device : " +
deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return isEnrolled;
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return true;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
Device device;
try {
MobileDevice mobileDevice = MobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getMobileDevice(deviceId.getId());
device = MobileDeviceManagementUtil.convertToDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while fetching the Android device : " + deviceId.getId();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return device;
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return true;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
boolean status;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
try {
status = MobileDeviceManagementDAOFactory.getMobileDeviceDAO()
.updateMobileDevice(mobileDevice);
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while updating the Android device : " + device.getDeviceIdentifier();
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return status;
}
@Override
public List<Device> getAllDevices() throws DeviceManagementException {
List<Device> devices = null;
try {
List<MobileDevice> mobileDevices =
MobileDeviceManagementDAOFactory.getMobileDeviceDAO().
getAllMobileDevices();
if (mobileDevices != null) {
devices = new ArrayList<Device>();
for (MobileDevice mobileDevice : mobileDevices) {
devices.add(MobileDeviceManagementUtil.convertToDevice(mobileDevice));
}
}
} catch (MobileDeviceManagementDAOException e) {
String msg = "Error while fetching all Android devices.";
log.error(msg, e);
throw new DeviceManagementException(msg, e);
}
return devices;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return operationManager;
}
}

@ -1,110 +0,0 @@
/**
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
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.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.MobileDeviceOperation;
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.util.MobileDeviceManagementUtil;
import java.util.ArrayList;
import java.util.List;
public class AndroidMobileOperationManager extends AbstractMobileOperationManager {
private static final Log log = LogFactory.getLog(AndroidMobileOperationManager.class);
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
boolean status = false;
try {
MobileDeviceOperation mobileDeviceOperation = null;
MobileOperation mobileOperation =
MobileDeviceManagementUtil.convertToMobileOperation(operation);
int operationId = MobileDeviceManagementDAOFactory.getMobileOperationDAO()
.addMobileOperation(mobileOperation);
if (operationId > 0) {
for (MobileOperationProperty operationProperty : mobileOperation.getProperties()) {
operationProperty.setOperationId(operationId);
status = MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO()
.addMobileOperationProperty(
operationProperty);
}
for (DeviceIdentifier deviceIdentifier : devices) {
mobileDeviceOperation = new MobileDeviceOperation();
mobileDeviceOperation.setOperationId(operationId);
mobileDeviceOperation.setDeviceId(deviceIdentifier.getId());
status = MobileDeviceManagementDAOFactory.getMobileDeviceOperationDAO()
.addMobileDeviceOperation(
mobileDeviceOperation);
}
}
} catch (MobileDeviceManagementDAOException e) {
String msg =
"Error while adding an operation " + operation.getCode() + "to Android devices";
log.error(msg, e);
throw new OperationManagementException(msg, e);
}
return status;
}
@Override
public List<Operation> getOperations(DeviceIdentifier deviceIdentifier)
throws OperationManagementException {
List<Operation> operations = new ArrayList<Operation>();
List<MobileDeviceOperation> mobileDeviceOperations = null;
List<MobileOperationProperty> operationProperties = null;
MobileOperation mobileOperation = null;
try {
mobileDeviceOperations = MobileDeviceManagementDAOFactory.getMobileDeviceOperationDAO()
.getAllMobileDeviceOperationsOfDevice(
deviceIdentifier
.getId());
if (mobileDeviceOperations.size() > 0) {
List<Integer> operationIds = MobileDeviceManagementUtil
.getMobileOperationIdsFromMobileDeviceOperations(mobileDeviceOperations);
for (Integer operationId : operationIds) {
mobileOperation = MobileDeviceManagementDAOFactory.getMobileOperationDAO()
.getMobileOperation(
operationId);
operationProperties =
MobileDeviceManagementDAOFactory.getMobileOperationPropertyDAO()
.getAllMobileOperationPropertiesOfOperation(
operationId);
mobileOperation.setProperties(operationProperties);
operations.add(MobileDeviceManagementUtil
.convertMobileOperationToOperation(mobileOperation));
}
}
} catch (MobileDeviceManagementDAOException e) {
String msg =
"Error while fetching the operations for the android device " +
deviceIdentifier.getId();
log.error(msg, e);
throw new OperationManagementException(msg, e);
}
return operations;
}
}

@ -1,91 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.impl.ios;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import java.util.List;
/**
* This represents the iOS implementation of DeviceManagerService.
*/
public class IOSDeviceManagerService implements DeviceManagerService {
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_IOS;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return true;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return true;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return true;
}
@Override
public List<Device> getAllDevices() throws DeviceManagementException {
return null;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return null;
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return true;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true;
}
}

@ -1,90 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import java.util.List;
/**
* This represents the Windows implementation of DeviceManagerService.
*/
public class WindowsDeviceManagerService implements DeviceManagerService {
@Override
public String getProviderType() {
return DeviceManagementConstants.MobileDeviceTypes.MOBILE_DEVICE_TYPE_WINDOWS;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return true;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return true;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return true;
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return true;
}
public List<Device> getAllDevices() throws DeviceManagementException {
return null;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return null;
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException {
return true;
}
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true;
}
}

@ -1,166 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.*;
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.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.DataSourceListener;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService;
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;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService;
import java.util.ArrayList;
import java.util.List;
public class MobileDeviceManagementBundleActivator implements BundleActivator, BundleListener {
private ServiceRegistration androidServiceRegRef;
private ServiceRegistration iOSServiceRegRef;
private ServiceRegistration windowsServiceRegRef;
private static List<DataSourceListener> dataSourceListeners = new ArrayList<DataSourceListener>();
private static final String SYMBOLIC_NAME_DATA_SOURCE_COMPONENT = "org.wso2.carbon.ndatasource.core";
private static final Log log = LogFactory.getLog(MobileDeviceManagementBundleActivator.class);
@Override
public void start(BundleContext bundleContext) throws Exception {
try {
if (log.isDebugEnabled()) {
log.debug("Activating Mobile Device Management Service bundle");
}
bundleContext.addBundleListener(this);
/* Initialize the datasource configuration */
MobileDeviceConfigurationManager.getInstance().initConfig();
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
.getMobileDeviceManagementConfig();
MobileDataSourceConfig dsConfig =
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig();
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig);
androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
new AndroidDeviceManagerService(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
new IOSDeviceManagerService(), null);
windowsServiceRegRef =
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();
if (log.isDebugEnabled()) {
log.debug("Mobile Device Management Service bundle is activated");
}
} catch (Throwable e) {
log.error("Error occurred while activating Mobile Device Management bundle", e);
}
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
if (log.isDebugEnabled()) {
log.debug("Deactivating Mobile Device Management Service");
}
try {
androidServiceRegRef.unregister();
iOSServiceRegRef.unregister();
windowsServiceRegRef.unregister();
bundleContext.removeBundleListener(this);
/* Removing all APIs published upon start-up for mobile device management related JAX-RS
services */
this.removeAPIs();
} catch (Throwable e) {
log.error("Error occurred while de-activating Mobile Device Management bundle", e);
}
}
@Override
public void bundleChanged(BundleEvent bundleEvent) {
int eventType = bundleEvent.getType();
String bundleSymbolicName = bundleEvent.getBundle().getSymbolicName();
if (SYMBOLIC_NAME_DATA_SOURCE_COMPONENT.equals(bundleSymbolicName) &&
eventType == BundleEvent.STARTED) {
for (DataSourceListener listener : this.getDataSourceListeners()) {
listener.notifyObserver();
}
}
}
public static void registerDataSourceListener(DataSourceListener listener) {
dataSourceListeners.add(listener);
}
private List<DataSourceListener> getDataSourceListeners() {
return dataSourceListeners;
}
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().
getApiPublisherConfig().getAPIs();
for (APIConfig apiConfig : apiConfigs) {
DeviceManagementAPIPublisherUtil.removeAPI(apiConfig);
}
}
}

@ -1,188 +0,0 @@
/**
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.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.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
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;
import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import java.util.List;
/**
* @scr.component name="org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementServiceComponent"
* immediate="true"
* @scr.reference name="api.manager.config.service"
* interface="org.wso2.carbon.apimgt.impl.APIManagerConfigurationService"
* cardinality="1..1"
* policy="dynamic"
* bind="setAPIManagerConfigurationService"
* unbind="unsetAPIManagerConfigurationService"
* <p/>
* Adding reference to API Manager Configuration service is an unavoidable hack to get rid of NPEs thrown while
* initializing APIMgtDAOs attempting to register APIs programmatically. APIMgtDAO needs to be proper cleaned up
* to avoid as an ideal fix
*/
public class MobileDeviceManagementServiceComponent {
private ServiceRegistration androidServiceRegRef;
private ServiceRegistration iOSServiceRegRef;
private ServiceRegistration windowsServiceRegRef;
private static final Log log = LogFactory.getLog(MobileDeviceManagementServiceComponent.class);
protected void activate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("Activating Mobile Device Management Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
/* Initialize the datasource configuration */
MobileDeviceConfigurationManager.getInstance().initConfig();
MobileDeviceManagementConfig config = MobileDeviceConfigurationManager.getInstance()
.getMobileDeviceManagementConfig();
MobileDataSourceConfig dsConfig =
config.getMobileDeviceMgtRepository().getMobileDataSourceConfig();
MobileDeviceManagementDAOFactory.setMobileDataSourceConfig(dsConfig);
MobileDeviceManagementDAOFactory.init();
String setupOption = System.getProperty("setup");
if (setupOption != null) {
if (log.isDebugEnabled()) {
log.debug(
"-Dsetup is enabled. Mobile Device management repository schema initialization is about " +
"to begin");
}
try {
MobileDeviceManagementDAOUtil.setupMobileDeviceManagementSchema(
MobileDeviceManagementDAOFactory.getDataSource());
} catch (DeviceManagementException e) {
log.error(
"Exception occurred while initializing mobile device management database schema",
e);
}
}
androidServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
new AndroidDeviceManagerService(), null);
iOSServiceRegRef =
bundleContext.registerService(DeviceManagerService.class.getName(),
new IOSDeviceManagerService(), null);
windowsServiceRegRef =
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();
if (log.isDebugEnabled()) {
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);
}
}
protected void deactivate(ComponentContext ctx) {
if (log.isDebugEnabled()) {
log.debug("De-activating Mobile Device Management Service Component");
}
try {
BundleContext bundleContext = ctx.getBundleContext();
androidServiceRegRef.unregister();
iOSServiceRegRef.unregister();
windowsServiceRegRef.unregister();
/* Removing all APIs published upon start-up for mobile device management related JAX-RS
services */
this.removeAPIs();
if (log.isDebugEnabled()) {
log.debug(
"Mobile Device Management Service Component has been successfully de-activated");
}
} catch (Throwable e) {
log.error("Error occurred while de-activating Mobile Device Management bundle", e);
}
}
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().
getApiPublisherConfig().getAPIs();
for (APIConfig apiConfig : apiConfigs) {
DeviceManagementAPIPublisherUtil.removeAPI(apiConfig);
}
}
protected void setAPIManagerConfigurationService(APIManagerConfigurationService service) {
//do nothing
}
protected void unsetAPIManagerConfigurationService(APIManagerConfigurationService service) {
//do nothing
}
}

@ -1,109 +0,0 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.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;
}
}

@ -1,46 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.utils.CarbonUtils;
import org.wso2.carbon.utils.dbcreator.DatabaseCreator;
import javax.sql.DataSource;
import java.io.File;
public final class MobileDeviceManagementSchemaInitializer extends DatabaseCreator {
private static final Log log = LogFactory.getLog(MobileDeviceManagementSchemaInitializer.class);
private static final String setupSQLScriptBaseLocation =
CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator + "cdm" +
File.separator + "plugins" + File.separator ;
public MobileDeviceManagementSchemaInitializer(DataSource dataSource) {
super(dataSource);
}
protected String getDbScriptLocation(String databaseType) {
String scriptName = databaseType + ".sql";
if (log.isDebugEnabled()) {
log.debug("Loading database script from :" + scriptName);
}
return setupSQLScriptBaseLocation.replaceFirst("DBTYPE", databaseType) + scriptName;
}
}

@ -1,137 +0,0 @@
/*
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.Operation;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.dto.MobileDeviceOperation;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperation;
import org.wso2.carbon.device.mgt.mobile.dto.MobileOperationProperty;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File;
import java.util.*;
/**
* Provides utility methods required by the mobile device management bundle.
*/
public class MobileDeviceManagementUtil {
private static final Log log = LogFactory.getLog(MobileDeviceManagementUtil.class);
private static final String MOBILE_DEVICE_IMEI = "imei";
private static final String MOBILE_DEVICE_IMSI = "imsi";
private static final String MOBILE_DEVICE_REG_ID = "regId";
private static final String MOBILE_DEVICE_VENDOR = "vendor";
private static final String MOBILE_DEVICE_OS_VERSION = "osVersion";
private static final String MOBILE_DEVICE_MODEL = "model";
private static final String MOBILE_DEVICE_LATITUDE = "latitude";
private static final String MOBILE_DEVICE_LONGITUDE = "longitude";
public static Document convertToDocument(File file) throws DeviceManagementException {
DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
factory.setNamespaceAware(true);
try {
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {
throw new DeviceManagementException(
"Error occurred while parsing file, while converting " +
"to a org.w3c.dom.Document : " + e.getMessage(), e);
}
}
public static MobileDevice convertToMobileDevice(Device device) {
MobileDevice mobileDevice = null;
if (device != null) {
mobileDevice = new MobileDevice();
mobileDevice.setMobileDeviceId(device.getDeviceIdentifier());
mobileDevice.setImei(device.getProperties().get(MOBILE_DEVICE_IMEI));
mobileDevice.setImsi(device.getProperties().get(MOBILE_DEVICE_IMSI));
mobileDevice.setRegId(device.getProperties().get(MOBILE_DEVICE_REG_ID));
mobileDevice.setModel(device.getProperties().get(MOBILE_DEVICE_MODEL));
mobileDevice.setOsVersion(device.getProperties().get(MOBILE_DEVICE_OS_VERSION));
mobileDevice.setVendor(device.getProperties().get(MOBILE_DEVICE_VENDOR));
mobileDevice.setLatitude(device.getProperties().get(MOBILE_DEVICE_LATITUDE));
mobileDevice.setLongitude(device.getProperties().get(MOBILE_DEVICE_LONGITUDE));
}
return mobileDevice;
}
public static Device convertToDevice(MobileDevice mobileDevice) {
Device device = null;
if (mobileDevice != null) {
device = new Device();
Map<String, String> propertyMap = new HashMap<String, String>();
propertyMap.put(MOBILE_DEVICE_IMEI, mobileDevice.getImei());
propertyMap.put(MOBILE_DEVICE_IMSI, mobileDevice.getImsi());
propertyMap.put(MOBILE_DEVICE_REG_ID, mobileDevice.getRegId());
propertyMap.put(MOBILE_DEVICE_MODEL, mobileDevice.getModel());
propertyMap.put(MOBILE_DEVICE_OS_VERSION, mobileDevice.getOsVersion());
propertyMap.put(MOBILE_DEVICE_VENDOR, mobileDevice.getVendor());
propertyMap.put(MOBILE_DEVICE_LATITUDE, mobileDevice.getLatitude());
propertyMap.put(MOBILE_DEVICE_LONGITUDE, mobileDevice.getLongitude());
device.setProperties(propertyMap);
device.setDeviceIdentifier(mobileDevice.getMobileDeviceId());
}
return device;
}
public static MobileOperation convertToMobileOperation(
org.wso2.carbon.device.mgt.common.Operation operation) {
MobileOperation mobileOperation = new MobileOperation();
MobileOperationProperty operationProperty = null;
List<MobileOperationProperty> properties = new LinkedList<MobileOperationProperty>();
mobileOperation.setFeatureCode(operation.getCode());
mobileOperation.setCreatedDate(new Date().getTime());
Properties operationProperties = operation.getProperties();
for (String key : operationProperties.stringPropertyNames()) {
operationProperty = new MobileOperationProperty();
operationProperty.setProperty(key);
operationProperty.setValue(operationProperties.getProperty(key));
properties.add(operationProperty);
}
mobileOperation.setProperties(properties);
return mobileOperation;
}
public static List<Integer> getMobileOperationIdsFromMobileDeviceOperations(
List<MobileDeviceOperation> mobileDeviceOperations) {
List<Integer> mobileOperationIds = new ArrayList<Integer>();
for (MobileDeviceOperation mobileDeviceOperation : mobileDeviceOperations) {
mobileOperationIds.add(mobileDeviceOperation.getOperationId());
}
return mobileOperationIds;
}
public static Operation convertMobileOperationToOperation(MobileOperation mobileOperation) {
Operation operation = new Operation();
Properties properties = new Properties();
operation.setCode(mobileOperation.getFeatureCode());
for (MobileOperationProperty mobileOperationProperty : mobileOperation.getProperties()) {
properties
.put(mobileOperationProperty.getProperty(), mobileOperationProperty.getValue());
}
operation.setProperties(properties);
return operation;
}
}

@ -1,29 +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.impl.common;
public enum DBTypes {
Oracle("Oracle"),H2("H2"),MySql("MySql");
String dbName ;
DBTypes(String dbStrName) {
dbName = dbStrName;
}
}

@ -1,90 +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.impl.common;
import javax.xml.bind.annotation.XmlAttribute;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "DBType")
public class TestDBConfiguration {
private String connectionUrl;
private String driverClass;
private String userName;
private String pwd;
@Override public String toString() {
return "TestDBConfiguration{" +
"connectionUrl='" + connectionUrl + '\'' +
", driverClass='" + driverClass + '\'' +
", userName='" + userName + '\'' +
", pwd='" + pwd + '\'' +
", dbType='" + dbType + '\'' +
'}';
}
private String dbType;
@XmlElement(name = "connectionurl", nillable = false)
public String getConnectionUrl() {
return connectionUrl;
}
public void setConnectionUrl(String connectionUrl) {
this.connectionUrl = connectionUrl;
}
@XmlElement(name = "driverclass", nillable = false)
public String getDriverClass() {
return driverClass;
}
public void setDriverClass(String driverClass) {
this.driverClass = driverClass;
}
@XmlElement(name = "userName", nillable = false)
public String getUserName() {
return userName;
}
public void setUserName(String userName) {
this.userName = userName;
}
@XmlElement(name = "pwd", nillable = false)
public String getPwd() {
return pwd;
}
public void setPwd(String pwd) {
this.pwd = pwd;
}
@XmlAttribute(name = "typeName")
public String getDbType() {
return dbType;
}
public void setDbType(String dbType) {
this.dbType = dbType;
}
}

@ -1,39 +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.impl.common;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.List;
@XmlRootElement(name = "DeviceMgtTestDBConfigurations")
public class TestDBConfigurations {
private List<TestDBConfiguration> dbTypesList;
@XmlElement(name = "DBType")
public List<TestDBConfiguration> getDbTypesList() {
return dbTypesList;
}
public void setDbTypesList(List<TestDBConfiguration> dbTypesList) {
this.dbTypesList = dbTypesList;
}
}

@ -1,141 +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.impl.dao;
import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Parameters;
import org.testng.annotations.Test;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.common.DBTypes;
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfiguration;
import org.wso2.carbon.device.mgt.mobile.impl.common.TestDBConfigurations;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.dao.impl.FeatureDAOImpl;
import org.wso2.carbon.device.mgt.mobile.dto.*;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.JAXBException;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.sql.*;
import java.util.Date;
import java.util.Iterator;
public class FeatureDAOTestSuite {
private TestDBConfiguration testDBConfiguration;
private Connection conn = null;
private Statement stmt = null;
private FeatureDAOImpl featureDAO;
@BeforeClass
@Parameters("dbType")
public void setUpDB(String dbTypeStr) throws Exception {
DBTypes dbType = DBTypes.valueOf(dbTypeStr);
testDBConfiguration = getTestDBConfiguration(dbType);
switch (dbType) {
case H2:
createH2DB(testDBConfiguration);
BasicDataSource testDataSource = new BasicDataSource();
testDataSource.setDriverClassName(testDBConfiguration.getDriverClass());
testDataSource.setUrl(testDBConfiguration.getConnectionUrl());
testDataSource.setUsername(testDBConfiguration.getUserName());
testDataSource.setPassword(testDBConfiguration.getPwd());
featureDAO = new FeatureDAOImpl(testDataSource);
default:
}
}
private TestDBConfiguration getTestDBConfiguration(DBTypes dbType) throws
MobileDeviceManagementDAOException,
DeviceManagementException {
File deviceMgtConfig = new File("src/test/resources/testdbconfig.xml");
Document doc = null;
testDBConfiguration = null;
TestDBConfigurations testDBConfigurations = null;
doc = DeviceManagerUtil.convertToDocument(deviceMgtConfig);
JAXBContext testDBContext = null;
try {
testDBContext = JAXBContext.newInstance(TestDBConfigurations.class);
Unmarshaller unmarshaller = testDBContext.createUnmarshaller();
testDBConfigurations = (TestDBConfigurations) unmarshaller.unmarshal(doc);
} catch (JAXBException e) {
throw new MobileDeviceManagementDAOException("Error parsing test db configurations", e);
}
Iterator<TestDBConfiguration> itrDBConfigs = testDBConfigurations.getDbTypesList().iterator();
while (itrDBConfigs.hasNext()) {
testDBConfiguration = itrDBConfigs.next();
if (testDBConfiguration.getDbType().equals(dbType.toString())) {
break;
}
}
return testDBConfiguration;
}
private void createH2DB(TestDBConfiguration testDBConf) throws Exception {
Class.forName(testDBConf.getDriverClass());
conn = DriverManager.getConnection(testDBConf.getConnectionUrl());
stmt = conn.createStatement();
stmt.executeUpdate("RUNSCRIPT FROM './src/test/resources/sql/CreateH2TestDB.sql'");
stmt.close();
conn.close();
}
@Test
public void addFeature() throws MobileDeviceManagementDAOException, DeviceManagementException {
Feature feature = new Feature();
feature.setCode("Camera");
feature.setDescription("Camera enable or disable");
feature.setName("Camera");
boolean added = featureDAO.addFeature(feature);
// Long deviceId = null;
// try {
// conn = DeviceManagementDAOFactory.getDataSource().getConnection();
// stmt = conn.createStatement();
// ResultSet resultSet = stmt
// .executeQuery("SELECT ID from DM_DEVICE DEVICE where DEVICE.DEVICE_IDENTIFICATION='111'");
//
// while (resultSet.next()) {
// deviceId = resultSet.getLong(1);
// }
// conn.close();
// } catch (SQLException sqlEx) {
// throw new DeviceManagementDAOException("error in fetch device by device identification id", sqlEx);
// }
Assert.assertTrue(added, "Device Id is null");
}
}

@ -1,24 +0,0 @@
CREATE TABLE IF NOT EXISTS DM_DEVICE_TYPE
(
ID INT auto_increment NOT NULL,
NAME VARCHAR(300) NULL DEFAULT NULL,
PRIMARY KEY (ID)
);
CREATE TABLE IF NOT EXISTS DM_DEVICE
(
ID INT auto_increment NOT NULL,
DESCRIPTION TEXT NULL DEFAULT NULL,
NAME VARCHAR(100) NULL DEFAULT NULL,
DATE_OF_ENROLLMENT BIGINT NULL DEFAULT NULL,
DATE_OF_LAST_UPDATE BIGINT NULL DEFAULT NULL,
OWNERSHIP VARCHAR(45) NULL DEFAULT NULL,
STATUS VARCHAR(15) NULL DEFAULT NULL,
DEVICE_TYPE_ID INT(11) NULL DEFAULT NULL,
DEVICE_IDENTIFICATION VARCHAR(300) NULL DEFAULT NULL,
OWNER VARCHAR(45) NULL DEFAULT NULL,
TENANT_ID INTEGER DEFAULT 0,
PRIMARY KEY (ID),
CONSTRAINT fk_DM_DEVICE_DM_DEVICE_TYPE2 FOREIGN KEY (DEVICE_TYPE_ID )
REFERENCES DM_DEVICE_TYPE (ID ) ON DELETE NO ACTION ON UPDATE NO ACTION
);

@ -1,24 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~ WSO2 Inc. licenses this file to you under the Apache License,
~ Version 2.0 (the "License"); you may not use this file except
~ in compliance with the License.
~ You may obtain a copy of the License at
~ http://www.apache.org/licenses/LICENSE-2.
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<DeviceMgtTestDBConfigurations>
<DBType typeName="H2">
<connectionurl>jdbc:h2:mem:cdm-test-db;DB_CLOSE_DELAY=-1</connectionurl>
<driverclass>org.h2.Driver</driverclass>
<userName></userName>
<pwd></pwd>
</DBType>
</DeviceMgtTestDBConfigurations>

@ -1,28 +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.
~ Unless required by applicable law or agreed to in writing,
~ software distributed under the License is distributed on an
~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~ KIND, either express or implied. See the License for the
~ specific language governing permissions and limitations
~ under the License.
-->
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="EMM-core-initializer">
<parameter name="useDefaultListeners" value="false"/>
<test name="DAO Unit Tests" preserve-order="true">
<parameter name="dbType" value="H2"/>
<classes>
<class name="org.wso2.carbon.device.mgt.mobile.impl.dao.FeatureDAOTestSuite"/>
</classes>
</test>
</suite>

@ -39,64 +39,8 @@
<modules>
<module>org.wso2.carbon.device.mgt.core</module>
<module>org.wso2.carbon.device.mgt.common</module>
<module>org.wso2.carbon.device.mgt.mobile.impl</module>
</modules>
<!-- <dependencyManagement>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
<version>3.8.1.v20120830-144521</version>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
<version>3.6.100.v20120522-1841</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
<version>4.3.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>2.0.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<version>3.3.100.v20120522-1822</version>
</dependency>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
<version>${orbit.version.h2.engine}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.core</artifactId>
<version>${apim.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.apimgt.impl</artifactId>
<version>${apim.version}</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat.wso2</groupId>
<artifactId>tomcat</artifactId>
<version>${orbit.version.tomcat}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.tomcat.ext</artifactId>
<version>4.3.0</version>
</dependency>
</dependencies>
</dependencyManagement>-->
<build>
<pluginManagement>
<plugins>

@ -1,116 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
~ Copyright (c) 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.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon</groupId>
<artifactId>device-mgt-feature</artifactId>
<version>2.0.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>org.wso2.carbon.device.mgt.mobile.feature</artifactId>
<packaging>pom</packaging>
<version>2.0.0-SNAPSHOT</version>
<name>WSO2 Carbon - Mobile Implementation of Device Management</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Mobile Device Management functionality
</description>
<dependencies>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.mobile.impl</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.device.mgt.common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<executions>
<execution>
<id>copy-resources</id>
<phase>generate-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>src/main/resources</outputDirectory>
<resources>
<resource>
<directory>resources</directory>
<includes>
<include>build.properties</include>
<include>p2.inf</include>
</includes>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.wso2.maven</groupId>
<artifactId>carbon-p2-plugin</artifactId>
<version>${carbon.p2.plugin.version}</version>
<executions>
<execution>
<id>p2-feature-generation</id>
<phase>package</phase>
<goals>
<goal>p2-feature-gen</goal>
</goals>
<configuration>
<id>org.wso2.carbon.device.mgt.mobile</id>
<propertiesFile>../../../features/etc/feature.properties</propertiesFile>
<adviceFile>
<properties>
<propertyDef>org.wso2.carbon.p2.category.type:server</propertyDef>
<propertyDef>org.eclipse.equinox.p2.type.group:false</propertyDef>
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.carbon:org.wso2.carbon.device.mgt.mobile.impl:${project.version}
</bundleDef>
<bundleDef>org.wso2.carbon:org.wso2.carbon.device.mgt.common:${project.version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}
</importFeatureDef>
<importFeatureDef>org.wso2.carbon.device.mgt.server:${project.version}
</importFeatureDef>
</importFeatures>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

@ -1,39 +0,0 @@
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
~ Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<MobileDeviceMgtConfiguration>
<ManagementRepository>
<DataSourceConfiguration>
<JndiLookupDefinition>
<Name>jdbc/MobileDM_DS</Name>
</JndiLookupDefinition>
</DataSourceConfiguration>
</ManagementRepository>
<APIPublisher>
<APIs>
<API>
<Name>enrollment</Name>
<Owner>admin</Owner>
<Context>enrollment</Context>
<Version>1.0.0</Version>
<Endpoint>http://localhost:9763/</Endpoint>
<Transports>http,https</Transports>
</API>
</APIs>
</APIPublisher>
</MobileDeviceMgtConfiguration>

@ -1,2 +0,0 @@
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);\

@ -38,7 +38,6 @@
<modules>
<module>org.wso2.carbon.device.mgt.server.feature</module>
<module>org.wso2.carbon.device.mgt.mobile.feature</module>
</modules>
</project>

@ -57,6 +57,10 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
</dependency>
</dependencies>
<build>
@ -111,6 +115,8 @@
</bundleDef>
<bundleDef>org.wso2.carbon:org.wso2.carbon.policy.mgt.common:${project.version}
</bundleDef>
<bundleDef>org.wso2.carbon:org.wso2.carbon.policy.evaluator:${project.version}
</bundleDef>
</bundles>
<importFeatures>
<importFeatureDef>org.wso2.carbon.core.server:${carbon.kernel.version}

@ -195,6 +195,12 @@
<version>${carbon.kernel.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

@ -1,27 +0,0 @@
/**
* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.cdm.agent.utils;
/**
* Constant values throughout the agent
*/
public class Constant {
public static final String USERNAME = "username";
public static final String PASSWORD = "password";
public static final String STATUS = "status";
public static final String RESPONSE = "response";
}

@ -35,10 +35,10 @@
<description>WSO2 Connected Device Manager (CDM) Distribution</description>
<dependencies>
<dependency>
<groupId>com.h2database.wso2</groupId>
<dependency>
<groupId>com.h2database.wso2</groupId>
<artifactId>h2-database-engine</artifactId>
</dependency>
</dependency>
</dependencies>
<build>
@ -98,7 +98,7 @@
<artifactId>maven-antrun-plugin</artifactId>
<!--<version>${maven-antrun-plugin.version}</version>-->
<executions>
<execution>
<execution>
<!-- Creating Device Management schema -->
<id>create-device-mgt-schema</id>
<phase>package</phase>
@ -125,15 +125,16 @@
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/h2.sql"/>
<fileset
file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/cdm/h2.sql"/>
</sql>
<echo
message="##################### END ####################"/>
</tasks>
</configuration>
</execution>
<execution>
<!-- Creating IDP Management schema -->
<!-- <execution>
&lt;!&ndash; Creating IDP Management schema &ndash;&gt;
<id>create-idp-mgt-schema</id>
<phase>package</phase>
<goals>
@ -159,15 +160,16 @@
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/application-mgt/h2.sql"/>
<fileset
file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/application-mgt/h2.sql"/>
</sql>
<echo
message="##################### END ####################"/>
</tasks>
</configuration>
</execution>
<execution>
<!-- Creating API Management schema -->
<execution>
&lt;!&ndash; Creating API Management schema &ndash;&gt;
<id>create-api-mgt-schema</id>
<phase>package</phase>
<goals>
@ -193,13 +195,14 @@
<classpath refid="maven.compile.classpath"/>
<classpath refid="maven.runtime.classpath"/>
<fileset file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/apimgt/h2.sql"/>
<fileset
file="${basedir}/../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/apimgt/h2.sql"/>
</sql>
<echo
message="##################### END ####################"/>
</tasks>
</configuration>
</execution>
</execution>-->
<execution>
<id>3-extract-docs-from-components</id>
<phase>package</phase>

@ -250,7 +250,7 @@
</dependencySets>
<files>
<file>
<!-- <file>
<source>../mobileservices/agents/android/jax-rs/target/cdm-android-api.war</source>
<outputDirectory>wso2cdm-${pom.version}/repository/deployment/server/webapps
</outputDirectory>
@ -261,7 +261,7 @@
<outputDirectory>wso2cdm-${pom.version}/repository/deployment/server/webapps
</outputDirectory>
<fileMode>755</fileMode>
</file>
</file>-->
<!-- <file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml
@ -350,6 +350,7 @@
</file>
<!-- Copying application-authentication.xml -->
<!--
<file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/security/application-authentication.xml
@ -358,16 +359,17 @@
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
-->
<!-- Copying thrift-authentication.xml -->
<file>
<!-- <file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/thrift-authentication.xml
</source>
<outputDirectory>wso2cdm-${project.version}/repository/conf</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
</file>-->
<file>
<source>src/repository/conf/multitenancy/cloud-services-desc.xml</source>
@ -420,7 +422,7 @@
</file>
<!--cdm plugin config file-->
<file>
<!-- <file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/mobile-config.xml
</source>
@ -429,7 +431,7 @@
</outputDirectory>
<filtered>true</filtered>
<fileMode>644</fileMode>
</file>
</file>-->
<file>
<source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading-environments.xml
@ -441,14 +443,14 @@
</file>
<!-- Copying H2 database related files corresponding to default API management repository schema -->
<file>
<!-- <file>
<source>
target/wso2carbon-core-${carbon.kernel.version}/repository/database/WSO2AM_DB.h2.db
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/database</outputDirectory>
<destName>WSO2AM_DB.h2.db</destName>
<fileMode>644</fileMode>
</file>
</file>-->
<!-- Copying H2 database related files corresponding to default Device management repository schema -->
<file>

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wso2.cdm.agent"
android:sharedUserId="org.wso2.emm.agent"
android:sharedUserLabel="@string/hello_world"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--
Creates a custom permission so only this app can receive its messages.
NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application's package name.
-->
<permission
android:name="org.wso2.emm.agent.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="org.wso2.emm.agent.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
</uses-permission>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.SEND_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" >
</uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
<activity
android:name="org.wso2.cdm.agent.RegistrationActivity"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
</activity>
<activity
android:name="org.wso2.cdm.agent.DisplayDeviceInfoActivity"
android:label="@string/title_activity_display_device_info"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.RegisterSuccessfulActivity"
android:label="@string/title_activity_register_successful"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<!-- Begin List of Receivers -->
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="org.wso2.emm.agent" />
</intent-filter>
</receiver>
<receiver
android:name="org.wso2.cdm.agent.services.WSO2DeviceAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN" >
<intent-filter>
<!-- This action is required -->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<!-- This is required this receiver to become device admin component. -->
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/wso2_device_admin" >
</meta-data>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.AlarmReceiver"></receiver>
<receiver android:name="org.wso2.cdm.agent.services.DeviceStartupIntentReceiver" android:enabled="true" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!-- End List of Receivers -->
<service android:name="org.wso2.cdm.agent.GCMIntentService" />
<activity
android:name="org.wso2.cdm.agent.AlreadyRegisteredActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationErrorActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.NotifyActivity"
android:label="@string/title_activity_notify"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.ServerDetails"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.wso2.cdm.agent.PinCodeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.Notification"
android:label="@string/title_activity_notification"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AlertActivity"
android:label="@string/title_activity_alert"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name="org.wso2.cdm.agent.LogActivity"
android:label="@string/title_activity_log"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>

@ -1,18 +0,0 @@
WSO2 EMM Agent
=================
Configure and build the Android client application
----------------------
Follow the instructions below to configure and build the Android client application:
1. Get a Git clone of the project.
2. Download <a href="https://developer.android.com/sdk/installing/installing-adt.html"> Android ADT plugin and configure </a> it in your Eclipse.
3. Open the project in your Eclipse IDE.
4. Import the project as an Android project using "File-->Import-->Existing Android Code Into Workspace"
5. Two projects will show, a library and the agent. Clean the Library first and build it.
6. Open the file properties of the Agent project.
7. Under "Android" scroll down (past the Build targets).
8. The library project will show with a red "X" next to it. Remove it.
9. Add the library project you just built in step 3
10. Ensure the Library is also on your "Java Build Path" under Libraries.
11. Clean and build.

@ -1,183 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.wso2.cdm.agent"
android:sharedUserId="org.wso2.emm.agent"
android:sharedUserLabel="@string/hello_world"
android:versionCode="1"
android:versionName="1.0" >
<uses-sdk
android:minSdkVersion="16"
android:targetSdkVersion="17" />
<!-- GCM connects to Google Services. -->
<uses-permission android:name="android.permission.INTERNET" />
<!-- GCM requires a Google account. -->
<uses-permission android:name="android.permission.GET_ACCOUNTS" />
<!-- Keeps the processor from sleeping when a message is received. -->
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<!--
Creates a custom permission so only this app can receive its messages.
NOTE: the permission *must* be called PACKAGE.permission.C2D_MESSAGE,
where PACKAGE is the application's package name.
-->
<permission
android:name="org.wso2.emm.agent.permission.C2D_MESSAGE"
android:protectionLevel="signature" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="org.wso2.emm.agent.permission.C2D_MESSAGE" />
<uses-permission android:name="android.permission.READ_PHONE_STATE" >
</uses-permission>
<uses-permission android:name="com.google.android.c2dm.permission.RECEIVE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_GPS" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permisssion.ACCESS_COARSE_LOCATION" >
</uses-permission>
<uses-permission android:name="android.permission.SEND_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.RECEIVE_SMS" >
</uses-permission>
<uses-permission android:name="android.permission.READ_SMS" />
<uses-permission android:name="android.permission.WRITE_SMS" />
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-permission android:name="android.permission.READ_LOGS" />
<uses-permission android:name="android.permission.READ_CALL_LOG" />
<uses-permission android:name="android.permission.WRITE_CALL_LOG" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.GET_ACCOUNTS" >
</uses-permission>
<uses-permission android:name="android.permission.CHANGE_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" >
</uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" >
</uses-permission>
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
<activity
android:name="org.wso2.cdm.agent.RegistrationActivity"
android:screenOrientation="portrait"
android:theme="@style/TopBarTheme" >
</activity>
<activity
android:name="org.wso2.cdm.agent.DisplayDeviceInfoActivity"
android:label="@string/title_activity_display_device_info"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.RegisterSuccessfulActivity"
android:label="@string/title_activity_register_successful"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<!-- Begin List of Receivers -->
<receiver
android:name="com.google.android.gcm.GCMBroadcastReceiver"
android:permission="com.google.android.c2dm.permission.SEND" >
<intent-filter>
<action android:name="com.google.android.c2dm.intent.RECEIVE" />
<action android:name="com.google.android.c2dm.intent.REGISTRATION" />
<category android:name="org.wso2.emm.agent" />
</intent-filter>
</receiver>
<receiver
android:name="org.wso2.cdm.agent.services.WSO2DeviceAdminReceiver"
android:permission="android.permission.BIND_DEVICE_ADMIN" >
<intent-filter>
<!-- This action is required -->
<action android:name="android.app.action.DEVICE_ADMIN_ENABLED" />
</intent-filter>
<!-- This is required this receiver to become device admin component. -->
<meta-data
android:name="android.app.device_admin"
android:resource="@xml/wso2_device_admin" >
</meta-data>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.SMSReceiver">
<intent-filter>
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
</intent-filter>
</receiver>
<receiver android:name="org.wso2.cdm.agent.services.AlarmReceiver"></receiver>
<receiver android:name="org.wso2.cdm.agent.services.DeviceStartupIntentReceiver" android:enabled="true" android:exported="false">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
<action android:name="android.intent.action.QUICKBOOT_POWERON" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
</receiver>
<!-- End List of Receivers -->
<service android:name="org.wso2.cdm.agent.GCMIntentService" />
<activity
android:name="org.wso2.cdm.agent.AlreadyRegisteredActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationActivity"
android:screenOrientation="portrait"
android:theme="@style/Theme.Sherlock"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AuthenticationErrorActivity"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.NotifyActivity"
android:label="@string/title_activity_notify"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.ServerDetails"
android:screenOrientation="portrait"
android:label="@string/app_name"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="org.wso2.cdm.agent.PinCodeActivity"
android:screenOrientation="portrait"
android:windowSoftInputMode="stateUnchanged|adjustPan" >
</activity>
<activity
android:name="org.wso2.cdm.agent.Notification"
android:label="@string/title_activity_notification"
android:screenOrientation="portrait" >
</activity>
<activity
android:name="org.wso2.cdm.agent.AlertActivity"
android:label="@string/title_activity_alert"
android:screenOrientation="portrait"
android:theme="@android:style/Theme.Dialog" >
</activity>
<activity
android:name="org.wso2.cdm.agent.LogActivity"
android:label="@string/title_activity_log"
android:screenOrientation="portrait" >
</activity>
</application>
</manifest>

@ -1,905 +0,0 @@
int attr actionBarDivider 0x7f01000e
int attr actionBarItemBackground 0x7f01000f
int attr actionBarSize 0x7f01000d
int attr actionBarSplitStyle 0x7f01000b
int attr actionBarStyle 0x7f01000a
int attr actionBarTabBarStyle 0x7f010007
int attr actionBarTabStyle 0x7f010006
int attr actionBarTabTextStyle 0x7f010008
int attr actionBarWidgetTheme 0x7f01000c
int attr actionButtonStyle 0x7f01003a
int attr actionDropDownStyle 0x7f010039
int attr actionMenuTextAppearance 0x7f010010
int attr actionMenuTextColor 0x7f010011
int attr actionModeBackground 0x7f010014
int attr actionModeCloseButtonStyle 0x7f010013
int attr actionModeCloseDrawable 0x7f010016
int attr actionModePopupWindowStyle 0x7f010018
int attr actionModeShareDrawable 0x7f010017
int attr actionModeSplitBackground 0x7f010015
int attr actionModeStyle 0x7f010012
int attr actionOverflowButtonStyle 0x7f010009
int attr actionSpinnerItemStyle 0x7f01003f
int attr activatedBackgroundIndicator 0x7f010047
int attr activityChooserViewStyle 0x7f010046
int attr background 0x7f010002
int attr backgroundSplit 0x7f010003
int attr backgroundStacked 0x7f01004e
int attr buttonStyleSmall 0x7f010019
int attr customNavigationLayout 0x7f01004f
int attr displayOptions 0x7f010049
int attr divider 0x7f010005
int attr dividerVertical 0x7f010038
int attr dropDownListViewStyle 0x7f01003c
int attr dropdownListPreferredItemHeight 0x7f01003e
int attr expandActivityOverflowButtonDrawable 0x7f01005e
int attr headerBackground 0x7f010058
int attr height 0x7f010004
int attr homeAsUpIndicator 0x7f01003b
int attr homeLayout 0x7f010050
int attr horizontalDivider 0x7f010056
int attr icon 0x7f01004c
int attr iconifiedByDefault 0x7f01005f
int attr indeterminateProgressStyle 0x7f010052
int attr initialActivityCount 0x7f01005d
int attr itemBackground 0x7f010059
int attr itemIconDisabledAlpha 0x7f01005b
int attr itemPadding 0x7f010054
int attr itemTextAppearance 0x7f010055
int attr listPopupWindowStyle 0x7f010045
int attr listPreferredItemHeightSmall 0x7f010032
int attr listPreferredItemPaddingLeft 0x7f010033
int attr listPreferredItemPaddingRight 0x7f010034
int attr logo 0x7f01004d
int attr navigationMode 0x7f010048
int attr popupMenuStyle 0x7f01003d
int attr preserveIconSpacing 0x7f01005c
int attr progressBarPadding 0x7f010053
int attr progressBarStyle 0x7f010051
int attr queryHint 0x7f010060
int attr searchAutoCompleteTextView 0x7f010024
int attr searchDropdownBackground 0x7f010025
int attr searchResultListItemHeight 0x7f01002f
int attr searchViewCloseIcon 0x7f010026
int attr searchViewEditQuery 0x7f01002a
int attr searchViewEditQueryBackground 0x7f01002b
int attr searchViewGoIcon 0x7f010027
int attr searchViewSearchIcon 0x7f010028
int attr searchViewTextField 0x7f01002c
int attr searchViewTextFieldRight 0x7f01002d
int attr searchViewVoiceIcon 0x7f010029
int attr selectableItemBackground 0x7f01001a
int attr spinnerDropDownItemStyle 0x7f010023
int attr spinnerItemStyle 0x7f010022
int attr subtitle 0x7f01004b
int attr subtitleTextStyle 0x7f010001
int attr textAppearanceLargePopupMenu 0x7f01001c
int attr textAppearanceListItemSmall 0x7f010035
int attr textAppearanceSearchResultSubtitle 0x7f010031
int attr textAppearanceSearchResultTitle 0x7f010030
int attr textAppearanceSmall 0x7f01001e
int attr textAppearanceSmallPopupMenu 0x7f01001d
int attr textColorPrimary 0x7f01001f
int attr textColorPrimaryDisableOnly 0x7f010020
int attr textColorPrimaryInverse 0x7f010021
int attr textColorSearchUrl 0x7f01002e
int attr title 0x7f01004a
int attr titleTextStyle 0x7f010000
int attr verticalDivider 0x7f010057
int attr windowActionBar 0x7f010041
int attr windowActionBarOverlay 0x7f010042
int attr windowActionModeOverlay 0x7f010043
int attr windowAnimationStyle 0x7f01005a
int attr windowContentOverlay 0x7f01001b
int attr windowMinWidthMajor 0x7f010036
int attr windowMinWidthMinor 0x7f010037
int attr windowNoTitle 0x7f010040
int attr windowSplitActionBar 0x7f010044
int bool abs__action_bar_embed_tabs 0x7f070000
int bool abs__action_bar_expanded_action_views_exclusive 0x7f070002
int bool abs__config_actionMenuItemAllCaps 0x7f070004
int bool abs__config_allowActionMenuItemTextWithIcon 0x7f070005
int bool abs__config_showMenuShortcutsWhenKeyboardPresent 0x7f070003
int bool abs__split_action_bar_is_narrow 0x7f070001
int color abs__background_holo_dark 0x7f080000
int color abs__background_holo_light 0x7f080001
int color abs__bright_foreground_disabled_holo_dark 0x7f080004
int color abs__bright_foreground_disabled_holo_light 0x7f080005
int color abs__bright_foreground_holo_dark 0x7f080002
int color abs__bright_foreground_holo_light 0x7f080003
int color abs__bright_foreground_inverse_holo_dark 0x7f080006
int color abs__bright_foreground_inverse_holo_light 0x7f080007
int color abs__holo_blue_light 0x7f080008
int color abs__primary_text_disable_only_holo_dark 0x7f08000c
int color abs__primary_text_disable_only_holo_light 0x7f08000d
int color abs__primary_text_holo_dark 0x7f08000e
int color abs__primary_text_holo_light 0x7f08000f
int color black 0x7f08000b
int color light_grey 0x7f080009
int color white 0x7f08000a
int dimen abs__action_bar_default_height 0x7f090001
int dimen abs__action_bar_icon_vertical_padding 0x7f090002
int dimen abs__action_bar_subtitle_bottom_margin 0x7f090006
int dimen abs__action_bar_subtitle_text_size 0x7f090004
int dimen abs__action_bar_subtitle_top_margin 0x7f090005
int dimen abs__action_bar_title_text_size 0x7f090003
int dimen abs__action_button_min_width 0x7f090007
int dimen abs__alert_dialog_title_height 0x7f090008
int dimen abs__config_prefDialogWidth 0x7f090000
int dimen abs__dialog_min_width_major 0x7f090009
int dimen abs__dialog_min_width_minor 0x7f09000a
int dimen abs__dropdownitem_icon_width 0x7f09000d
int dimen abs__dropdownitem_text_padding_left 0x7f09000b
int dimen abs__dropdownitem_text_padding_right 0x7f09000c
int dimen abs__search_view_preferred_width 0x7f09000f
int dimen abs__search_view_text_min_width 0x7f09000e
int dimen action_button_min_width 0x7f090010
int dimen activity_horizontal_margin 0x7f090011
int dimen activity_vertical_margin 0x7f090012
int dimen top_bar_height 0x7f090013
int drawable abs__ab_bottom_solid_dark_holo 0x7f020000
int drawable abs__ab_bottom_solid_inverse_holo 0x7f020001
int drawable abs__ab_bottom_solid_light_holo 0x7f020002
int drawable abs__ab_bottom_transparent_dark_holo 0x7f020003
int drawable abs__ab_bottom_transparent_light_holo 0x7f020004
int drawable abs__ab_share_pack_holo_dark 0x7f020005
int drawable abs__ab_share_pack_holo_light 0x7f020006
int drawable abs__ab_solid_dark_holo 0x7f020007
int drawable abs__ab_solid_light_holo 0x7f020008
int drawable abs__ab_solid_shadow_holo 0x7f020009
int drawable abs__ab_stacked_solid_dark_holo 0x7f02000a
int drawable abs__ab_stacked_solid_light_holo 0x7f02000b
int drawable abs__ab_stacked_transparent_dark_holo 0x7f02000c
int drawable abs__ab_stacked_transparent_light_holo 0x7f02000d
int drawable abs__ab_transparent_dark_holo 0x7f02000e
int drawable abs__ab_transparent_light_holo 0x7f02000f
int drawable abs__activated_background_holo_dark 0x7f020010
int drawable abs__activated_background_holo_light 0x7f020011
int drawable abs__btn_cab_done_default_holo_dark 0x7f020012
int drawable abs__btn_cab_done_default_holo_light 0x7f020013
int drawable abs__btn_cab_done_focused_holo_dark 0x7f020014
int drawable abs__btn_cab_done_focused_holo_light 0x7f020015
int drawable abs__btn_cab_done_holo_dark 0x7f020016
int drawable abs__btn_cab_done_holo_light 0x7f020017
int drawable abs__btn_cab_done_pressed_holo_dark 0x7f020018
int drawable abs__btn_cab_done_pressed_holo_light 0x7f020019
int drawable abs__cab_background_bottom_holo_dark 0x7f02001a
int drawable abs__cab_background_bottom_holo_light 0x7f02001b
int drawable abs__cab_background_top_holo_dark 0x7f02001c
int drawable abs__cab_background_top_holo_light 0x7f02001d
int drawable abs__dialog_full_holo_dark 0x7f02001e
int drawable abs__dialog_full_holo_light 0x7f02001f
int drawable abs__ic_ab_back_holo_dark 0x7f020020
int drawable abs__ic_ab_back_holo_light 0x7f020021
int drawable abs__ic_cab_done_holo_dark 0x7f020022
int drawable abs__ic_cab_done_holo_light 0x7f020023
int drawable abs__ic_clear 0x7f020024
int drawable abs__ic_clear_disabled 0x7f020025
int drawable abs__ic_clear_holo_light 0x7f020026
int drawable abs__ic_clear_normal 0x7f020027
int drawable abs__ic_clear_search_api_disabled_holo_light 0x7f020028
int drawable abs__ic_clear_search_api_holo_light 0x7f020029
int drawable abs__ic_go 0x7f02002a
int drawable abs__ic_go_search_api_holo_light 0x7f02002b
int drawable abs__ic_menu_moreoverflow_holo_dark 0x7f02002c
int drawable abs__ic_menu_moreoverflow_holo_light 0x7f02002d
int drawable abs__ic_menu_moreoverflow_normal_holo_dark 0x7f02002e
int drawable abs__ic_menu_moreoverflow_normal_holo_light 0x7f02002f
int drawable abs__ic_menu_share_holo_dark 0x7f020030
int drawable abs__ic_menu_share_holo_light 0x7f020031
int drawable abs__ic_search 0x7f020032
int drawable abs__ic_search_api_holo_light 0x7f020033
int drawable abs__ic_voice_search 0x7f020034
int drawable abs__ic_voice_search_api_holo_light 0x7f020035
int drawable abs__item_background_holo_dark 0x7f020036
int drawable abs__item_background_holo_light 0x7f020037
int drawable abs__list_activated_holo 0x7f020038
int drawable abs__list_divider_holo_dark 0x7f020039
int drawable abs__list_divider_holo_light 0x7f02003a
int drawable abs__list_focused_holo 0x7f02003b
int drawable abs__list_longpressed_holo 0x7f02003c
int drawable abs__list_pressed_holo_dark 0x7f02003d
int drawable abs__list_pressed_holo_light 0x7f02003e
int drawable abs__list_selector_background_transition_holo_dark 0x7f02003f
int drawable abs__list_selector_background_transition_holo_light 0x7f020040
int drawable abs__list_selector_disabled_holo_dark 0x7f020041
int drawable abs__list_selector_disabled_holo_light 0x7f020042
int drawable abs__list_selector_holo_dark 0x7f020043
int drawable abs__list_selector_holo_light 0x7f020044
int drawable abs__menu_dropdown_panel_holo_dark 0x7f020045
int drawable abs__menu_dropdown_panel_holo_light 0x7f020046
int drawable abs__progress_bg_holo_dark 0x7f020047
int drawable abs__progress_bg_holo_light 0x7f020048
int drawable abs__progress_horizontal_holo_dark 0x7f020049
int drawable abs__progress_horizontal_holo_light 0x7f02004a
int drawable abs__progress_medium_holo 0x7f02004b
int drawable abs__progress_primary_holo_dark 0x7f02004c
int drawable abs__progress_primary_holo_light 0x7f02004d
int drawable abs__progress_secondary_holo_dark 0x7f02004e
int drawable abs__progress_secondary_holo_light 0x7f02004f
int drawable abs__search_dropdown_dark 0x7f020050
int drawable abs__search_dropdown_light 0x7f020051
int drawable abs__spinner_48_inner_holo 0x7f020052
int drawable abs__spinner_48_outer_holo 0x7f020053
int drawable abs__spinner_ab_default_holo_dark 0x7f020054
int drawable abs__spinner_ab_default_holo_light 0x7f020055
int drawable abs__spinner_ab_disabled_holo_dark 0x7f020056
int drawable abs__spinner_ab_disabled_holo_light 0x7f020057
int drawable abs__spinner_ab_focused_holo_dark 0x7f020058
int drawable abs__spinner_ab_focused_holo_light 0x7f020059
int drawable abs__spinner_ab_holo_dark 0x7f02005a
int drawable abs__spinner_ab_holo_light 0x7f02005b
int drawable abs__spinner_ab_pressed_holo_dark 0x7f02005c
int drawable abs__spinner_ab_pressed_holo_light 0x7f02005d
int drawable abs__tab_indicator_ab_holo 0x7f02005e
int drawable abs__tab_selected_focused_holo 0x7f02005f
int drawable abs__tab_selected_holo 0x7f020060
int drawable abs__tab_selected_pressed_holo 0x7f020061
int drawable abs__tab_unselected_pressed_holo 0x7f020062
int drawable abs__textfield_search_default_holo_dark 0x7f020063
int drawable abs__textfield_search_default_holo_light 0x7f020064
int drawable abs__textfield_search_right_default_holo_dark 0x7f020065
int drawable abs__textfield_search_right_default_holo_light 0x7f020066
int drawable abs__textfield_search_right_selected_holo_dark 0x7f020067
int drawable abs__textfield_search_right_selected_holo_light 0x7f020068
int drawable abs__textfield_search_selected_holo_dark 0x7f020069
int drawable abs__textfield_search_selected_holo_light 0x7f02006a
int drawable abs__textfield_searchview_holo_dark 0x7f02006b
int drawable abs__textfield_searchview_holo_light 0x7f02006c
int drawable abs__textfield_searchview_right_holo_dark 0x7f02006d
int drawable abs__textfield_searchview_right_holo_light 0x7f02006e
int drawable appinstall 0x7f02006f
int drawable applist 0x7f020070
int drawable appuninstall 0x7f020071
int drawable btn_grey 0x7f020072
int drawable btn_orange 0x7f020073
int drawable camera 0x7f020074
int drawable changepassword 0x7f020075
int drawable custom_checkbox 0x7f020076
int drawable dot 0x7f020077
int drawable encrypt 0x7f020078
int drawable ic_bookmark 0x7f020079
int drawable ic_check_default 0x7f02007a
int drawable ic_check_selected 0x7f02007b
int drawable ic_launcher 0x7f02007c
int drawable ic_logo 0x7f02007d
int drawable ic_logo_dark 0x7f02007e
int drawable ic_stat_gcm 0x7f02007f
int drawable info 0x7f020080
int drawable location 0x7f020081
int drawable lock 0x7f020082
int drawable mdm_logo 0x7f020083
int drawable mute 0x7f020084
int drawable notification 0x7f020085
int drawable option_icon 0x7f020086
int drawable repeat_bg 0x7f020087
int drawable top_bar 0x7f020088
int drawable wifi 0x7f020089
int drawable wipe 0x7f02008a
int id TextView01 0x7f060091
int id abs__action_bar 0x7f06004e
int id abs__action_bar_container 0x7f06004d
int id abs__action_bar_subtitle 0x7f06003d
int id abs__action_bar_title 0x7f06003c
int id abs__action_context_bar 0x7f06004f
int id abs__action_menu_divider 0x7f06000c
int id abs__action_menu_presenter 0x7f06000d
int id abs__action_mode_bar 0x7f060052
int id abs__action_mode_bar_stub 0x7f060051
int id abs__action_mode_close_button 0x7f060040
int id abs__activity_chooser_view_content 0x7f060041
int id abs__checkbox 0x7f06004a
int id abs__content 0x7f060049
int id abs__default_activity_button 0x7f060044
int id abs__expand_activities_button 0x7f060042
int id abs__home 0x7f06000a
int id abs__icon 0x7f060046
int id abs__image 0x7f060043
int id abs__imageButton 0x7f06003e
int id abs__list_item 0x7f060045
int id abs__progress_circular 0x7f06000e
int id abs__progress_horizontal 0x7f06000f
int id abs__radio 0x7f06004c
int id abs__search_badge 0x7f060055
int id abs__search_bar 0x7f060054
int id abs__search_button 0x7f060056
int id abs__search_close_btn 0x7f06005b
int id abs__search_edit_frame 0x7f060057
int id abs__search_go_btn 0x7f06005d
int id abs__search_mag_icon 0x7f060058
int id abs__search_plate 0x7f060059
int id abs__search_src_text 0x7f06005a
int id abs__search_voice_btn 0x7f06005e
int id abs__shortcut 0x7f06004b
int id abs__split_action_bar 0x7f060050
int id abs__submit_area 0x7f06005c
int id abs__textButton 0x7f06003f
int id abs__title 0x7f060047
int id abs__titleDivider 0x7f060048
int id abs__up 0x7f06000b
int id action_settings 0x7f060095
int id background_container 0x7f06001f
int id blocks_now 0x7f06001e
int id blocks_ruler 0x7f06001d
int id btnEnroll 0x7f060082
int id btnLogin 0x7f060090
int id btnOK 0x7f060064
int id btnRefresh 0x7f06007d
int id btnRegister 0x7f060070
int id btnReset 0x7f06007e
int id btnSetPin 0x7f060087
int id btnStartRegistration 0x7f06008b
int id btnTryAgain 0x7f060073
int id btnUnreg 0x7f060065
int id btnUnregister 0x7f060088
int id button_layout 0x7f06008d
int id debug_log 0x7f06009b
int id dialogButtonCancel 0x7f06008f
int id dialogButtonOK 0x7f06008e
int id dialog_discard_confirm 0x7f06001a
int id dialog_moderator 0x7f06001b
int id dialog_wave 0x7f06001c
int id disableHome 0x7f060009
int id edit_query 0x7f060053
int id enrollPanel 0x7f060081
int id error 0x7f060072
int id etDomain 0x7f06006a
int id etPassword 0x7f06006c
int id etUsername 0x7f06006b
int id evServerIP 0x7f06008a
int id footer 0x7f060071
int id footerlogo 0x7f060068
int id fragment_container 0x7f060034
int id gridview 0x7f060014
int id homeAsUp 0x7f060006
int id incompatibleError 0x7f060074
int id info 0x7f060098
int id info_setting 0x7f060099
int id ip_setting 0x7f060097
int id layout_topbar 0x7f060067
int id lblPin 0x7f060084
int id linInner 0x7f060062
int id linearLayout1 0x7f060069
int id linearLayoutText 0x7f060080
int id listMode 0x7f060002
int id listview 0x7f060060
int id logo 0x7f06005f
int id more 0x7f060096
int id normal 0x7f060001
int id notify 0x7f060092
int id option_button 0x7f06007c
int id pin_setting 0x7f06009a
int id preference_brand_view 0x7f06002d
int id preference_empty_view 0x7f06002c
int id radioBYOD 0x7f06006e
int id radioCOPE 0x7f06006f
int id radioGroupType 0x7f06006d
int id rowImage 0x7f060093
int id rowTextView 0x7f060094
int id scroller 0x7f060061
int id setting_invite_email_button 0x7f060030
int id setting_invite_email_edittext 0x7f06002f
int id setting_invite_email_imageview 0x7f060031
int id setting_invite_email_layout 0x7f06002e
int id setting_invite_email_textview 0x7f060032
int id sg_button1 0x7f060039
int id sg_button2 0x7f06003a
int id sg_button3 0x7f06003b
int id sg_category_popup 0x7f060035
int id sg_city 0x7f060038
int id sg_tag_command 0x7f060036
int id sg_tag_payload 0x7f060037
int id showCustom 0x7f060008
int id showHome 0x7f060005
int id showTitle 0x7f060007
int id sp_edittext_city 0x7f060025
int id sp_edittext_email 0x7f060023
int id sp_edittext_location 0x7f060022
int id sp_edittext_name 0x7f060021
int id sp_edittext_other 0x7f06002a
int id sp_edittext_phone 0x7f060029
int id sp_edittext_state 0x7f060026
int id sp_edittext_street 0x7f060024
int id sp_edittext_zipcode 0x7f060027
int id sp_textview_country 0x7f060028
int id sp_textview_gpspick 0x7f06002b
int id startRegistration 0x7f060083
int id swipeable 0x7f060013
int id swipeable_bottom 0x7f060010
int id swipeable_container 0x7f060012
int id swipeable_top 0x7f060011
int id tabMode 0x7f060003
int id text 0x7f06008c
int id title_bar_layout 0x7f060020
int id title_container 0x7f060016
int id title_logo 0x7f060017
int id title_option 0x7f060019
int id title_text 0x7f060018
int id tvSeverAddress 0x7f060089
int id txtDevice 0x7f060076
int id txtId 0x7f060075
int id txtLog 0x7f06007f
int id txtMessage 0x7f060063
int id txtModel 0x7f060077
int id txtOS 0x7f06007a
int id txtOldPinCode 0x7f060085
int id txtOperator 0x7f060078
int id txtPinCode 0x7f060086
int id txtRegText 0x7f060066
int id txtRoot 0x7f06007b
int id txtSDK 0x7f060079
int id useLogo 0x7f060004
int id user_edit_location 0x7f060033
int id webview 0x7f060015
int id wrap_content 0x7f060000
int integer abs__max_action_buttons 0x7f0a0000
int layout abs__action_bar_home 0x7f030000
int layout abs__action_bar_tab 0x7f030001
int layout abs__action_bar_tab_bar_view 0x7f030002
int layout abs__action_bar_title_item 0x7f030003
int layout abs__action_menu_item_layout 0x7f030004
int layout abs__action_menu_layout 0x7f030005
int layout abs__action_mode_bar 0x7f030006
int layout abs__action_mode_close_item 0x7f030007
int layout abs__activity_chooser_view 0x7f030008
int layout abs__activity_chooser_view_list_item 0x7f030009
int layout abs__dialog_title_holo 0x7f03000a
int layout abs__list_menu_item_checkbox 0x7f03000b
int layout abs__list_menu_item_icon 0x7f03000c
int layout abs__list_menu_item_layout 0x7f03000d
int layout abs__list_menu_item_radio 0x7f03000e
int layout abs__popup_menu_item_layout 0x7f03000f
int layout abs__screen_action_bar 0x7f030010
int layout abs__screen_action_bar_overlay 0x7f030011
int layout abs__screen_simple 0x7f030012
int layout abs__screen_simple_overlay_action_mode 0x7f030013
int layout abs__search_dropdown_item_icons_2line 0x7f030014
int layout abs__search_view 0x7f030015
int layout abs__simple_dropdown_hint 0x7f030016
int layout activity_agent_settings 0x7f030017
int layout activity_alert 0x7f030018
int layout activity_already_registered 0x7f030019
int layout activity_authentication 0x7f03001a
int layout activity_authentication_error 0x7f03001b
int layout activity_available_operations 0x7f03001c
int layout activity_display_device_info 0x7f03001d
int layout activity_entry 0x7f03001e
int layout activity_log 0x7f03001f
int layout activity_main 0x7f030020
int layout activity_notification 0x7f030021
int layout activity_pin_code 0x7f030022
int layout activity_register_successful 0x7f030023
int layout activity_settings 0x7f030024
int layout custom_sherlock_bar 0x7f030025
int layout custom_terms_popup 0x7f030026
int layout footer_repeat 0x7f030027
int layout header_gradient 0x7f030028
int layout login 0x7f030029
int layout main 0x7f03002a
int layout notify 0x7f03002b
int layout row_with_icon 0x7f03002c
int layout sherlock_spinner_dropdown_item 0x7f03002d
int layout sherlock_spinner_item 0x7f03002e
int layout simplerow 0x7f03002f
int menu agent_settings 0x7f0d0000
int menu alert 0x7f0d0001
int menu all_ready_registered 0x7f0d0002
int menu auth_sherlock_menu 0x7f0d0003
int menu authentication 0x7f0d0004
int menu authentication_error 0x7f0d0005
int menu available_operations 0x7f0d0006
int menu display_device_info 0x7f0d0007
int menu entry 0x7f0d0008
int menu log 0x7f0d0009
int menu main 0x7f0d000a
int menu notification 0x7f0d000b
int menu notify 0x7f0d000c
int menu options_menu 0x7f0d000d
int menu pin_code 0x7f0d000e
int menu register_successful 0x7f0d000f
int menu settings 0x7f0d0010
int menu sherlock_menu 0x7f0d0011
int menu sherlock_menu_debug 0x7f0d0012
int raw emm_truststore 0x7f050000
int string abs__action_bar_home_description 0x7f0b0000
int string abs__action_bar_up_description 0x7f0b0001
int string abs__action_menu_overflow_description 0x7f0b0002
int string abs__action_mode_done 0x7f0b0003
int string abs__activity_chooser_view_dialog_title_default 0x7f0b0005
int string abs__activity_chooser_view_see_all 0x7f0b0004
int string abs__activitychooserview_choose_application 0x7f0b0007
int string abs__searchview_description_clear 0x7f0b000c
int string abs__searchview_description_query 0x7f0b000b
int string abs__searchview_description_search 0x7f0b000a
int string abs__searchview_description_submit 0x7f0b000d
int string abs__searchview_description_voice 0x7f0b000e
int string abs__share_action_provider_share_with 0x7f0b0006
int string abs__shareactionprovider_share_with 0x7f0b0008
int string abs__shareactionprovider_share_with_application 0x7f0b0009
int string action_settings 0x7f0b0023
int string already_registered 0x7f0b0010
int string app_name 0x7f0b0021
int string application_mgr_download_file_name 0x7f0b0092
int string application_mgr_download_location 0x7f0b0091
int string application_mgr_mime 0x7f0b0093
int string application_package_launcher_action 0x7f0b0095
int string application_package_prefix 0x7f0b0094
int string button_ok 0x7f0b0090
int string device_admin_disabled 0x7f0b002e
int string device_admin_enable_alert 0x7f0b003d
int string device_admin_enabled 0x7f0b002d
int string device_compatible 0x7f0b0031
int string device_enroll_type_byod 0x7f0b003e
int string device_enroll_type_cope 0x7f0b003f
int string device_not_compatible_error 0x7f0b002f
int string device_not_compatible_error_os 0x7f0b0030
int string device_not_compatible_error_root 0x7f0b0032
int string dialog_authenticate 0x7f0b0071
int string dialog_checking_reg 0x7f0b0073
int string dialog_enrolling 0x7f0b0076
int string dialog_init_confirmation 0x7f0b0079
int string dialog_init_device_type 0x7f0b007b
int string dialog_init_end 0x7f0b007c
int string dialog_init_end_general 0x7f0b007d
int string dialog_init_middle 0x7f0b007a
int string dialog_license_agreement 0x7f0b0075
int string dialog_message_please_wait 0x7f0b0085
int string dialog_message_unregistering 0x7f0b0084
int string dialog_pin_confirmation 0x7f0b0077
int string dialog_pin_confirmation_end 0x7f0b0078
int string dialog_please_wait 0x7f0b0072
int string dialog_sender_id 0x7f0b0074
int string dialog_unregister 0x7f0b007e
int string empty_app_title 0x7f0b0022
int string error_auth_failed_detail 0x7f0b0068
int string error_authentication_failed 0x7f0b0069
int string error_authorization_failed 0x7f0b0065
int string error_config 0x7f0b000f
int string error_connect_to_server 0x7f0b0061
int string error_enrollment_failed 0x7f0b0066
int string error_enrollment_failed_detail 0x7f0b0067
int string error_for_all_unknown_authentication_failures 0x7f0b006c
int string error_for_all_unknown_notification_failures 0x7f0b006e
int string error_for_all_unknown_registration_failures 0x7f0b006b
int string error_for_all_unknown_unregister_failures 0x7f0b006d
int string error_heading_connection 0x7f0b0062
int string error_internal_server 0x7f0b006f
int string error_invalid_server_address 0x7f0b0070
int string error_network_unavailable 0x7f0b006a
int string error_registration_failed 0x7f0b0063
int string error_unregistration_failed 0x7f0b0064
int string gcm_deleted 0x7f0b0016
int string gcm_error 0x7f0b0014
int string gcm_message 0x7f0b0013
int string gcm_recoverable_error 0x7f0b0015
int string gcm_registered 0x7f0b0011
int string gcm_unregistered 0x7f0b0012
int string hello_world 0x7f0b0024
int string hint_new_pin 0x7f0b0042
int string info_label_device 0x7f0b0087
int string info_label_imei 0x7f0b0086
int string info_label_imsi 0x7f0b008b
int string info_label_model 0x7f0b0088
int string info_label_no_sim 0x7f0b0089
int string info_label_operator 0x7f0b008a
int string info_label_os 0x7f0b008c
int string info_label_rooted 0x7f0b008d
int string intent_extra_fresh_reg_flag 0x7f0b004c
int string intent_extra_from_activity 0x7f0b0048
int string intent_extra_main_activity 0x7f0b004a
int string intent_extra_message 0x7f0b004b
int string intent_extra_notification 0x7f0b004e
int string intent_extra_regid 0x7f0b0049
int string intent_extra_username 0x7f0b004d
int string menu_item_change_ip 0x7f0b0083
int string menu_item_change_pin 0x7f0b0082
int string menu_item_ip 0x7f0b003a
int string menu_item_log 0x7f0b003b
int string menu_item_operations 0x7f0b0038
int string menu_item_phone_info 0x7f0b0081
int string menu_item_pin 0x7f0b0039
int string no 0x7f0b008f
int string options_clear 0x7f0b001f
int string options_exit 0x7f0b0020
int string options_register 0x7f0b001c
int string options_unregister 0x7f0b001d
int string register_button_text 0x7f0b007f
int string register_text_view_text_unregister 0x7f0b0080
int string registration_heading 0x7f0b0099
int string server_register_error 0x7f0b001a
int string server_registered 0x7f0b0018
int string server_registering 0x7f0b0017
int string server_unregister_error 0x7f0b001b
int string server_unregistered 0x7f0b0019
int string server_util_req_type_get 0x7f0b0097
int string server_util_req_type_post 0x7f0b0096
int string shared_pref_client_id 0x7f0b005f
int string shared_pref_client_secret 0x7f0b0060
int string shared_pref_device_active 0x7f0b005e
int string shared_pref_eula 0x7f0b0054
int string shared_pref_interval 0x7f0b005d
int string shared_pref_ip 0x7f0b0053
int string shared_pref_isagreed 0x7f0b0051
int string shared_pref_message_mode 0x7f0b005c
int string shared_pref_package 0x7f0b004f
int string shared_pref_pin 0x7f0b0057
int string shared_pref_policy 0x7f0b0050
int string shared_pref_regId 0x7f0b0055
int string shared_pref_reg_fail 0x7f0b0059
int string shared_pref_reg_success 0x7f0b0058
int string shared_pref_reg_type 0x7f0b005a
int string shared_pref_registered 0x7f0b0052
int string shared_pref_sender_id 0x7f0b005b
int string shared_pref_username 0x7f0b0056
int string string_content 0x7f0b001e
int string title_activity_agent_settings 0x7f0b0036
int string title_activity_alert 0x7f0b003c
int string title_activity_authentication_error 0x7f0b0033
int string title_activity_available_operations 0x7f0b0037
int string title_activity_display_device_info 0x7f0b0025
int string title_activity_entry 0x7f0b0028
int string title_activity_log 0x7f0b0098
int string title_activity_notification 0x7f0b0034
int string title_activity_notify 0x7f0b0035
int string title_activity_register_successful 0x7f0b0027
int string title_head_authentication_error 0x7f0b0029
int string title_head_connection_error 0x7f0b002b
int string title_head_init_error 0x7f0b0041
int string title_head_notification_error 0x7f0b002c
int string title_head_registration_error 0x7f0b002a
int string title_init_msg_error 0x7f0b0040
int string toast_error_password 0x7f0b0047
int string toast_error_username 0x7f0b0046
int string toast_message_enter_server_address 0x7f0b0045
int string toast_message_pin_change_failed 0x7f0b0044
int string toast_message_pin_change_success 0x7f0b0043
int string url 0x7f0b0026
int string yes 0x7f0b008e
int style AppBaseTheme 0x7f0c0059
int style AppTheme 0x7f0c005a
int style ButtonText 0x7f0c005f
int style DialogWindowTitle_Sherlock 0x7f0c0036
int style DialogWindowTitle_Sherlock_Light 0x7f0c0037
int style Sherlock___TextAppearance_Small 0x7f0c004a
int style Sherlock___Theme 0x7f0c004e
int style Sherlock___Theme_DarkActionBar 0x7f0c0050
int style Sherlock___Theme_Dialog 0x7f0c0051
int style Sherlock___Theme_Light 0x7f0c004f
int style Sherlock___Widget_ActionBar 0x7f0c0001
int style Sherlock___Widget_ActionMode 0x7f0c0016
int style Sherlock___Widget_ActivityChooserView 0x7f0c001e
int style Sherlock___Widget_Holo_DropDownItem 0x7f0c0029
int style Sherlock___Widget_Holo_ListView 0x7f0c0026
int style Sherlock___Widget_Holo_Spinner 0x7f0c0023
int style Sherlock___Widget_SearchAutoCompleteTextView 0x7f0c0033
int style TextAppearance_Sherlock_DialogWindowTitle 0x7f0c0048
int style TextAppearance_Sherlock_Light_DialogWindowTitle 0x7f0c0049
int style TextAppearance_Sherlock_Light_Small 0x7f0c004c
int style TextAppearance_Sherlock_Light_Widget_PopupMenu_Large 0x7f0c0043
int style TextAppearance_Sherlock_Light_Widget_PopupMenu_Small 0x7f0c0045
int style TextAppearance_Sherlock_Small 0x7f0c004b
int style TextAppearance_Sherlock_Widget_ActionBar_Menu 0x7f0c0038
int style TextAppearance_Sherlock_Widget_ActionBar_Subtitle 0x7f0c003b
int style TextAppearance_Sherlock_Widget_ActionBar_Subtitle_Inverse 0x7f0c003c
int style TextAppearance_Sherlock_Widget_ActionBar_Title 0x7f0c0039
int style TextAppearance_Sherlock_Widget_ActionBar_Title_Inverse 0x7f0c003a
int style TextAppearance_Sherlock_Widget_ActionMode_Subtitle 0x7f0c003f
int style TextAppearance_Sherlock_Widget_ActionMode_Subtitle_Inverse 0x7f0c0040
int style TextAppearance_Sherlock_Widget_ActionMode_Title 0x7f0c003d
int style TextAppearance_Sherlock_Widget_ActionMode_Title_Inverse 0x7f0c003e
int style TextAppearance_Sherlock_Widget_DropDownHint 0x7f0c004d
int style TextAppearance_Sherlock_Widget_DropDownItem 0x7f0c0047
int style TextAppearance_Sherlock_Widget_PopupMenu 0x7f0c0041
int style TextAppearance_Sherlock_Widget_PopupMenu_Large 0x7f0c0042
int style TextAppearance_Sherlock_Widget_PopupMenu_Small 0x7f0c0044
int style TextAppearance_Sherlock_Widget_TextView_SpinnerItem 0x7f0c0046
int style Theme_Sherlock 0x7f0c0052
int style Theme_Sherlock_Dialog 0x7f0c0057
int style Theme_Sherlock_Light 0x7f0c0053
int style Theme_Sherlock_Light_DarkActionBar 0x7f0c0054
int style Theme_Sherlock_Light_Dialog 0x7f0c0058
int style Theme_Sherlock_Light_NoActionBar 0x7f0c0056
int style Theme_Sherlock_NoActionBar 0x7f0c0055
int style TitleBar 0x7f0c005c
int style TitleBarLogo 0x7f0c005d
int style TitleBarOption 0x7f0c005e
int style TopBarTheme 0x7f0c005b
int style Widget 0x7f0c0000
int style Widget_Sherlock_ActionBar 0x7f0c0002
int style Widget_Sherlock_ActionBar_Solid 0x7f0c0003
int style Widget_Sherlock_ActionBar_TabBar 0x7f0c000a
int style Widget_Sherlock_ActionBar_TabText 0x7f0c000d
int style Widget_Sherlock_ActionBar_TabView 0x7f0c0007
int style Widget_Sherlock_ActionButton 0x7f0c0010
int style Widget_Sherlock_ActionButton_CloseMode 0x7f0c0012
int style Widget_Sherlock_ActionButton_Overflow 0x7f0c0014
int style Widget_Sherlock_ActionMode 0x7f0c0017
int style Widget_Sherlock_ActivityChooserView 0x7f0c001f
int style Widget_Sherlock_Button_Small 0x7f0c0021
int style Widget_Sherlock_DropDownItem_Spinner 0x7f0c002a
int style Widget_Sherlock_Light_ActionBar 0x7f0c0004
int style Widget_Sherlock_Light_ActionBar_Solid 0x7f0c0005
int style Widget_Sherlock_Light_ActionBar_Solid_Inverse 0x7f0c0006
int style Widget_Sherlock_Light_ActionBar_TabBar 0x7f0c000b
int style Widget_Sherlock_Light_ActionBar_TabBar_Inverse 0x7f0c000c
int style Widget_Sherlock_Light_ActionBar_TabText 0x7f0c000e
int style Widget_Sherlock_Light_ActionBar_TabText_Inverse 0x7f0c000f
int style Widget_Sherlock_Light_ActionBar_TabView 0x7f0c0008
int style Widget_Sherlock_Light_ActionBar_TabView_Inverse 0x7f0c0009
int style Widget_Sherlock_Light_ActionButton 0x7f0c0011
int style Widget_Sherlock_Light_ActionButton_CloseMode 0x7f0c0013
int style Widget_Sherlock_Light_ActionButton_Overflow 0x7f0c0015
int style Widget_Sherlock_Light_ActionMode 0x7f0c0018
int style Widget_Sherlock_Light_ActionMode_Inverse 0x7f0c0019
int style Widget_Sherlock_Light_ActivityChooserView 0x7f0c0020
int style Widget_Sherlock_Light_Button_Small 0x7f0c0022
int style Widget_Sherlock_Light_DropDownItem_Spinner 0x7f0c002b
int style Widget_Sherlock_Light_ListPopupWindow 0x7f0c001b
int style Widget_Sherlock_Light_ListView_DropDown 0x7f0c0028
int style Widget_Sherlock_Light_PopupMenu 0x7f0c001d
int style Widget_Sherlock_Light_PopupWindow_ActionMode 0x7f0c002d
int style Widget_Sherlock_Light_ProgressBar 0x7f0c002f
int style Widget_Sherlock_Light_ProgressBar_Horizontal 0x7f0c0031
int style Widget_Sherlock_Light_SearchAutoCompleteTextView 0x7f0c0035
int style Widget_Sherlock_Light_Spinner_DropDown_ActionBar 0x7f0c0025
int style Widget_Sherlock_ListPopupWindow 0x7f0c001a
int style Widget_Sherlock_ListView_DropDown 0x7f0c0027
int style Widget_Sherlock_PopupMenu 0x7f0c001c
int style Widget_Sherlock_PopupWindow_ActionMode 0x7f0c002c
int style Widget_Sherlock_ProgressBar 0x7f0c002e
int style Widget_Sherlock_ProgressBar_Horizontal 0x7f0c0030
int style Widget_Sherlock_SearchAutoCompleteTextView 0x7f0c0034
int style Widget_Sherlock_Spinner_DropDown_ActionBar 0x7f0c0024
int style Widget_Sherlock_TextView_SpinnerItem 0x7f0c0032
int[] styleable SherlockActionBar { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004, 0x7f010005, 0x7f010048, 0x7f010049, 0x7f01004a, 0x7f01004b, 0x7f01004c, 0x7f01004d, 0x7f01004e, 0x7f01004f, 0x7f010050, 0x7f010051, 0x7f010052, 0x7f010053, 0x7f010054 }
int styleable SherlockActionBar_background 2
int styleable SherlockActionBar_backgroundSplit 3
int styleable SherlockActionBar_backgroundStacked 12
int styleable SherlockActionBar_customNavigationLayout 13
int styleable SherlockActionBar_displayOptions 7
int styleable SherlockActionBar_divider 5
int styleable SherlockActionBar_height 4
int styleable SherlockActionBar_homeLayout 14
int styleable SherlockActionBar_icon 10
int styleable SherlockActionBar_indeterminateProgressStyle 16
int styleable SherlockActionBar_itemPadding 18
int styleable SherlockActionBar_logo 11
int styleable SherlockActionBar_navigationMode 6
int styleable SherlockActionBar_progressBarPadding 17
int styleable SherlockActionBar_progressBarStyle 15
int styleable SherlockActionBar_subtitle 9
int styleable SherlockActionBar_subtitleTextStyle 1
int styleable SherlockActionBar_title 8
int styleable SherlockActionBar_titleTextStyle 0
int[] styleable SherlockActionMenuItemView { 0x0101013f }
int styleable SherlockActionMenuItemView_android_minWidth 0
int[] styleable SherlockActionMode { 0x7f010000, 0x7f010001, 0x7f010002, 0x7f010003, 0x7f010004 }
int styleable SherlockActionMode_background 2
int styleable SherlockActionMode_backgroundSplit 3
int styleable SherlockActionMode_height 4
int styleable SherlockActionMode_subtitleTextStyle 1
int styleable SherlockActionMode_titleTextStyle 0
int[] styleable SherlockActivityChooserView { 0x010100d4, 0x7f01005d, 0x7f01005e }
int styleable SherlockActivityChooserView_android_background 0
int styleable SherlockActivityChooserView_expandActivityOverflowButtonDrawable 2
int styleable SherlockActivityChooserView_initialActivityCount 1
int[] styleable SherlockMenuGroup { 0x0101000e, 0x010100d0, 0x01010194, 0x010101de, 0x010101df, 0x010101e0 }
int styleable SherlockMenuGroup_android_checkableBehavior 5
int styleable SherlockMenuGroup_android_enabled 0
int styleable SherlockMenuGroup_android_id 1
int styleable SherlockMenuGroup_android_menuCategory 3
int styleable SherlockMenuGroup_android_orderInCategory 4
int styleable SherlockMenuGroup_android_visible 2
int[] styleable SherlockMenuItem { 0x01010002, 0x0101000e, 0x010100d0, 0x01010106, 0x01010194, 0x010101de, 0x010101df, 0x010101e1, 0x010101e2, 0x010101e3, 0x010101e4, 0x010101e5, 0x0101026f, 0x010102d9, 0x010102fb, 0x010102fc, 0x01010389 }
int styleable SherlockMenuItem_android_actionLayout 14
int styleable SherlockMenuItem_android_actionProviderClass 16
int styleable SherlockMenuItem_android_actionViewClass 15
int styleable SherlockMenuItem_android_alphabeticShortcut 9
int styleable SherlockMenuItem_android_checkable 11
int styleable SherlockMenuItem_android_checked 3
int styleable SherlockMenuItem_android_enabled 1
int styleable SherlockMenuItem_android_icon 0
int styleable SherlockMenuItem_android_id 2
int styleable SherlockMenuItem_android_menuCategory 5
int styleable SherlockMenuItem_android_numericShortcut 10
int styleable SherlockMenuItem_android_onClick 12
int styleable SherlockMenuItem_android_orderInCategory 6
int styleable SherlockMenuItem_android_showAsAction 13
int styleable SherlockMenuItem_android_title 7
int styleable SherlockMenuItem_android_titleCondensed 8
int styleable SherlockMenuItem_android_visible 4
int[] styleable SherlockMenuView { 0x7f010055, 0x7f010056, 0x7f010057, 0x7f010058, 0x7f010059, 0x7f01005a, 0x7f01005b, 0x7f01005c }
int styleable SherlockMenuView_headerBackground 3
int styleable SherlockMenuView_horizontalDivider 1
int styleable SherlockMenuView_itemBackground 4
int styleable SherlockMenuView_itemIconDisabledAlpha 6
int styleable SherlockMenuView_itemTextAppearance 0
int styleable SherlockMenuView_preserveIconSpacing 7
int styleable SherlockMenuView_verticalDivider 2
int styleable SherlockMenuView_windowAnimationStyle 5
int[] styleable SherlockSearchView { 0x0101011f, 0x01010220, 0x01010264, 0x7f01005f, 0x7f010060 }
int styleable SherlockSearchView_android_imeOptions 2
int styleable SherlockSearchView_android_inputType 1
int styleable SherlockSearchView_android_maxWidth 0
int styleable SherlockSearchView_iconifiedByDefault 3
int styleable SherlockSearchView_queryHint 4
int[] styleable SherlockSpinner { 0x010100af, 0x01010175, 0x01010176, 0x0101017b, 0x01010262, 0x010102ac, 0x010102ad, 0x0101043a }
int styleable SherlockSpinner_android_dropDownHorizontalOffset 5
int styleable SherlockSpinner_android_dropDownSelector 1
int styleable SherlockSpinner_android_dropDownVerticalOffset 6
int styleable SherlockSpinner_android_dropDownWidth 4
int styleable SherlockSpinner_android_gravity 0
int styleable SherlockSpinner_android_popupBackground 2
int styleable SherlockSpinner_android_popupPromptView 7
int styleable SherlockSpinner_android_prompt 3
int[] styleable SherlockTheme { 0x01010057, 0x7f010006, 0x7f010007, 0x7f010008, 0x7f010009, 0x7f01000a, 0x7f01000b, 0x7f01000c, 0x7f01000d, 0x7f01000e, 0x7f01000f, 0x7f010010, 0x7f010011, 0x7f010012, 0x7f010013, 0x7f010014, 0x7f010015, 0x7f010016, 0x7f010017, 0x7f010018, 0x7f010019, 0x7f01001a, 0x7f01001b, 0x7f01001c, 0x7f01001d, 0x7f01001e, 0x7f01001f, 0x7f010020, 0x7f010021, 0x7f010022, 0x7f010023, 0x7f010024, 0x7f010025, 0x7f010026, 0x7f010027, 0x7f010028, 0x7f010029, 0x7f01002a, 0x7f01002b, 0x7f01002c, 0x7f01002d, 0x7f01002e, 0x7f01002f, 0x7f010030, 0x7f010031, 0x7f010032, 0x7f010033, 0x7f010034, 0x7f010035, 0x7f010036, 0x7f010037, 0x7f010038, 0x7f010039, 0x7f01003a, 0x7f01003b, 0x7f01003c, 0x7f01003d, 0x7f01003e, 0x7f01003f, 0x7f010040, 0x7f010041, 0x7f010042, 0x7f010043, 0x7f010044, 0x7f010045, 0x7f010046, 0x7f010047 }
int styleable SherlockTheme_actionBarDivider 9
int styleable SherlockTheme_actionBarItemBackground 10
int styleable SherlockTheme_actionBarSize 8
int styleable SherlockTheme_actionBarSplitStyle 6
int styleable SherlockTheme_actionBarStyle 5
int styleable SherlockTheme_actionBarTabBarStyle 2
int styleable SherlockTheme_actionBarTabStyle 1
int styleable SherlockTheme_actionBarTabTextStyle 3
int styleable SherlockTheme_actionBarWidgetTheme 7
int styleable SherlockTheme_actionButtonStyle 53
int styleable SherlockTheme_actionDropDownStyle 52
int styleable SherlockTheme_actionMenuTextAppearance 11
int styleable SherlockTheme_actionMenuTextColor 12
int styleable SherlockTheme_actionModeBackground 15
int styleable SherlockTheme_actionModeCloseButtonStyle 14
int styleable SherlockTheme_actionModeCloseDrawable 17
int styleable SherlockTheme_actionModePopupWindowStyle 19
int styleable SherlockTheme_actionModeShareDrawable 18
int styleable SherlockTheme_actionModeSplitBackground 16
int styleable SherlockTheme_actionModeStyle 13
int styleable SherlockTheme_actionOverflowButtonStyle 4
int styleable SherlockTheme_actionSpinnerItemStyle 58
int styleable SherlockTheme_activatedBackgroundIndicator 66
int styleable SherlockTheme_activityChooserViewStyle 65
int styleable SherlockTheme_android_windowIsFloating 0
int styleable SherlockTheme_buttonStyleSmall 20
int styleable SherlockTheme_dividerVertical 51
int styleable SherlockTheme_dropDownListViewStyle 55
int styleable SherlockTheme_dropdownListPreferredItemHeight 57
int styleable SherlockTheme_homeAsUpIndicator 54
int styleable SherlockTheme_listPopupWindowStyle 64
int styleable SherlockTheme_listPreferredItemHeightSmall 45
int styleable SherlockTheme_listPreferredItemPaddingLeft 46
int styleable SherlockTheme_listPreferredItemPaddingRight 47
int styleable SherlockTheme_popupMenuStyle 56
int styleable SherlockTheme_searchAutoCompleteTextView 31
int styleable SherlockTheme_searchDropdownBackground 32
int styleable SherlockTheme_searchResultListItemHeight 42
int styleable SherlockTheme_searchViewCloseIcon 33
int styleable SherlockTheme_searchViewEditQuery 37
int styleable SherlockTheme_searchViewEditQueryBackground 38
int styleable SherlockTheme_searchViewGoIcon 34
int styleable SherlockTheme_searchViewSearchIcon 35
int styleable SherlockTheme_searchViewTextField 39
int styleable SherlockTheme_searchViewTextFieldRight 40
int styleable SherlockTheme_searchViewVoiceIcon 36
int styleable SherlockTheme_selectableItemBackground 21
int styleable SherlockTheme_spinnerDropDownItemStyle 30
int styleable SherlockTheme_spinnerItemStyle 29
int styleable SherlockTheme_textAppearanceLargePopupMenu 23
int styleable SherlockTheme_textAppearanceListItemSmall 48
int styleable SherlockTheme_textAppearanceSearchResultSubtitle 44
int styleable SherlockTheme_textAppearanceSearchResultTitle 43
int styleable SherlockTheme_textAppearanceSmall 25
int styleable SherlockTheme_textAppearanceSmallPopupMenu 24
int styleable SherlockTheme_textColorPrimary 26
int styleable SherlockTheme_textColorPrimaryDisableOnly 27
int styleable SherlockTheme_textColorPrimaryInverse 28
int styleable SherlockTheme_textColorSearchUrl 41
int styleable SherlockTheme_windowActionBar 60
int styleable SherlockTheme_windowActionBarOverlay 61
int styleable SherlockTheme_windowActionModeOverlay 62
int styleable SherlockTheme_windowContentOverlay 22
int styleable SherlockTheme_windowMinWidthMajor 49
int styleable SherlockTheme_windowMinWidthMinor 50
int styleable SherlockTheme_windowNoTitle 59
int styleable SherlockTheme_windowSplitActionBar 63
int[] styleable SherlockView { 0x010100da }
int styleable SherlockView_android_focusable 0
int xml wso2_device_admin 0x7f040000

@ -1,5 +0,0 @@
# cache for current jar dependency. DO NOT EDIT.
# format is <lastModified> <length> <SHA-1> <path>
# Encoding is UTF-8
1417676912000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-cdm/product/modules/agents/android/client/libs/android-support-v4.jar
1417676912000 484258 bd6479f5dd592790607e0504e66e0f31c2b4d308 /home/inoshp/Documents/work/EMM 2.0/Source/CDM/product-cdm/product/modules/agents/android/client/plugins/ActionBarSherlock/library/libs/android-support-v4.jar

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.9 KiB

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save