diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementAPI.java similarity index 98% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementAPI.java index fcd7b99635e..55ccd12913a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementService.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/ApplicationManagementAPI.java @@ -30,7 +30,7 @@ import javax.ws.rs.core.Response; "such as get all the available devices, etc.") @Produces(MediaType.APPLICATION_JSON) @Consumes(MediaType.APPLICATION_JSON) -public interface ApplicationManagementService { +public interface ApplicationManagementAPI { public final static String SCOPE = "scope"; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java similarity index 77% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java index f973274b523..856cae1d2b4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java @@ -20,21 +20,25 @@ package org.wso2.carbon.device.application.mgt.api.services.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.api.util.ApplicationMgtAPIUtil; +import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; import javax.ws.rs.*; import javax.ws.rs.core.Response; +import static org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory.ManagerService.APPLICATION_MANAGER; + @Produces({ "application/json"}) @Consumes({ "application/json"}) -public class ApplicationManagementServiceImpl { +public class ApplicationManagementAPIImpl { public static final int DEFAULT_LIMIT = 20; - private static Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class); + private static Log log = LogFactory.getLog(ApplicationManagementAPIImpl.class); @GET @@ -42,7 +46,9 @@ public class ApplicationManagementServiceImpl { @Path("applications") public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, @QueryParam("q") String searchQuery) { - ApplicationManager applicationManager = ApplicationMgtAPIUtil.getApplicationManagementService(); + ApplicationManagementServiceFactory serviceFactory = ApplicationMgtAPIUtil.getApplicationManagementServiceFactory(); + ApplicationManager applicationManager = (ApplicationManager) serviceFactory + .getApplicationManagementService(APPLICATION_MANAGER); try { if(limit == 0){ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java index 7ef89a21aef..84cb905996b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java @@ -20,9 +20,8 @@ package org.wso2.carbon.device.application.mgt.api.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; /** * Holds util methods required for Application-Mgt API component. @@ -31,15 +30,15 @@ public class ApplicationMgtAPIUtil { private static Log log = LogFactory.getLog(ApplicationMgtAPIUtil.class); - public static ApplicationManagementService getApplicationManagementService() { + public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ApplicationManagementService applicationManager = - (ApplicationManagementService) ctx.getOSGiService(ApplicationManagementService.class, null); - if (applicationManager == null) { + ApplicationManagementServiceFactory applicationManagerServiceFactory = + (ApplicationManagementServiceFactory) ctx.getOSGiService(ApplicationManagementServiceFactory.class, null); + if (applicationManagerServiceFactory == null) { String msg = "Application Management provider service has not initialized."; log.error(msg); throw new IllegalStateException(msg); } - return applicationManager; + return applicationManagerServiceFactory; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index c7aeccc348d..897692df30a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -32,7 +32,7 @@ http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"> - + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java index 1935617b08d..7dee927630d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -64,6 +64,18 @@ public class Application { private boolean published; + private LifecycleState lifecycleState; + + private Date lifecycleStateModifiedAt; + + private Date getLifecycleStateModifiedBy; + + private boolean freeApp; + + private String paymentCurrency; + + private Float paymentPrice; + public int getId() { return id; @@ -208,4 +220,52 @@ public class Application { public void setPublished(boolean published) { this.published = published; } + + public LifecycleState getLifecycleState() { + return lifecycleState; + } + + public void setLifecycleState(LifecycleState lifecycleState) { + this.lifecycleState = lifecycleState; + } + + public Date getLifecycleStateModifiedAt() { + return lifecycleStateModifiedAt; + } + + public void setLifecycleStateModifiedAt(Date lifecycleStateModifiedAt) { + this.lifecycleStateModifiedAt = lifecycleStateModifiedAt; + } + + public Date getGetLifecycleStateModifiedBy() { + return getLifecycleStateModifiedBy; + } + + public void setGetLifecycleStateModifiedBy(Date getLifecycleStateModifiedBy) { + this.getLifecycleStateModifiedBy = getLifecycleStateModifiedBy; + } + + public boolean isFreeApp() { + return freeApp; + } + + public void setFreeApp(boolean freeApp) { + this.freeApp = freeApp; + } + + public String getPaymentCurrency() { + return paymentCurrency; + } + + public void setPaymentCurrency(String paymentCurrency) { + this.paymentCurrency = paymentCurrency; + } + + public Float getPaymentPrice() { + return paymentPrice; + } + + public void setPaymentPrice(Float paymentPrice) { + this.paymentPrice = paymentPrice; + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java index d6bd130c8ba..299d36c0c7b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java @@ -43,14 +43,14 @@ public class ApplicationRelease { private Application application; - private LifecycleState lifecycleState; - private Date lifecycleStateModifiedAt; private String lifecycleStateModifiedBy; private Map properties; + private boolean published; + public int getId() { return id; } @@ -115,14 +115,6 @@ public class ApplicationRelease { this.application = application; } - public LifecycleState getLifecycleState() { - return lifecycleState; - } - - public void setLifecycleState(LifecycleState lifecycleState) { - this.lifecycleState = lifecycleState; - } - public Date getLifecycleStateModifiedAt() { return lifecycleStateModifiedAt; } @@ -146,4 +138,12 @@ public class ApplicationRelease { public void setProperties(Map properties) { this.properties = properties; } + + public boolean isPublished() { + return published; + } + + public void setPublished(boolean published) { + this.published = published; + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtensionsService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtensionsService.java new file mode 100644 index 00000000000..770940c7aaa --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtensionsService.java @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2017, 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.device.application.mgt.common.services; + +public interface ApplicationManagementExtensionsService { + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java index 8b459383f24..9fe5fe9996e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java @@ -18,10 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; - -public interface ApplicationManagementService extends ApplicationReleaseManager, ApplicationManager, CategoryManager, - CommentsManager, LifecycleStateManager, PlatformManager, ResourceTypeManager, SubscriptionManager, - VisibilityManager { - +public interface ApplicationManagementService { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java index bc591c36a42..759d085836e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java @@ -23,7 +23,7 @@ import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; -public interface ApplicationManager { +public interface ApplicationManager extends ApplicationManagementService { void createApplication(Application application) throws ApplicationManagerException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementExtensionsFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementExtensionsFactory.java new file mode 100644 index 00000000000..fb5ec65dc95 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementExtensionsFactory.java @@ -0,0 +1,28 @@ +/* + * Copyright (c) 2017, 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.device.application.mgt.core.dao.common; + +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementExtensionsService; + +public class ApplicationManagementExtensionsFactory { + + public ApplicationManagementExtensionsService getExtensionsService(Class managerClass) throws Exception { + return (ApplicationManagementExtensionsService) managerClass.newInstance(); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java index a9fea8f9a0b..73fd21660c4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java @@ -18,17 +18,17 @@ */ package org.wso2.carbon.device.application.mgt.core.internal; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; public class ApplicationManagementDataHolder { private DeviceManagementProviderService deviceManagementService; - private ApplicationManagementService applicationManagementService; + private ApplicationManagementServiceFactory applicationManagementServiceFactory; private static final ApplicationManagementDataHolder applicationMgtDataHolder = new ApplicationManagementDataHolder(); - private ApplicationManagementDataHolder(){ + private ApplicationManagementDataHolder() { } @@ -44,11 +44,15 @@ public class ApplicationManagementDataHolder { this.deviceManagementService = deviceManagementService; } - public ApplicationManagementService getApplicationManagementService() { - return applicationManagementService; + public ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { + return applicationManagementServiceFactory; } - public void setApplicationManagementService(ApplicationManagementService applicationManagementService) { - this.applicationManagementService = applicationManagementService; + public void setApplicationManagementServiceFactory(ApplicationManagementServiceFactory applicationManagementServiceFactory) { + this.applicationManagementServiceFactory = applicationManagementServiceFactory; + } + + public static ApplicationManagementDataHolder getApplicationMgtDataHolder() { + return applicationMgtDataHolder; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.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 index c1249b2ae9c..552a74effe5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.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 @@ -23,7 +23,7 @@ import org.osgi.service.component.ComponentContext; import org.osgi.framework.BundleContext; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; -import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceImpl; +import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; @@ -47,11 +47,9 @@ public class ApplicationManagementServiceComponent { protected void activate(ComponentContext componentContext) throws NamingException { BundleContext bundleContext = componentContext.getBundleContext(); - ApplicationManagementService applicationManagementService = new ApplicationManagementServiceImpl(); - ApplicationManagementDataHolder.getInstance().setApplicationManagementService(applicationManagementService); - bundleContext.registerService(ApplicationManagementService.class.getName(), - applicationManagementService, null); - + ApplicationManagementServiceFactory serviceFactory = new ApplicationManagementServiceFactory(); + ApplicationManagementDataHolder.getInstance().setApplicationManagementServiceFactory(serviceFactory); + bundleContext.registerService(ApplicationManagementServiceFactory.class.getName(), serviceFactory, null); DataSourceConfig dataSourceConfig = ApplicationConfigurationManager.getInstance() .getApplicationManagerConfiguration().getApplicationManagerRepository().getDataSourceConfig(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java new file mode 100644 index 00000000000..d1db02f71fb --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2017, 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.device.application.mgt.core.services.impl; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.Application; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.services.*; +import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; +import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; + +public class ApplicationManagementServiceFactory { + + public enum ManagerService { + APPLICATION_MANAGER, + APPLICATION_RELEASE_MANAGER + } + + public ApplicationManagementService getApplicationManagementService(ManagerService managerService) { + switch (managerService) { + case APPLICATION_MANAGER: + return new ApplicationManagerImpl(); + default: + return null; + } + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java similarity index 86% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java index d2e523c1ac2..720e75fff3d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java @@ -18,25 +18,20 @@ */ package org.wso2.carbon.device.application.mgt.core.services.impl; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; -public class ApplicationManagementServiceImpl implements ApplicationManagementService { - - private static final Log log = LogFactory.getLog(ApplicationManagementServiceImpl.class); - +public class ApplicationManagerImpl implements ApplicationManager { @Override - public void createApplication(Application application) { + public void createApplication(Application application) throws ApplicationManagerException { } 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 12584885668..7a1df760369 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 @@ -23,8 +23,8 @@ import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; @@ -35,16 +35,16 @@ public class ApplicationManagementUtil { private static Log log = LogFactory.getLog(ApplicationManagementUtil.class); - public static ApplicationManagementService getApplicationManagementService() { + public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - ApplicationManagementService applicationManager = - (ApplicationManagementService) CarbonContext.getThreadLocalCarbonContext().getOSGiService(ApplicationManagementService.class, null); - if (applicationManager == null) { + ApplicationManagementServiceFactory applicationManagerServiceFactory = + (ApplicationManagementServiceFactory) ctx.getOSGiService(ApplicationManagementServiceFactory.class, null); + if (applicationManagerServiceFactory == null) { String msg = "Application Management provider service has not initialized."; log.error(msg); throw new IllegalStateException(msg); } - return applicationManager; + return applicationManagerServiceFactory; } public static Document convertToDocument(File file) throws ApplicationManagerException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml new file mode 100644 index 00000000000..591dd295057 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/pom.xml @@ -0,0 +1,160 @@ + + + + + + org.wso2.carbon.devicemgt + application-mgt + 2.0.63-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.application.mgt.extensions + 2.0.63-SNAPSHOT + bundle + WSO2 Carbon - Application Management Extensions + WSO2 Carbon - Application Management Extensions + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.device.mgt.version} + Application Management Core Bundle + + org.wso2.carbon.device.application.mgt.core.internal + + + org.osgi.framework, + org.osgi.service.component, + org.apache.commons.logging, + javax.xml.*, + javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, + org.wso2.carbon.context.*, + org.wso2.carbon.utils.*, + org.w3c.dom, + org.json, + javax.sql, + com.google.gson, + javax.naming, + javax.xml.bind.annotation, + javax.xml.bind, + org.wso2.carbon.device.application.mgt.common.*, + org.wso2.carbon.device.mgt.core.*, + org.wso2.carbon.device.mgt.common.*, + + + !org.wso2.carbon.device.application.mgt.core.internal.*, + org.wso2.carbon.device.application.mgt.core.* + + + + + + + org.apache.maven.plugins + maven-surefire-plugin + 2.18 + + + file:src/test/resources/log4j.properties + + + src/test/resources/testng.xml + + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.osgi + org.eclipse.osgi.services + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.testng + testng + + + org.wso2.carbon + org.wso2.carbon.logging + + + org.wso2.carbon + org.wso2.carbon.utils + + + commons-codec.wso2 + commons-codec + + + commons-io.wso2 + commons-io + + + org.slf4j + slf4j-simple + test + + + org.json.wso2 + json + + + com.google.code.gson + gson + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core + + + + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/PaymentService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/PaymentService.java new file mode 100644 index 00000000000..e9868a9637e --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/PaymentService.java @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2017, 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.device.application.mgt.extensions.payments; + +public interface PaymentService { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/impl/PaymentServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/impl/PaymentServiceImpl.java new file mode 100644 index 00000000000..a3df8dd4f71 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/payments/impl/PaymentServiceImpl.java @@ -0,0 +1,24 @@ +/* + * Copyright (c) 2017, 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.device.application.mgt.extensions.payments.impl; + +import org.wso2.carbon.device.application.mgt.extensions.payments.PaymentService; + +public class PaymentServiceImpl implements PaymentService { +} diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 3c350b22432..478fd3f5df3 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -39,6 +39,8 @@ org.wso2.carbon.device.application.mgt.common org.wso2.carbon.device.application.mgt.api org.wso2.carbon.device.application.mgt.ui + org.wso2.carbon.device.application.mgt.extensions + diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml new file mode 100644 index 00000000000..286d01f0c0d --- /dev/null +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.extensions.feature/pom.xml @@ -0,0 +1,105 @@ + + + + + + + org.wso2.carbon.devicemgt + application-mgt-feature + 2.0.63-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.application.mgt.extensions.feature + pom + 2.0.63-SNAPSHOT + WSO2 Carbon - Application Management Extension Feature + http://wso2.org + WSO2 Application Management Extension Feature + + + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.extensions + + + + + + + maven-resources-plugin + 2.6 + + + copy-resources + generate-resources + + copy-resources + + + src/main/resources + + + resources + + build.properties + p2.inf + + + + + + + + + org.wso2.maven + carbon-p2-plugin + ${carbon.p2.plugin.version} + + + p2-feature-generation + package + + p2-feature-gen + + + org.wso2.carbon.device.application.mgt.extensions + ../../../features/etc/feature.properties + + + org.wso2.carbon.p2.category.type:server + org.eclipse.equinox.p2.type.group:false + + + + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.extensions:${carbon.device.mgt.version} + + + + + + + + + + + + \ No newline at end of file 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 87e8f0c2031..d96620cf59f 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 @@ -100,6 +100,7 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version} + org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.extensions.feature:${carbon.device.mgt.version} diff --git a/features/application-mgt/pom.xml b/features/application-mgt/pom.xml index d058eda2020..d2dc6d58054 100644 --- a/features/application-mgt/pom.xml +++ b/features/application-mgt/pom.xml @@ -38,6 +38,7 @@ org.wso2.carbon.device.application.mgt.api.feature org.wso2.carbon.device.application.mgt.ui.feature org.wso2.carbon.device.application.mgt.feature + org.wso2.carbon.device.application.mgt.extensions.feature org.wso2.carbon.device.application.mgt.server.feature \ No newline at end of file diff --git a/pom.xml b/pom.xml index cb15d5e12bd..cb7f993f671 100644 --- a/pom.xml +++ b/pom.xml @@ -187,6 +187,11 @@ org.wso2.carbon.device.application.mgt.api ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.extensions + ${carbon.device.mgt.version} + org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.ui @@ -350,6 +355,12 @@ zip ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.extensions.feature + zip + ${carbon.device.mgt.version} + org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.api.feature