Installation APP service

revert-70aa11f8
manoj 10 years ago
parent 1b1b66fc29
commit 3589804ede

@ -19,6 +19,7 @@ package org.wso2.carbon.device.mgt.common.app.mgt;
import org.wso2.carbon.device.mgt.common.Application; import org.wso2.carbon.device.mgt.common.Application;
import org.wso2.carbon.device.mgt.common.Credential; import org.wso2.carbon.device.mgt.common.Credential;
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.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List; import java.util.List;

@ -18,10 +18,7 @@
package org.wso2.carbon.device.mgt.common.spi; package org.wso2.carbon.device.mgt.common.spi;
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.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.FeatureManager;
import java.util.List; import java.util.List;
@ -124,7 +121,7 @@ public interface DeviceManager {
* @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, List<Application> applicationList) 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.

@ -378,10 +378,10 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device, List<Application> applicationList) throws DeviceManagementException {
DeviceManager dms = DeviceManager dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType()); this.getPluginRepository().getDeviceManagementProvider(device.getType());
return dms.updateDeviceInfo(device); return dms.updateDeviceInfo(device,applicationList);
} }
@Override @Override

@ -17,18 +17,21 @@
*/ */
package org.wso2.carbon.device.mgt.core.app.mgt; package org.wso2.carbon.device.mgt.core.app.mgt;
import org.wso2.carbon.device.mgt.common.Application; import org.apache.commons.logging.Log;
import org.wso2.carbon.device.mgt.common.Credential; import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnector; import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnector;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException; import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation; import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder; import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import java.util.ArrayList;
import java.util.List; import java.util.List;
public class AppManagementServiceImpl implements AppManagerConnector { public class AppManagementServiceImpl implements AppManagerConnector {
private static final Log log = LogFactory.getLog(AppManagementServiceImpl.class);
@Override @Override
public Application[] getApplicationList(String domain, int pageNumber, int size) throws AppManagerConnectorException { public Application[] getApplicationList(String domain, int pageNumber, int size) throws AppManagerConnectorException {
return DeviceManagementDataHolder.getInstance().getAppManager().getApplicationList(domain, pageNumber, size); return DeviceManagementDataHolder.getInstance().getAppManager().getApplicationList(domain, pageNumber, size);
@ -55,6 +58,14 @@ public class AppManagementServiceImpl implements AppManagerConnector {
@Override @Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers) public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException { throws AppManagerConnectorException {
try {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(operation,
deviceIdentifiers);
} catch (OperationManagementException opMgtEx) {
String errorMsg = "Error occurred when add operations at install application";
log.error(errorMsg, opMgtEx);
throw new AppManagerConnectorException();
}
DeviceManagementDataHolder.getInstance().getAppManager().installApplication(operation, deviceIdentifiers); DeviceManagementDataHolder.getInstance().getAppManager().installApplication(operation, deviceIdentifiers);
} }

@ -98,8 +98,9 @@ public class DeviceManagementServiceImpl implements DeviceManagementService {
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device, List<Application> applicationList) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().updateDeviceInfo(device); return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
updateDeviceInfo(device, applicationList);
} }
@Override @Override

@ -79,7 +79,7 @@ public class TestDeviceManager implements DeviceMgtService {
} }
@Override @Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException { public boolean updateDeviceInfo(Device device, sList<Application> applicationList) throws DeviceManagementException {
return false; return false;
} }

Loading…
Cancel
Save