From 169c9db89b254eee921df8055013a7437f4c22de Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 11:48:59 +0530 Subject: [PATCH 01/14] code cleanup --- .../device/mgt/core/internal/DeviceMgtServiceComponent.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java index ce9f77cdfb..1703d23fd5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java @@ -31,13 +31,13 @@ public class DeviceMgtServiceComponent { protected void setDeviceManagerService(DeviceManagerService deviceManager) { if (log.isDebugEnabled()) { - log.debug("Setting Data Sources Service"); + log.debug("Setting Device Management Service"); } } protected void unsetDeviceManagerService(DeviceManagerService deviceManager) { if (log.isDebugEnabled()) { - log.debug("Unsetting Data Sources Service"); + log.debug("Unsetting Device Management Service"); } } From 41d372536d2cae84c657d124044106d503b43093 Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Thu, 4 Dec 2014 11:58:39 +0530 Subject: [PATCH 02/14] Fixing bin xml to add bin folder --- product/modules/distribution/pom.xml | 43 +++---- .../modules/distribution/src/assembly/bin.xml | 118 +++++++++--------- .../distribution/src/assembly/dist.xml | 4 +- .../distribution/src/assembly/docs.xml | 2 +- .../src/assembly/filter.properties | 2 +- 5 files changed, 85 insertions(+), 84 deletions(-) diff --git a/product/modules/distribution/pom.xml b/product/modules/distribution/pom.xml index 81d0999a46..c326a514ef 100644 --- a/product/modules/distribution/pom.xml +++ b/product/modules/distribution/pom.xml @@ -104,16 +104,16 @@ - + - + + dir="${tempdir}/wso2cdm-${project.version}/repository/components"> @@ -178,7 +178,7 @@ - + @@ -197,7 +197,7 @@ org.apache.maven.plugins maven-assembly-plugin - 2.5.2 + 1-pre-dist @@ -217,21 +217,22 @@ - + + 2-dist + package + + attached + + + false + + ${basedir}/src/assembly/filter.properties + + + ${basedir}/src/assembly/bin.xml + + + diff --git a/product/modules/distribution/src/assembly/bin.xml b/product/modules/distribution/src/assembly/bin.xml index 3a3fbc673a..a6b60078ef 100644 --- a/product/modules/distribution/src/assembly/bin.xml +++ b/product/modules/distribution/src/assembly/bin.xml @@ -1,5 +1,5 @@ - + bin zip @@ -8,8 +8,8 @@ target/wso2carbon-core-${carbon.kernel.version} - wso2emm-${project.version} - + wso2cdm-${pom.version} + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/lib/runtimes - wso2emm-${project.version}/lib/runtimes/ + wso2cdm-${pom.version}/lib/runtimes/ */** target/wso2carbon-core-${carbon.kernel.version} - wso2emm-${project.version} + wso2cdm-${pom.version} **/*.sh 755 - + ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/multitenancy/ - wso2emm-${project.version}/repository/conf/multitenancy + wso2cdm-${project.version}/repository/conf/multitenancy **/stratos.xml **/multitenancy-packages.xml @@ -68,7 +68,7 @@ ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/multitenancy/ - wso2emm-${project.version}/repository/conf + wso2cdm-${project.version}/repository/conf **/tenant-mgt.xml @@ -76,14 +76,14 @@ src/repository/resources/styles/css - wso2emm-${project.version}/resources/allthemes/Default/admin + wso2cdm-${project.version}/resources/allthemes/Default/admin **/**.css src/repository/resources/styles/images - wso2emm-${project.version}/resources/allthemes/Default/images + wso2cdm-${project.version}/resources/allthemes/Default/images **/**.gif **/**.png @@ -94,13 +94,13 @@ target/site - wso2emm-${project.version}/docs + wso2cdm-${project.version}/docs 755 src/repository/resources/stratos_root - wso2emm-${project.version}/repository/deployment/server/webapps/STRATOS_ROOT + wso2cdm-${project.version}/repository/deployment/server/webapps/STRATOS_ROOT 755 @@ -110,7 +110,7 @@ */** - + - + + <!–copy web app for application authentication feature –> ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps @@ -146,10 +146,10 @@ authenticationendpoint.war - + --> src/repository/conf - wso2emm-${project.version}/repository/conf + wso2cdm-${project.version}/repository/conf **/api-manager.xml **/sso-idp-config.xml @@ -159,7 +159,7 @@ ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/security/ - wso2emm-${project.version}/repository/conf/security/ + wso2cdm-${project.version}/repository/conf/security/ **/entitlement.properties **/trusted-idp-config.xml @@ -167,14 +167,14 @@ src/repository/conf/datasources - wso2emm-${project.version}/repository/conf/datasources + wso2cdm-${project.version}/repository/conf/datasources **/master-datasources.xml src/repository/resources - wso2emm-${project.version}/repository/resources + wso2cdm-${project.version}/repository/resources */** @@ -182,12 +182,12 @@ src/repository/conf/data-bridge - wso2emm-${project.version}/repository/conf/data-bridge + wso2cdm-${project.version}/repository/conf/data-bridge 755 ../p2-profile-gen/target/wso2carbon-core-${carbon.version}/lib/runtimes - wso2emm-${project.version}/lib/runtimes/ + wso2cdm-${project.version}/lib/runtimes/ */** @@ -195,14 +195,14 @@ ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/service-provider - wso2emm-${project.version}/dbscripts/service-provider + wso2cdm-${project.version}/dbscripts/service-provider */** ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/modules - wso2emm-${project.version}/modules/ + wso2cdm-${project.version}/modules/ */** @@ -212,7 +212,7 @@ src/repository/dbscripts/ - wso2emm-${project.version}/dbscripts + wso2cdm-${project.version}/dbscripts */** @@ -222,13 +222,13 @@ - wso2emm-${project.version}/lib/endorsed + wso2cdm-${project.version}/lib/endorsed javax.el:el-api:jar - wso2emm-${project.version}/repository/deployment/client/modules + wso2cdm-${project.version}/repository/deployment/client/modules org.hibernate.wso2:hibernate:jar @@ -238,11 +238,11 @@ - + src/repository/conf/tomcat/context.xml - wso2emm-${project.version}/repository/conf/tomcat + wso2cdm-${project.version}/repository/conf/tomcat true 644 - + INSTALL.txt - wso2emm-${project.version} + wso2cdm-${project.version} true 644 README.txt - wso2emm-${project.version} + wso2cdm-${project.version} true 644 LICENSE.txt - wso2emm-${project.version} + wso2cdm-${project.version} true 644 release-notes.html - wso2emm-${project.version} + wso2cdm-${project.version} true 644 target/wso2carbon-core-${carbon.kernel.version}/bin/README.txt - wso2emm-${project.version}/bin/ + wso2cdm-${project.version}/bin/ true 644 target/wso2carbon-core-${carbon.kernel.version}/bin/version.txt - wso2emm-${project.version}/bin/ + wso2cdm-${project.version}/bin/ true 644 - + - src/repository/conf/log4j.properties - wso2emm-${project.version}/repository/conf/ + target/wso2carbon-core-${carbon.kernel.version}/repository/conf/log4j.properties + wso2cdm-${project.version}/repository/conf/ true src/repository/conf/multitenancy/cloud-services-desc.xml - wso2emm-${project.version}/repository/conf/multitenancy/ + wso2cdm-${project.version}/repository/conf/multitenancy/ true src/repository/conf/axis2/axis2.xml - wso2emm-${project.version}/repository/conf/axis2/ + wso2cdm-${project.version}/repository/conf/axis2/ true 644 src/repository/conf/application-authenticators.xml - wso2emm-${project.version}/repository/conf/security/ + wso2cdm-${project.version}/repository/conf/security/ true 644 target/wso2carbon-core-${carbon.kernel.version}/repository/conf/README - wso2emm-${project.version}/repository/conf/ + wso2cdm-${project.version}/repository/conf/ true 644 src/repository/conf/identity.xml - wso2emm-${project.version}/repository/conf + wso2cdm-${project.version}/repository/conf 644 src/repository/database/WSO2EMM_DB.h2.db - wso2emm-${project.version}/repository/database + wso2cdm-${project.version}/repository/database 644 - + diff --git a/product/modules/distribution/src/assembly/dist.xml b/product/modules/distribution/src/assembly/dist.xml index 35210c3bac..d0a9a55a8d 100644 --- a/product/modules/distribution/src/assembly/dist.xml +++ b/product/modules/distribution/src/assembly/dist.xml @@ -16,7 +16,7 @@ ~ under the License. --> - 1-pre-dist + wso2-cdm-dist zip @@ -26,7 +26,7 @@ ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/components - wso2emm-${project.version}/repository/components + wso2cdm-${project.version}/repository/components **/eclipse.ini **/*.lock diff --git a/product/modules/distribution/src/assembly/docs.xml b/product/modules/distribution/src/assembly/docs.xml index 7d7a026e7e..51539b58bb 100644 --- a/product/modules/distribution/src/assembly/docs.xml +++ b/product/modules/distribution/src/assembly/docs.xml @@ -25,7 +25,7 @@ target/site - wso2emm-${project.version}-docs + wso2cdm-${project.version}-docs ../../modules/documentation/src/site/xdoc/user-core diff --git a/product/modules/distribution/src/assembly/filter.properties b/product/modules/distribution/src/assembly/filter.properties index bd8f07d1e0..a0ebf6302a 100644 --- a/product/modules/distribution/src/assembly/filter.properties +++ b/product/modules/distribution/src/assembly/filter.properties @@ -1,6 +1,6 @@ product.name=WSO2 Connected Device Manager product.version=2.0.0-SNAPSHOT -product.key=EMM +product.key=CDM hotdeployment=true hotupdate=true carbon.version=4.3.0 From 6bd0f82e2c6b7b8baaf0a6297fe636eeb3ed17e0 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 13:57:48 +0530 Subject: [PATCH 03/14] adding mobile plugin implementation related modules --- .../pom.xml | 77 +++++++++++++++++++ 1 file changed, 77 insertions(+) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml new file mode 100644 index 0000000000..8226ca1fe0 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml @@ -0,0 +1,77 @@ + + + + device-mgt + org.wso2.carbon + 2.0.0-SNAPSHOT + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.device.mgt.mobile.impl + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Mobile Device Management Impl + WSO2 Carbon - Mobile Device Management Impl + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Device Management Core Bundle + org.wso2.carbon.device.mgt.mobile.impl.internal + + org.osgi.framework, + org.osgi.service.component, + org.apache.commons.logging, + + + !org.wso2.carbon.device.mgt.mobile.impl.internal, + org.wso2.carbon.device.mgt.mobile.impl.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.device.mgt.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + + \ No newline at end of file From db9505695223aab8c3c5027477c3e31e4075d9d2 Mon Sep 17 00:00:00 2001 From: harshanL Date: Thu, 4 Dec 2014 14:45:02 +0530 Subject: [PATCH 04/14] Added Mobile-platform specific DeviceManagerService implementations. --- .../mgt/common/spi/DeviceManagerService.java | 4 +- .../android/AndroidDeviceManagerService.java | 78 +++++++++++++++++++ .../MobileDeviceMgtServiceComponent.java | 23 ++++++ .../impl/ios/IOSDeviceManagerService.java | 77 ++++++++++++++++++ .../windows/WindowsDeviceManagerService.java | 77 ++++++++++++++++++ 5 files changed, 257 insertions(+), 2 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java index e73a0af766..45b674228e 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java @@ -31,7 +31,7 @@ public interface DeviceManagerService { * @param device Metadata corresponding to the device being enrolled * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - void enrolDevice(Device device) throws DeviceManagementException; + void enrollDevice(Device device) throws DeviceManagementException; /** * Method to modify the metadata corresponding to device enrollment @@ -39,7 +39,7 @@ public interface DeviceManagerService { * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a * device */ - void modifyEnrolment(Device device) throws DeviceManagementException; + void modifyEnrollment(Device device) throws DeviceManagementException; /** * Method to disenroll a particular device from CDM. diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java new file mode 100644 index 0000000000..74a046cba3 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java @@ -0,0 +1,78 @@ +/* + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.carbon.device.mgt.mobile.impl.android; + +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; + +import java.util.List; + +/** + * This represents the Android implementation of DeviceManagerService. * + */ +public class AndroidDeviceManagerService implements DeviceManagerService { + + @Override + public void enrollDevice(Device device) throws DeviceManagementException { + + } + + @Override + public void modifyEnrollment(Device device) throws DeviceManagementException { + + } + + @Override + public void disEnrollDevice(String type, String deviceId) + throws DeviceManagementException { + + } + + @Override + public boolean isRegistered(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public boolean isActive(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public void setActive(boolean status) throws DeviceManagementException { + + } + + @Override + public List getAllDeviceInfo(String type) throws DeviceManagementException { + return null; + } + + @Override + public Device getDeviceInfo(String type, String deviceId) + throws DeviceManagementException { + return null; + } + + @Override + public void setOwnership(String ownershipType) throws DeviceManagementException { + + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java new file mode 100644 index 0000000000..e1a8817952 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.carbon.device.mgt.mobile.impl.internal; + +/** + * Created by harshan on 12/4/14. + */ +public class MobileDeviceMgtServiceComponent { +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java new file mode 100644 index 0000000000..1907f2636e --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.carbon.device.mgt.mobile.impl.ios; + +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; + +import java.util.List; + +/** + * This represents the iOS implementation of DeviceManagerService. * + */ +public class IOSDeviceManagerService implements DeviceManagerService { + @Override + public void enrollDevice(Device device) throws DeviceManagementException { + + } + + @Override + public void modifyEnrollment(Device device) throws DeviceManagementException { + + } + + @Override + public void disEnrollDevice(String type, String deviceId) + throws DeviceManagementException { + + } + + @Override + public boolean isRegistered(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public boolean isActive(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public void setActive(boolean status) throws DeviceManagementException { + + } + + @Override + public List getAllDeviceInfo(String type) throws DeviceManagementException { + return null; + } + + @Override + public Device getDeviceInfo(String type, String deviceId) + throws DeviceManagementException { + return null; + } + + @Override + public void setOwnership(String ownershipType) throws DeviceManagementException { + + } +} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java new file mode 100644 index 0000000000..98a339448b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java @@ -0,0 +1,77 @@ +/* + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.wso2.carbon.device.mgt.mobile.impl.windows; + +import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceManagementException; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; + +import java.util.List; + +/** + * This represents the Windows implementation of DeviceManagerService. + */ +public class WindowsDeviceManagerService implements DeviceManagerService{ + @Override + public void enrollDevice(Device device) throws DeviceManagementException { + + } + + @Override + public void modifyEnrollment(Device device) throws DeviceManagementException { + + } + + @Override + public void disEnrollDevice(String type, String deviceId) + throws DeviceManagementException { + + } + + @Override + public boolean isRegistered(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public boolean isActive(String type, String deviceId) + throws DeviceManagementException { + return false; + } + + @Override + public void setActive(boolean status) throws DeviceManagementException { + + } + + @Override + public List getAllDeviceInfo(String type) throws DeviceManagementException { + return null; + } + + @Override + public Device getDeviceInfo(String type, String deviceId) + throws DeviceManagementException { + return null; + } + + @Override + public void setOwnership(String ownershipType) throws DeviceManagementException { + + } +} From d23da5e215394119f3a928348a0530eb2ccf59c2 Mon Sep 17 00:00:00 2001 From: harshanL Date: Thu, 4 Dec 2014 14:51:25 +0530 Subject: [PATCH 05/14] Added Mobile DeviceManagerService component. --- components/device-mgt/pom.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 8ec21df4bb..c193df9605 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -39,6 +39,7 @@ org.wso2.carbon.device.mgt.core org.wso2.carbon.device.mgt.common + org.wso2.carbon.device.mgt.mobile.impl From 578338263ca5a0bc9c117515429429c680dae142 Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Thu, 4 Dec 2014 16:41:32 +0530 Subject: [PATCH 06/14] Adding policy management components --- .../org.wso2.carbon.policy.evalutor/pom.xml | 89 ++++++++++++++++++ .../carbon/policy/evaluator/PDPException.java | 22 +++++ .../policy/evaluator/spi/PDPService.java | 25 +++++ .../org.wso2.carbon.policy.mgt.common/pom.xml | 89 ++++++++++++++++++ .../wso2/carbon/policy/mgt/common/Policy.java | 32 +++++++ .../mgt/common/PolicyManagementException.java | 56 +++++++++++ .../mgt/common/spi/PolicyManagerService.java | 30 ++++++ .../org.wso2.carbon.policy.mgt.core/pom.xml | 94 +++++++++++++++++++ .../internal/PolicyMgtServiceComponent.java | 25 +++++ components/policy-mgt/pom.xml | 65 +++++++++++++ pom.xml | 1 + 11 files changed, 528 insertions(+) create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java create mode 100644 components/policy-mgt/pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml new file mode 100644 index 0000000000..3d72835c75 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml @@ -0,0 +1,89 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.evaluator + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Decision Point + WSO2 Carbon - Policy Decision Point + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Common Bundle + org.wso2.carbon.policy.evaluator + + org.apache.commons.logging + + + org.wso2.carbon.policy.evaluator.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java new file mode 100644 index 0000000000..799efadeb0 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2005-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.policy.evaluator; + +public class PDPException { +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java new file mode 100644 index 0000000000..9c3f33da34 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java @@ -0,0 +1,25 @@ +/* +* 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.policy.evaluator.spi; + + +public interface PDPService { + + +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml new file mode 100644 index 0000000000..f39fe3df81 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -0,0 +1,89 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.mgt.common + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Management Common + WSO2 Carbon - Policy Management Common + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Common Bundle + org.wso2.carbon.policy.mgt.common.internal + + org.apache.commons.logging + + + org.wso2.carbon.policy.mgt.common.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java new file mode 100644 index 0000000000..ddebf9e1e1 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java @@ -0,0 +1,32 @@ +/* +* 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.policy.mgt.common; + +public class Policy { + private int id; + private String policyName; + + + public static class Features { + + private String code; + private String name; + private Object attribute; + } +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java new file mode 100644 index 0000000000..9e087ff3d8 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-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.policy.mgt.common; + +public class PolicyManagementException extends Exception { + + private String policyErrorMessage; + + public String getPolicyErrorMessage() { + return policyErrorMessage; + } + + public void setPolicyErrorMessage(String policyErrorMessage) { + this.policyErrorMessage = policyErrorMessage; + } + + public PolicyManagementException(String message) { + super(message); + setPolicyErrorMessage(message); + } + + public PolicyManagementException(String message, Exception ex) { + super(message, ex); + setPolicyErrorMessage(message); + } + + public PolicyManagementException(String message, Throwable cause) { + super(message, cause); + setPolicyErrorMessage(message); + } + + + public PolicyManagementException() { + super(); + } + + public PolicyManagementException(Throwable cause) { + super(cause); + } +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java new file mode 100644 index 0000000000..7fd3bf5dc1 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java @@ -0,0 +1,30 @@ +/* +* 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.policy.mgt.common.spi; + +import org.wso2.carbon.policy.mgt.common.Policy; + +public interface PolicyManagerService { + + void addPolicy(Policy policy); + + void addPolicy(String deviceId, String deviceType, Policy policy); + + void addPolicy(String deviceType,Policy policy); +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml new file mode 100644 index 0000000000..d66e9ff997 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -0,0 +1,94 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.mgt.core + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Management Core + WSO2 Carbon - Policy Management Core + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Core Bundle + org.wso2.carbon.policy.mgt.core.internal + + org.apache.axis2.*; + version="${axis2.osgi.version.range}", + org.osgi.framework, + org.osgi.service.component, + org.apache.commons.logging, + + + !org.wso2.carbon.policy.mgt.core.internal, + org.wso2.carbon.policy.mgt.core.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java new file mode 100644 index 0000000000..b66e04262e --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wso2.carbon.policy.mgt.core.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PolicyMgtServiceComponent { + + private static Log log = LogFactory.getLog(PolicyMgtServiceComponent.class); + +} diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml new file mode 100644 index 0000000000..1c6633acd5 --- /dev/null +++ b/components/policy-mgt/pom.xml @@ -0,0 +1,65 @@ + + + + + + + org.wso2.carbon + wso2cdm-parent + 2.0.0-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + pom + WSO2 Carbon - Policy Management Component + http://wso2.org + + + org.wso2.carbon.policy.mgt.core + org.wso2.carbon.policy.mgt.common + org.wso2.carbon.policy.evalutor + + + + + + org.eclipse.osgi + org.eclipse.osgi + 3.8.1.v20120830-144521 + + + org.eclipse.equinox + org.eclipse.equinox.common + 3.6.100.v20120522-1841 + + + org.wso2.carbon + org.wso2.carbon.logging + 4.3.0-SNAPSHOT + + + + + diff --git a/pom.xml b/pom.xml index d0b77c184f..07e6b80b30 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ components/device-mgt + components/policy-mgt product/modules/p2-profile-gen product/modules/distribution product/modules/integration From b94d6edfce34d250292e2bf7ef18ebc93ee55461 Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Thu, 4 Dec 2014 16:51:15 +0530 Subject: [PATCH 07/14] Fixing pom name issues of cdm product --- product/modules/integration/tests-common/admin-clients/pom.xml | 2 +- .../integration/tests-common/integration-test-utils/pom.xml | 2 +- product/modules/integration/tests-common/ui-pages/pom.xml | 2 +- product/modules/p2-profile-gen/pom.xml | 1 + 4 files changed, 4 insertions(+), 3 deletions(-) diff --git a/product/modules/integration/tests-common/admin-clients/pom.xml b/product/modules/integration/tests-common/admin-clients/pom.xml index 43406c5d33..10da72790e 100644 --- a/product/modules/integration/tests-common/admin-clients/pom.xml +++ b/product/modules/integration/tests-common/admin-clients/pom.xml @@ -32,5 +32,5 @@ org.wso2.cdm org.wso2.cdm.integration.common.clients jar - admin-clents + WSO2 CDM - Integration Admin Clients diff --git a/product/modules/integration/tests-common/integration-test-utils/pom.xml b/product/modules/integration/tests-common/integration-test-utils/pom.xml index 7154dea020..28aee1ab94 100644 --- a/product/modules/integration/tests-common/integration-test-utils/pom.xml +++ b/product/modules/integration/tests-common/integration-test-utils/pom.xml @@ -32,7 +32,7 @@ org.wso2.cdm.integration.common.utils org.wso2.cdm jar - integration-test-utils + WSO2 CDM - Integration Test Utils diff --git a/product/modules/integration/tests-common/ui-pages/pom.xml b/product/modules/integration/tests-common/ui-pages/pom.xml index 4868a6873d..a26af8b05a 100644 --- a/product/modules/integration/tests-common/ui-pages/pom.xml +++ b/product/modules/integration/tests-common/ui-pages/pom.xml @@ -32,7 +32,7 @@ org.wso2.cdm org.wso2.cdm.integration.ui.pages jar - integration-test-ui-pages + WSO2 CDM - Integration Test Ui Pages diff --git a/product/modules/p2-profile-gen/pom.xml b/product/modules/p2-profile-gen/pom.xml index 2bf338b4a1..9d70de4249 100644 --- a/product/modules/p2-profile-gen/pom.xml +++ b/product/modules/p2-profile-gen/pom.xml @@ -28,6 +28,7 @@ 4.0.0 wso2cdm-profile-gen + WSO2 Connected Device Manager (CDM) - P2 Profile Gen pom From 843322d33f502ab26cd49c368d58dd0419060846 Mon Sep 17 00:00:00 2001 From: harshanL Date: Thu, 4 Dec 2014 17:12:55 +0530 Subject: [PATCH 08/14] Added service registrations to Mobile DeviceManagerService component . --- .../pom.xml | 7 ++- .../MobileDeviceMgtServiceComponent.java | 43 ++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml index 8226ca1fe0..18f3cb20a1 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/pom.xml @@ -33,7 +33,7 @@ ${project.artifactId} ${project.artifactId} ${project.version} - Device Management Core Bundle + Device Management Mobile Impl Bundle org.wso2.carbon.device.mgt.mobile.impl.internal org.osgi.framework, @@ -72,6 +72,11 @@ org.wso2.carbon org.wso2.carbon.logging + + org.eclipse.osgi + org.eclipse.osgi.services + 3.2.0.v20090520-1800 + \ No newline at end of file diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java index e1a8817952..af66453e64 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/internal/MobileDeviceMgtServiceComponent.java @@ -16,8 +16,49 @@ package org.wso2.carbon.device.mgt.mobile.impl.internal; +import org.apache.commons.logging.LogFactory; +import org.apache.commons.logging.Log; +import org.osgi.framework.ServiceRegistration; +import org.osgi.service.component.ComponentContext; +import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; +import org.wso2.carbon.device.mgt.mobile.impl.android.AndroidDeviceManagerService; +import org.wso2.carbon.device.mgt.mobile.impl.ios.IOSDeviceManagerService; +import org.wso2.carbon.device.mgt.mobile.impl.windows.WindowsDeviceManagerService; + /** - * Created by harshan on 12/4/14. + * @scr.component name="org.wso2.carbon.device.manager.mobile" immediate="true" */ public class MobileDeviceMgtServiceComponent { + + private static final Log log = LogFactory.getLog(MobileDeviceMgtServiceComponent.class); + ServiceRegistration serviceRegistration; + + protected void activate(ComponentContext ctx) { + try { + if (log.isDebugEnabled()) { + log.debug("Activating Mobile Device Management Service"); + } + AndroidDeviceManagerService androidDeviceMgrService = new AndroidDeviceManagerService(); + IOSDeviceManagerService iOSDeviceMgrService = new IOSDeviceManagerService(); + WindowsDeviceManagerService windowsDeviceMgrService = new WindowsDeviceManagerService(); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + androidDeviceMgrService, null); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + iOSDeviceMgrService, null); + serviceRegistration = + ctx.getBundleContext().registerService(DeviceManagerService.class.getName(), + windowsDeviceMgrService, null); + } catch (Throwable e) { + log.error("Unable to activate Mobile Device Management Service Component", e); + } + } + + protected void deactivate(ComponentContext ctx) { + if (log.isDebugEnabled()) { + log.debug("Deactivating Mobile Device Management Service"); + } + serviceRegistration.unregister(); + } } From 1ed02a5c01e0106787dfbbf7ab974539cbd02bbb Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 18:18:30 +0530 Subject: [PATCH 09/14] Adding an interface method "getProviderType" to identify a particular implementation of DeviceManagerService and pom cleanup --- .../org.wso2.carbon.device.mgt.common/pom.xml | 4 --- .../mgt/common/spi/DeviceManagerService.java | 36 +++++++++++++------ .../org.wso2.carbon.device.mgt.core/pom.xml | 4 +-- .../internal/DeviceMgtServiceComponent.java | 2 +- 4 files changed, 27 insertions(+), 19 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml index 80fd2aa7ab..ad7e005500 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/pom.xml @@ -19,10 +19,6 @@ - - org.apache.felix - maven-scr-plugin - org.apache.felix maven-bundle-plugin diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java index e73a0af766..c64c0ad0f5 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/spi/DeviceManagerService.java @@ -1,12 +1,12 @@ /** * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - *

+ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at - *

- * http://www.apache.org/licenses/LICENSE-2.0 - *

+ * + * 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. @@ -26,23 +26,31 @@ import java.util.List; */ public interface DeviceManagerService { + /** + * Method to retrieve the provider type that implements DeviceManagerService interface + * @return Returns provider type + */ + String getProviderType(); /** * Method to enrolling a particular device of type mobile, IoT, etc within CDM. - * @param device Metadata corresponding to the device being enrolled + * + * @param device Metadata corresponding to the device being enrolled * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - void enrolDevice(Device device) throws DeviceManagementException; + void enrollDevice(Device device) throws DeviceManagementException; /** * Method to modify the metadata corresponding to device enrollment + * * @param device Modified device enrollment related metadata - * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a - * device + * @throws DeviceManagementException If some unusual behaviour is observed while modify the enrollment of a + * device */ - void modifyEnrolment(Device device) throws DeviceManagementException; + void modifyEnrollment(Device device) throws DeviceManagementException; /** * Method to disenroll a particular device from CDM. + * * @param type Device Type * @param deviceId Device Identifier * @throws DeviceManagementException @@ -51,6 +59,7 @@ public interface DeviceManagerService { /** * Method to retrieve the status of the registration process of a particular device. + * * @param type Device Type * @param deviceId Device Identifier * @return Status of enrollment @@ -60,6 +69,7 @@ public interface DeviceManagerService { /** * Method to retrieve the status of a particular device. + * * @param type Device Type * @param deviceId Device Identifier * @return Returns if the device is active @@ -70,6 +80,7 @@ public interface DeviceManagerService { /** * Method to set the status indicating whether a particular device registered within CDM is enabled at a given * moment. + * * @param status Indicates whether the device is active * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ @@ -77,6 +88,7 @@ public interface DeviceManagerService { /** * Method to retrieve metadata of all devices registered within CDM corresponding to a particular device type. + * * @param type Device Type * @return List of metadata corresponding to all devices registered within CDM */ @@ -84,16 +96,18 @@ public interface DeviceManagerService { /** * Method to retrieve metadata of a device corresponding to a particular type that carries a specific identifier. + * * @param type Device Type * @param deviceId Device Identifier - * @return Metadata corresponding to a particular device + * @return Metadata corresponding to a particular device * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ Device getDeviceInfo(String type, String deviceId) throws DeviceManagementException; /** * Method to set the ownership type of a particular device. i.e. BYOD, COPE - * @param ownershipType Type of ownership + * + * @param ownershipType Type of ownership * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ void setOwnership(String ownershipType) throws DeviceManagementException; diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml index aa5f4e9a54..a1995bccee 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/pom.xml @@ -53,8 +53,7 @@ Device Management Core Bundle org.wso2.carbon.device.mgt.core.internal - org.apache.axis2.*; - version="${axis2.osgi.version.range}", + org.apache.axis2.*;version="${axis2.osgi.version.range}", org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, @@ -90,7 +89,6 @@ org.wso2.carbon org.wso2.carbon.logging - ${carbon.kernel.version} diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java index 1703d23fd5..557de2cf94 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceMgtServiceComponent.java @@ -22,7 +22,7 @@ import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; /** * @scr.component name="org.wso2.carbon.device.manager" immediate="true" * @scr.reference name="device.manager.service" - * interface="org.wso2.carbon.device.mgt.common.spi.DeviceManager" cardinality="1..n" + * interface="org.wso2.carbon.device.mgt.common.spi.DeviceManagerService" cardinality="1..n" * policy="dynamic" bind="setDeviceManagerService" unbind="unsetDeviceManagerService" */ public class DeviceMgtServiceComponent { From 6e9366bfbfb09bcf29ec267ab512f6696a4cbff1 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 18:20:17 +0530 Subject: [PATCH 10/14] Adding SCR plugin info --- components/device-mgt/pom.xml | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/components/device-mgt/pom.xml b/components/device-mgt/pom.xml index 8ec21df4bb..bcfbf8edfd 100644 --- a/components/device-mgt/pom.xml +++ b/components/device-mgt/pom.xml @@ -39,6 +39,7 @@ org.wso2.carbon.device.mgt.core org.wso2.carbon.device.mgt.common + org.wso2.carbon.device.mgt.mobile.impl @@ -63,7 +64,32 @@ org.wso2.carbon.device.mgt.common 2.0.0-SNAPSHOT + + org.eclipse.osgi + org.eclipse.osgi.services + 3.3.100.v20120522-1822 + + + + + + org.apache.felix + maven-scr-plugin + 1.7.2 + + + generate-scr-scrdescriptor + + scr + + + + + + + + From 95b555b11c5764694fb4bc9621872b956e05406f Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Thu, 4 Dec 2014 18:20:57 +0530 Subject: [PATCH 11/14] Adding Constructors to the PDP exceptioon class --- .../org.wso2.carbon.policy.evalutor/pom.xml | 5 --- .../carbon/policy/evaluator/PDPException.java | 34 ++++++++++++++++++- .../wso2/carbon/policy/mgt/common/Policy.java | 3 ++ 3 files changed, 36 insertions(+), 6 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml index 3d72835c75..790e295273 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml @@ -78,11 +78,6 @@ org.wso2.carbon org.wso2.carbon.logging - - org.wso2.carbon - org.wso2.carbon.logging - ${carbon.kernel.version} - diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java index 799efadeb0..c650e371a4 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java @@ -18,5 +18,37 @@ package org.wso2.carbon.policy.evaluator; -public class PDPException { +public class PDPException extends Exception { + + private String pdpErrorMessage; + + public String getPdpErrorMessage() { + return pdpErrorMessage; + } + + public void setPdpErrorMessage(String pdpErrorMessage) { + this.pdpErrorMessage = pdpErrorMessage; + } + + public PDPException(String message) { + setPdpErrorMessage(message); + } + + public PDPException(String message, Exception ex) { + super(message, ex); + setPdpErrorMessage(message); + } + + public PDPException(String message, Throwable cause) { + super(message, cause); + setPdpErrorMessage(message); + } + + public PDPException(Throwable cause) { + super(cause); + } + + public PDPException(){ + super(); + } } diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java index ddebf9e1e1..29184b24bd 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java @@ -18,9 +18,12 @@ package org.wso2.carbon.policy.mgt.common; +import java.util.List; + public class Policy { private int id; private String policyName; + private List featuresList; public static class Features { From 7ebb6fba4d8d458eece79d1dfe9986d459d01d58 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 18:29:59 +0530 Subject: [PATCH 12/14] Fixing mobile related implementations of DeviceManagerService SPI to be able to support newly added getProviderType method --- .../impl/android/AndroidDeviceManagerService.java | 9 ++++++++- .../mgt/mobile/impl/ios/IOSDeviceManagerService.java | 10 +++++++++- .../impl/windows/WindowsDeviceManagerService.java | 12 ++++++++++-- 3 files changed, 27 insertions(+), 4 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java index 74a046cba3..aa10e18869 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/android/AndroidDeviceManagerService.java @@ -27,7 +27,14 @@ import java.util.List; */ public class AndroidDeviceManagerService implements DeviceManagerService { - @Override + private static final String DEVICE_MANAGER_ANDROID = "android"; + + @Override + public String getProviderType() { + return DEVICE_MANAGER_ANDROID; + } + + @Override public void enrollDevice(Device device) throws DeviceManagementException { } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java index 1907f2636e..cf174c5cf2 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/ios/IOSDeviceManagerService.java @@ -26,7 +26,15 @@ import java.util.List; * This represents the iOS implementation of DeviceManagerService. * */ public class IOSDeviceManagerService implements DeviceManagerService { - @Override + + private static final String DEVICE_MANAGER_IOS = "ios"; + + @Override + public String getProviderType() { + return DEVICE_MANAGER_IOS; + } + + @Override public void enrollDevice(Device device) throws DeviceManagementException { } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java index 98a339448b..9efa62bb02 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.mobile.impl/src/main/java/org/wso2/carbon/device/mgt/mobile/impl/windows/WindowsDeviceManagerService.java @@ -25,8 +25,16 @@ import java.util.List; /** * This represents the Windows implementation of DeviceManagerService. */ -public class WindowsDeviceManagerService implements DeviceManagerService{ - @Override +public class WindowsDeviceManagerService implements DeviceManagerService { + + private static final String DEVICE_MANAGER_WINDOWS = "windows"; + + @Override + public String getProviderType() { + return DEVICE_MANAGER_WINDOWS; + } + + @Override public void enrollDevice(Device device) throws DeviceManagementException { } From 5fb3dec2ab1c8c4a4839c3d8a0e81f27fec716a2 Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Fri, 5 Dec 2014 10:32:22 +0530 Subject: [PATCH 13/14] Fixing Exception class in Policy Mgt --- .../wso2/carbon/policy/mgt/common/PolicyManagementException.java | 1 - 1 file changed, 1 deletion(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java index 9e087ff3d8..524f669d6a 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java @@ -45,7 +45,6 @@ public class PolicyManagementException extends Exception { setPolicyErrorMessage(message); } - public PolicyManagementException() { super(); } From 63360243532c7c751b7bfeffcf5c99f867e0f9dd Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Fri, 5 Dec 2014 10:48:12 +0530 Subject: [PATCH 14/14] Adding the feature and exception class to repo --- .../carbon/policy/mgt/common/Feature.java | 27 +++++++++ .../common/FeatureManagementException.java | 55 +++++++++++++++++++ .../wso2/carbon/policy/mgt/common/Policy.java | 9 +-- 3 files changed, 83 insertions(+), 8 deletions(-) create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Feature.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/FeatureManagementException.java diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Feature.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Feature.java new file mode 100644 index 0000000000..b06a59e940 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Feature.java @@ -0,0 +1,27 @@ +/* +* Copyright (c) 2005-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.policy.mgt.common; + +public class Feature { + + private String code; + private String name; + private Object attribute; + +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/FeatureManagementException.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/FeatureManagementException.java new file mode 100644 index 0000000000..cd87922b6e --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/FeatureManagementException.java @@ -0,0 +1,55 @@ +/* +* 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.policy.mgt.common; + +public class FeatureManagementException extends Exception{ + + private String errorMessage; + + public String getErrorMessage() { + return errorMessage; + } + + public void setErrorMessage(String errorMessage) { + this.errorMessage = errorMessage; + } + + public FeatureManagementException(String message) { + super(message); + setErrorMessage(message); + } + + public FeatureManagementException(String message, Exception ex) { + super(message, ex); + setErrorMessage(message); + } + + public FeatureManagementException(String message, Throwable cause) { + super(message, cause); + setErrorMessage(message); + } + + public FeatureManagementException() { + super(); + } + + public FeatureManagementException(Throwable cause) { + super(cause); + } +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java index 29184b24bd..192745c1ec 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java @@ -23,13 +23,6 @@ import java.util.List; public class Policy { private int id; private String policyName; - private List featuresList; + private List featuresList; - - public static class Features { - - private String code; - private String name; - private Object attribute; - } }