Add app manager osgi fixes

feature/appm-store/pbac
geethkokila 6 years ago
parent 7d59c342b2
commit 4ded86a134

@ -42,7 +42,6 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions>
<configuration>
<instructions>
@ -50,9 +49,7 @@
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Application Management Core Bundle</Bundle-Description>
<Private-Package>
org.wso2.carbon.device.application.mgt.core.internal
</Private-Package>
<Private-Package>org.wso2.carbon.device.application.mgt.core.internal</Private-Package>
<Import-Package>
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
</Import-Package>
<Embed-Dependency>apk-parser;scope=compile|runtime;inline=false</Embed-Dependency>
<!--<Embed-Transitive>true</Embed-Transitive>-->

@ -81,7 +81,7 @@ public class Extension {
ApplicationManager,
ApplicationReleaseManager,
CategoryManager,
CommentsManager,
ReviewManager,
LifecycleStateManager,
PlatformManager,
VisibilityTypeManager,

@ -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<DeviceIdentifier> 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<DeviceIdentifier> 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<DeviceGroup> groupList = new ArrayList<>();

@ -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<LifecycleState> 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);
}
}

@ -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);
}

@ -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");

@ -30,6 +30,7 @@
<artifactId>org.wso2.carbon.device.application.mgt.server.feature</artifactId>
<packaging>pom</packaging>
<version>3.1.40-SNAPSHOT</version>
<name>WSO2 Carbon - Application Management Server Feature</name>
<url>http://wso2.org</url>
<description>This feature contains the core bundles required for Back-end Application Management functionality
@ -44,6 +45,18 @@
<groupId>org.wso2.carbon.devicemgt</groupId>
<artifactId>org.wso2.carbon.device.application.mgt.core</artifactId>
</dependency>
<dependency>
<groupId>com.googlecode.plist</groupId>
<artifactId>dd-plist</artifactId>
<version>${googlecode.plist.version}</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
<!--<dependency>-->
<!--<groupId>javax.servlet.jsp</groupId>-->
<!--<artifactId>javax.servlet.jsp-api</artifactId>-->
@ -122,6 +135,12 @@
<bundleDef>
org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version}
</bundleDef>
<bundleDef>
com.googlecode.plist:dd-plist:${googlecode.plist.version}
</bundleDef>
<bundleDef>
commons-validator:commons-validator:${commons-validator.version}
</bundleDef>
<!--<bundleDef>javax.servlet.jsp:javax.servlet.jsp-api</bundleDef>-->
<!--<bundleDef>org.wso2.orbit.org.scannotation:scannotation:${scannotation.version}</bundleDef>-->
</bundles>
@ -136,4 +155,7 @@
</plugin>
</plugins>
</build>
<properties>
<commons-validator.version>1.6</commons-validator.version>
</properties>
</project>

@ -31,8 +31,8 @@
<Extension name="CategoryManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl</ClassName>
</Extension>
<Extension name="CommentsManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.CommentsManagerImpl</ClassName>
<Extension name="ReviewManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.ReviewManagerImpl</ClassName>
</Extension>
<Extension name="LifecycleStateManager">
<ClassName>org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl</ClassName>

@ -1840,7 +1840,7 @@
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.5</version>
<version>2.5.3</version>
<extensions>true</extensions>
<configuration>
<obrRepository>NONE</obrRepository>

Loading…
Cancel
Save