diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml index 932265189f6..bd2a14ba47e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/pom.xml @@ -42,7 +42,6 @@ org.apache.felix maven-bundle-plugin - 3.0.1 true @@ -50,9 +49,7 @@ ${project.artifactId} ${carbon.device.mgt.version} Application Management Core Bundle - - org.wso2.carbon.device.application.mgt.core.internal - + org.wso2.carbon.device.application.mgt.core.internal org.osgi.framework, org.osgi.service.component, @@ -81,7 +78,8 @@ org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", org.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}", org.wso2.carbon.base, - net.dongliu.apk.parser.* + com.dd.*, + org.apache.commons.validator.routines apk-parser;scope=compile|runtime;inline=false diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java index 07e3b09a851..593ecd4a99c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java @@ -81,7 +81,7 @@ public class Extension { ApplicationManager, ApplicationReleaseManager, CategoryManager, - CommentsManager, + ReviewManager, LifecycleStateManager, PlatformManager, VisibilityTypeManager, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java index b82057447f7..1717be58c6f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java @@ -27,7 +27,7 @@ import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; +import org.wso2.carbon.device.application.mgt.core.internal.DataHolder; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.HelperUtil; import org.wso2.carbon.device.mgt.common.Device; @@ -68,7 +68,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { if (log.isDebugEnabled()) { log.debug("Install application: " + applicationUUID + " to " + deviceList.size() + "devices."); } - ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); + ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); Application application = applicationManager.getApplicationByRelease(applicationUUID); return installApplication(application, deviceList); @@ -80,7 +80,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { if (log.isDebugEnabled()) { log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users."); } - ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); + ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); Application application = applicationManager.getApplicationByRelease(applicationUUID); List deviceList = new ArrayList<>(); for (String user : userList) { @@ -121,7 +121,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { if (log.isDebugEnabled()) { log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles."); } - ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); + ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); Application application = applicationManager.getApplicationByRelease(applicationUUID); List deviceList = new ArrayList<>(); for (String role : roleList) { @@ -162,7 +162,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager { if (log.isDebugEnabled()) { log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups."); } - ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); + ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager(); Application application = applicationManager.getApplicationByRelease(applicationUUID); GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService(); List groupList = new ArrayList<>(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java similarity index 89% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java index e2224b2c30d..cf891d5d1c7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -63,21 +63,26 @@ import java.util.List; * bind="setDataSourceService" * unbind="unsetDataSourceService" */ -public class ServiceComponent { +public class ApplicationManagementServiceComponent { - private static Log log = LogFactory.getLog(ServiceComponent.class); + private static Log log = LogFactory.getLog(ApplicationManagementServiceComponent.class); - protected void activate(ComponentContext componentContext) throws NamingException { + @SuppressWarnings("unused") + protected void activate(ComponentContext componentContext) { + + log.info("CALLING ACTIVATE ............."); BundleContext bundleContext = componentContext.getBundleContext(); try { - String datasourceName = ConfigurationManager.getInstance().getConfiguration().getDatasourceName(); + String dataSourceName = ConfigurationManager.getInstance().getConfiguration().getDatasourceName(); + ApplicationManagementDAOFactory.init(dataSourceName); +// ApplicationManagementDAOFactory.initDatabases(); ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); DataHolder.getInstance().setApplicationManager(applicationManager); bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null); - ReviewManager reviewManager = ApplicationManagementUtil.getCommentsManagerInstance(); + ReviewManager reviewManager = ApplicationManagementUtil.getReviewManagerInstance(); DataHolder.getInstance().setReviewManager(reviewManager); bundleContext.registerService(ReviewManager.class.getName(), reviewManager, null); @@ -94,19 +99,14 @@ public class ServiceComponent { DataHolder.getInstance().setApplicationStorageManager(applicationStorageManager); bundleContext.registerService(ApplicationStorageManager.class.getName(), applicationStorageManager, null); - ApplicationManagementDAOFactory.init(datasourceName); - ApplicationManagementDAOFactory.initDatabases(); - List lifecycleStates = ConfigurationManager.getInstance(). getConfiguration().getLifecycleStates(); LifecycleStateManger lifecycleStateManger = new LifecycleStateManger(lifecycleStates); DataHolder.getInstance().setLifecycleStateManger(lifecycleStateManger); log.info("ApplicationManagement core bundle has been successfully initialized"); - } catch (InvalidConfigurationException e) { - log.error("Error while activating Application Management core component. ", e); - } catch (ApplicationManagementDAOException e) { - log.error("Error while activating Application Management core component.Failed to create the database ", e); + } catch (Throwable e) { + log.error("Error occurred while initializing app management core bundle", e); } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java index 4127696e30c..488f8147b57 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java @@ -45,9 +45,9 @@ public class ApplicationManagementUtil { return getInstance(extension, ApplicationManager.class); } - public static ReviewManager getCommentsManagerInstance() throws InvalidConfigurationException { + public static ReviewManager getReviewManagerInstance() throws InvalidConfigurationException { ConfigurationManager configurationManager = ConfigurationManager.getInstance(); - Extension extension = configurationManager.getExtension(Extension.Name.CommentsManager); + Extension extension = configurationManager.getExtension(Extension.Name.ReviewManager); return getInstance(extension, ReviewManager.class); } diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java index 65decec77f1..fccdc8a86c3 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/internal/DeviceManagementServiceComponent.java @@ -149,6 +149,9 @@ public class DeviceManagementServiceComponent { @SuppressWarnings("unused") protected void activate(ComponentContext componentContext) { + + log.info("CALLING Crazy ............."); + try { if (log.isDebugEnabled()) { log.debug("Initializing device management core bundle"); diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml index f70e66d5425..ac05f5cac14 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/pom.xml @@ -30,6 +30,7 @@ org.wso2.carbon.device.application.mgt.server.feature pom 3.1.40-SNAPSHOT + WSO2 Carbon - Application Management Server Feature http://wso2.org This feature contains the core bundles required for Back-end Application Management functionality @@ -44,6 +45,18 @@ org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.core + + com.googlecode.plist + dd-plist + ${googlecode.plist.version} + + + + commons-validator + commons-validator + ${commons-validator.version} + + @@ -122,6 +135,12 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version} + + com.googlecode.plist:dd-plist:${googlecode.plist.version} + + + commons-validator:commons-validator:${commons-validator.version} + @@ -136,4 +155,7 @@ + + 1.6 + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml index cfe2145e561..9bcbcf4fa49 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -31,8 +31,8 @@ org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl - - org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl + + org.wso2.carbon.device.application.mgt.core.impl.ReviewManagerImpl org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl diff --git a/pom.xml b/pom.xml index de54d162441..b96ebfe0fc5 100644 --- a/pom.xml +++ b/pom.xml @@ -1840,7 +1840,7 @@ org.apache.felix maven-bundle-plugin - 2.3.5 + 2.5.3 true NONE