revert-dabc3590
manoj 10 years ago
commit 6a86ab43c1

@ -20,10 +20,19 @@ package org.wso2.carbon.policy.mgt.common;
public class Feature { public class Feature {
private int id;
private String code; private String code;
private String name; private String name;
private Object attribute; private Object attribute;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getCode() { public String getCode() {
return code; return code;
} }

@ -63,4 +63,19 @@ public class PolicyManagement implements PolicyManagerService {
public Policy getPolicyOfRole(String roleName) throws FeatureManagementException, PolicyManagementException { public Policy getPolicyOfRole(String roleName) throws FeatureManagementException, PolicyManagementException {
return null; return null;
} }
@Override
public boolean isPolicyAvailableForDevice(String deviceId, String deviceType) throws PolicyManagementException {
return false;
}
@Override
public boolean isPolicyUsed(String deviceId, String deviceType) throws PolicyManagementException {
return false;
}
@Override
public void setPolicyUsed(String deviceId, String deviceType, Policy policy) throws PolicyManagementException {
}
} }

@ -0,0 +1,38 @@
/*
* 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.Feature;
import org.wso2.carbon.policy.mgt.common.FeatureManagementException;
import java.util.List;
public interface FeatureManagerService {
void addFeature(Feature feature) throws FeatureManagementException;
void editFeature(Feature feature) throws FeatureManagementException;
void removeFeature(int featureId) throws FeatureManagementException;
List<Feature> getFeatures() throws FeatureManagementException;
List<Feature> getFeaturesOfPolicy(int policyId) throws FeatureManagementException;
}

@ -30,6 +30,7 @@ public interface PolicyManagerService {
/** /**
* This method adds a policy to the platform * This method adds a policy to the platform
*
* @param policy * @param policy
* @return primary key (generated key) * @return primary key (generated key)
*/ */
@ -38,6 +39,7 @@ public interface PolicyManagerService {
/** /**
* This method adds a policy per device which should be implemented by the related plugins. * This method adds a policy per device which should be implemented by the related plugins.
*
* @param deviceId * @param deviceId
* @param deviceType * @param deviceType
* @param policy * @param policy
@ -48,15 +50,17 @@ public interface PolicyManagerService {
/** /**
* This method adds a policy to device type by the related device type plugins. * This method adds a policy to device type by the related device type plugins.
*
* @param deviceType * @param deviceType
* @param policy * @param policy
* @return primary key (generated key) * @return primary key (generated key)
*/ */
int addPolicyToDeviceType(String deviceType,Policy policy) throws FeatureManagementException, PolicyManagementException; int addPolicyToDeviceType(String deviceType, Policy policy) throws FeatureManagementException, PolicyManagementException;
/** /**
* This method adds the policy to specific role. * This method adds the policy to specific role.
*
* @param roleName * @param roleName
* @param policy * @param policy
* @return primary key (generated key) * @return primary key (generated key)
@ -65,6 +69,7 @@ public interface PolicyManagerService {
/** /**
* This method returns the policy of whole platform * This method returns the policy of whole platform
*
* @return * @return
*/ */
@ -72,6 +77,7 @@ public interface PolicyManagerService {
/** /**
* This method gives the device specific policy. * This method gives the device specific policy.
*
* @param deviceId * @param deviceId
* @param deviceType * @param deviceType
* @return Policy * @return Policy
@ -81,6 +87,7 @@ public interface PolicyManagerService {
/** /**
* This method returns the device type specific policy. * This method returns the device type specific policy.
*
* @param deviceType * @param deviceType
* @return Policy * @return Policy
*/ */
@ -89,6 +96,7 @@ public interface PolicyManagerService {
/** /**
* This method returns the role specific policy. * This method returns the role specific policy.
*
* @param roleName * @param roleName
* @return * @return
*/ */
@ -96,4 +104,11 @@ public interface PolicyManagerService {
Policy getPolicyOfRole(String roleName) throws FeatureManagementException, PolicyManagementException; Policy getPolicyOfRole(String roleName) throws FeatureManagementException, PolicyManagementException;
boolean isPolicyAvailableForDevice(String deviceId, String deviceType) throws PolicyManagementException;
boolean isPolicyUsed(String deviceId, String deviceType) throws PolicyManagementException;
void setPolicyUsed(String deviceId, String deviceType, Policy policy) throws PolicyManagementException;
} }

@ -21,24 +21,35 @@ package cdm.api.windows.impl;
import cdm.api.windows.DiscoveryService; import cdm.api.windows.DiscoveryService;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import org.apache.log4j.Logger; import org.apache.log4j.Logger;
public class DiscoveryServiceImpl implements DiscoveryService { public class DiscoveryServiceImpl implements DiscoveryService {
private Logger LOGGER = Logger.getLogger(DiscoveryServiceImpl.class); private Logger LOGGER = Logger.getLogger(DiscoveryServiceImpl.class);
private String discoveryServiceFileName;
public Response getDiscoveryResponse(InputStream discoveryRequest) { public Response getDiscoveryResponse(InputStream discoveryRequest) {
LOGGER.info("Received Discovery Service POST Request [{}]"); LOGGER.info("Received Discovery Service POST Request [{}]");
String response = null; String response = null;
File file = null;
FileInputStream fis = null;
byte[] data = null;
try { try {
response = new String(Files.readAllBytes(Paths.get(discoveryServiceFileName)));
file = new File("./conf/discover-service.xml");
fis = new FileInputStream(file);
data = new byte[(int) file.length()];
fis.read(data);
fis.close();
response = new String(data, "UTF-8");
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("An Unexpected Error has occurred while processing the request ", e); LOGGER.error("An Unexpected Error has occurred while processing the request ", e);
} }
@ -57,8 +68,5 @@ public class DiscoveryServiceImpl implements DiscoveryService {
return Response.ok().build(); return Response.ok().build();
} }
public void setDiscoveryServiceFileName(String discoveryServiceFileName) {
this.discoveryServiceFileName = discoveryServiceFileName;
}
} }

@ -40,11 +40,10 @@ import javax.xml.transform.stream.StreamResult;
import javax.xml.xpath.XPath; import javax.xml.xpath.XPath;
import javax.xml.xpath.XPathConstants; import javax.xml.xpath.XPathConstants;
import javax.xml.xpath.XPathFactory; import javax.xml.xpath.XPathFactory;
import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.StringWriter; import java.io.StringWriter;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.security.KeyFactory; import java.security.KeyFactory;
import java.security.PrivateKey; import java.security.PrivateKey;
import java.security.Security; import java.security.Security;
@ -65,8 +64,6 @@ public class EnrolmentServiceImpl implements EnrolmentService {
private String enrollmentResponseFile; private String enrollmentResponseFile;
private String responseFile;
private String wapProvisioningXmlFile; private String wapProvisioningXmlFile;
private String privatePemKeyFilePath; private String privatePemKeyFilePath;
@ -156,9 +153,21 @@ public class EnrolmentServiceImpl implements EnrolmentService {
public Response getPolicies(Document request) { public Response getPolicies(Document request) {
LOGGER.info("Received Get Policies Request"); LOGGER.info("Received Get Policies Request");
String response = null; String response = null;
File file = null;
FileInputStream fis = null;
byte[] data = null;
try { try {
response = new String(Files.readAllBytes(Paths.get(responseFile)));
file = new File("./conf/policy-service.xml");
fis = new FileInputStream(file);
data = new byte[(int) file.length()];
fis.read(data);
fis.close();
response = new String(data, "UTF-8");
} catch (IOException e) { } catch (IOException e) {
LOGGER.error("An Unexpected Error has occurred while processing the request ", e); LOGGER.error("An Unexpected Error has occurred while processing the request ", e);
} }
@ -250,10 +259,6 @@ public class EnrolmentServiceImpl implements EnrolmentService {
this.enrollmentResponseFile = enrollmentResponseFile; this.enrollmentResponseFile = enrollmentResponseFile;
} }
public void setResponseFile(String responseFile) {
this.responseFile = responseFile;
}
public void setWapProvisioningXmlFile(String wapProvisioningXmlFile) { public void setWapProvisioningXmlFile(String wapProvisioningXmlFile) {
this.wapProvisioningXmlFile = wapProvisioningXmlFile; this.wapProvisioningXmlFile = wapProvisioningXmlFile;
} }

@ -105,6 +105,8 @@
<mkdir dir="${tempdir}"/> <mkdir dir="${tempdir}"/>
<mkdir dir="${tempdir}/wso2cdm-${project.version}/repository/components"/> <mkdir dir="${tempdir}/wso2cdm-${project.version}/repository/components"/>
<mkdir dir="${tempdir}/wso2cdm-${project.version}/repository/deployment/server"/>
<mkdir dir="${tempdir}/wso2cdm-${project.version}/repository/deployment/server/webapps"/>
<unzip dest="${tempdir}"> <unzip dest="${tempdir}">
<fileset dir="target"> <fileset dir="target">
<include name="wso2cdm-${project.version}.zip"/> <include name="wso2cdm-${project.version}.zip"/>
@ -137,7 +139,7 @@
og4j.logger.net.sf.ehcache=ERROR og4j.logger.net.sf.ehcache=ERROR
</concat> </concat>
<!--<delete file="target/wso2cdm-${project.version}.zip"/>--> <delete file="target/wso2cdm-${project.version}.zip"/>
<delete dir="${tempdir}"/> <delete dir="${tempdir}"/>
</tasks> </tasks>
</configuration> </configuration>
@ -147,6 +149,8 @@
<phase>package</phase> <phase>package</phase>
<configuration> <configuration>
<tasks> <tasks>
<mkdir dir="target/wso2carbon-core-${project.version}/repository/deployment/server/webapps"/>
<!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/modules" <!--<copy todir="target/wso2carbon-core-${carbon.kernel.version}/modules"
overwrite="true"> overwrite="true">
<fileset dir="src/repository/modules"></fileset> <fileset dir="src/repository/modules"></fileset>

@ -40,15 +40,6 @@
</includes> </includes>
<fileMode>755</fileMode> <fileMode>755</fileMode>
</fileSet> </fileSet>
<!-- <fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/dbscripts/identity/
</directory>
<outputDirectory>wso2cdm-${project.version}/dbscripts/identity</outputDirectory>
<includes>
<include>**/**.sql</include>
</includes>
</fileSet>-->
<!--Multitenancy related file --> <!--Multitenancy related file -->
<fileSet> <fileSet>
@ -98,11 +89,11 @@
<fileMode>755</fileMode> <fileMode>755</fileMode>
</fileSet> </fileSet>
<!-- copy the landing page webapp --> <!-- copy the landing page webapp -->
<fileSet> <!-- <fileSet>
<directory>src/repository/resources/stratos_root</directory> <directory>src/repository/resources/stratos_root</directory>
<outputDirectory>wso2cdm-${project.version}/repository/deployment/server/webapps/STRATOS_ROOT</outputDirectory> <outputDirectory>wso2cdm-${project.version}/repository/deployment/server/webapps/STRATOS_ROOT</outputDirectory>
<fileMode>755</fileMode> <fileMode>755</fileMode>
</fileSet> </fileSet>-->
<fileSet> <fileSet>
<directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/modules</directory> <directory>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/modules</directory>
<outputDirectory>${pom.artifactId}-${project.version}/modules/</outputDirectory> <outputDirectory>${pom.artifactId}-${project.version}/modules/</outputDirectory>
@ -110,43 +101,7 @@
<include>*/**</include> <include>*/**</include>
</includes> </includes>
</fileSet> </fileSet>
<!-- <fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/jaggeryapps
</directory>
<outputDirectory>${pom.artifactId}-${project.version}/repository/deployment/server/jaggeryapps/
</outputDirectory>
<includes>
<include>*/**</include>
</includes>
<excludes>
<exclude>**/social/</exclude>
<exclude>**/fakepublisher/</exclude>
<exclude>**/fakestore/</exclude>
</excludes>
</fileSet>-->
<!--copy jaxrs web app for OAuth feature-->
<!-- <fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps
</directory>
<outputDirectory>${pom.artifactId}-${project.version}/repository/deployment/server/webapps</outputDirectory>
<includes>
<include>oauth2.war</include>
</includes>
</fileSet>
&lt;!&ndash;copy web app for application authentication feature &ndash;&gt;
<fileSet>
<directory>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/deployment/server/webapps
</directory>
<outputDirectory>${pom.artifactId}-${project.version}/repository/deployment/server/webapps</outputDirectory>
<includes>
<include>authenticationendpoint.war</include>
</includes>
</fileSet>-->
<fileSet> <fileSet>
<directory>src/repository/conf</directory> <directory>src/repository/conf</directory>
<outputDirectory>wso2cdm-${project.version}/repository/conf</outputDirectory> <outputDirectory>wso2cdm-${project.version}/repository/conf</outputDirectory>
@ -239,6 +194,13 @@
</dependencySets> </dependencySets>
<files> <files>
<file>
<source>../agents/android/jax-rs/target/cdm-android-api.war</source>
<outputDirectory>wso2cdm-${pom.version}/repository/deployment/server/webapps</outputDirectory>
<filtered>true</filtered>
<fileMode>755</fileMode>
</file>
<!-- <file> <!-- <file>
<source> <source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml
@ -261,7 +223,7 @@
<filtered>true</filtered> <filtered>true</filtered>
<fileMode>644</fileMode> <fileMode>644</fileMode>
</file> </file>
<!-- <file> <!-- <file>
<source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/event-broker.xml <source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/event-broker.xml
</source> </source>
<outputDirectory>wso2cdm-${project.version}/repository/conf/</outputDirectory> <outputDirectory>wso2cdm-${project.version}/repository/conf/</outputDirectory>
@ -314,11 +276,7 @@
<filtered>true</filtered> <filtered>true</filtered>
</file>--> </file>-->
<file>
<source>target/wso2carbon-core-${carbon.kernel.version}/repository/conf/log4j.properties</source>
<outputDirectory>wso2cdm-${project.version}/repository/conf/</outputDirectory>
<filtered>true</filtered>
</file>
<file> <file>
<source>src/repository/conf/multitenancy/cloud-services-desc.xml</source> <source>src/repository/conf/multitenancy/cloud-services-desc.xml</source>
<outputDirectory>wso2cdm-${project.version}/repository/conf/multitenancy/</outputDirectory> <outputDirectory>wso2cdm-${project.version}/repository/conf/multitenancy/</outputDirectory>
@ -354,7 +312,9 @@
</file> </file>
<file> <file>
<source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml</source> <source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading.xml
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/tomcat</outputDirectory> <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/tomcat</outputDirectory>
<filtered>true</filtered> <filtered>true</filtered>
<fileMode>644</fileMode> <fileMode>644</fileMode>
@ -362,7 +322,8 @@
<!--cdm config file--> <!--cdm config file-->
<file> <file>
<source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/cdm-config.xml</source> <source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/cdm-config.xml
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory> <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf</outputDirectory>
<filtered>true</filtered> <filtered>true</filtered>
<fileMode>644</fileMode> <fileMode>644</fileMode>
@ -370,14 +331,16 @@
<file> <file>
<source>../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading-environments.xml</source> <source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/tomcat/webapp-classloading-environments.xml
</source>
<outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/tomcat</outputDirectory> <outputDirectory>${pom.artifactId}-${pom.version}/repository/conf/tomcat</outputDirectory>
<filtered>true</filtered> <filtered>true</filtered>
<fileMode>644</fileMode> <fileMode>644</fileMode>
</file> </file>
<!-- nTask Component --> <!-- nTask Component -->
<!-- <file> <!-- <file>
<source> <source>
../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/tasks-config.xml ../p2-profile-gen/target/wso2carbon-core-${carbon.kernel.version}/repository/conf/etc/tasks-config.xml
</source> </source>

Loading…
Cancel
Save