fixing packaging structure of mobile impl module and adding operations manager related interfaces

revert-dabc3590
prabathabey 10 years ago
parent f3a73b453e
commit 7f089b2a30

@ -15,6 +15,7 @@
*/ */
package org.wso2.carbon.device.mgt.common; package org.wso2.carbon.device.mgt.common;
@SuppressWarnings("unused")
public class DeviceManagementException extends Exception { public class DeviceManagementException extends Exception {
private static final long serialVersionUID = -3151279311929070297L; private static final long serialVersionUID = -3151279311929070297L;

@ -0,0 +1,55 @@
/**
* 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.common;
public class OperationExecutionException extends Exception {
private static final long serialVersionUID = -3151279311929070299L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public OperationExecutionException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public OperationExecutionException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public OperationExecutionException(String msg) {
super(msg);
setErrorMessage(msg);
}
public OperationExecutionException() {
super();
}
public OperationExecutionException(Throwable cause) {
super(cause);
}
}

@ -0,0 +1,55 @@
/**
* Copyright (c) 2012, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.wso2.carbon.device.mgt.common;
public class OperationManagementException extends Exception {
private static final long serialVersionUID = -3151279311929070298L;
private String errorMessage;
public String getErrorMessage() {
return errorMessage;
}
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
}
public OperationManagementException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public OperationManagementException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public OperationManagementException(String msg) {
super(msg);
setErrorMessage(msg);
}
public OperationManagementException() {
super();
}
public OperationManagementException(Throwable cause) {
super(cause);
}
}

@ -0,0 +1,22 @@
/**
* 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.common;
public interface OperationManager {
boolean executeOperation();
}

@ -18,6 +18,7 @@ package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import java.util.List; import java.util.List;
@ -28,7 +29,8 @@ import java.util.List;
public interface DeviceManagerService { public interface DeviceManagerService {
/** /**
* Method to retrieve the provider type that implements DeviceManagerService interface * Method to retrieve the provider type that implements DeviceManagerService interface.
*
* @return Returns provider type * @return Returns provider type
*/ */
String getProviderType(); String getProviderType();
@ -42,7 +44,7 @@ public interface DeviceManagerService {
boolean enrollDevice(Device device) throws DeviceManagementException; boolean enrollDevice(Device device) throws DeviceManagementException;
/** /**
* Method to modify the metadata corresponding to device enrollment * Method to modify the metadata corresponding to device enrollment.
* *
* @param device Modified device enrollment related metadata * @param device Modified device enrollment related metadata
* @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a
@ -92,11 +94,10 @@ public interface DeviceManagerService {
/** /**
* Method to retrieve metadata of all devices registered within CDM corresponding to a particular device type. * Method to retrieve metadata of all devices registered within CDM corresponding to a particular device type.
* *
* @param type Device Type
* @return List of metadata corresponding to all devices registered within CDM * @return List of metadata corresponding to all devices registered within CDM
* @throws DeviceManagementException If some unusual behaviour is observed while obtaining the enrolled device list * @throws DeviceManagementException If some unusual behaviour is observed while obtaining the enrolled device list
*/ */
List<Device> getAllDevices(String type) throws DeviceManagementException; List<Device> getAllDevices() throws DeviceManagementException;
/** /**
* Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier. * Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier.
@ -109,13 +110,14 @@ public interface DeviceManagerService {
/** /**
* Method to update device information. * Method to update device information.
*
* @param device Updated device information related data * @param device Updated device information related data
* @throws DeviceManagementException If some unusual behaviour is observed while updating the device info * @throws DeviceManagementException If some unusual behaviour is observed while updating the device info
*/ */
boolean updateDeviceInfo(Device device) throws DeviceManagementException; boolean updateDeviceInfo(Device device) throws DeviceManagementException;
/** /**
* Method to set the ownership type of a particular device. i.e. BYOD, COPE * Method to set the ownership type of a particular device. i.e. BYOD, COPE.
* *
* @param deviceId Fully qualified device identifier * @param deviceId Fully qualified device identifier
* @param ownershipType Type of ownership * @param ownershipType Type of ownership
@ -124,4 +126,12 @@ public interface DeviceManagerService {
*/ */
boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException; boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
/**
* Method to retrieve the Operation manager implementation associated with a given plugin.
*
* @return An appropriate instance of the underlying operation management implementation
* @throws DeviceManagementException
*/
OperationManager getOperationManager() throws DeviceManagementException;
} }

@ -18,139 +18,36 @@ package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import java.util.List; import java.util.List;
public class DeviceManager implements DeviceManagerService { /**
* Proxy class for all Device Management related operations that take the corresponding plugin type in
private DeviceDAO deviceDAO; * and resolve the appropriate plugin implementation
private DeviceTypeDAO deviceTypeDAO; */
private DeviceManagementConfig config; public interface DeviceManager {
private DeviceManagementRepository pluginRepository;
public DeviceManager(DeviceManagementConfig config, DeviceManagementRepository pluginRepository) {
this.config = config;
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
}
@Override
public String getProviderType() {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.enrollDevice(device);
try {
this.getDeviceTypeDAO().getDeviceType();
org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(
device);
Integer deviceTypeId = this.getDeviceDAO().getDeviceTypeIdByDeviceTypeName(device.getType());
deviceDto.setDeviceType(deviceTypeId);
this.getDeviceDAO().addDevice(deviceDto);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while enrolling the device '" +
device.getId() + "'", e);
}
return status;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.modifyEnrollment(device);
try {
this.getDeviceDAO().updateDevice(DeviceManagementDAOUtil.convertDevice(device));
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while modifying the device '" +
device.getId() + "'", e);
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.disenrollDevice(deviceId);
}
@Override public boolean enrollDevice(Device device) throws DeviceManagementException;
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isEnrolled(deviceId);
}
@Override public boolean modifyEnrollment(Device device) throws DeviceManagementException;
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isActive(deviceId);
}
@Override public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setActive(deviceId, status);
}
@Override public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException;
public List<Device> getAllDevices(String type) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(type);
return dms.getAllDevices(type);
}
@Override public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.getDevice(deviceId);
}
@Override public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException;
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device);
}
@Override public List<Device> getAllDevices(String type) throws DeviceManagementException;
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setOwnership(deviceId, ownershipType);
}
public DeviceDAO getDeviceDAO() { public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
return deviceDAO;
}
public DeviceTypeDAO getDeviceTypeDAO() { public boolean updateDeviceInfo(Device device) throws DeviceManagementException;
return deviceTypeDAO;
}
public DeviceManagementConfig getDeviceManagementConfig() { public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
return config;
}
public DeviceManagementRepository getPluginRepository() { public OperationManager getOperationManager(String type) throws DeviceManagementException;
return pluginRepository;
}
} }

@ -0,0 +1,154 @@
/**
* 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.core;
import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOException;
import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.dao.DeviceTypeDAO;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import java.util.List;
public class DeviceManagerImpl implements DeviceManager{
private DeviceDAO deviceDAO;
private DeviceTypeDAO deviceTypeDAO;
private DeviceManagementConfig config;
private DeviceManagementRepository pluginRepository;
public DeviceManagerImpl(DeviceManagementConfig config, DeviceManagementRepository pluginRepository) {
this.config = config;
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.enrollDevice(device);
try {
this.getDeviceTypeDAO().getDeviceType();
org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(
device);
Integer deviceTypeId = this.getDeviceDAO().getDeviceTypeIdByDeviceTypeName(device.getType());
deviceDto.setDeviceType(deviceTypeId);
this.getDeviceDAO().addDevice(deviceDto);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while enrolling the device '" +
device.getId() + "'", e);
}
return status;
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.modifyEnrollment(device);
try {
this.getDeviceDAO().updateDevice(DeviceManagementDAOUtil.convertDevice(device));
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while modifying the device '" +
device.getId() + "'", e);
}
return status;
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.disenrollDevice(deviceId);
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isEnrolled(deviceId);
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.isActive(deviceId);
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setActive(deviceId, status);
}
@Override
public List<Device> getAllDevices(String type) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(type);
return dms.getAllDevices();
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.getDevice(deviceId);
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device);
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setOwnership(deviceId, ownershipType);
}
public OperationManager getOperationManager(String type) throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(type);
return dms.getOperationManager();
}
public DeviceDAO getDeviceDAO() {
return deviceDAO;
}
public DeviceTypeDAO getDeviceTypeDAO() {
return deviceTypeDAO;
}
public DeviceManagementRepository getPluginRepository() {
return pluginRepository;
}
}

@ -19,8 +19,8 @@
package org.wso2.carbon.device.mgt.core.internal; package org.wso2.carbon.device.mgt.core.internal;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.DeviceManager; import org.wso2.carbon.device.mgt.core.DeviceManager;
import org.wso2.carbon.device.mgt.core.DeviceManagerImpl;
import org.wso2.carbon.user.core.service.RealmService; import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.user.core.tenant.TenantManager; import org.wso2.carbon.user.core.tenant.TenantManager;

@ -23,6 +23,7 @@ import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository; import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.DeviceManager; import org.wso2.carbon.device.mgt.core.DeviceManager;
import org.wso2.carbon.device.mgt.core.DeviceManagerImpl;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager; import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig; import org.wso2.carbon.device.mgt.core.config.DeviceManagementConfig;
import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.mgt.core.config.datasource.DataSourceConfig;
@ -61,7 +62,7 @@ public class DeviceManagementServiceComponent {
DataSourceConfig dsConfig = config.getDeviceMgtRepository().getDataSourceConfig(); DataSourceConfig dsConfig = config.getDeviceMgtRepository().getDataSourceConfig();
DeviceManagementDAOFactory.init(dsConfig); DeviceManagementDAOFactory.init(dsConfig);
DeviceManager deviceManager = new DeviceManager(config, this.getPluginRepository()); DeviceManager deviceManager = new DeviceManagerImpl(config, this.getPluginRepository());
DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager); DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager);
/* If -Dsetup option enabled then create device management database schema */ /* If -Dsetup option enabled then create device management database schema */

@ -18,17 +18,14 @@ package org.wso2.carbon.device.mgt.core.service;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.core.DeviceManager;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import java.util.List; import java.util.List;
public class DeviceManagementService implements DeviceManagerService { public class DeviceManagementService implements DeviceManager {
@Override
public String getProviderType() {
return null;
}
@Override @Override
public boolean enrollDevice(Device device) throws DeviceManagementException { public boolean enrollDevice(Device device) throws DeviceManagementException {
@ -85,4 +82,10 @@ public class DeviceManagementService implements DeviceManagerService {
.setOwnership(deviceId, ownershipType); .setOwnership(deviceId, ownershipType);
} }
@Override
public OperationManager getOperationManager(String type) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager().
getOperationManager(type);
}
} }

@ -35,15 +35,15 @@
<Bundle-Name>${project.artifactId}</Bundle-Name> <Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${project.version}</Bundle-Version> <Bundle-Version>${project.version}</Bundle-Version>
<Bundle-Description>Device Management Mobile Impl Bundle</Bundle-Description> <Bundle-Description>Device Management Mobile Impl Bundle</Bundle-Description>
<Bundle-Activator>org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementBundleActivator</Bundle-Activator> <Bundle-Activator>org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementBundleActivator</Bundle-Activator>
<Private-Package>org.wso2.carbon.device.mgt.mobile.impl.internal</Private-Package> <Private-Package>org.wso2.carbon.device.mgt.mobile.internal</Private-Package>
<Import-Package> <Import-Package>
org.osgi.framework, org.osgi.framework,
org.osgi.service.component, org.osgi.service.component,
org.apache.commons.logging, org.apache.commons.logging,
</Import-Package> </Import-Package>
<Export-Package> <Export-Package>
!org.wso2.carbon.device.mgt.mobile.impl.internal, !org.wso2.carbon.device.mgt.mobile.internal,
org.wso2.carbon.device.mgt.mobile.impl.* org.wso2.carbon.device.mgt.mobile.impl.*
</Export-Package> </Export-Package>
<DynamicImport-Package>*</DynamicImport-Package> <DynamicImport-Package>*</DynamicImport-Package>

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

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl; package org.wso2.carbon.device.mgt.mobile;
public interface DataSourceListener { public interface DataSourceListener {

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config; package org.wso2.carbon.device.mgt.mobile.config;
import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.APIProvider;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config; package org.wso2.carbon.device.mgt.mobile.config;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;

@ -14,12 +14,12 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config; package org.wso2.carbon.device.mgt.mobile.config;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.util.MobileDeviceManagementUtil; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.utils.CarbonUtils; import org.wso2.carbon.utils.CarbonUtils;
import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBContext;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config; package org.wso2.carbon.device.mgt.mobile.config;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;

@ -13,9 +13,9 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config; package org.wso2.carbon.device.mgt.mobile.config;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config.datasource; package org.wso2.carbon.device.mgt.mobile.config.datasource;
import javax.xml.bind.annotation.*; import javax.xml.bind.annotation.*;
import java.util.List; import java.util.List;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.config.datasource; package org.wso2.carbon.device.mgt.mobile.config.datasource;
import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlRootElement;

@ -14,9 +14,9 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dao; package org.wso2.carbon.device.mgt.mobile.dao;
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
/** /**
* This class represents the key operations associated with persisting mobile-device related * This class represents the key operations associated with persisting mobile-device related

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dao; package org.wso2.carbon.device.mgt.mobile.dao;
/** /**
* Custom exception class for mobile device specific data access related exceptions. * Custom exception class for mobile device specific data access related exceptions.

@ -14,15 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dao; package org.wso2.carbon.device.mgt.mobile.dao;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; import org.wso2.carbon.device.mgt.mobile.DataSourceListener;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.impl.dao.impl.MobileDeviceDAOImpl; import org.wso2.carbon.device.mgt.mobile.dao.impl.MobileDeviceDAOImpl;
import org.wso2.carbon.device.mgt.mobile.impl.dao.util.MobileDeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.internal.MobileDeviceManagementBundleActivator; import org.wso2.carbon.device.mgt.mobile.internal.MobileDeviceManagementBundleActivator;
import javax.sql.DataSource; import javax.sql.DataSource;

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dao.impl; package org.wso2.carbon.device.mgt.mobile.dao.impl;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceDAO; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceDAO;
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.impl.dao.util.MobileDeviceManagementDAOUtil; import org.wso2.carbon.device.mgt.mobile.dao.util.MobileDeviceManagementDAOUtil;
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import javax.sql.DataSource; import javax.sql.DataSource;
import java.sql.Connection; import java.sql.Connection;

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dao.util; package org.wso2.carbon.device.mgt.mobile.dao.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.JNDILookupDefinition; import org.wso2.carbon.device.mgt.mobile.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.impl.util.MobileDeviceManagementSchemaInitializer; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementSchemaInitializer;
import javax.naming.InitialContext; import javax.naming.InitialContext;
import javax.sql.DataSource; import javax.sql.DataSource;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.dto; package org.wso2.carbon.device.mgt.mobile.dto;
import java.io.Serializable; import java.io.Serializable;

@ -18,15 +18,12 @@ package org.wso2.carbon.device.mgt.mobile.impl.android;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOException; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOException;
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOFactory; import org.wso2.carbon.device.mgt.mobile.dao.MobileDeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import org.wso2.carbon.device.mgt.mobile.impl.util.MobileDeviceManagementUtil; import org.wso2.carbon.device.mgt.mobile.util.MobileDeviceManagementUtil;
import java.util.List; import java.util.List;
@ -36,6 +33,11 @@ import java.util.List;
public class AndroidDeviceManagerService implements DeviceManagerService { public class AndroidDeviceManagerService implements DeviceManagerService {
private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class); private static final Log log = LogFactory.getLog(AndroidDeviceManagerService.class);
private OperationManager operationManager;
public AndroidDeviceManagerService() {
this.operationManager = new AndroidMobileOperationManager();
}
@Override @Override
public String getProviderType() { public String getProviderType() {
@ -116,7 +118,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
} }
@Override @Override
public List<Device> getAllDevices(String type) throws DeviceManagementException { public List<Device> getAllDevices() throws DeviceManagementException {
return null; return null;
} }
@ -141,7 +143,7 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
return true; return true;
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
boolean status = false; boolean status = false;
MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device); MobileDevice mobileDevice = MobileDeviceManagementUtil.convertToMobileDevice(device);
@ -154,4 +156,10 @@ public class AndroidDeviceManagerService implements DeviceManagerService {
} }
return status; return status;
} }
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return operationManager;
}
} }

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

@ -16,10 +16,7 @@
package org.wso2.carbon.device.mgt.mobile.impl.ios; package org.wso2.carbon.device.mgt.mobile.impl.ios;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import java.util.List; import java.util.List;
@ -66,7 +63,7 @@ public class IOSDeviceManagerService implements DeviceManagerService {
} }
@Override @Override
public List<Device> getAllDevices(String type) throws DeviceManagementException { public List<Device> getAllDevices() throws DeviceManagementException {
return null; return null;
} }
@ -81,6 +78,11 @@ public class IOSDeviceManagerService implements DeviceManagerService {
return true; return true;
} }
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true; return true;

@ -16,10 +16,7 @@
package org.wso2.carbon.device.mgt.mobile.impl.windows; package org.wso2.carbon.device.mgt.mobile.impl.windows;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import java.util.List; import java.util.List;
@ -65,8 +62,7 @@ public class WindowsDeviceManagerService implements DeviceManagerService {
return true; return true;
} }
@Override public List<Device> getAllDevices() throws DeviceManagementException {
public List<Device> getAllDevices(String type) throws DeviceManagementException {
return null; return null;
} }
@ -81,6 +77,11 @@ public class WindowsDeviceManagerService implements DeviceManagerService {
return true; return true;
} }
@Override
public OperationManager getOperationManager() throws DeviceManagementException {
return null;
}
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
return true; return true;

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.internal; package org.wso2.carbon.device.mgt.mobile.internal;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
@ -24,15 +24,15 @@ import org.wso2.carbon.apimgt.api.APIProvider;
import org.wso2.carbon.apimgt.impl.APIManagerFactory; import org.wso2.carbon.apimgt.impl.APIManagerFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.DataSourceListener; 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.impl.android.AndroidDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.config.APIConfig; import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
import org.wso2.carbon.device.mgt.mobile.impl.config.MobileDeviceConfigurationManager; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceConfigurationManager;
import org.wso2.carbon.device.mgt.mobile.impl.config.MobileDeviceManagementConfig; import org.wso2.carbon.device.mgt.mobile.config.MobileDeviceManagementConfig;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig; import org.wso2.carbon.device.mgt.mobile.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.impl.dao.MobileDeviceManagementDAOFactory; 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.impl.ios.IOSDeviceManagerService;
import org.wso2.carbon.device.mgt.mobile.impl.util.DeviceManagementAPIPublisherUtil; import org.wso2.carbon.device.mgt.mobile.util.DeviceManagementAPIPublisherUtil;
import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService;
import java.util.ArrayList; import java.util.ArrayList;

@ -13,7 +13,7 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.util; package org.wso2.carbon.device.mgt.mobile.util;
import org.wso2.carbon.apimgt.api.APIManagementException; import org.wso2.carbon.apimgt.api.APIManagementException;
import org.wso2.carbon.apimgt.api.APIProvider; import org.wso2.carbon.apimgt.api.APIProvider;
@ -22,10 +22,8 @@ import org.wso2.carbon.apimgt.api.model.APIIdentifier;
import org.wso2.carbon.apimgt.api.model.APIStatus; import org.wso2.carbon.apimgt.api.model.APIStatus;
import org.wso2.carbon.apimgt.api.model.URITemplate; import org.wso2.carbon.apimgt.api.model.URITemplate;
import org.wso2.carbon.apimgt.impl.APIConstants; import org.wso2.carbon.apimgt.impl.APIConstants;
import org.wso2.carbon.apimgt.usage.publisher.service.APIMGTConfigReaderService;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.config.APIConfig; import org.wso2.carbon.device.mgt.mobile.config.APIConfig;
import org.wso2.carbon.utils.CarbonUtils;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.LinkedHashSet; import java.util.LinkedHashSet;

@ -14,22 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.util; package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.mobile.impl.config.datasource.MobileDataSourceConfig;
import org.wso2.carbon.device.mgt.mobile.impl.dao.util.MobileDeviceManagementDAOUtil;
import javax.sql.DataSource;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import java.io.File; import java.io.File;
import java.util.Hashtable;
import java.util.List;
public class DeviceManagementUtil { public class DeviceManagementUtil {

@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.util; package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;

@ -14,14 +14,14 @@
* limitations under the License. * limitations under the License.
*/ */
package org.wso2.carbon.device.mgt.mobile.impl.util; package org.wso2.carbon.device.mgt.mobile.util;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.w3c.dom.Document; import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.mobile.impl.dto.MobileDevice; import org.wso2.carbon.device.mgt.mobile.dto.MobileDevice;
import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
Loading…
Cancel
Save