From db9505695223aab8c3c5027477c3e31e4075d9d2 Mon Sep 17 00:00:00 2001 From: harshanL Date: Thu, 4 Dec 2014 14:45:02 +0530 Subject: [PATCH 1/5] 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 2/5] 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 3/5] 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 4/5] 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 5/5] 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(); + } }