From 578338263ca5a0bc9c117515429429c680dae142 Mon Sep 17 00:00:00 2001 From: Geeth Munasinghe Date: Thu, 4 Dec 2014 16:41:32 +0530 Subject: [PATCH] Adding policy management components --- .../org.wso2.carbon.policy.evalutor/pom.xml | 89 ++++++++++++++++++ .../carbon/policy/evaluator/PDPException.java | 22 +++++ .../policy/evaluator/spi/PDPService.java | 25 +++++ .../org.wso2.carbon.policy.mgt.common/pom.xml | 89 ++++++++++++++++++ .../wso2/carbon/policy/mgt/common/Policy.java | 32 +++++++ .../mgt/common/PolicyManagementException.java | 56 +++++++++++ .../mgt/common/spi/PolicyManagerService.java | 30 ++++++ .../org.wso2.carbon.policy.mgt.core/pom.xml | 94 +++++++++++++++++++ .../internal/PolicyMgtServiceComponent.java | 25 +++++ components/policy-mgt/pom.xml | 65 +++++++++++++ pom.xml | 1 + 11 files changed, 528 insertions(+) create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml create mode 100644 components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java create mode 100644 components/policy-mgt/pom.xml diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml new file mode 100644 index 0000000000..3d72835c75 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/pom.xml @@ -0,0 +1,89 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.evaluator + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Decision Point + WSO2 Carbon - Policy Decision Point + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Common Bundle + org.wso2.carbon.policy.evaluator + + org.apache.commons.logging + + + org.wso2.carbon.policy.evaluator.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java new file mode 100644 index 0000000000..799efadeb0 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/PDPException.java @@ -0,0 +1,22 @@ +/* +* Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.policy.evaluator; + +public class PDPException { +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java new file mode 100644 index 0000000000..9c3f33da34 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.evalutor/src/main/java/org/wso2/carbon/policy/evaluator/spi/PDPService.java @@ -0,0 +1,25 @@ +/* +* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.policy.evaluator.spi; + + +public interface PDPService { + + +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml new file mode 100644 index 0000000000..f39fe3df81 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/pom.xml @@ -0,0 +1,89 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.mgt.common + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Management Common + WSO2 Carbon - Policy Management Common + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Common Bundle + org.wso2.carbon.policy.mgt.common.internal + + org.apache.commons.logging + + + org.wso2.carbon.policy.mgt.common.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java new file mode 100644 index 0000000000..ddebf9e1e1 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/Policy.java @@ -0,0 +1,32 @@ +/* +* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.policy.mgt.common; + +public class Policy { + private int id; + private String policyName; + + + public static class Features { + + private String code; + private String name; + private Object attribute; + } +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java new file mode 100644 index 0000000000..9e087ff3d8 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/PolicyManagementException.java @@ -0,0 +1,56 @@ +/* +* Copyright (c) 2005-2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.policy.mgt.common; + +public class PolicyManagementException extends Exception { + + private String policyErrorMessage; + + public String getPolicyErrorMessage() { + return policyErrorMessage; + } + + public void setPolicyErrorMessage(String policyErrorMessage) { + this.policyErrorMessage = policyErrorMessage; + } + + public PolicyManagementException(String message) { + super(message); + setPolicyErrorMessage(message); + } + + public PolicyManagementException(String message, Exception ex) { + super(message, ex); + setPolicyErrorMessage(message); + } + + public PolicyManagementException(String message, Throwable cause) { + super(message, cause); + setPolicyErrorMessage(message); + } + + + public PolicyManagementException() { + super(); + } + + public PolicyManagementException(Throwable cause) { + super(cause); + } +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java new file mode 100644 index 0000000000..7fd3bf5dc1 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.common/src/main/java/org/wso2/carbon/policy/mgt/common/spi/PolicyManagerService.java @@ -0,0 +1,30 @@ +/* +* Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. +* +* WSO2 Inc. licenses this file to you under the Apache License, +* Version 2.0 (the "License"); you may not use this file except +* in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, +* software distributed under the License is distributed on an +* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +* KIND, either express or implied. See the License for the +* specific language governing permissions and limitations +* under the License. +*/ + +package org.wso2.carbon.policy.mgt.common.spi; + +import org.wso2.carbon.policy.mgt.common.Policy; + +public interface PolicyManagerService { + + void addPolicy(Policy policy); + + void addPolicy(String deviceId, String deviceType, Policy policy); + + void addPolicy(String deviceType,Policy policy); +} diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml new file mode 100644 index 0000000000..d66e9ff997 --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/pom.xml @@ -0,0 +1,94 @@ + + + + + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon + org.wso2.carbon.policy.mgt.core + 2.0.0-SNAPSHOT + bundle + WSO2 Carbon - Policy Management Core + WSO2 Carbon - Policy Management Core + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${project.version} + Policy Management Core Bundle + org.wso2.carbon.policy.mgt.core.internal + + org.apache.axis2.*; + version="${axis2.osgi.version.range}", + org.osgi.framework, + org.osgi.service.component, + org.apache.commons.logging, + + + !org.wso2.carbon.policy.mgt.core.internal, + org.wso2.carbon.policy.mgt.core.* + + * + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.logging + ${carbon.kernel.version} + + + + + diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java new file mode 100644 index 0000000000..b66e04262e --- /dev/null +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/internal/PolicyMgtServiceComponent.java @@ -0,0 +1,25 @@ +/** + * Copyright (c) 2014, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.wso2.carbon.policy.mgt.core.internal; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + +public class PolicyMgtServiceComponent { + + private static Log log = LogFactory.getLog(PolicyMgtServiceComponent.class); + +} diff --git a/components/policy-mgt/pom.xml b/components/policy-mgt/pom.xml new file mode 100644 index 0000000000..1c6633acd5 --- /dev/null +++ b/components/policy-mgt/pom.xml @@ -0,0 +1,65 @@ + + + + + + + org.wso2.carbon + wso2cdm-parent + 2.0.0-SNAPSHOT + ../../pom.xml + + + 4.0.0 + org.wso2.carbon + policy-mgt + 2.0.0-SNAPSHOT + pom + WSO2 Carbon - Policy Management Component + http://wso2.org + + + org.wso2.carbon.policy.mgt.core + org.wso2.carbon.policy.mgt.common + org.wso2.carbon.policy.evalutor + + + + + + org.eclipse.osgi + org.eclipse.osgi + 3.8.1.v20120830-144521 + + + org.eclipse.equinox + org.eclipse.equinox.common + 3.6.100.v20120522-1841 + + + org.wso2.carbon + org.wso2.carbon.logging + 4.3.0-SNAPSHOT + + + + + diff --git a/pom.xml b/pom.xml index d0b77c184f..07e6b80b30 100644 --- a/pom.xml +++ b/pom.xml @@ -39,6 +39,7 @@ components/device-mgt + components/policy-mgt product/modules/p2-profile-gen product/modules/distribution product/modules/integration