Fixing merge conflicts

revert-70aa11f8
prabathabey 10 years ago
commit a9a0ac5899

@ -41,7 +41,8 @@ public interface DeviceManager {
public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException;
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException;
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException;
public List<Device> getAllDevices(String type) throws DeviceManagementException;
@ -49,7 +50,8 @@ public interface DeviceManager {
public boolean updateDeviceInfo(Device device) throws DeviceManagementException;
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException;
public boolean setOwnership(DeviceIdentifier deviceId, String ownershipType)
throws DeviceManagementException;
public OperationManager getOperationManager(String type) throws DeviceManagementException;

@ -44,7 +44,8 @@ public class DeviceManagerImpl implements DeviceManager {
private DeviceManagementConfig config;
private DeviceManagementRepository pluginRepository;
public DeviceManagerImpl(DeviceManagementConfig config, DeviceManagementRepository pluginRepository) {
public DeviceManagerImpl(DeviceManagementConfig config,
DeviceManagementRepository pluginRepository) {
this.config = config;
this.pluginRepository = pluginRepository;
this.deviceDAO = DeviceManagementDAOFactory.getDeviceDAO();
@ -53,16 +54,20 @@ public class DeviceManagerImpl implements DeviceManager {
@Override
public boolean enrollDevice(Device device) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(device.getType());
boolean status = dms.enrollDevice(device);
try {
org.wso2.carbon.device.mgt.core.dto.Device deviceDto = DeviceManagementDAOUtil.convertDevice(device);
Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(device.getType());
org.wso2.carbon.device.mgt.core.dto.Device deviceDto =
DeviceManagementDAOUtil.convertDevice(device);
Integer deviceTypeId =
this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(device.getType());
deviceDto.setStatus(Status.ACTIVE);
deviceDto.setDeviceTypeId(deviceTypeId);
this.getDeviceDAO().addDevice(deviceDto);
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while enrolling the device '" + device.getId() + "'",
throw new DeviceManagementException(
"Error occurred while enrolling the device '" + device.getId() + "'",
e);
}
return status;
@ -70,12 +75,14 @@ public class DeviceManagerImpl implements DeviceManager {
@Override
public boolean modifyEnrollment(Device device) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
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() + "'",
throw new DeviceManagementException(
"Error occurred while modifying the device '" + device.getId() + "'",
e);
}
return status;
@ -83,25 +90,30 @@ public class DeviceManagerImpl implements DeviceManager {
@Override
public boolean disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
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());
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());
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());
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setActive(deviceId, status);
}
@ -111,12 +123,14 @@ public class DeviceManagerImpl implements DeviceManager {
List<Device> devicesList = new ArrayList<Device>();
try {
Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(type);
List<org.wso2.carbon.device.mgt.core.dto.Device> devices = this.getDeviceDAO().getDevices(deviceTypeId);
List<org.wso2.carbon.device.mgt.core.dto.Device> devices =
this.getDeviceDAO().getDevices(deviceTypeId);
for (org.wso2.carbon.device.mgt.core.dto.Device device : devices) {
DeviceType deviceType = this.deviceTypeDAO.getDeviceType(device.getDeviceTypeId());
Device convertedDevice = DeviceManagementDAOUtil.convertDevice(device, deviceType);
DeviceIdentifier deviceIdentifier = DeviceManagementDAOUtil.createDeviceIdentifier(device, deviceType);
DeviceIdentifier deviceIdentifier =
DeviceManagementDAOUtil.createDeviceIdentifier(device, deviceType);
Device dmsDevice = dms.getDevice(deviceIdentifier);
if (dmsDevice != null) {
convertedDevice.setProperties(dmsDevice.getProperties());
@ -125,17 +139,20 @@ public class DeviceManagerImpl implements DeviceManager {
devicesList.add(convertedDevice);
}
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException("Error occurred while obtaining the device for type '" + type + "'", e);
throw new DeviceManagementException(
"Error occurred while obtaining the device for type '" + type + "'", e);
}
return devicesList;
}
@Override
public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
Device convertedDevice = null;
try {
Integer deviceTypeId = this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(deviceId.getType());
Integer deviceTypeId =
this.getDeviceTypeDAO().getDeviceTypeIdByDeviceTypeName(deviceId.getType());
org.wso2.carbon.device.mgt.core.dto.Device device =
this.getDeviceDAO().getDeviceByDeviceIdentifier(deviceTypeId, deviceId.getId());
if (device != null) {
@ -149,21 +166,24 @@ public class DeviceManagerImpl implements DeviceManager {
}
} catch (DeviceManagementDAOException e) {
throw new DeviceManagementException(
"Error occurred while obtaining the device for id '" + deviceId.getId() + "'", e);
"Error occurred while obtaining the device for id '" + deviceId.getId() + "'",
e);
}
return convertedDevice;
}
@Override
public boolean updateDeviceInfo(Device device) throws DeviceManagementException {
DeviceManagerService dms = this.getPluginRepository().getDeviceManagementProvider(device.getType());
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());
DeviceManagerService dms =
this.getPluginRepository().getDeviceManagementProvider(deviceId.getType());
return dms.setOwnership(deviceId, ownershipType);
}

@ -30,14 +30,15 @@ import javax.xml.bind.Unmarshaller;
import java.io.File;
/**
* Class responsible for the cdm manager configuration initialization
* Class responsible for the cdm manager configuration initialization.
*/
public class DeviceConfigurationManager {
private DeviceManagementConfig currentDeviceConfig;
private static DeviceConfigurationManager deviceConfigManager;
private static final String deviceMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator +
private static final String deviceMgtConfigXMLPath =
CarbonUtils.getCarbonConfigDirPath() + File.separator +
DeviceManagementConstants.DataSourceProperties.DEVICE_CONFIG_XML_NAME;
public static DeviceConfigurationManager getInstance() {

@ -22,7 +22,7 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Class for holding management repository data
* Class for holding management repository data.
*/
@XmlRootElement(name = "ManagementRepository")
public class DeviceManagementRepository {

@ -35,7 +35,8 @@ public class LicenseConfigurationManager {
private LicenseManagementConfig licenseMgtConfig;
private static LicenseConfigurationManager licenseConfigManager;
private static final String licenseMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator +
private static final String licenseMgtConfigXMLPath =
CarbonUtils.getCarbonConfigDirPath() + File.separator +
DeviceManagementConstants.Common.DEFAULT_LICENSE_CONFIG_XML_NAME;
public static LicenseConfigurationManager getInstance() {
@ -69,5 +70,4 @@ public class LicenseConfigurationManager {
return licenseMgtConfig;
}
}

@ -21,7 +21,8 @@ import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
/**
* Class for holding data source configuration in malformed-cdm-config-no-mgt-repo.xml at parsing with JAXB
* Class for holding data source configuration in malformed-cdm-config-no-mgt-repo.xml at parsing
* with JAXB.
*/
@XmlRootElement(name = "DataSourceConfiguration")
public class DataSourceConfig {

@ -22,7 +22,7 @@ import javax.xml.bind.annotation.*;
import java.util.List;
/**
* Class for hold JndiLookupDefinition of rss-manager.xml at parsing with JAXB
* Class for hold JndiLookupDefinition of rss-manager.xml at parsing with JAXB.
*/
@XmlRootElement(name = "JndiLookupDefinition")
public class JNDILookupDefinition {

@ -20,12 +20,8 @@
package org.wso2.carbon.device.mgt.core.config.license;
import org.wso2.carbon.device.mgt.core.util.DateAdapter;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
import java.util.Date;
@XmlRootElement(name = "License")
public class License {
@ -34,8 +30,9 @@ public class License {
private String name;
private String version;
private String language;
private Date validFrom;
private Date validTo;
private String validFrom;
private String validTo;
private String license;
@XmlElement(name = "provider")
@ -74,31 +71,30 @@ public class License {
this.language = language;
}
@XmlJavaTypeAdapter(DateAdapter.class)
public Date getValidFrom() {
return validFrom;
@XmlElement(name = "license")
public String getLicense() {
return license;
}
public void setValidFrom(Date validFrom) {
this.validFrom = validFrom;
public void setLicense(String license) {
this.license = license;
}
@XmlJavaTypeAdapter(DateAdapter.class)
public Date getValidTo() {
return validTo;
@XmlElement(name = "validFrom")
public String getValidFrom() {
return validFrom;
}
public void setValidTo(Date validTo) {
this.validTo = validTo;
public void setValidFrom(String validFrom) {
this.validFrom = validFrom;
}
@XmlElement(name = "license")
public String getLicense() {
return license;
@XmlElement(name = "validTo")
public String getValidTo() {
return validTo;
}
public void setLicense(String license) {
this.license = license;
public void setValidTo(String validTo) {
this.validTo = validTo;
}
}

@ -24,7 +24,7 @@ import org.wso2.carbon.device.mgt.core.dto.Status;
import java.util.List;
/**
* This class represents the key operations associated with persisting device related information
* This class represents the key operations associated with persisting device related information.
*/
public interface DeviceDAO {
@ -44,7 +44,8 @@ public interface DeviceDAO {
* @return the Device object which matches given data
* @throws DeviceManagementDAOException
*/
Device getDeviceByDeviceIdentifier(Integer type, String identifier) throws DeviceManagementDAOException;
Device getDeviceByDeviceIdentifier(Integer type, String identifier)
throws DeviceManagementDAOException;
List<Device> getDevices() throws DeviceManagementDAOException;

@ -19,7 +19,7 @@
package org.wso2.carbon.device.mgt.core.dao;
/**
* Custom exception class for data access related exceptions
* Custom exception class for data access related exceptions.
*/
public class DeviceManagementDAOException extends Exception {

@ -25,6 +25,7 @@ import org.wso2.carbon.device.mgt.core.config.datasource.JNDILookupDefinition;
import org.wso2.carbon.device.mgt.core.dao.impl.DeviceDAOImpl;
import org.wso2.carbon.device.mgt.core.dao.impl.DeviceTypeDAOImpl;
import org.wso2.carbon.device.mgt.core.dao.util.DeviceManagementDAOUtil;
import javax.sql.DataSource;
import java.util.Hashtable;
import java.util.List;
@ -59,7 +60,8 @@ public class DeviceManagementDAOFactory {
private static DataSource resolveDataSource(DataSourceConfig config) {
DataSource dataSource = null;
if (config == null) {
throw new RuntimeException("Device Management Repository data source configuration " + "is null and " +
throw new RuntimeException(
"Device Management Repository data source configuration " + "is null and " +
"thus, is not initialized");
}
JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition();
@ -68,15 +70,18 @@ public class DeviceManagementDAOFactory {
log.debug("Initializing Device Management Repository data source using the JNDI " +
"Lookup Definition");
}
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties();
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList =
jndiConfig.getJndiProperties();
if (jndiPropertyList != null) {
Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>();
for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) {
jndiProperties.put(prop.getName(), prop.getValue());
}
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
dataSource = DeviceManagementDAOUtil
.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
} else {
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
dataSource =
DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
}
}
return dataSource;

@ -22,7 +22,8 @@ import org.wso2.carbon.device.mgt.core.dto.DeviceType;
import java.util.List;
/**
* This class represents the key operations associated with persisting device type related information
* This class represents the key operations associated with persisting device type related
* information.
*/
public interface DeviceTypeDAO {

@ -44,15 +44,16 @@ public class DeviceDAOImpl implements DeviceDAO {
this.dataSource = dataSource;
}
@Override public void addDevice(Device device) throws DeviceManagementDAOException {
@Override
public void addDevice(Device device) throws DeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
try {
conn = this.getConnection();
String createDBQuery =
"INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DATE_OF_ENROLLMENT, DATE_OF_LAST_UPDATE, OWNERSHIP," +
"STATUS, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, OWNER, TENANT_ID) VALUES " +
"(?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
"INSERT INTO DM_DEVICE(DESCRIPTION, NAME, DATE_OF_ENROLLMENT, DATE_OF_LAST_UPDATE, " +
"OWNERSHIP, STATUS, DEVICE_TYPE_ID, DEVICE_IDENTIFICATION, OWNER, TENANT_ID) " +
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
stmt = conn.prepareStatement(createDBQuery);
stmt.setString(1, device.getDescription());
@ -75,23 +76,29 @@ public class DeviceDAOImpl implements DeviceDAO {
}
}
@Override public void updateDevice(Device device) throws DeviceManagementDAOException {
@Override
public void updateDevice(Device device) throws DeviceManagementDAOException {
}
@Override public void updateDeviceStatus(Long deviceId, Status status) throws DeviceManagementDAOException {
@Override
public void updateDeviceStatus(Long deviceId, Status status)
throws DeviceManagementDAOException {
}
@Override public void deleteDevice(Long deviceId) throws DeviceManagementDAOException {
@Override
public void deleteDevice(Long deviceId) throws DeviceManagementDAOException {
}
@Override public Device getDeviceByDeviceId(Long deviceId) throws DeviceManagementDAOException {
@Override
public Device getDeviceByDeviceId(Long deviceId) throws DeviceManagementDAOException {
return null;
}
@Override public Device getDeviceByDeviceIdentifier(Integer type, String identifier)
@Override
public Device getDeviceByDeviceIdentifier(Integer type, String identifier)
throws DeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
@ -102,7 +109,8 @@ public class DeviceDAOImpl implements DeviceDAO {
String selectDBQueryForType = "SELECT ID, DESCRIPTION, NAME, DATE_OF_ENROLLMENT, " +
"DATE_OF_LAST_UPDATE, OWNERSHIP, STATUS, DEVICE_TYPE_ID, " +
"DEVICE_IDENTIFICATION, OWNER, TENANT_ID FROM DM_DEVICE " +
"WHERE DM_DEVICE.DEVICE_TYPE_ID=? AND DM_DEVICE.DEVICE_IDENTIFICATION=?";
"WHERE DM_DEVICE.DEVICE_TYPE_ID=? AND " +
"DM_DEVICE.DEVICE_IDENTIFICATION=?";
stmt = conn.prepareStatement(selectDBQueryForType);
stmt.setInt(1, type);
stmt.setString(2, identifier);
@ -132,11 +140,13 @@ public class DeviceDAOImpl implements DeviceDAO {
return device;
}
@Override public List<Device> getDevices() throws DeviceManagementDAOException {
@Override
public List<Device> getDevices() throws DeviceManagementDAOException {
return null;
}
@Override public List<Device> getDevices(Integer type) throws DeviceManagementDAOException {
@Override
public List<Device> getDevices(Integer type) throws DeviceManagementDAOException {
Connection conn = null;
PreparedStatement stmt = null;
ResultSet resultSet = null;
@ -181,7 +191,8 @@ public class DeviceDAOImpl implements DeviceDAO {
try {
return dataSource.getConnection();
} catch (SQLException e) {
throw new DeviceManagementDAOException("Error occurred while obtaining a connection from the device " +
throw new DeviceManagementDAOException(
"Error occurred while obtaining a connection from the device " +
"management metadata repository datasource", e);
}
}

@ -87,13 +87,15 @@ public final class DeviceManagementDAOUtil {
try {
tenantId = tenantManager.getTenantId(tenantDomain);
} catch (UserStoreException e) {
String msg = "Error occurred while retrieving id from the domain of tenant " + tenantDomain;
String msg =
"Error occurred while retrieving id from the domain of tenant " + tenantDomain;
throw new DeviceManagementDAOException(msg);
}
return tenantId;
}
public static DataSource lookupDataSource(String dataSourceName, final Hashtable<Object, Object> jndiProperties) {
public static DataSource lookupDataSource(String dataSourceName,
final Hashtable<Object, Object> jndiProperties) {
try {
if (jndiProperties == null || jndiProperties.isEmpty()) {
return (DataSource) InitialContext.doLookup(dataSourceName);
@ -110,7 +112,8 @@ public final class DeviceManagementDAOUtil {
* @param deviceType - The DeviceType object associated with the device
* @return A Business Object.
*/
public static org.wso2.carbon.device.mgt.common.Device convertDevice(Device device, DeviceType deviceType){
public static org.wso2.carbon.device.mgt.common.Device convertDevice(Device device,
DeviceType deviceType) {
org.wso2.carbon.device.mgt.common.Device deviceBO =
new org.wso2.carbon.device.mgt.common.Device();
deviceBO.setDateOfEnrolment(device.getDateOfEnrollment());

@ -62,7 +62,8 @@ public class DeviceManagementServiceComponent {
}
/* Initializing Device Management Configuration */
DeviceConfigurationManager.getInstance().initConfig();
DeviceManagementConfig config = DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
DeviceManagementConfig config =
DeviceConfigurationManager.getInstance().getDeviceManagementConfig();
DataSourceConfig dsConfig = config.getDeviceMgtRepository().getDataSourceConfig();
DeviceManagementDAOFactory.init(dsConfig);
@ -71,11 +72,13 @@ public class DeviceManagementServiceComponent {
DeviceManagementDataHolder.getInstance().setDeviceManager(deviceManager);
/* If -Dsetup option enabled then create device management database schema */
String setupOption = System.getProperty(DeviceManagementConstants.Common.PROPERTY_SETUP);
String setupOption =
System.getProperty(DeviceManagementConstants.Common.PROPERTY_SETUP);
if (setupOption != null) {
if (log.isDebugEnabled()) {
log.debug("-Dsetup is enabled. Device management repository schema initialization is about " +
"to begin");
log.debug(
"-Dsetup is enabled. Device management repository schema initialization " +
"is about to begin");
}
this.setupDeviceManagementSchema(dsConfig);
}
@ -95,23 +98,28 @@ public class DeviceManagementServiceComponent {
}
}
private void setupDeviceManagementSchema(DataSourceConfig config) throws DeviceManagementException {
DeviceManagementSchemaInitializer initializer = new DeviceManagementSchemaInitializer(config);
private void setupDeviceManagementSchema(DataSourceConfig config)
throws DeviceManagementException {
DeviceManagementSchemaInitializer initializer =
new DeviceManagementSchemaInitializer(config);
log.info("Initializing device management repository database schema");
try {
initializer.createRegistryDatabase();
} catch (Exception e) {
throw new DeviceManagementException("Error occurred while initializing Device Management " +
throw new DeviceManagementException(
"Error occurred while initializing Device Management " +
"database schema", e);
}
if (log.isDebugEnabled()) {
log.debug("Device management metadata repository schema has been successfully initialized");
log.debug(
"Device management metadata repository schema has been successfully initialized");
}
}
/**
* Sets Device Manager service.
*
* @param deviceManagerService An instance of DeviceManagerService
*/
protected void setDeviceManagerService(DeviceManagerService deviceManagerService) {
@ -124,6 +132,7 @@ public class DeviceManagementServiceComponent {
/**
* Unsets Device Management service.
*
* @param deviceManagerService An Instance of DeviceManagerService
*/
protected void unsetDeviceManagerService(DeviceManagerService deviceManagerService) {
@ -136,6 +145,7 @@ public class DeviceManagementServiceComponent {
/**
* Sets Realm Service.
*
* @param realmService An instance of RealmService
*/
protected void setRealmService(RealmService realmService) {
@ -147,6 +157,7 @@ public class DeviceManagementServiceComponent {
/**
* Unsets Realm Service.
*
* @param realmService An instance of RealmService
*/
protected void unsetRealmService(RealmService realmService) {

@ -55,8 +55,10 @@ public class DeviceManagementService implements DeviceManager {
}
@Override
public boolean setActive(DeviceIdentifier deviceId, boolean status) throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager().setActive(deviceId, status);
public boolean setActive(DeviceIdentifier deviceId, boolean status)
throws DeviceManagementException {
return DeviceManagementDataHolder.getInstance().getDeviceManager()
.setActive(deviceId, status);
}
@Override
@ -68,7 +70,8 @@ public class DeviceManagementService implements DeviceManager {
public org.wso2.carbon.device.mgt.common.Device getDevice(DeviceIdentifier deviceId)
throws DeviceManagementException {
Device device = DeviceManagementDataHolder.getInstance().getDeviceManager().getDevice(deviceId);
Device device =
DeviceManagementDataHolder.getInstance().getDeviceManager().getDevice(deviceId);
return device;
}

@ -28,7 +28,9 @@ import org.wso2.carbon.device.mgt.core.internal.LicenseManagementDataHolder;
public class LicenseManagementService implements LicenseManager {
@Override
public License getLicense(String deviceType, String languageCode) throws LicenseManagementException {
return LicenseManagementDataHolder.getInstance().getLicenseManager().getLicense(deviceType, languageCode);
public License getLicense(String deviceType, String languageCode)
throws LicenseManagementException {
return LicenseManagementDataHolder.getInstance().getLicenseManager()
.getLicense(deviceType, languageCode);
}
}

@ -1,40 +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.core.util;
import javax.xml.bind.annotation.adapters.XmlAdapter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
public class DateAdapter extends XmlAdapter<String, Date> {
private SimpleDateFormat dateFormat = new SimpleDateFormat("dd-mm-yyyy");
@Override
public Date unmarshal(String strDate) throws ParseException {
return dateFormat.parse(strDate);
}
@Override
public String marshal(Date date) throws ParseException {
return dateFormat.format(date);
}
}

@ -31,7 +31,8 @@ public final class DeviceManagementSchemaInitializer extends DatabaseCreator {
private static final Log log = LogFactory.getLog(DeviceManagementSchemaInitializer.class);
private static final String setupSQLScriptBaseLocation =
CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator + "cdm" + File.separator;
CarbonUtils.getCarbonHome() + File.separator + "dbscripts" + File.separator + "cdm" +
File.separator;
public DeviceManagementSchemaInitializer(DataSourceConfig config) {
super(DeviceManagerUtil.resolveDataSource(config));

@ -50,7 +50,8 @@ public final class DeviceManagerUtil {
DocumentBuilder docBuilder = factory.newDocumentBuilder();
return docBuilder.parse(file);
} catch (Exception e) {
throw new DeviceManagementException("Error occurred while parsing file, while converting " +
throw new DeviceManagementException(
"Error occurred while parsing file, while converting " +
"to a org.w3c.dom.Document : " + e.getMessage(), e);
}
}
@ -65,23 +66,28 @@ public final class DeviceManagerUtil {
DataSource dataSource = null;
if (config == null) {
throw new RuntimeException(
"Device Management Repository data source configuration " + "is null and thus, is not initialized");
"Device Management Repository data source configuration " +
"is null and thus, is not initialized");
}
JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition();
if (jndiConfig != null) {
if (log.isDebugEnabled()) {
log.debug(
"Initializing Device Management Repository data source using the JNDI " + "Lookup Definition");
"Initializing Device Management Repository data source using the JNDI " +
"Lookup Definition");
}
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList = jndiConfig.getJndiProperties();
List<JNDILookupDefinition.JNDIProperty> jndiPropertyList =
jndiConfig.getJndiProperties();
if (jndiPropertyList != null) {
Hashtable<Object, Object> jndiProperties = new Hashtable<Object, Object>();
for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) {
jndiProperties.put(prop.getName(), prop.getValue());
}
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
dataSource = DeviceManagementDAOUtil
.lookupDataSource(jndiConfig.getJndiName(), jndiProperties);
} else {
dataSource = DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
dataSource =
DeviceManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null);
}
}
return dataSource;

@ -28,7 +28,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>0.9.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Decision Point</name>
@ -51,10 +51,10 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Policy Management Common Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.policy.evaluator</Private-Package>
<Bundle-Description>Complex Policy Decision Point Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.complex.policy.decision.point.internal</Private-Package>
<Export-Package>
org.wso2.carbon.policy.evaluator.*
org.wso2.carbon.complex.policy.decision.point.*
</Export-Package>
</instructions>
</configuration>

@ -0,0 +1,68 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>0.9.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>0.9.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Policy Information Point</name>
<description>WSO2 Carbon - Policy Information Point</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Policy Information Point Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.policy.information.point.internal</Private-Package>
<Bundle-Activator>org.wso2.carbon.policy.information.point.internal.PolicyInformationPointBundleActivator</Bundle-Activator>
<Export-Package>
org.wso2.carbon.policy.information.point.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,43 @@
/*
* 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.policy.information.point;
import org.wso2.carbon.policy.mgt.common.Feature;
import org.wso2.carbon.policy.mgt.common.PIPDeviceData;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyInformationService;
import java.util.List;
public class PolicyInformationServiceImpl implements PolicyInformationService{
@Override
public void getDeviceData(PIPDeviceData pipDeviceData) {
}
@Override
public List<Policy> getRelatedPolicies(PIPDeviceData pipDeviceData) {
return null;
}
@Override
public List<Feature> getRelatedFeatures(String deviceType) {
return null;
}
}

@ -0,0 +1,66 @@
/*
* 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.policy.information.point.internal;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import org.osgi.framework.ServiceRegistration;
import org.wso2.carbon.policy.information.point.PolicyInformationServiceImpl;
import org.wso2.carbon.policy.mgt.common.PolicyInformationService;
public class PolicyInformationPointBundleActivator implements BundleActivator {
private ServiceRegistration pipServiceRegRef;
private static final Log log = LogFactory.getLog(PolicyInformationPointBundleActivator.class);
@Override
public void start(BundleContext bundleContext) throws Exception {
try {
if (log.isDebugEnabled()) {
log.debug("Activating Policy information Point bundle.");
}
pipServiceRegRef = bundleContext.registerService(PolicyInformationService.class.getName(),
new PolicyInformationServiceImpl(), null);
if (log.isDebugEnabled()) {
log.debug("Policy information Point bundle is activated.");
}
} catch (Exception ex) {
log.error("Error occurred while activating the Policy Information Point bundle.", ex);
}
}
@Override
public void stop(BundleContext bundleContext) throws Exception {
try {
if (log.isDebugEnabled()) {
log.debug("Policy information Point bundle is deactivated.");
}
pipServiceRegRef.unregister();
} catch (Exception ex) {
log.error("Error occurred while de-activating the Policy Information Point bundle.", ex);
}
}
}

@ -0,0 +1,39 @@
/*
* 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.policy.mgt.common;
import java.sql.Timestamp;
import java.util.List;
import java.util.Map;
public class PIPDeviceData {
String deviceId;
String deviceType;
String ownershipType;
List<String> userIds;
List<String> roles;
String altitude;
String longitude;
Timestamp timestamp;
/*This will be used to record attributes to which would come from other PDPs*/
Map<String, Object> attributes;
}

@ -18,16 +18,82 @@
package org.wso2.carbon.policy.mgt.common;
import java.sql.Date;
import java.util.List;
import java.util.Map;
/**
* This class will be the used to create policy object with relevant information for evaluating.
*/
public class Policy {
private int id;
private String policyName;
private List<Feature> featuresList;
private boolean generic;
private List<String> roleList;
private List<String> DeviceList;
private String deviceType;
private int id; // Identifier of the policy.
private int priorityId; // Priority of the policies. This will be used only for simple evaluation.
private String policyName; // Name of the policy.
private List<Feature> featuresList; // Features included in the policies.
private boolean generic; // If true, this should be applied to all related device.
private List<String> roleList; // Roles which this policy should be applied.
private String ownershipType; // Ownership type (COPE, BYOD, CPE)
private List<String> DeviceList; // Individual devices this policy should be applied
private String deviceType; // Device type to apply the policy.
/*Dynamic policy attributes*/
/*These are related to time based policies*/
private int startTime; // Start time to apply the policy.
private int endTime; // After this time policy will not be applied
private Date startDate; // Start date to apply the policy
private Date endDate; // After this date policy will not be applied.
/*These are related to location based policies*/
private String altitude; // Altitude
private String longitude; // Longitude
/*This will be used to record attributes which will be used by customer extended PDPs and PIPs*/
private Map<String, Object> attributes;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public int getPriorityId() {
return priorityId;
}
public void setPriorityId(int priorityId) {
this.priorityId = priorityId;
}
public String getPolicyName() {
return policyName;
}
public void setPolicyName(String policyName) {
this.policyName = policyName;
}
public List<Feature> getFeaturesList() {
return featuresList;
}
public void setFeaturesList(List<Feature> featuresList) {
this.featuresList = featuresList;
}
public boolean isGeneric() {
return generic;
}
public void setGeneric(boolean generic) {
this.generic = generic;
}
public List<String> getRoleList() {
return roleList;
@ -37,6 +103,14 @@ public class Policy {
this.roleList = roleList;
}
public String getOwnershipType() {
return ownershipType;
}
public void setOwnershipType(String ownershipType) {
this.ownershipType = ownershipType;
}
public List<String> getDeviceList() {
return DeviceList;
}
@ -53,35 +127,59 @@ public class Policy {
this.deviceType = deviceType;
}
public boolean isGeneric() {
return generic;
public int getStartTime() {
return startTime;
}
public void setGeneric(boolean generic) {
this.generic = generic;
public void setStartTime(int startTime) {
this.startTime = startTime;
}
public int getId() {
return id;
public int getEndTime() {
return endTime;
}
public void setId(int id) {
this.id = id;
public void setEndTime(int endTime) {
this.endTime = endTime;
}
public String getPolicyName() {
return policyName;
public Date getStartDate() {
return startDate;
}
public void setPolicyName(String policyName) {
this.policyName = policyName;
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public List<Feature> getFeaturesList() {
return featuresList;
public Date getEndDate() {
return endDate;
}
public void setFeaturesList(List<Feature> featuresList) {
this.featuresList = featuresList;
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getAltitude() {
return altitude;
}
public void setAltitude(String altitude) {
this.altitude = altitude;
}
public String getLongitude() {
return longitude;
}
public void setLongitude(String longitude) {
this.longitude = longitude;
}
public Map<String, Object> getAttributes() {
return attributes;
}
public void setAttributes(Map<String, Object> attributes) {
this.attributes = attributes;
}
}

@ -22,7 +22,7 @@ package org.wso2.carbon.policy.mgt.common;
* This interface defines the policy management which should be implemented by the plugins
*/
public interface PolicyManagerService {
public interface PolicyAdministratorService {
/**
* This method adds a policy to the platform
@ -100,11 +100,32 @@ public interface PolicyManagerService {
Policy getPolicyOfRole(String roleName) throws FeatureManagementException, PolicyManagementException;
/**
* This method checks weather a policy is available for a device.
* @param deviceId
* @param deviceType
* @return
* @throws PolicyManagementException
*/
boolean isPolicyAvailableForDevice(String deviceId, String deviceType) throws PolicyManagementException;
/**
* This method checks weather a policy is used by a particular device.
* @param deviceId
* @param deviceType
* @return
* @throws PolicyManagementException
*/
boolean isPolicyUsed(String deviceId, String deviceType) throws PolicyManagementException;
/**
*
* @param deviceId
* @param deviceType
* @param policy
* @throws PolicyManagementException
*/
void setPolicyUsed(String deviceId, String deviceType, Policy policy) throws PolicyManagementException;
}

@ -0,0 +1,44 @@
/*
* 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.policy.mgt.common;
import java.util.List;
/**
* This is the interface which will be used to create plug-able policy decision points.
*/
public interface PolicyEvaluationService {
/**
* This method returns the effective policy from the list.
* @param pipDeviceData device information.
* @return returns the effective policy.
*/
Policy getEffectivePolicy(PIPDeviceData pipDeviceData);
/**
* This class will return the effective feature set from the list.
* @param pipDeviceData device information.
* @return returns the effective feature set.
*/
List<Feature> getEffectiveFeatures(PIPDeviceData pipDeviceData);
}

@ -0,0 +1,50 @@
/*
* 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.policy.mgt.common;
import java.util.List;
/**
* This will be used retrieve data database. This interface has to be implemented by PIP. PIP will be plug-able.
*/
public interface PolicyInformationService {
/**
* This method will return the data related Device, Some of the device data will provided in the initial pipDeviceData object such as
* device id, device time and location, Other data such as roles, owned users and ownership type will be filled by this method.
* @param pipDeviceData device data.
*/
void getDeviceData(PIPDeviceData pipDeviceData);
/**
* This method will retrieve the policies related given device Data.
* @param pipDeviceData
* @return
*/
List<Policy> getRelatedPolicies(PIPDeviceData pipDeviceData);
/**
* This is will retrieve the features related to device type. This feature list will be used for dynamically
* merging the policies.
* @param deviceType
* @return
*/
List<Feature> getRelatedFeatures(String deviceType);
}

@ -20,10 +20,10 @@ package org.wso2.carbon.policy.mgt.common.impl;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyAdministratorService;
import org.wso2.carbon.policy.mgt.common.PolicyManagementException;
import org.wso2.carbon.policy.mgt.common.PolicyManagerService;
public class PolicyManagement implements PolicyManagerService {
public class PolicyManagement implements PolicyAdministratorService {
@Override
public int addPolicy(Policy policy) {
return 0;

@ -21,6 +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.policy.mgt.common.PolicyInformationService;
import org.wso2.carbon.policy.mgt.core.config.PolicyConfigurationManager;
import org.wso2.carbon.policy.mgt.core.config.PolicyManagementConfig;
import org.wso2.carbon.policy.mgt.core.config.datasource.DataSourceConfig;
@ -28,13 +29,19 @@ import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
import org.wso2.carbon.user.core.service.RealmService;
/**
* @scr.component name="org.wso2.carbon.policy.manager" immediate="true"
* @scr.component name="org.wso2.carbon.devicemgt.policy.manager" immediate="true"
* @scr.reference name="user.realmservice.default"
* interface="org.wso2.carbon.user.core.service.RealmService"
* cardinality="1..1"
* policy="dynamic"
* bind="setRealmService"
* unbind="unsetRealmService"
* @scr.reference name="org.wso2.carbon.devicemgt.policy.information.point.default"
* interface="org.wso2.carbon.policy.mgt.common.PolicyInformationService"
* cardinality="1..1"
* policy="dynamic"
* bind="setPIPService"
* unbind="unsetPIPService"
*/
public class PolicyManagementServiceComponent {
@ -81,4 +88,17 @@ public class PolicyManagementServiceComponent {
PolicyManagementDataHolder.getInstance().setRealmService(null);
}
protected void setPIPService(PolicyInformationService policyInformationService) {
if (log.isDebugEnabled()) {
log.debug("Setting Policy Information Service");
}
}
protected void unsetPIPService(PolicyInformationService policyInformationService) {
if (log.isDebugEnabled()) {
log.debug("Unsetting Policy Information Service");
}
}
}

@ -0,0 +1,64 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>policy-mgt</artifactId>
<version>0.9.1-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.simple.policy.decision.point</artifactId>
<version>0.9.1-SNAPSHOT</version>
<packaging>bundle</packaging>
<name>WSO2 Carbon - Simple Policy Decision Point</name>
<description>WSO2 Carbon - Simple Policy Decision Point</description>
<url>http://wso2.org</url>
<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>1.4.0</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Simple Policy Decision Point Bundle</Bundle-Description>
<Private-Package>org.wso2.carbon.simple.policy.decision.point.internal</Private-Package>
<Export-Package>
org.wso2.carbon.simple.policy.decision.point.*
</Export-Package>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.common</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.logging</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
</dependency>
</dependencies>
</project>

@ -0,0 +1,38 @@
/*
* 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.simple.policy.decision.point;
import org.wso2.carbon.policy.mgt.common.Feature;
import org.wso2.carbon.policy.mgt.common.PIPDeviceData;
import org.wso2.carbon.policy.mgt.common.Policy;
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationService;
import java.util.List;
public class PolicyEvaluationServiceImpl implements PolicyEvaluationService {
@Override
public Policy getEffectivePolicy(PIPDeviceData pipDeviceData) {
return null;
}
@Override
public List<Feature> getEffectiveFeatures(PIPDeviceData pipDeviceData) {
return null;
}
}

@ -38,7 +38,9 @@
<modules>
<module>org.wso2.carbon.policy.mgt.core</module>
<module>org.wso2.carbon.policy.mgt.common</module>
<module>org.wso2.carbon.policy.evalutor</module>
<module>org.wso2.carbon.policy.information.point</module>
<module>org.wso2.carbon.simple.policy.decision.point</module>
<module>org.wso2.carbon.complex.policy.decision.point</module>
</modules>

@ -18,7 +18,8 @@
~ under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<groupId>org.wso2.carbon.devicemgt</groupId>
@ -47,7 +48,11 @@
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
</dependency>
</dependencies>
@ -99,11 +104,17 @@
</properties>
</adviceFile>
<bundles>
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.core:${carbon.device.mgt.version}
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.core:${carbon.device.mgt.version}
</bundleDef>
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.common:${carbon.device.mgt.version}
</bundleDef>
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.common:${carbon.device.mgt.version}
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.complex.policy.decision.point:${carbon.device.mgt.version}
</bundleDef>
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.evaluator:${carbon.device.mgt.version}
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.information.point:${carbon.device.mgt.version}
</bundleDef>
</bundles>
<importFeatures>

@ -67,7 +67,12 @@
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
<version>${carbon.device.mgt.version}</version>
</dependency>
<!-- Device Management dependencies -->

Loading…
Cancel
Save