From 6bd0f82e2c6b7b8baaf0a6297fe636eeb3ed17e0 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Thu, 4 Dec 2014 13:57:48 +0530 Subject: [PATCH 01/18] 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 00000000000..8226ca1fe02 --- /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 02/18] 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 e73a0af7666..45b674228e5 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 00000000000..74a046cba3d --- /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 00000000000..e1a88179525 --- /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 00000000000..1907f2636ea --- /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 00000000000..98a339448bd --- /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 03/18] 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 8ec21df4bb1..c193df96056 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 04/18] 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 00000000000..3d72835c751 --- /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 00000000000..799efadeb00 --- /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 00000000000..9c3f33da346 --- /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 00000000000..f39fe3df818 --- /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 00000000000..ddebf9e1e1a --- /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 00000000000..9e087ff3d81 --- /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 00000000000..7fd3bf5dc1d --- /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 00000000000..d66e9ff997e --- /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 00000000000..b66e04262e5 --- /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 00000000000..1c6633acd54 --- /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 d0b77c184fa..07e6b80b30c 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 05/18] 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 43406c5d336..10da72790e1 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 7154dea0201..28aee1ab94c 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 4868a6873d0..a26af8b05ae 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 2bf338b4a14..9d70de4249b 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 06/18] 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 8226ca1fe02..18f3cb20a11 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 e1a88179525..af66453e645 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 07/18] 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 80fd2aa7ab3..ad7e005500e 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 e73a0af7666..c64c0ad0f56 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 aa5f4e9a548..a1995bcceec 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 1703d23fd54..557de2cf94b 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 08/18] 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 8ec21df4bb1..bcfbf8edfd9 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 09/18] 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 3d72835c751..790e2952733 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 799efadeb00..c650e371a43 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 ddebf9e1e1a..29184b24bdf 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 10/18] 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 74a046cba3d..aa10e188695 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 1907f2636ea..cf174c5cf21 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 98a339448bd..9efa62bb02d 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 11/18] 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 9e087ff3d81..524f669d6a1 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 12/18] 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 00000000000..b06a59e940c --- /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 00000000000..cd87922b6e8 --- /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 29184b24bdf..192745c1ec8 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; - } } From d5d332e91c76c6a78906007567f4805369acf6c5 Mon Sep 17 00:00:00 2001 From: harshanL Date: Fri, 5 Dec 2014 11:39:19 +0530 Subject: [PATCH 13/18] Added updateDeviceInfo method to DeviceManagerService. --- .../carbon/device/mgt/common/spi/DeviceManagerService.java | 7 +++++++ .../mobile/impl/android/AndroidDeviceManagerService.java | 5 +++++ .../mgt/mobile/impl/ios/IOSDeviceManagerService.java | 5 +++++ .../mobile/impl/windows/WindowsDeviceManagerService.java | 5 +++++ 4 files changed, 22 insertions(+) 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 45b674228e5..97beb26c6b6 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 @@ -91,6 +91,13 @@ public interface DeviceManagerService { */ Device getDeviceInfo(String type, String deviceId) throws DeviceManagementException; + /** + * Method to update device information. + * @param device Updated device information related data + * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device + */ + void updateDeviceInfo(Device device) throws DeviceManagementException; + /** * Method to set the ownership type of a particular device. i.e. BYOD, COPE * @param ownershipType Type of ownership 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 74a046cba3d..8fc7947bf87 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 @@ -71,6 +71,11 @@ public class AndroidDeviceManagerService implements DeviceManagerService { return null; } + @Override + public void updateDeviceInfo(Device device) throws DeviceManagementException{ + + } + @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/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 1907f2636ea..9bb60464662 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 @@ -70,6 +70,11 @@ public class IOSDeviceManagerService implements DeviceManagerService { return null; } + @Override + public void updateDeviceInfo(Device device) throws DeviceManagementException{ + + } + @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 index 98a339448bd..d0447d2ddeb 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 @@ -70,6 +70,11 @@ public class WindowsDeviceManagerService implements DeviceManagerService{ return null; } + @Override + public void updateDeviceInfo(Device device) throws DeviceManagementException{ + + } + @Override public void setOwnership(String ownershipType) throws DeviceManagementException { From 85fc1adc79c713e8aba7ea7f4f3fd56491492e5e Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Fri, 5 Dec 2014 12:05:48 +0530 Subject: [PATCH 14/18] Adding featurs for the device mgt --- .../org.wso2.carbon.policy.mgt.common/pom.xml | 5 - .../pom.xml | 124 ++++++++++++++++++ .../src/main/resources/build.properties | 1 + .../src/main/resources/p2.inf | 0 features/device-mgt/pom.xml | 43 ++++++ pom.xml | 46 +++++-- product/modules/p2-profile-gen/pom.xml | 8 +- 7 files changed, 211 insertions(+), 16 deletions(-) create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties create mode 100644 features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf create mode 100644 features/device-mgt/pom.xml 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 index f39fe3df818..da740f2c430 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/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/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml new file mode 100644 index 00000000000..ab9bf942f2d --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/pom.xml @@ -0,0 +1,124 @@ + + + + + + + org.wso2.carbon + device-mgt-feature + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.mgt.server.feature + pom + 2.0.0-SNAPSHOT + WSO2 Carbon - Device Management Server Feature + http://wso2.org + This feature contains the core bundles required for Back-end Devvice Management functionality + + + + + 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.core + + + org.wso2.carbon + org.wso2.carbon.device.mgt.common + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.mgt.server + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + org.wso2.carbon:org.wso2.carbon.device.mgt.core:${project.version} + + org.wso2.carbon:org.wso2.carbon.device.mgt.common:${project.version} + + + + org.wso2.carbon.core.server:${carbon.platform.version} + + + + + + + + + diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties new file mode 100644 index 00000000000..9c86577d768 --- /dev/null +++ b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/build.properties @@ -0,0 +1 @@ +custom = true diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf b/features/device-mgt/org.wso2.carbon.device.mgt.server.feature/src/main/resources/p2.inf new file mode 100644 index 00000000000..e69de29bb2d diff --git a/features/device-mgt/pom.xml b/features/device-mgt/pom.xml new file mode 100644 index 00000000000..44b69518064 --- /dev/null +++ b/features/device-mgt/pom.xml @@ -0,0 +1,43 @@ + + + + + + + org.wso2.carbon + wso2cdm-parent + 2.0.0-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon + device-mgt-feature + 2.0.0-SNAPSHOT + pom + WSO2 Carbon - Device Management Feature + http://wso2.org + + + org.wso2.carbon.device.mgt.server.feature + + + diff --git a/pom.xml b/pom.xml index 07e6b80b30c..e9c30ba26db 100644 --- a/pom.xml +++ b/pom.xml @@ -30,7 +30,6 @@ http://wso2.org WSO2 Connected Device Manager - org.wso2 wso2 @@ -40,22 +39,15 @@ components/device-mgt components/policy-mgt + features/device-mgt product/modules/p2-profile-gen product/modules/distribution product/modules/integration - - - org.wso2.carbon.automation org.wso2.carbon.automation.engine @@ -91,21 +83,55 @@ ${stub.version} test + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + org.wso2.carbon + org.wso2.carbon.device.mgt.core + ${project.version} + + + org.wso2.carbon + org.wso2.carbon.device.mgt.common + ${project.version} + + + + + org.eclipse.osgi + org.eclipse.osgi + ${eclipse.osgi.version} + + + org.eclipse.equinox + org.eclipse.equinox.common + ${eclipse.equinox.common.version} + + 4.3.0-SNAPSHOT - 4.2.0-SNAPSHOT + 4.3.0-SNAPSHOT 1.5.4 1.3 [1.6.1.wso2v11, 1.7.0) + 1.5.4 4.3.1 6.8 4.3.0-SNAPSHOT 1.1.0 + + + 3.6.100.v20120522-1841 + 3.8.1.v20120830-144521 + \ No newline at end of file diff --git a/product/modules/p2-profile-gen/pom.xml b/product/modules/p2-profile-gen/pom.xml index 9d70de4249b..7883a736403 100644 --- a/product/modules/p2-profile-gen/pom.xml +++ b/product/modules/p2-profile-gen/pom.xml @@ -104,6 +104,9 @@ org.wso2.carbon:org.wso2.carbon.ndatasource.feature:${carbon.kernel.version} + + org.wso2.carbon:org.wso2.carbon.device.mgt.server.feature:${project.version} + @@ -129,11 +132,14 @@ org.wso2.carbon.ndatasource.feature.group ${carbon.kernel.version} - org.wso2.carbon.ndatasource.ui.feature.group ${carbon.kernel.version} + + org.wso2.carbon.device.mgt.server.feature.group + ${project.version} + From 983ca1562f960d3d6aab0e4a2c35d7cba9ded37f Mon Sep 17 00:00:00 2001 From: prabathabey Date: Fri, 5 Dec 2014 13:26:42 +0530 Subject: [PATCH 15/18] Introducing DeviceIdentifier bean wrapping id and the type of a particular device. This includes other formatting related improvments too brought up during the code reviews --- .../device/mgt/common/DeviceIdentifier.java | 40 +++++++++++++++++++ .../mgt/common/spi/DeviceManagerService.java | 29 +++++++------- .../mgt/core/DeviceManagementRepository.java | 22 ++++++++++ 3 files changed, 76 insertions(+), 15 deletions(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java new file mode 100644 index 00000000000..e9f7ca51102 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.common/src/main/java/org/wso2/carbon/device/mgt/common/DeviceIdentifier.java @@ -0,0 +1,40 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wso2.carbon.device.mgt.common; + +public class DeviceIdentifier { + + private String type; + + private String id; + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + +} 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 c64c0ad0f56..50ccacfc9ed 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 @@ -16,6 +16,7 @@ package org.wso2.carbon.device.mgt.common.spi; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import java.util.List; @@ -31,6 +32,7 @@ public interface DeviceManagerService { * @return Returns provider type */ String getProviderType(); + /** * Method to enrolling a particular device of type mobile, IoT, etc within CDM. * @@ -51,31 +53,28 @@ public interface DeviceManagerService { /** * Method to disenroll a particular device from CDM. * - * @param type Device Type - * @param deviceId Device Identifier - * @throws DeviceManagementException + * @param deviceId Fully qualified device identifier + * @throws DeviceManagementException If some unusual behaviour is observed while disenrolling a device */ - void disEnrollDevice(String type, String deviceId) throws DeviceManagementException; + void disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException; /** * Method to retrieve the status of the registration process of a particular device. * - * @param type Device Type - * @param deviceId Device Identifier + * @param deviceId Fully qualified device identifier * @return Status of enrollment * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - boolean isRegistered(String type, String deviceId) throws DeviceManagementException; + boolean isRegistered(DeviceIdentifier deviceId) throws DeviceManagementException; /** * Method to retrieve the status of a particular device. * - * @param type Device Type - * @param deviceId Device Identifier + * @param deviceId Fully qualified device identifier * @return Returns if the device is active * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - boolean isActive(String type, String deviceId) throws DeviceManagementException; + boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException; /** * Method to set the status indicating whether a particular device registered within CDM is enabled at a given @@ -92,24 +91,24 @@ public interface DeviceManagerService { * @param type Device Type * @return List of metadata corresponding to all devices registered within CDM */ - List getAllDeviceInfo(String type) throws DeviceManagementException; + List getAllDevices(String type) throws DeviceManagementException; /** * 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 + * @param deviceId Fully qualified device identifier * @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; + Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException; /** * Method to set the ownership type of a particular device. i.e. BYOD, COPE * + * @param deviceId Fully qualified device identifier * @param ownershipType Type of ownership * @throws DeviceManagementException If some unusual behaviour is observed while enrolling a device */ - void setOwnership(String ownershipType) throws DeviceManagementException; + void setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException; } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java new file mode 100644 index 00000000000..fb7e0a32e90 --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/DeviceManagementRepository.java @@ -0,0 +1,22 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wso2.carbon.device.mgt.core; + +public class DeviceManagementRepository { + + + +} From ef95ac4621dd98aafc97b8ba74242e8d6869ed83 Mon Sep 17 00:00:00 2001 From: prabathabey Date: Fri, 5 Dec 2014 13:28:32 +0530 Subject: [PATCH 16/18] Making all the implementations of DeviceManagerService interface compatible with the changes introduced into the same --- .../android/AndroidDeviceManagerService.java | 56 +++++++++---------- .../impl/ios/IOSDeviceManagerService.java | 56 +++++++++---------- .../windows/WindowsDeviceManagerService.java | 56 +++++++++---------- 3 files changed, 81 insertions(+), 87 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 aa10e188695..754a0a1bba7 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 @@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.android; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; @@ -44,42 +45,39 @@ public class AndroidDeviceManagerService implements DeviceManagerService { } - @Override - public void disEnrollDevice(String type, String deviceId) - throws DeviceManagementException { + @Override + public void disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { - } + } - @Override - public boolean isRegistered(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isRegistered(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public boolean isActive(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public void setActive(boolean status) throws DeviceManagementException { + @Override + public void setActive(boolean status) throws DeviceManagementException { - } + } - @Override - public List getAllDeviceInfo(String type) throws DeviceManagementException { - return null; - } + @Override + public List getAllDevices(String type) throws DeviceManagementException { + return null; + } - @Override - public Device getDeviceInfo(String type, String deviceId) - throws DeviceManagementException { - return null; - } + @Override + public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + return null; + } - @Override - public void setOwnership(String ownershipType) throws DeviceManagementException { + @Override + public void setOwnership(DeviceIdentifier deviceId, 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/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 cf174c5cf21..7f2226d7139 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 @@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.ios; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; @@ -44,42 +45,39 @@ public class IOSDeviceManagerService implements DeviceManagerService { } - @Override - public void disEnrollDevice(String type, String deviceId) - throws DeviceManagementException { + @Override + public void disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { - } + } - @Override - public boolean isRegistered(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isRegistered(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public boolean isActive(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public void setActive(boolean status) throws DeviceManagementException { + @Override + public void setActive(boolean status) throws DeviceManagementException { - } + } - @Override - public List getAllDeviceInfo(String type) throws DeviceManagementException { - return null; - } + @Override + public List getAllDevices(String type) throws DeviceManagementException { + return null; + } - @Override - public Device getDeviceInfo(String type, String deviceId) - throws DeviceManagementException { - return null; - } + @Override + public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + return null; + } - @Override - public void setOwnership(String ownershipType) throws DeviceManagementException { + @Override + public void setOwnership(DeviceIdentifier deviceId, 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 index 9efa62bb02d..575219c901e 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 @@ -17,6 +17,7 @@ package org.wso2.carbon.device.mgt.mobile.impl.windows; import org.wso2.carbon.device.mgt.common.Device; +import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import org.wso2.carbon.device.mgt.common.DeviceManagementException; import org.wso2.carbon.device.mgt.common.spi.DeviceManagerService; @@ -44,42 +45,39 @@ public class WindowsDeviceManagerService implements DeviceManagerService { } - @Override - public void disEnrollDevice(String type, String deviceId) - throws DeviceManagementException { + @Override + public void disenrollDevice(DeviceIdentifier deviceId) throws DeviceManagementException { - } + } - @Override - public boolean isRegistered(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isRegistered(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public boolean isActive(String type, String deviceId) - throws DeviceManagementException { - return false; - } + @Override + public boolean isActive(DeviceIdentifier deviceId) throws DeviceManagementException { + return false; + } - @Override - public void setActive(boolean status) throws DeviceManagementException { + @Override + public void setActive(boolean status) throws DeviceManagementException { - } + } - @Override - public List getAllDeviceInfo(String type) throws DeviceManagementException { - return null; - } + @Override + public List getAllDevices(String type) throws DeviceManagementException { + return null; + } - @Override - public Device getDeviceInfo(String type, String deviceId) - throws DeviceManagementException { - return null; - } + @Override + public Device getDevice(DeviceIdentifier deviceId) throws DeviceManagementException { + return null; + } - @Override - public void setOwnership(String ownershipType) throws DeviceManagementException { + @Override + public void setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException { + + } - } } From 7b30fc964235af7f341ebe642785afffd1a1996b Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Fri, 5 Dec 2014 13:49:01 +0530 Subject: [PATCH 17/18] Fixing mobile implementations --- .../mobile/impl/windows/WindowsDeviceManagerService.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 9f6410c565a..bebeb972e6c 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 @@ -75,19 +75,15 @@ public class WindowsDeviceManagerService implements DeviceManagerService { return null; } -<<<<<<< HEAD + @Override public void setOwnership(DeviceIdentifier deviceId, String ownershipType) throws DeviceManagementException { } -======= + @Override public void updateDeviceInfo(Device device) throws DeviceManagementException{ } - @Override - public void setOwnership(String ownershipType) throws DeviceManagementException { ->>>>>>> cc9417d8eba5a0e432e8cc9c87f3e4b64951e520 - } From 28a2cec61553500a1d71875671855fc8144d920c Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Fri, 5 Dec 2014 14:41:43 +0530 Subject: [PATCH 18/18] adding the test case class, no implementation is done --- .../org.wso2.carbon.device.mgt.core/pom.xml | 5 +++ .../mgt/core/DeviceManagementTestCase.java | 40 +++++++++++++++++++ pom.xml | 11 ++++- 3 files changed, 55 insertions(+), 1 deletion(-) create mode 100644 components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java 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 a1995bcceec..3c7d6f1fc12 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 @@ -90,6 +90,11 @@ org.wso2.carbon org.wso2.carbon.logging + + junit + junit + test + diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java new file mode 100644 index 00000000000..c096f0bd42b --- /dev/null +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/java/org/wso2/carbon/device/mgt/core/DeviceManagementTestCase.java @@ -0,0 +1,40 @@ +/* +* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.device.mgt.core; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class DeviceManagementTestCase extends TestCase { + + private static final Log log = LogFactory.getLog(DeviceManagementTestCase.class); + + /** + * @return the suite of tests being tested + */ + public static Test suite() { + return new TestSuite(DeviceManagementTestCase.class); + } + + + +} diff --git a/pom.xml b/pom.xml index e9c30ba26db..3628d9a93cc 100644 --- a/pom.xml +++ b/pom.xml @@ -99,7 +99,7 @@ ${project.version} - + org.eclipse.osgi org.eclipse.osgi @@ -111,6 +111,15 @@ ${eclipse.equinox.common.version} + + + + junit + junit + 4.12-beta-3 + test + +