Merge branch 'application-mgt-new' of https://github.com/lasanthaDLPDS/carbon-device-mgt into application-mgt-new

4.x.x
lasanthaDLPDS 6 years ago
commit f5615c5ec7

@ -42,7 +42,6 @@
<plugin> <plugin>
<groupId>org.apache.felix</groupId> <groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId> <artifactId>maven-bundle-plugin</artifactId>
<version>3.0.1</version>
<extensions>true</extensions> <extensions>true</extensions>
<configuration> <configuration>
<instructions> <instructions>
@ -50,9 +49,7 @@
<Bundle-Name>${project.artifactId}</Bundle-Name> <Bundle-Name>${project.artifactId}</Bundle-Name>
<Bundle-Version>${carbon.device.mgt.version}</Bundle-Version> <Bundle-Version>${carbon.device.mgt.version}</Bundle-Version>
<Bundle-Description>Application Management Core Bundle</Bundle-Description> <Bundle-Description>Application Management Core Bundle</Bundle-Description>
<Private-Package> <Private-Package>org.wso2.carbon.device.application.mgt.core.internal</Private-Package>
org.wso2.carbon.device.application.mgt.core.internal
</Private-Package>
<Import-Package> <Import-Package>
org.osgi.framework, org.osgi.framework,
org.osgi.service.component, org.osgi.service.component,
@ -81,7 +78,8 @@
org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", 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.apache.commons.codec.digest;version="${commons-codec.wso2.osgi.version.range}",
org.wso2.carbon.base, org.wso2.carbon.base,
net.dongliu.apk.parser.* com.dd.*,
org.apache.commons.validator.routines
</Import-Package> </Import-Package>
<Embed-Dependency>apk-parser;scope=compile|runtime;inline=false</Embed-Dependency> <Embed-Dependency>apk-parser;scope=compile|runtime;inline=false</Embed-Dependency>
<!--<Embed-Transitive>true</Embed-Transitive>--> <!--<Embed-Transitive>true</Embed-Transitive>-->

@ -81,7 +81,7 @@ public class Extension {
ApplicationManager, ApplicationManager,
ApplicationReleaseManager, ApplicationReleaseManager,
CategoryManager, CategoryManager,
CommentsManager, ReviewManager,
LifecycleStateManager, LifecycleStateManager,
PlatformManager, PlatformManager,
VisibilityTypeManager, 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.common.services.SubscriptionManager;
import org.wso2.carbon.device.application.mgt.core.dao.SubscriptionDAO; 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.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.ConnectionManagerUtil;
import org.wso2.carbon.device.application.mgt.core.util.HelperUtil; import org.wso2.carbon.device.application.mgt.core.util.HelperUtil;
import org.wso2.carbon.device.mgt.common.Device; import org.wso2.carbon.device.mgt.common.Device;
@ -68,7 +68,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Install application: " + applicationUUID + " to " + deviceList.size() + "devices."); log.debug("Install application: " + applicationUUID + " to " + deviceList.size() + "devices.");
} }
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID); Application application = applicationManager.getApplicationByRelease(applicationUUID);
return installApplication(application, deviceList); return installApplication(application, deviceList);
@ -80,7 +80,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users."); log.debug("Install application: " + applicationUUID + " to " + userList.size() + " users.");
} }
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID); Application application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>(); List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String user : userList) { for (String user : userList) {
@ -121,7 +121,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles."); log.debug("Install application: " + applicationUUID + " to " + roleList.size() + " roles.");
} }
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID); Application application = applicationManager.getApplicationByRelease(applicationUUID);
List<DeviceIdentifier> deviceList = new ArrayList<>(); List<DeviceIdentifier> deviceList = new ArrayList<>();
for (String role : roleList) { for (String role : roleList) {
@ -162,7 +162,7 @@ public class SubscriptionManagerImpl implements SubscriptionManager {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups."); log.debug("Install application: " + applicationUUID + " to " + deviceGroupList.size() + " groups.");
} }
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); ApplicationManager applicationManager = DataHolder.getInstance().getApplicationManager();
Application application = applicationManager.getApplicationByRelease(applicationUUID); Application application = applicationManager.getApplicationByRelease(applicationUUID);
GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService(); GroupManagementProviderService groupManagementProviderService = HelperUtil.getGroupManagementProviderService();
List<DeviceGroup> groupList = new ArrayList<>(); List<DeviceGroup> groupList = new ArrayList<>();

@ -63,21 +63,26 @@ import java.util.List;
* bind="setDataSourceService" * bind="setDataSourceService"
* unbind="unsetDataSourceService" * 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(); BundleContext bundleContext = componentContext.getBundleContext();
try { try {
String datasourceName = ConfigurationManager.getInstance().getConfiguration().getDatasourceName(); String dataSourceName = ConfigurationManager.getInstance().getConfiguration().getDatasourceName();
ApplicationManagementDAOFactory.init(dataSourceName);
// ApplicationManagementDAOFactory.initDatabases();
ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance();
DataHolder.getInstance().setApplicationManager(applicationManager); DataHolder.getInstance().setApplicationManager(applicationManager);
bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null); bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null);
ReviewManager reviewManager = ApplicationManagementUtil.getCommentsManagerInstance(); ReviewManager reviewManager = ApplicationManagementUtil.getReviewManagerInstance();
DataHolder.getInstance().setReviewManager(reviewManager); DataHolder.getInstance().setReviewManager(reviewManager);
bundleContext.registerService(ReviewManager.class.getName(), reviewManager, null); bundleContext.registerService(ReviewManager.class.getName(), reviewManager, null);
@ -94,19 +99,14 @@ public class ServiceComponent {
DataHolder.getInstance().setApplicationStorageManager(applicationStorageManager); DataHolder.getInstance().setApplicationStorageManager(applicationStorageManager);
bundleContext.registerService(ApplicationStorageManager.class.getName(), applicationStorageManager, null); bundleContext.registerService(ApplicationStorageManager.class.getName(), applicationStorageManager, null);
ApplicationManagementDAOFactory.init(datasourceName);
ApplicationManagementDAOFactory.initDatabases();
List<LifecycleState> lifecycleStates = ConfigurationManager.getInstance(). List<LifecycleState> lifecycleStates = ConfigurationManager.getInstance().
getConfiguration().getLifecycleStates(); getConfiguration().getLifecycleStates();
LifecycleStateManger lifecycleStateManger = new LifecycleStateManger(lifecycleStates); LifecycleStateManger lifecycleStateManger = new LifecycleStateManger(lifecycleStates);
DataHolder.getInstance().setLifecycleStateManger(lifecycleStateManger); DataHolder.getInstance().setLifecycleStateManger(lifecycleStateManger);
log.info("ApplicationManagement core bundle has been successfully initialized"); log.info("ApplicationManagement core bundle has been successfully initialized");
} catch (InvalidConfigurationException e) { } catch (Throwable e) {
log.error("Error while activating Application Management core component. ", e); log.error("Error occurred while initializing app management core bundle", e);
} catch (ApplicationManagementDAOException e) {
log.error("Error while activating Application Management core component.Failed to create the database ", e);
} }
} }

@ -45,9 +45,9 @@ public class ApplicationManagementUtil {
return getInstance(extension, ApplicationManager.class); return getInstance(extension, ApplicationManager.class);
} }
public static ReviewManager getCommentsManagerInstance() throws InvalidConfigurationException { public static ReviewManager getReviewManagerInstance() throws InvalidConfigurationException {
ConfigurationManager configurationManager = ConfigurationManager.getInstance(); ConfigurationManager configurationManager = ConfigurationManager.getInstance();
Extension extension = configurationManager.getExtension(Extension.Name.CommentsManager); Extension extension = configurationManager.getExtension(Extension.Name.ReviewManager);
return getInstance(extension, ReviewManager.class); return getInstance(extension, ReviewManager.class);
} }

@ -149,6 +149,9 @@ public class DeviceManagementServiceComponent {
@SuppressWarnings("unused") @SuppressWarnings("unused")
protected void activate(ComponentContext componentContext) { protected void activate(ComponentContext componentContext) {
log.info("CALLING Crazy .............");
try { try {
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
log.debug("Initializing device management core bundle"); log.debug("Initializing device management core bundle");

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

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

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

Loading…
Cancel
Save