mirror of
https://repository.entgra.net/community/device-mgt-core.git
synced 2025-10-06 02:01:45 +00:00
Adding the bundle activator for PIP
This commit is contained in:
parent
cd3913d43d
commit
60e98f12b2
@ -37,6 +37,7 @@
|
||||
<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>
|
||||
<Bundle-Activator>org.wso2.carbon.policy.information.point.internal.PolicyInformationPointBundleActivator</Bundle-Activator>
|
||||
<Export-Package>
|
||||
org.wso2.carbon.policy.information.point.*
|
||||
</Export-Package>
|
||||
|
||||
@ -0,0 +1,66 @@
|
||||
/*
|
||||
* 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.internal;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.framework.BundleActivator;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceRegistration;
|
||||
import org.wso2.carbon.policy.information.point.PolicyInformationServiceImpl;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyInformationService;
|
||||
|
||||
public class PolicyInformationPointBundleActivator implements BundleActivator {
|
||||
|
||||
private ServiceRegistration pipServiceRegRef;
|
||||
private static final Log log = LogFactory.getLog(PolicyInformationPointBundleActivator.class);
|
||||
|
||||
@Override
|
||||
public void start(BundleContext bundleContext) throws Exception {
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Activating Policy information Point bundle.");
|
||||
}
|
||||
|
||||
pipServiceRegRef = bundleContext.registerService(PolicyInformationService.class.getName(),
|
||||
new PolicyInformationServiceImpl(), null);
|
||||
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Policy information Point bundle is activated.");
|
||||
}
|
||||
|
||||
} catch (Exception ex) {
|
||||
log.error("Error occurred while activating the Policy Information Point bundle.", ex);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop(BundleContext bundleContext) throws Exception {
|
||||
try {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Policy information Point bundle is deactivated.");
|
||||
}
|
||||
pipServiceRegRef.unregister();
|
||||
} catch (Exception ex) {
|
||||
log.error("Error occurred while de-activating the Policy Information Point bundle.", ex);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@ -21,6 +21,7 @@ package org.wso2.carbon.policy.mgt.core.internal;
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
import org.osgi.service.component.ComponentContext;
|
||||
import org.wso2.carbon.policy.mgt.common.PolicyInformationService;
|
||||
import org.wso2.carbon.policy.mgt.core.config.PolicyConfigurationManager;
|
||||
import org.wso2.carbon.policy.mgt.core.config.PolicyManagementConfig;
|
||||
import org.wso2.carbon.policy.mgt.core.config.datasource.DataSourceConfig;
|
||||
@ -28,13 +29,19 @@ import org.wso2.carbon.policy.mgt.core.dao.PolicyManagementDAOFactory;
|
||||
import org.wso2.carbon.user.core.service.RealmService;
|
||||
|
||||
/**
|
||||
* @scr.component name="org.wso2.carbon.policy.manager" immediate="true"
|
||||
* @scr.component name="org.wso2.carbon.devicemgt.policy.manager" immediate="true"
|
||||
* @scr.reference name="user.realmservice.default"
|
||||
* interface="org.wso2.carbon.user.core.service.RealmService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setRealmService"
|
||||
* unbind="unsetRealmService"
|
||||
* @scr.reference name="org.wso2.carbon.devicemgt.policy.information.point.default"
|
||||
* interface="org.wso2.carbon.policy.mgt.common.PolicyInformationService"
|
||||
* cardinality="1..1"
|
||||
* policy="dynamic"
|
||||
* bind="setPIPService"
|
||||
* unbind="unsetPIPService"
|
||||
*/
|
||||
|
||||
public class PolicyManagementServiceComponent {
|
||||
@ -81,4 +88,17 @@ public class PolicyManagementServiceComponent {
|
||||
PolicyManagementDataHolder.getInstance().setRealmService(null);
|
||||
}
|
||||
|
||||
|
||||
protected void setPIPService(PolicyInformationService policyInformationService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Setting Policy Information Service");
|
||||
}
|
||||
}
|
||||
|
||||
protected void unsetPIPService(PolicyInformationService policyInformationService) {
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Unsetting Policy Information Service");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -18,7 +18,8 @@
|
||||
~ under the License.
|
||||
-->
|
||||
|
||||
<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">
|
||||
<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>
|
||||
@ -47,7 +48,11 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
|
||||
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@ -99,11 +104,17 @@
|
||||
</properties>
|
||||
</adviceFile>
|
||||
<bundles>
|
||||
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.core:${carbon.device.mgt.version}
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.core:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.common:${carbon.device.mgt.version}
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.mgt.common:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
<bundleDef>org.wso2.carbon.devicemgt:org.wso2.carbon.policy.evaluator:${carbon.device.mgt.version}
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.complex.policy.decision.point:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
<bundleDef>
|
||||
org.wso2.carbon.devicemgt:org.wso2.carbon.policy.information.point:${carbon.device.mgt.version}
|
||||
</bundleDef>
|
||||
</bundles>
|
||||
<importFeatures>
|
||||
|
||||
7
pom.xml
7
pom.xml
@ -67,7 +67,12 @@
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.evaluator</artifactId>
|
||||
<artifactId>org.wso2.carbon.complex.policy.decision.point</artifactId>
|
||||
<version>${carbon.device.mgt.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.wso2.carbon.devicemgt</groupId>
|
||||
<artifactId>org.wso2.carbon.policy.information.point</artifactId>
|
||||
<version>${carbon.device.mgt.version}</version>
|
||||
</dependency>
|
||||
<!-- Device Management dependencies -->
|
||||
|
||||
Loading…
Reference in New Issue
Block a user