Code cleanup

revert-70aa11f8
prabathabey 10 years ago
parent 67c3c7f9a5
commit c13975191e

@ -1,44 +0,0 @@
/*
*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
/**
* DTO of the consumer key and secret
*/
public class Credential {
String consumerKey;
String consumerSecret;
public String getConsumerKey() {
return consumerKey;
}
public void setConsumerKey(String consumerKey) {
this.consumerKey = consumerKey;
}
public String getConsumerSecret() {
return consumerSecret;
}
public void setConsumerSecret(String consumerSecret) {
this.consumerSecret = consumerSecret;
}
}

@ -1,77 +0,0 @@
/*
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.app.mgt;
import org.wso2.carbon.device.mgt.common.Application;
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.operation.mgt.Operation;
import java.util.List;
/**
* This will handle the Application management side of MDM by acting a bridge between
* MDM and App manager product.
*/
public interface AppManagerConnector {
/**
* This will communicate with App manager and retrieve the list of apps in the store, when
* the domain is given. The list is broken down into pages and retrieved.
*
* @param domain Tenant domain of the app list to be retrieved.
* @param pageNumber Page number of the list.
* @param size Number of items in one page.
* @return The list of applications belongs to a domain.
* @throws AppManagerConnectorException
*/
Application[] getApplicationList(String domain, int pageNumber, int size) throws AppManagerConnectorException;
/**
* Updates the application, install/uninstall status of the a certain application, on a device.
*
* @param deviceId Device id of the device that the status belongs to.
* @param application Application details of the app being updated.
* @param status Installed/Uninstalled
*/
void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
String status) throws AppManagerConnectorException;
/**
* Retrieve the status of an application on a device. Whether it is installed or not.
*
* @param deviceId Device id of the device that the status belongs to.
* @param application Application details of the app being searched.
* @return Status of the application on the device.
*/
String getApplicationStatus(DeviceIdentifier deviceId, Application application) throws AppManagerConnectorException;
/**
* Create a new application and return client Id and secret.
*
* @return consumer Id and consumer key.
* * @throws AppManagerConnectorException
*/
Credential getClientCredentials() throws AppManagerConnectorException;
void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers) throws
AppManagerConnectorException;
}

@ -17,7 +17,7 @@
* under the License.
*/
package org.wso2.carbon.device.mgt.common;
package org.wso2.carbon.device.mgt.common.app.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.Platform;

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.common.app.mgt;
/**
* Handles the exceptions related to Application management.
*/
public class AppManagerConnectorException extends Exception {
public class ApplicationManagementException extends Exception {
private static final long serialVersionUID = -8933142342423122660L;
private String errorMessage;
@ -34,26 +34,26 @@ public class AppManagerConnectorException extends Exception {
this.errorMessage = errorMessage;
}
public AppManagerConnectorException(String msg, Exception nestedEx) {
public ApplicationManagementException(String msg, Exception nestedEx) {
super(msg, nestedEx);
setErrorMessage(msg);
}
public AppManagerConnectorException(String message, Throwable cause) {
public ApplicationManagementException(String message, Throwable cause) {
super(message, cause);
setErrorMessage(message);
}
public AppManagerConnectorException(String msg) {
public ApplicationManagementException(String msg) {
super(msg);
setErrorMessage(msg);
}
public AppManagerConnectorException() {
public ApplicationManagementException() {
super();
}
public AppManagerConnectorException(Throwable cause) {
public ApplicationManagementException(Throwable cause) {
super(cause);
}

@ -0,0 +1,71 @@
/*
*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.app.mgt;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List;
/**
* This will handle the Application management side of MDM by acting a bridge between
* MDM and App manager product.
*/
public interface ApplicationManager {
/**
* This will communicate with App manager and retrieve the list of apps in the store, when
* the domain is given. The list is broken down into pages and retrieved.
*
* @param domain Tenant domain of the app list to be retrieved.
* @param pageNumber Page number of the list.
* @param size Number of items in one page.
* @return The list of applications belongs to a domain.
* @throws ApplicationManagementException
*/
Application[] getApplications(String domain, int pageNumber, int size) throws ApplicationManagementException;
/**
* Updates the application, install/uninstall status of the a certain application, on a device.
*
* @param deviceId Device id of the device that the status belongs to.
* @param application Application details of the app being updated.
* @param status Installed/Uninstalled
*/
void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
String status) throws ApplicationManagementException;
/**
* Retrieve the status of an application on a device. Whether it is installed or not.
*
* @param deviceId Device id of the device that the status belongs to.
* @param application Application details of the app being searched.
* @return Status of the application on the device.
*/
String getApplicationStatus(DeviceIdentifier deviceId,
Application application) throws ApplicationManagementException;
void installApplication(Operation operation,
List<DeviceIdentifier> deviceIdentifiers) throws ApplicationManagementException;
}

@ -1,33 +0,0 @@
/*
*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import java.util.List;
public interface AppManager {
void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException;
}

@ -0,0 +1,30 @@
/*
* Copyright (c) 2015, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
*
* WSO2 Inc. licenses this file to you under the Apache License,
* Version 2.0 (the "License"); you may not use this file except
* in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*
*/
package org.wso2.carbon.device.mgt.common.spi;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
/**
* Composite interface that acts as the SPI exposing all device management as well as application management
* functionalities
*/
public interface DeviceManagementService extends DeviceManager, ApplicationManager {
}

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

@ -18,7 +18,7 @@
package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import java.util.Collection;
@ -27,13 +27,13 @@ import java.util.Map;
public class DeviceManagementRepository {
private Map<String, DeviceMgtService> providers;
private Map<String, DeviceManagementService> providers;
public DeviceManagementRepository() {
providers = new HashMap<String, DeviceMgtService>();
providers = new HashMap<String, DeviceManagementService>();
}
public void addDeviceManagementProvider(DeviceMgtService provider) throws DeviceManagementException {
public void addDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
String deviceType = provider.getProviderType();
try {
DeviceManagerUtil.registerDeviceType(deviceType);
@ -44,16 +44,16 @@ public class DeviceManagementRepository {
providers.put(deviceType, provider);
}
public void removeDeviceManagementProvider(DeviceMgtService provider) throws DeviceManagementException {
public void removeDeviceManagementProvider(DeviceManagementService provider) throws DeviceManagementException {
String deviceType = provider.getProviderType();
providers.remove(deviceType);
}
public DeviceMgtService getDeviceManagementProvider(String type) {
public DeviceManagementService getDeviceManagementProvider(String type) {
return providers.get(type);
}
public Collection<DeviceMgtService> getDeviceManagementProviders(){
public Collection<DeviceManagementService> getDeviceManagementProviders(){
return providers.values();
}

@ -20,51 +20,47 @@ package org.wso2.carbon.device.mgt.core.app.mgt;
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.app.mgt.AppManagerConnector;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
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 java.util.ArrayList;
import java.util.List;
public class AppManagementServiceImpl implements AppManagerConnector {
public class ApplicationManagementServiceImpl implements ApplicationManager {
private static final Log log = LogFactory.getLog(AppManagementServiceImpl.class);
private static final Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class);
@Override
public Application[] getApplicationList(String domain, int pageNumber, int size) throws AppManagerConnectorException {
return DeviceManagementDataHolder.getInstance().getAppManager().getApplicationList(domain, pageNumber, size);
public Application[] getApplications(String domain, int pageNumber,
int size) throws ApplicationManagementException {
return DeviceManagementDataHolder.getInstance().getAppManager().getApplications(domain, pageNumber, size);
}
@Override
public void updateApplicationStatus(
DeviceIdentifier deviceId, Application application, String status) throws AppManagerConnectorException {
DeviceIdentifier deviceId, Application application, String status) throws ApplicationManagementException {
DeviceManagementDataHolder.getInstance().getAppManager().updateApplicationStatus(deviceId, application, status);
}
@Override
public String getApplicationStatus(DeviceIdentifier deviceId,
Application application) throws AppManagerConnectorException {
Application application) throws ApplicationManagementException {
return null;
}
@Override
public Credential getClientCredentials() throws AppManagerConnectorException {
return DeviceManagementDataHolder.getInstance().getAppManager().getClientCredentials();
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException {
throws ApplicationManagementException {
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();
throw new ApplicationManagementException();
}
DeviceManagementDataHolder.getInstance().getAppManager().installApplication(operation, deviceIdentifiers);
}

@ -18,11 +18,11 @@
*/
package org.wso2.carbon.device.mgt.core.app.mgt;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnector;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
public class AppManagerConnectorFactory {
public class ApplicationManagerFactory {
private static DeviceManagementRepository pluginRepository;
@ -36,8 +36,8 @@ public class AppManagerConnectorFactory {
public static AppManagerConnector getConnector(AppManagementConfig config) {
return new RemoteAppManagerConnector(config, pluginRepository);
public static ApplicationManager getConnector(AppManagementConfig config) {
return new RemoteApplicationManager(config, pluginRepository);
}
}

@ -23,13 +23,12 @@ import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.Application;
import org.wso2.carbon.device.mgt.common.Credential;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.DeviceIdentifier;
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.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
@ -46,7 +45,7 @@ import java.util.List;
/**
* Implements AppManagerConnector interface
*/
public class RemoteAppManagerConnector implements AppManagerConnector {
public class RemoteApplicationManager implements ApplicationManager {
private ConfigurationContext configCtx;
private ServiceAuthenticator authenticator;
@ -55,9 +54,9 @@ public class RemoteAppManagerConnector implements AppManagerConnector {
private static final String GET_APP_LIST_URL = "store/apis/assets/mobileapp?domain=carbon.super&page=1";
private static final Log log = LogFactory.getLog(RemoteAppManagerConnector.class);
private static final Log log = LogFactory.getLog(RemoteApplicationManager.class);
public RemoteAppManagerConnector(AppManagementConfig appManagementConfig, DeviceManagementRepository pluginRepository) {
public RemoteApplicationManager(AppManagementConfig appManagementConfig, DeviceManagementRepository pluginRepository) {
IdentityConfigurations identityConfig = DeviceConfigurationManager.getInstance().getDeviceManagementConfig().
getDeviceManagementConfigRepository().getIdentityConfigurations();
@ -75,44 +74,35 @@ public class RemoteAppManagerConnector implements AppManagerConnector {
}
@Override
public Application[] getApplicationList(String domain, int pageNumber,
int size) throws AppManagerConnectorException {
public Application[] getApplications(String domain, int pageNumber,
int size) throws ApplicationManagementException {
return new Application[0];
}
@Override
public void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
String status) throws AppManagerConnectorException{
String status) throws ApplicationManagementException {
}
@Override
public String getApplicationStatus(DeviceIdentifier deviceId,
Application application) throws AppManagerConnectorException {
Application application) throws ApplicationManagementException {
return null;
}
@Override
public Credential getClientCredentials() throws AppManagerConnectorException {
OAuthConsumerAppDTO appInfo = this.getAppInfo();
Credential credential = new Credential();
credential.setConsumerKey(appInfo.getOauthConsumerKey());
credential.setConsumerSecret(appInfo.getOauthConsumerSecret());
return credential;
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException {
throws ApplicationManagementException {
for(DeviceIdentifier deviceIdentifier:deviceIdentifiers){
DeviceMgtService dms = this.getPluginRepository().getDeviceManagementProvider(deviceIdentifier.getType());
DeviceManagementService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceIdentifier.getType());
dms.installApplication(operation,deviceIdentifiers);
}
}
private OAuthConsumerAppDTO getAppInfo() throws AppManagerConnectorException {
private OAuthConsumerAppDTO getAppInfo() throws ApplicationManagementException {
OAuthConsumerAppDTO appInfo = null;
try {
OAuthAdminServiceStub oAuthAdminServiceStub =
@ -147,9 +137,9 @@ public class RemoteAppManagerConnector implements AppManagerConnector {
return appDTO;
}
private void handleException(String msg, Exception e) throws AppManagerConnectorException {
private void handleException(String msg, Exception e) throws ApplicationManagementException {
log.error(msg, e);
throw new AppManagerConnectorException(msg, e);
throw new ApplicationManagementException(msg, e);
}
public DeviceManagementRepository getPluginRepository() {

@ -19,7 +19,7 @@
package org.wso2.carbon.device.mgt.core.app.mgt.config;
import org.w3c.dom.Document;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import org.wso2.carbon.utils.CarbonUtils;
@ -47,7 +47,7 @@ public class AppManagementConfigurationManager {
return appManagementConfigManager;
}
public synchronized void initConfig() throws AppManagerConnectorException {
public synchronized void initConfig() throws ApplicationManagementException {
try {
File appManagementConfig =
new File(AppManagementConfigurationManager.APP_MANAGER_CONFIG_PATH);
@ -60,7 +60,7 @@ public class AppManagementConfigurationManager {
} catch (Exception e) {
/* Catches generic exception as there's no specific task to be carried out catching a particular
exception */
throw new AppManagerConnectorException(
throw new ApplicationManagementException(
"Error occurred while initializing application management Configurations", e);
}
}

@ -21,7 +21,7 @@ package org.wso2.carbon.device.mgt.core.app.mgt.oauth;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.transport.http.HttpTransportProperties;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
/**
* Authenticate a given service client.
@ -36,7 +36,7 @@ public class ServiceAuthenticator {
this.password = password;
}
public void authenticate(ServiceClient client) throws AppManagerConnectorException {
public void authenticate(ServiceClient client) throws ApplicationManagementException {
Options option = client.getOptions();
HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
auth.setUsername(username);

@ -19,28 +19,28 @@
package org.wso2.carbon.device.mgt.core.internal;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherService;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnector;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.config.license.LicenseConfig;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.user.core.UserManager;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService;
import org.wso2.carbon.user.core.tenant.TenantManager;
import org.wso2.carbon.device.mgt.user.core.UserManager;
public class DeviceManagementDataHolder {
private RealmService realmService;
private TenantManager tenantManager;
private DeviceManagementService deviceManagerProvider;
private DeviceManagementProviderService deviceManagerProvider;
private LicenseManager licenseManager;
private RegistryService registryService;
private LicenseConfig licenseConfig;
private APIPublisherService apiPublisherService;
private AppManagerConnector appManager;
private ApplicationManager appManager;
private AppManagementConfig appManagerConfig;
private OperationManager operationManager;
private UserManager userManager;
@ -74,11 +74,11 @@ public class DeviceManagementDataHolder {
return tenantManager;
}
public DeviceManagementService getDeviceManagementProvider() {
public DeviceManagementProviderService getDeviceManagementProvider() {
return deviceManagerProvider;
}
public void setDeviceManagementProvider(DeviceManagementService deviceManagerProvider) {
public void setDeviceManagementProvider(DeviceManagementProviderService deviceManagerProvider) {
this.deviceManagerProvider = deviceManagerProvider;
}
@ -114,11 +114,11 @@ public class DeviceManagementDataHolder {
this.apiPublisherService = apiPublisherService;
}
public AppManagerConnector getAppManager() {
public ApplicationManager getAppManager() {
return appManager;
}
public void setAppManager(AppManagerConnector appManager) {
public void setAppManager(ApplicationManager appManager) {
this.appManager = appManager;
}

@ -24,22 +24,21 @@ import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService;
import org.wso2.carbon.core.ServerStartupObserver;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
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.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.DeviceManagementServiceProviderImpl;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherService;
import org.wso2.carbon.device.mgt.core.api.mgt.APIPublisherServiceImpl;
import org.wso2.carbon.device.mgt.core.api.mgt.APIRegistrationStartupObserver;
import org.wso2.carbon.device.mgt.core.app.mgt.AppManagementServiceImpl;
import org.wso2.carbon.device.mgt.core.app.mgt.RemoteAppManagerConnector;
import org.wso2.carbon.device.mgt.core.app.mgt.ApplicationManagementServiceImpl;
import org.wso2.carbon.device.mgt.core.app.mgt.RemoteApplicationManager;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfig;
import org.wso2.carbon.device.mgt.core.app.mgt.config.AppManagementConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
@ -51,11 +50,10 @@ import org.wso2.carbon.device.mgt.core.dao.DeviceManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.license.mgt.LicenseManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementServiceImpl;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import org.wso2.carbon.device.mgt.core.util.DeviceManagementSchemaInitializer;
import org.wso2.carbon.device.mgt.user.core.UserManager;
import org.wso2.carbon.device.mgt.user.core.service.UserManagementService;
import org.wso2.carbon.ndatasource.core.DataSourceService;
import org.wso2.carbon.registry.core.service.RegistryService;
import org.wso2.carbon.user.core.service.RealmService;
@ -72,7 +70,7 @@ import java.util.List;
* bind="setRealmService"
* unbind="unsetRealmService"
* @scr.reference name="device.manager.service"
* interface="org.wso2.carbon.device.mgt.common.spi.DeviceMgtService"
* interface="org.wso2.carbon.device.mgt.common.spi.DeviceManagementService"
* cardinality="0..n"
* policy="dynamic"
* bind="setDeviceManager"
@ -109,7 +107,7 @@ public class DeviceManagementServiceComponent {
private static final Object LOCK = new Object();
private boolean isInitialized;
private List<DeviceMgtService> deviceManagers = new ArrayList<DeviceMgtService>();
private List<DeviceManagementService> deviceManagementServices = new ArrayList<DeviceManagementService>();
protected void activate(ComponentContext componentContext) {
try {
@ -131,8 +129,8 @@ public class DeviceManagementServiceComponent {
/* Initializing app manager connector */
this.initAppManagerConnector();
DeviceManagementService deviceManagementProvider =
new DeviceManagementServiceProviderImpl(this.getPluginRepository());
DeviceManagementProviderService deviceManagementProvider =
new DeviceManagementProviderServiceImpl(this.getPluginRepository());
DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(deviceManagementProvider);
OperationManagementDAOFactory.init(dsConfig);
@ -149,8 +147,8 @@ public class DeviceManagementServiceComponent {
}
synchronized (LOCK) {
for (DeviceMgtService deviceManager : deviceManagers) {
this.registerDeviceManagementProvider(deviceManager);
for (DeviceManagementService deviceManagementService : deviceManagementServices) {
this.registerDeviceManagementProvider(deviceManagementService);
}
this.isInitialized = true;
}
@ -185,23 +183,23 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setOperationManager(operationManager);
}
private void initAppManagerConnector() throws AppManagerConnectorException {
private void initAppManagerConnector() throws ApplicationManagementException {
AppManagementConfigurationManager.getInstance().initConfig();
AppManagementConfig appConfig =
AppManagementConfigurationManager.getInstance().getAppManagementConfig();
DeviceManagementDataHolder.getInstance().setAppManagerConfig(appConfig);
RemoteAppManagerConnector appManager = new RemoteAppManagerConnector(appConfig, this.getPluginRepository());
RemoteApplicationManager appManager = new RemoteApplicationManager(appConfig, this.getPluginRepository());
DeviceManagementDataHolder.getInstance().setAppManager(appManager);
}
private void registerServices(ComponentContext componentContext) {
if (log.isDebugEnabled()) {
log.debug("Registering OSGi service DeviceManagementServiceImpl");
log.debug("Registering OSGi service DeviceManagementProviderServiceImpl");
}
/* Registering Device Management Service */
BundleContext bundleContext = componentContext.getBundleContext();
bundleContext.registerService(DeviceManagementService.class.getName(),
new DeviceManagementServiceImpl(), null);
bundleContext.registerService(DeviceManagementProviderService.class.getName(),
new DeviceManagementProviderServiceImpl(), null);
APIPublisherService publisher = new APIPublisherServiceImpl();
DeviceManagementDataHolder.getInstance().setApiPublisherService(publisher);
@ -210,7 +208,7 @@ public class DeviceManagementServiceComponent {
bundleContext.registerService(ServerStartupObserver.class, new APIRegistrationStartupObserver(), null);
/* Registering App Management service */
bundleContext.registerService(AppManagerConnector.class.getName(), new AppManagementServiceImpl(), null);
bundleContext.registerService(ApplicationManager.class.getName(), new ApplicationManagementServiceImpl(), null);
}
private void setupDeviceManagementSchema(DataSourceConfig config)
@ -241,12 +239,12 @@ public class DeviceManagementServiceComponent {
}
}
private void registerDeviceManagementProvider(DeviceMgtService deviceManager) {
private void registerDeviceManagementProvider(DeviceManagementService deviceManagementService) {
try {
this.getPluginRepository().addDeviceManagementProvider(deviceManager);
this.getPluginRepository().addDeviceManagementProvider(deviceManagementService);
} catch (DeviceManagementException e) {
log.error("Error occurred while adding device management provider '" +
deviceManager.getProviderType() + "'");
deviceManagementService.getProviderType() + "'");
}
}
@ -255,7 +253,7 @@ public class DeviceManagementServiceComponent {
*
* @param deviceManager An instance of DeviceManager
*/
protected void setDeviceManager(DeviceMgtService deviceManager) {
protected void setDeviceManager(DeviceManagementService deviceManager) {
if (log.isDebugEnabled()) {
log.debug("Setting Device Management Service Provider: '" + deviceManager.getProviderType() + "'");
}
@ -263,7 +261,7 @@ public class DeviceManagementServiceComponent {
if (isInitialized) {
this.registerDeviceManagementProvider(deviceManager);
}
deviceManagers.add(deviceManager);
deviceManagementServices.add(deviceManager);
}
}
@ -272,7 +270,7 @@ public class DeviceManagementServiceComponent {
*
* @param deviceManager An Instance of DeviceManager
*/
protected void unsetDeviceManager(DeviceMgtService deviceManager) {
protected void unsetDeviceManager(DeviceManagementService deviceManager) {
if (log.isDebugEnabled()) {
log.debug("Un setting Device Management Service Provider : '" + deviceManager.getProviderType() + "'");
}

@ -24,7 +24,7 @@ import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.device.mgt.common.DeviceManagementConstants;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.core.DeviceManagementServiceProviderImpl;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.governance.api.exception.GovernanceException;
import org.wso2.carbon.governance.api.generic.GenericArtifactFilter;
@ -39,7 +39,7 @@ import java.util.Locale;
public class LicenseManagerImpl implements LicenseManager {
private static Log log = LogFactory.getLog(DeviceManagementServiceProviderImpl.class);
private static Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class);
private static final DateFormat format = new SimpleDateFormat("dd-mm-yyyy", Locale.ENGLISH);
@Override

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

@ -20,20 +20,21 @@ package org.wso2.carbon.device.mgt.core.operation.mgt;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
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.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
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.dto.Device;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationDAO;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOException;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationMappingDAO;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.util.OperationDAOUtil;
import org.wso2.carbon.device.mgt.core.operation.mgt.util.OperationCreateTimeComparator;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementServiceImpl;
import java.util.ArrayList;
import java.util.Collections;
@ -54,7 +55,7 @@ public class OperationManagerImpl implements OperationManager {
private OperationDAO policyOperationDAO;
private OperationMappingDAO operationMappingDAO;
private OperationDAO operationDAO;
private DeviceManagementService deviceManagementService;
private DeviceDAO deviceDAO;
public OperationManagerImpl() {
commandOperationDAO = OperationManagementDAOFactory.getCommandOperationDAO();
@ -63,16 +64,16 @@ public class OperationManagerImpl implements OperationManager {
policyOperationDAO = OperationManagementDAOFactory.getPolicyOperationDAO();
operationMappingDAO = OperationManagementDAOFactory.getOperationMappingDAO();
operationDAO = OperationManagementDAOFactory.getOperationDAO();
deviceManagementService = new DeviceManagementServiceImpl();
deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
}
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices) throws
OperationManagementException {
public boolean addOperation(Operation operation,
List<DeviceIdentifier> deviceIdentifiers) throws OperationManagementException {
if (log.isDebugEnabled()) {
log.debug("operation:[" + operation.toString() + "]");
for (DeviceIdentifier deviceIdentifier : devices) {
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
log.debug("device identifier id:[" + deviceIdentifier.getId() + "] type:[" + deviceIdentifier.getType()
+ "]");
}
@ -83,10 +84,10 @@ public class OperationManagerImpl implements OperationManager {
OperationDAOUtil.convertOperation(operation);
int operationId = this.lookupOperationDAO(operation).addOperation(operationDto);
org.wso2.carbon.device.mgt.common.Device device;
for (DeviceIdentifier deviceIdentifier : devices) {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
Device device;
for (DeviceIdentifier deviceIdentifier : deviceIdentifiers) {
device = deviceDAO.getDevice(deviceIdentifier);
if (device == null) {
String errorMsg = "The operation not added for device.The device not found for " +
"device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '" +
@ -99,22 +100,19 @@ public class OperationManagerImpl implements OperationManager {
OperationManagementDAOFactory.commitTransaction();
return true;
} catch (OperationManagementDAOException e) {
log.error("Error occurred while adding operation: ", e);
try {
OperationManagementDAOFactory.rollbackTransaction();
} catch (OperationManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e1);
}
throw new OperationManagementException("Error occurred while adding operation", e);
} catch (DeviceManagementException deviceMgtEx) {
} catch (DeviceManagementDAOException e) {
try {
OperationManagementDAOFactory.rollbackTransaction();
} catch (OperationManagementDAOException e1) {
log.warn("Error occurred while roll-backing the transaction", e1);
}
String errorMsg = "Error occurred fetching devices ";
log.error(deviceMgtEx.getErrorMessage(), deviceMgtEx);
throw new OperationManagementException(errorMsg, deviceMgtEx);
throw new OperationManagementException("Error occurred while retrieving device metadata", e);
}
}
@ -124,16 +122,12 @@ public class OperationManagerImpl implements OperationManager {
try {
List<Operation> operations = new ArrayList<Operation>();
org.wso2.carbon.device.mgt.common.Device device;
Device device = null;
try {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
} catch (DeviceManagementException deviceMgtEx) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '" +
deviceIdentifier.getId();
log.error(errorMsg, deviceMgtEx);
throw new OperationManagementException(errorMsg, deviceMgtEx);
device = deviceDAO.getDevice(deviceIdentifier);
} catch (DeviceManagementDAOException e) {
e.printStackTrace();
}
if (device == null) {
throw new OperationManagementException("Device not found for given device " +
@ -163,7 +157,7 @@ public class OperationManagerImpl implements OperationManager {
+ "]");
}
org.wso2.carbon.device.mgt.common.Device device;
Device device;
List<Operation> operations = new ArrayList<Operation>();
List<org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> dtoOperationList =
@ -171,7 +165,7 @@ public class OperationManagerImpl implements OperationManager {
try {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
device = deviceDAO.getDevice(deviceIdentifier);
if (device == null) {
throw new OperationManagementException("Device not found for given device " +
@ -197,16 +191,16 @@ public class OperationManagerImpl implements OperationManager {
}
Collections.sort(operations, new OperationCreateTimeComparator());
return operations;
} catch (DeviceManagementException deviceMgtException) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, deviceMgtException);
throw new OperationManagementException(errorMsg, deviceMgtException);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " +
"pending operations assigned for '" + deviceIdentifier.getType() + "' device '" +
deviceIdentifier.getId() + "'", e);
} catch (DeviceManagementDAOException e) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, e);
throw new OperationManagementException(errorMsg, e);
}
}
@ -220,7 +214,7 @@ public class OperationManagerImpl implements OperationManager {
Operation operation = null;
Device device;
try {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
device = deviceDAO.getDevice(deviceIdentifier);
if (device == null) {
throw new OperationManagementException("Device not found for given device " +
@ -249,14 +243,14 @@ public class OperationManagerImpl implements OperationManager {
operation = OperationDAOUtil.convertOperation(dtoOperation);
}
return operation;
} catch (DeviceManagementException deviceMgtException) {
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving next pending operation", e);
} catch (DeviceManagementDAOException e) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, deviceMgtException);
throw new OperationManagementException(errorMsg, deviceMgtException);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving next pending operation", e);
log.error(errorMsg, e);
throw new OperationManagementException(errorMsg, e);
}
}
@ -277,7 +271,7 @@ public class OperationManagerImpl implements OperationManager {
}
dtoOperation.setStatus(org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status.valueOf
(operationStatus.toString()));
Device device = deviceManagementService.getCoreDevice(deviceIdentifier);
Device device = deviceDAO.getDevice(deviceIdentifier);
OperationManagementDAOFactory.beginTransaction();
operationDAO.updateOperation(dtoOperation);
@ -285,11 +279,6 @@ public class OperationManagerImpl implements OperationManager {
org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation.Status
.valueOf(operationStatus.toString()));
OperationManagementDAOFactory.commitTransaction();
} catch (DeviceManagementException ex) {
log.error("Error occurred while fetch the device for device identifier: " + deviceIdentifier.getId() + " " +
"type:" + deviceIdentifier.getType(), ex);
throw new OperationManagementException("Error occurred while update operation", ex);
} catch (OperationManagementDAOException ex) {
try {
OperationManagementDAOFactory.rollbackTransaction();
@ -298,6 +287,10 @@ public class OperationManagerImpl implements OperationManager {
}
log.error("Error occurred while updating the operation: " + operationId + " status:" + operationStatus, ex);
throw new OperationManagementException("Error occurred while update operation", ex);
} catch (DeviceManagementDAOException e) {
log.error("Error occurred while fetch the device for device identifier: " + deviceIdentifier.getId() + " " +
"type:" + deviceIdentifier.getType(), e);
throw new OperationManagementException("Error occurred while update operation", e);
}
}
@ -331,7 +324,7 @@ public class OperationManagerImpl implements OperationManager {
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceIdentifier, int operationId)
throws OperationManagementException {
org.wso2.carbon.device.mgt.common.Device device;
Device device;
Operation operation;
if (log.isDebugEnabled()) {
@ -342,7 +335,7 @@ public class OperationManagerImpl implements OperationManager {
}
try {
device = deviceManagementService.getCoreDevice(deviceIdentifier);
device = deviceDAO.getDevice(deviceIdentifier);
if (device == null) {
throw new OperationManagementException("Device not found for given device identifier:" +
deviceIdentifier.getId() + " type:" + deviceIdentifier.getType());
@ -373,16 +366,16 @@ public class OperationManagerImpl implements OperationManager {
" device" + " Id:" + device.getId());
}
operation = OperationDAOUtil.convertOperation(dtoOperation);
} catch (DeviceManagementException deviceMgtException) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, deviceMgtException);
throw new OperationManagementException(errorMsg, deviceMgtException);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + deviceIdentifier.getType() + "' device '" + deviceIdentifier.getId()
+ "'", e);
} catch (DeviceManagementDAOException e) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + deviceIdentifier.getType() + "' and device Id '"
+ deviceIdentifier.getId();
log.error(errorMsg, e);
throw new OperationManagementException(errorMsg, e);
}
return operation;
}
@ -396,7 +389,7 @@ public class OperationManagerImpl implements OperationManager {
List<org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation> dtoOperationList =
new ArrayList<org.wso2.carbon.device.mgt.core.dto.operation.mgt.Operation>();
org.wso2.carbon.device.mgt.common.Device device = deviceManagementService.getCoreDevice(identifier);
Device device = deviceDAO.getDevice(identifier);
if (device == null) {
throw new DeviceManagementException("Device not found for device id:" + identifier.getId() + " " +
@ -423,15 +416,15 @@ public class OperationManagerImpl implements OperationManager {
operations.add(operation);
}
return operations;
} catch (DeviceManagementException deviceMgtException) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + identifier.getType() + "' and device Id '" + identifier.getId();
log.error(errorMsg, deviceMgtException);
throw new OperationManagementException(errorMsg, deviceMgtException);
} catch (OperationManagementDAOException e) {
throw new OperationManagementException("Error occurred while retrieving the list of " +
"operations assigned for '" + identifier.getType() + "' device '" +
identifier.getId() + "' and status:" + status.toString(), e);
} catch (DeviceManagementDAOException e) {
String errorMsg = "Error occurred while retrieving the device " +
"for device Identifier type -'" + identifier.getType() + "' and device Id '" + identifier.getId();
log.error(errorMsg, e);
throw new OperationManagementException(errorMsg, e);
}
}

@ -18,8 +18,7 @@
package org.wso2.carbon.device.mgt.core.service;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnector;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManager;
import org.wso2.carbon.device.mgt.common.operation.mgt.OperationManager;
import java.util.List;
@ -28,7 +27,7 @@ import java.util.List;
* Proxy class for all Device Management related operations that take the corresponding plugin type in
* and resolve the appropriate plugin implementation
*/
public interface DeviceManagementService extends DeviceManager, LicenseManager, OperationManager {
public interface DeviceManagementProviderService extends DeviceManager, LicenseManager, OperationManager {
List<Device> getAllDevices(String type) throws DeviceManagementException;
@ -42,14 +41,6 @@ public interface DeviceManagementService extends DeviceManager, LicenseManager,
FeatureManager getFeatureManager(String type) throws DeviceManagementException;
/**
* This method returns core device details.
* @param deviceId
* @return
* @throws DeviceManagementException
*/
Device getCoreDevice(DeviceIdentifier deviceId) throws DeviceManagementException;
/**
* Method to get the list of devices owned by an user.
*
@ -87,4 +78,5 @@ public interface DeviceManagementService extends DeviceManager, LicenseManager,
* device list
*/
List<Device> getDevicesByName(String deviceName, int tenantId) throws DeviceManagementException;
}

@ -15,16 +15,17 @@
* specific language governing permissions and limitations
* under the License.
*/
package org.wso2.carbon.device.mgt.core;
package org.wso2.carbon.device.mgt.core.service;
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.Device;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
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.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.core.DeviceManagementRepository;
import org.wso2.carbon.device.mgt.core.config.DeviceConfigurationManager;
import org.wso2.carbon.device.mgt.core.config.email.NotificationMessages;
import org.wso2.carbon.device.mgt.core.dao.DeviceDAO;
@ -32,11 +33,10 @@ 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 org.wso2.carbon.device.mgt.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.dto.*;
import org.wso2.carbon.device.mgt.core.email.EmailConstants;
import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.internal.EmailServiceDataHolder;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.util.DeviceManagerUtil;
import java.io.IOException;
@ -45,21 +45,21 @@ import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.List;
public class DeviceManagementServiceProviderImpl implements DeviceManagementService {
public class DeviceManagementProviderServiceImpl implements DeviceManagementProviderService {
private DeviceDAO deviceDAO;
private DeviceTypeDAO deviceTypeDAO;
private DeviceManagementRepository pluginRepository;
private static Log log = LogFactory.getLog(DeviceManagementServiceProviderImpl.class);
private static Log log = LogFactory.getLog(DeviceManagementProviderServiceImpl.class);
public DeviceManagementServiceProviderImpl(DeviceManagementRepository pluginRepository) {
public DeviceManagementProviderServiceImpl(DeviceManagementRepository pluginRepository) {
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
}
public DeviceManagementServiceProviderImpl() {
public DeviceManagementProviderServiceImpl() {
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
this.deviceTypeDAO = DeviceManagementDAOFactory.getDeviceTypeDAO();
}
@ -81,24 +81,6 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
return dms.getFeatureManager();
}
@Override
public Device getCoreDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
Device convertedDevice = null;
try {
DeviceType deviceType = this.getDeviceTypeDAO().getDeviceType(deviceId.getType());
org.wso2.carbon.device.mgt.core.dto.Device device = this.getDeviceDAO().getDevice(deviceId);
if (device != null) {
convertedDevice = DeviceManagementDAOUtil.convertDevice(device,
this.getDeviceTypeDAO().getDeviceType(deviceType.getId()));
}
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while obtaining the device for id " +
"'" + deviceId.getId() + "' and type:" + deviceId.getType(), e);
}
return convertedDevice;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
DeviceManager dms =
@ -253,8 +235,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
public void sendEnrolmentInvitation(EmailMessageProperties emailMessageProperties)
throws DeviceManagementException {
List<NotificationMessages> notificationMessages = DeviceConfigurationManager.getInstance()
.getNotificationMessagesConfig().getNotificationMessagesList();
List<NotificationMessages> notificationMessages =
DeviceConfigurationManager.getInstance().getNotificationMessagesConfig().getNotificationMessagesList();
String messageHeader = "";
String messageBody = "";
@ -265,8 +247,8 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
String subject = "";
for (NotificationMessages notificationMessage : notificationMessages) {
if (DeviceManagementConstants.EmailNotifications.ENROL_NOTIFICATION_TYPE.
equals(notificationMessage.getType())) {
if (org.wso2.carbon.device.mgt.core.DeviceManagementConstants.EmailNotifications.ENROL_NOTIFICATION_TYPE.equals(
notificationMessage.getType())) {
messageHeader = notificationMessage.getHeader();
messageBody = notificationMessage.getBody();
messageFooter1 = notificationMessage.getFooterLine1();
@ -322,7 +304,7 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
String subject = "";
for (NotificationMessages notificationMessage : notificationMessages) {
if (DeviceManagementConstants.EmailNotifications.USER_REGISTRATION_NOTIFICATION_TYPE.
if (org.wso2.carbon.device.mgt.core.DeviceManagementConstants.EmailNotifications.USER_REGISTRATION_NOTIFICATION_TYPE.
equals(notificationMessage.getType())) {
messageHeader = notificationMessage.getHeader();
messageBody = notificationMessage.getBody();
@ -467,7 +449,7 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
@Override
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus)
throws OperationManagementException {
DeviceManagementDataHolder.getInstance().getOperationManager().updateOperation(deviceId,operationId,
DeviceManagementDataHolder.getInstance().getOperationManager().updateOperation(deviceId, operationId,
operationStatus);
}
@ -499,7 +481,7 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
public List<Device> getAllDevicesOfUser(String userName)
throws DeviceManagementException {
List<Device> devicesOfUser = new ArrayList<Device>();
List<org.wso2.carbon.device.mgt.core.dto.Device> devicesList;
List<org.wso2.carbon.device.mgt.core.dto.Device> devices;
Device convertedDevice;
DeviceIdentifier deviceIdentifier;
DeviceManager dms;
@ -508,15 +490,15 @@ public class DeviceManagementServiceProviderImpl implements DeviceManagementServ
int tenantId = DeviceManagerUtil.getTenantId();
//Fetch the DeviceList from Core
try {
devicesList = this.getDeviceDAO().getDeviceListOfUser(userName, tenantId);
devices = this.getDeviceDAO().getDeviceListOfUser(userName, tenantId);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while obtaining the devices of user '"
+ userName + "'", e);
}
//Fetch the DeviceList from device plugin dbs & append the properties
for (int x = 0; x < devicesList.size(); x++) {
device = devicesList.get(x);
for (org.wso2.carbon.device.mgt.core.dto.Device aDevicesList : devices) {
device = aDevicesList;
try {
//TODO : Possible improvement if DeviceTypes have been cached
device.setDeviceType(deviceTypeDAO.getDeviceType(device.getDeviceTypeId()));

@ -1,224 +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.core.service;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.license.mgt.License;
import org.wso2.carbon.device.mgt.common.license.mgt.LicenseManagementException;
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 java.util.List;
public class DeviceManagementServiceImpl implements DeviceManagementService {
@Override
public String getProviderType() {
return null;
}
@Override
public FeatureManager getFeatureManager() {
return null;
}
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().enrollDevice(device);
}
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().modifyEnrollment(device);
}
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().disenrollDevice(deviceId);
}
@Override
public boolean isEnrolled(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isEnrolled(deviceId);
}
@Override
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isActive(deviceId);
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setActive(deviceId, status);
}
@Override
public List<Device> getAllDevices() throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getAllDevices();
}
@Override
public List<Device> getAllDevices(String type) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getAllDevices(type);
}
public List<Device> getDeviceListOfUser(String username) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDeviceListOfUser(username);
}
public FeatureManager getFeatureManager(String type) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getFeatureManager(type);
}
@Override
public Device getCoreDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getCoreDevice(deviceId);
}
@Override
public org.wso2.carbon.device.mgt.common.Device getDevice(DeviceIdentifier deviceId)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getDevice(deviceId);
}
@Override
public boolean updateDeviceInfo(DeviceIdentifier deviceIdentifier, Device device) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().
updateDeviceInfo(deviceIdentifier, device);
}
@Override
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().setOwnership(deviceId,
ownershipType);
}
@Override
public boolean isClaimable(DeviceIdentifier deviceId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().isClaimable(deviceId);
}
@Override
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getLicense(deviceType,
languageCode);
}
@Override
public boolean addLicense(String type, License license) throws LicenseManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addLicense(type, license);
}
@Override
public boolean addOperation(Operation operation, List<DeviceIdentifier> devices)
throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().addOperation(operation, devices);
}
@Override
public List<? extends Operation> getOperations(DeviceIdentifier deviceId) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperations(deviceId);
}
@Override
public List<? extends Operation> getPendingOperations(
DeviceIdentifier deviceId) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getPendingOperations(deviceId);
}
@Override
public Operation getNextPendingOperation(DeviceIdentifier deviceId) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getNextPendingOperation(deviceId);
}
@Override
public void updateOperation(DeviceIdentifier deviceId, int operationId, Operation.Status operationStatus) throws
OperationManagementException {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().updateOperation(deviceId, operationId,
operationStatus);
}
@Override
public void deleteOperation(int operationId) throws OperationManagementException {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().deleteOperation(operationId);
}
@Override
public Operation getOperationByDeviceAndOperationId(DeviceIdentifier deviceId,
int operationId) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getOperationByDeviceAndOperationId(deviceId, operationId);
}
@Override
public List<? extends Operation> getOperationsByDeviceAndStatus(DeviceIdentifier identifier,
Operation.Status status) throws OperationManagementException, DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperationsByDeviceAndStatus
(identifier, status);
}
@Override
public Operation getOperation(int operationId) throws OperationManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider().getOperation(operationId);
}
@Override
public void sendEnrolmentInvitation(EmailMessageProperties emailMessageProperties)
throws DeviceManagementException {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.sendEnrolmentInvitation(emailMessageProperties);
}
@Override
public void sendRegistrationEmail(EmailMessageProperties emailMessageProperties) throws DeviceManagementException {
DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.sendRegistrationEmail(emailMessageProperties);
}
@Override
public List<Device> getAllDevicesOfUser(String userName)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getAllDevicesOfUser(userName);
}
@Override
public List<Device> getAllDevicesOfRole(String roleName)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getAllDevicesOfRole(roleName);
}
@Override
public int getDeviceCount() throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getDeviceCount();
}
@Override
public List<Device> getDevicesByName(String deviceName, int tenantId) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManagementProvider()
.getDevicesByName(deviceName, tenantId);
}
}

@ -21,8 +21,8 @@ import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
import org.wso2.carbon.device.mgt.common.DeviceManagementException;
import org.wso2.carbon.device.mgt.common.spi.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
public class DeviceManagementRepositoryTests {
@ -35,7 +35,7 @@ public class DeviceManagementRepositoryTests {
@Test
public void testAddDeviceManagementService() {
DeviceMgtService sourceProvider = new TestDeviceManager();
DeviceManagementService sourceProvider = new TestDeviceManager();
try {
this.getRepository().addDeviceManagementProvider(sourceProvider);
} catch (DeviceManagementException e) {
@ -48,7 +48,7 @@ public class DeviceManagementRepositoryTests {
@Test(dependsOnMethods = "testAddDeviceManagementService")
public void testRemoveDeviceManagementService() {
DeviceMgtService sourceProvider = new TestDeviceManager();
DeviceManagementService sourceProvider = new TestDeviceManager();
try {
this.getRepository().removeDeviceManagementProvider(sourceProvider);
} catch (DeviceManagementException e) {

@ -31,6 +31,7 @@ import org.wso2.carbon.device.mgt.core.internal.DeviceManagementDataHolder;
import org.wso2.carbon.device.mgt.core.operation.mgt.CommandOperation;
import org.wso2.carbon.device.mgt.core.operation.mgt.OperationManagerImpl;
import org.wso2.carbon.device.mgt.core.operation.mgt.dao.OperationManagementDAOFactory;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderServiceImpl;
import java.util.ArrayList;
import java.util.List;
@ -59,7 +60,7 @@ public class DeviceOperationManagementTests extends DeviceManagementBaseTest {
private void initOperationManager() {
this.operationManager = new OperationManagerImpl();
DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(new DeviceManagementServiceProviderImpl());
DeviceManagementDataHolder.getInstance().setDeviceManagementProvider(new DeviceManagementProviderServiceImpl());
}
@Test

@ -18,13 +18,16 @@
package org.wso2.carbon.device.mgt.core;
import org.wso2.carbon.device.mgt.common.*;
import org.wso2.carbon.device.mgt.common.app.mgt.AppManagerConnectorException;
import org.wso2.carbon.device.mgt.common.app.mgt.Application;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManagementException;
import org.wso2.carbon.device.mgt.common.operation.mgt.Operation;
import org.wso2.carbon.device.mgt.common.spi.DeviceMgtService;
import org.wso2.carbon.device.mgt.common.app.mgt.ApplicationManager;
import org.wso2.carbon.device.mgt.common.DeviceManager;
import org.wso2.carbon.device.mgt.common.spi.DeviceManagementService;
import java.util.List;
public class TestDeviceManager implements DeviceMgtService {
public class TestDeviceManager implements DeviceManagementService {
public static final String DEVICE_TYPE_TEST = "Test";
@ -93,9 +96,27 @@ public class TestDeviceManager implements DeviceMgtService {
return false;
}
@Override
public Application[] getApplications(String domain, int pageNumber,
int size) throws ApplicationManagementException {
return new Application[0];
}
@Override
public void updateApplicationStatus(DeviceIdentifier deviceId, Application application,
String status) throws ApplicationManagementException {
}
@Override
public String getApplicationStatus(DeviceIdentifier deviceId,
Application application) throws ApplicationManagementException {
return null;
}
@Override
public void installApplication(Operation operation, List<DeviceIdentifier> deviceIdentifiers)
throws AppManagerConnectorException {
throws ApplicationManagementException {
}
}

@ -25,7 +25,7 @@ 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.core.dto.DeviceType;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.device.mgt.common.Feature;
import org.wso2.carbon.policy.mgt.common.*;
import org.wso2.carbon.policy.mgt.core.internal.PolicyManagementDataHolder;
@ -46,7 +46,7 @@ public class PolicyInformationPointImpl implements PolicyInformationPoint {
PolicyManager policyManager;
FeatureManager featureManager;
DeviceManagementService deviceManagementService;
DeviceManagementProviderService deviceManagementService;
public PolicyInformationPointImpl() {
deviceManagementService =
@ -143,7 +143,7 @@ public class PolicyInformationPointImpl implements PolicyInformationPoint {
return finalPolicies;
}
private DeviceManagementService getDeviceManagementService() {
private DeviceManagementProviderService getDeviceManagementService() {
return PolicyManagementDataHolder.getInstance().getDeviceManagementService();
}

@ -18,7 +18,7 @@
package org.wso2.carbon.policy.mgt.core.internal;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
import org.wso2.carbon.policy.mgt.common.PolicyInformationPoint;
import org.wso2.carbon.user.core.service.RealmService;
@ -30,7 +30,7 @@ public class PolicyManagementDataHolder {
private TenantManager tenantManager;
private PolicyEvaluationPoint policyEvaluationPoint;
private PolicyInformationPoint policyInformationPoint;
private DeviceManagementService deviceManagementService;
private DeviceManagementProviderService deviceManagementService;
private static PolicyManagementDataHolder thisInstance = new PolicyManagementDataHolder();
private PolicyManagementDataHolder() {}
@ -75,11 +75,11 @@ public class PolicyManagementDataHolder {
this.policyInformationPoint = policyInformationPoint;
}
public DeviceManagementService getDeviceManagementService() {
public DeviceManagementProviderService getDeviceManagementService() {
return deviceManagementService;
}
public void setDeviceManagementService(DeviceManagementService deviceManagementService) {
public void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) {
this.deviceManagementService = deviceManagementService;
}
}

@ -21,7 +21,7 @@ package org.wso2.carbon.policy.mgt.core.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementService;
import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationPoint;
import org.wso2.carbon.policy.mgt.core.PolicyManagerService;
import org.wso2.carbon.policy.mgt.core.PolicyManagerServiceImpl;
@ -46,7 +46,7 @@ import org.wso2.carbon.user.core.service.RealmService;
* bind="setPEPService"
* unbind="unsetPEPService"
* @scr.reference name="org.wso2.carbon.device.manager"
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementService"
* interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService"
* cardinality="1..1"
* policy="dynamic"
* bind="setDeviceManagementService"
@ -129,14 +129,14 @@ public class PolicyManagementServiceComponent {
PolicyManagementDataHolder.getInstance().setPolicyEvaluationPoint(null);
}
protected void setDeviceManagementService(DeviceManagementService deviceManagerService) {
protected void setDeviceManagementService(DeviceManagementProviderService deviceManagerService) {
if (log.isDebugEnabled()) {
log.debug("Setting Device Management Service");
}
PolicyManagementDataHolder.getInstance().setDeviceManagementService(deviceManagerService);
}
protected void unsetDeviceManagementService(DeviceManagementService deviceManagementService) {
protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementService) {
if (log.isDebugEnabled()) {
log.debug("Unsetting Device Management Service");
}

Loading…
Cancel
Save