forked from community/device-mgt-core
Adding policy components, renamed the evaluator as the complex policy decision point, added the PIP component and simple policy decision point, Add the interfaces related to policies
parent
98ac04479d
commit
3032b1c55f
@ -0,0 +1,67 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>policy-mgt</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<packaging>bundle</packaging>
|
||||
<name>WSO2 Carbon - Policy Information Point</name>
|
||||
<description>WSO2 Carbon - Policy Information Point</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||
<Bundle-Description>Policy Information Point Bundle</Bundle-Description>
|
||||
<Private-Package>org.wso2.carbon.policy.information.point.internal</Private-Package>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.policy.information.point.*
|
||||
</Export-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.equinox</groupId>
|
||||
<artifactId>org.eclipse.equinox.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
@ -0,0 +1,43 @@
|
||||
/*
|
||||
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.policy.information.point;
|
||||
|
||||
import org.wso2.carbon.policy.mgt.common.Feature;
|
||||
import org.wso2.carbon.policy.mgt.common.PIPDeviceData;
|
||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyInformationService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PolicyInformationServiceImpl implements PolicyInformationService{
|
||||
@Override
|
||||
public void getDeviceData(PIPDeviceData pipDeviceData) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Policy> getRelatedPolicies(PIPDeviceData pipDeviceData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getRelatedFeatures(String deviceType) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.wso2.carbon.policy;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
@ -0,0 +1,39 @@
|
||||
/*
|
||||
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.policy.mgt.common;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class PIPDeviceData {
|
||||
|
||||
String deviceId;
|
||||
String deviceType;
|
||||
String ownershipType;
|
||||
List<String> userIds;
|
||||
List<String> roles;
|
||||
String altitude;
|
||||
String longitude;
|
||||
Timestamp timestamp;
|
||||
|
||||
/*This will be used to record attributes to which would come from other PDPs*/
|
||||
Map<String, Object> attributes;
|
||||
|
||||
}
|
@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.wso2.carbon.policy.mgt.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This is the interface which will be used to create plug-able policy decision points.
|
||||
*/
|
||||
public interface PolicyEvaluationService {
|
||||
|
||||
|
||||
/**
|
||||
* This method returns the effective policy from the list.
|
||||
* @param pipDeviceData device information.
|
||||
* @return returns the effective policy.
|
||||
*/
|
||||
Policy getEffectivePolicy(PIPDeviceData pipDeviceData);
|
||||
|
||||
|
||||
/**
|
||||
* This class will return the effective feature set from the list.
|
||||
* @param pipDeviceData device information.
|
||||
* @return returns the effective feature set.
|
||||
*/
|
||||
List<Feature> getEffectiveFeatures(PIPDeviceData pipDeviceData);
|
||||
}
|
@ -0,0 +1,50 @@
|
||||
/*
|
||||
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
|
||||
package org.wso2.carbon.policy.mgt.common;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* This will be used retrieve data database. This interface has to be implemented by PIP. PIP will be plug-able.
|
||||
*/
|
||||
public interface PolicyInformationService {
|
||||
|
||||
/**
|
||||
* This method will return the data related Device, Some of the device data will provided in the initial pipDeviceData object such as
|
||||
* device id, device time and location, Other data such as roles, owned users and ownership type will be filled by this method.
|
||||
* @param pipDeviceData device data.
|
||||
*/
|
||||
void getDeviceData(PIPDeviceData pipDeviceData);
|
||||
|
||||
/**
|
||||
* This method will retrieve the policies related given device Data.
|
||||
* @param pipDeviceData
|
||||
* @return
|
||||
*/
|
||||
List<Policy> getRelatedPolicies(PIPDeviceData pipDeviceData);
|
||||
|
||||
/**
|
||||
* This is will retrieve the features related to device type. This feature list will be used for dynamically
|
||||
* merging the policies.
|
||||
* @param deviceType
|
||||
* @return
|
||||
*/
|
||||
List<Feature> getRelatedFeatures(String deviceType);
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
|
||||
<parent>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>policy-mgt</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<relativePath>../pom.xml</relativePath>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.simple.policy.decision.point</artifactId>
|
||||
<version>0.9.1-SNAPSHOT</version>
|
||||
<packaging>bundle</packaging>
|
||||
<name>WSO2 Carbon - Simple Policy Decision Point</name>
|
||||
<description>WSO2 Carbon - Simple Policy Decision Point</description>
|
||||
<url>http://wso2.org</url>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-scr-plugin</artifactId>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.felix</groupId>
|
||||
<artifactId>maven-bundle-plugin</artifactId>
|
||||
<version>1.4.0</version>
|
||||
<extensions>true</extensions>
|
||||
<configuration>
|
||||
<instructions>
|
||||
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
|
||||
<Bundle-Name>${project.artifactId}</Bundle-Name>
|
||||
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
|
||||
<Bundle-Description>Simple Policy Decision Point Bundle</Bundle-Description>
|
||||
<Private-Package>org.wso2.carbon.simple.policy.decision.point.internal</Private-Package>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.simple.policy.decision.point.*
|
||||
</Export-Package>
|
||||
</instructions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.osgi</groupId>
|
||||
<artifactId>org.eclipse.osgi</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.eclipse.equinox</groupId>
|
||||
<artifactId>org.eclipse.equinox.common</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon</groupId>
|
||||
<artifactId>org.wso2.carbon.logging</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.mgt.common</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright (c) 2015 WSO2 Inc. (http://www.wso2.org) All Rights Reserved.
|
||||
*
|
||||
* WSO2 Inc. licenses this file to you under the Apache License,
|
||||
* Version 2.0 (the "License"); you may not use this file except
|
||||
* in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing,
|
||||
* software distributed under the License is distributed on an
|
||||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
* KIND, either express or implied. See the License for the
|
||||
* specific language governing permissions and limitations
|
||||
* under the License.
|
||||
*/
|
||||
|
||||
package org.wso2.carbon.simple.policy.decision.point;
|
||||
|
||||
import org.wso2.carbon.policy.mgt.common.Feature;
|
||||
import org.wso2.carbon.policy.mgt.common.PIPDeviceData;
|
||||
import org.wso2.carbon.policy.mgt.common.Policy;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyEvaluationService;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class PolicyEvaluationServiceImpl implements PolicyEvaluationService {
|
||||
@Override
|
||||
public Policy getEffectivePolicy(PIPDeviceData pipDeviceData) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Feature> getEffectiveFeatures(PIPDeviceData pipDeviceData) {
|
||||
return null;
|
||||
}
|
||||
}
|
@ -0,0 +1,38 @@
|
||||
package org.wso2.carbon.policy;
|
||||
|
||||
import junit.framework.Test;
|
||||
import junit.framework.TestCase;
|
||||
import junit.framework.TestSuite;
|
||||
|
||||
/**
|
||||
* Unit test for simple App.
|
||||
*/
|
||||
public class AppTest
|
||||
extends TestCase
|
||||
{
|
||||
/**
|
||||
* Create the test case
|
||||
*
|
||||
* @param testName name of the test case
|
||||
*/
|
||||
public AppTest( String testName )
|
||||
{
|
||||
super( testName );
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the suite of tests being tested
|
||||
*/
|
||||
public static Test suite()
|
||||
{
|
||||
return new TestSuite( AppTest.class );
|
||||
}
|
||||
|
||||
/**
|
||||
* Rigourous Test :-)
|
||||
*/
|
||||
public void testApp()
|
||||
{
|
||||
assertTrue( true );
|
||||
}
|
||||
}
|
Loading…
Reference in new issue