From 7dd48bf00efb3121ebcdf7c4a604b016c8c881f1 Mon Sep 17 00:00:00 2001 From: geethkokila Date: Wed, 2 Sep 2015 19:39:50 +0530 Subject: [PATCH 1/2] Fixing the monitoring task for INACTIVE, BLOCKED, REMOVED, UNCLAIMED, DISENROLLMENT_REQUESTED, SUSPENDED devices --- .../policy/mgt/core/task/MonitoringTask.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java index cff114bf40c..2fd0a5b07ec 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/main/java/org/wso2/carbon/policy/mgt/core/task/MonitoringTask.java @@ -77,14 +77,13 @@ public class MonitoringTask implements Task { try { - DeviceManagementProviderService deviceManagementProviderService = PolicyManagementDataHolder.getInstance().getDeviceManagementService(); for (DeviceType deviceType : deviceTypes) { - if(log.isDebugEnabled()){ - log.debug("Running task for device type : " + deviceType.getName() ); + if (log.isDebugEnabled()) { + log.debug("Running task for device type : " + deviceType.getName()); } PolicyMonitoringService monitoringService = @@ -100,15 +99,21 @@ public class MonitoringTask implements Task { deviceType.getName()); } for (Device device : devices) { - if (device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.INACTIVE) || - device.getEnrolmentInfo().getStatus().equals(EnrolmentInfo.Status.BLOCKED)) { + EnrolmentInfo.Status status = device.getEnrolmentInfo().getStatus(); + if (status.equals(EnrolmentInfo.Status.INACTIVE) || + status.equals(EnrolmentInfo.Status.BLOCKED) || + status.equals(EnrolmentInfo.Status.REMOVED) || + status.equals(EnrolmentInfo.Status.UNCLAIMED) || + status.equals(EnrolmentInfo.Status.DISENROLLMENT_REQUESTED) || + status.equals(EnrolmentInfo.Status.SUSPENDED)) { continue; } else { notifiableDevices.add(device); } } if (log.isDebugEnabled()) { - log.debug("Following devices selected to send the notification for " + deviceType.getName()); + log.debug("Following devices selected to send the notification for " + + deviceType.getName()); for (Device device : notifiableDevices) { log.debug(device.getDeviceIdentifier()); } From d7ea5625bc5782550b38b784c2fd4456a7e25aa6 Mon Sep 17 00:00:00 2001 From: harshanl Date: Wed, 2 Sep 2015 20:24:33 +0530 Subject: [PATCH 2/2] Fixed apimgt publisher component issues --- .../org.wso2.carbon.apimgt.webapp.publisher/pom.xml | 4 ++++ .../publisher/internal/APIPublisherServiceComponent.java | 5 +++-- .../lifecycle/listener/APIPublisherLifecycleListener.java | 2 +- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml index db99ddb99d1..25275cb3342 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/pom.xml @@ -52,6 +52,10 @@ + + org.apache.felix + maven-scr-plugin + org.apache.felix maven-bundle-plugin diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java index 97fe5d11e87..3c47749e03b 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/internal/APIPublisherServiceComponent.java @@ -26,11 +26,13 @@ import org.wso2.carbon.apimgt.impl.APIManagerConfigurationService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherService; import org.wso2.carbon.apimgt.webapp.publisher.APIPublisherServiceImpl; +/** + * @scr.component name="org.wso2.carbon.apimgt.webapp.publisher" immediate="true" + */ public class APIPublisherServiceComponent { private static Log log = LogFactory.getLog(APIPublisherServiceComponent.class); - @SuppressWarnings("unused") protected void activate(ComponentContext componentContext) { try { if (log.isDebugEnabled()) { @@ -48,7 +50,6 @@ public class APIPublisherServiceComponent { } } - @SuppressWarnings("unused") protected void deactivate(ComponentContext componentContext) { //do nothing } diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java index 4284c9a5a5b..0078b7c6ff0 100644 --- a/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java +++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.webapp.publisher/src/main/java/org/wso2/carbon/apimgt/webapp/publisher/lifecycle/listener/APIPublisherLifecycleListener.java @@ -54,7 +54,7 @@ public class APIPublisherLifecycleListener implements LifecycleListener { ServletContext servletContext = context.getServletContext(); String param = servletContext.getInitParameter(PARAM_MANAGED_API_ENABLED); - boolean isManagedApi = (param != null && param.isEmpty()) && Boolean.parseBoolean(param); + boolean isManagedApi = (param != null && !param.isEmpty()) && Boolean.parseBoolean(param); if (isManagedApi) { APIConfig apiConfig = this.buildApiConfig(servletContext);