From 242cf06f42982ff65219df4c3a8333a6ed22e27e Mon Sep 17 00:00:00 2001 From: sinthuja Date: Wed, 31 May 2017 13:50:03 +0530 Subject: [PATCH 1/3] Refactoring the APP manager code, second phase. --- .../device/application/mgt/api/APIUtil.java | 20 +-- .../application/mgt/api/ApiOriginFilter.java | 44 ------ .../mgt/api/JSONMessageHandler.java | 3 +- .../mgt/api/beans/ErrorListItem.java | 1 - .../impl/ApplicationManagementAPIImpl.java | 12 +- .../src/main/webapp/WEB-INF/web.xml | 23 ++- .../application/mgt/common/Application.java | 104 +++++-------- .../mgt/common/ApplicationRelease.java | 8 +- .../mgt/common/ApplicationType.java | 65 -------- .../application/mgt/common/Comment.java | 1 + .../device/application/mgt/common/Filter.java | 1 + .../mgt/common/FilterProperty.java | 1 + .../application/mgt/common/LifeCycle.java | 53 +++++++ .../application/mgt/common/Payment.java | 50 ++++++ .../application/mgt/common/Platform.java | 17 +- .../application/mgt/common/ResourceType.java | 52 ------- .../application/mgt/common/Subscription.java | 6 +- .../application/mgt/common/Visibility.java | 42 ++++- .../ApplicationManagementExtension.java | 36 ----- .../common/services/ApplicationManager.java | 2 +- .../services/ApplicationReleaseManager.java | 2 +- ...ice.java => ApplicationUploadManager.java} | 3 +- .../mgt/common/services/CategoryManager.java | 2 +- .../mgt/common/services/CommentsManager.java | 2 +- .../services/LifecycleStateManager.java | 2 +- .../mgt/common/services/PlatformManager.java | 2 +- .../common/services/SubscriptionManager.java | 2 +- .../common/services/VisibilityManager.java | 37 ++--- ...anager.java => VisibilityTypeManager.java} | 2 +- .../ApplicationConfigurationManager.java | 82 ---------- .../ApplicationManagementRepository.java | 40 ----- .../mgt/core/config/ConfigurationManager.java | 90 +++++++++++ ...onfigurations.java => Configurations.java} | 28 ++-- .../config/datasource/DataSourceConfig.java | 40 ----- .../datasource/JNDILookupDefinition.java | 79 ---------- .../mgt/core/config/extensions/Extension.java | 34 +++- .../core/config/extensions/Extensions.java | 49 ------ .../config/extensions/ExtensionsConfig.java | 37 ----- .../mgt/core/config/extensions/Parameter.java | 11 +- .../config/extensions/ParameterAdapter.java | 50 ------ .../core/config/extensions/Parameters.java | 45 ------ .../mgt/core/dao/ApplicationDAO.java | 2 +- ...agementDAOFactory.java => DAOFactory.java} | 20 +-- ...cationManagementDAOUtil.java => Util.java} | 8 +- .../dao/impl/AbstractApplicationDAOImpl.java | 6 +- .../application/H2ApplicationDAOImpl.java | 12 +- .../application/MySQLApplicationDAOImpl.java | 14 +- .../ApplicationManagementDAOException.java | 2 +- .../mgt/core/exception/KeystoreException.java | 55 ------- .../impl/ApplicationManagerImpl.java | 8 +- .../impl/ApplicationReleaseManagerImpl.java | 2 +- .../ApplicationManagementDataHolder.java | 58 ------- ...ApplicationManagementServiceComponent.java | 82 ---------- .../mgt/core/internal/DataHolder.java | 146 ++++++++++++++++++ .../mgt/core/internal/ServiceComponent.java | 122 +++++++++++++++ .../ApplicationManagementServiceFactory.java | 80 ---------- .../core/util/ApplicationManagementUtil.java | 101 ++++++++---- .../mgt/core/util/ConnectionManagerUtil.java | 48 +----- ...onManagerConstants.java => Constants.java} | 2 +- .../src/test/resources/application-mgt.xml | 16 ++ .../appupload/AppUploadManager.java | 25 --- .../appupload/AppUploadManagerImpl.java | 9 +- .../pom.xml | 2 +- .../pom.xml | 5 + .../main/resources/conf/application-mgt.xml | 27 ++-- 65 files changed, 808 insertions(+), 1224 deletions(-) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java rename components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/{ApplicationManagementService.java => ApplicationUploadManager.java} (94%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/{ResourceTypeManager.java => VisibilityTypeManager.java} (90%) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/{ApplicationManagementConfigurations.java => Configurations.java} (55%) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/{ApplicationManagementDAOFactory.java => DAOFactory.java} (76%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/{ApplicationManagementDAOUtil.java => Util.java} (90%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/{dao/common => exception}/ApplicationManagementDAOException.java (94%) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/{services => }/impl/ApplicationManagerImpl.java (79%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/{services => }/impl/ApplicationReleaseManagerImpl.java (92%) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceFactory.java rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/{ApplicationManagerConstants.java => Constants.java} (96%) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java index 754907282a..c9dfbb057a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java @@ -23,7 +23,7 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.context.PrivilegedCarbonContext; import org.wso2.carbon.device.application.mgt.api.beans.ErrorResponse; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import javax.ws.rs.core.Response; @@ -35,24 +35,24 @@ public class APIUtil { private static Log log = LogFactory.getLog(APIUtil.class); - private static ApplicationManagementServiceFactory applicationManagementServiceFactory; + private static ApplicationManager applicationManager; - public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { - if (applicationManagementServiceFactory == null) { + public static ApplicationManager getApplicationManagemer() { + if (applicationManager == null) { synchronized (APIUtil.class) { - if (applicationManagementServiceFactory == null) { + if (applicationManager == null) { PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - applicationManagementServiceFactory = - (ApplicationManagementServiceFactory) ctx.getOSGiService(ApplicationManagementServiceFactory.class, null); - if (applicationManagementServiceFactory == null) { - String msg = "Application Management provider service has not initialized."; + applicationManager = + (ApplicationManager) ctx.getOSGiService(ApplicationManager.class, null); + if (applicationManager == null) { + String msg = "Application Manager service has not initialized."; log.error(msg); throw new IllegalStateException(msg); } } } } - return applicationManagementServiceFactory; + return applicationManager; } public static Response getResponse(ApplicationManagementException ex, Response.Status status) { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java deleted file mode 100644 index fc8d84d3e7..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/ApiOriginFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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.api; - -import javax.servlet.*; -import javax.servlet.http.HttpServletResponse; -import java.io.IOException; - -public class APIOriginFilter implements Filter { - - //TODO: check no config option. - public void doFilter(ServletRequest request, ServletResponse response, - FilterChain chain) throws IOException, ServletException { - HttpServletResponse res = (HttpServletResponse) response; - res.addHeader("Access-Control-Allow-Origin", "*"); - res.addHeader("Access-Control-Allow-Methods", "GET, POST, DELETE, PUT"); - res.addHeader("Access-Control-Allow-Headers", "Content-Type"); - chain.doFilter(request, response); - } - - public void destroy() { - //do nothing - } - - public void init(FilterConfig filterConfig) throws ServletException { - //do nothing - } - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java index 2a1407eeae..2f88b22306 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/JSONMessageHandler.java @@ -62,7 +62,7 @@ public class JSONMessageHandler implements MessageBodyWriter, MessageBod public Object readFrom(Class objectClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap stringStringMultivaluedMap, InputStream entityStream) throws IOException, WebApplicationException { - try (InputStreamReader reader = new InputStreamReader(entityStream, "UTF-8")) { + try (InputStreamReader reader = new InputStreamReader(entityStream, UTF_8)) { return getGson().fromJson(reader, type); } } @@ -78,7 +78,6 @@ public class JSONMessageHandler implements MessageBodyWriter, MessageBod public void writeTo(Object object, Class aClass, Type type, Annotation[] annotations, MediaType mediaType, MultivaluedMap stringObjectMultivaluedMap, OutputStream entityStream) throws IOException, WebApplicationException { - try (OutputStreamWriter writer = new OutputStreamWriter(entityStream, UTF_8)) { getGson().toJson(object, type, writer); } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java index e69f62c2ca..91599d539a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/beans/ErrorListItem.java @@ -50,7 +50,6 @@ public class ErrorListItem { this.message = msg; } - /** * Description about individual errors occurred */ 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/ApplicationManagementAPIImpl.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 index a02469577f..06e95af7b0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.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 @@ -25,15 +25,9 @@ import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.api.APIUtil; -import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; -import org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManager; - 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 ApplicationManagementAPIImpl { @@ -49,10 +43,8 @@ public class ApplicationManagementAPIImpl { @Consumes("application/json") @Path("applications") public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, - @QueryParam("q") String searchQuery) { - ApplicationManagementServiceFactory serviceFactory = APIUtil.getApplicationManagementServiceFactory(); - ApplicationManager applicationManager = (ApplicationManager) serviceFactory - .getApplicationManagementService(APPLICATION_MANAGER); + @QueryParam("query") String searchQuery) { + ApplicationManager applicationManager = APIUtil.getApplicationManagemer(); try { if (limit == 0) { limit = DEFAULT_LIMIT; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml index abcd6b3d1c..db708d84b9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/web.xml @@ -16,7 +16,9 @@ ~ specific language governing permissions and limitations ~ under the License. --> - + Application Management Webapp JAX-WS/JAX-RS Application Management Endpoint @@ -53,8 +55,20 @@ - ApiOriginFilter - org.wso2.carbon.device.application.mgt.api.APIOriginFilter + CorsFilter + org.apache.catalina.filters.CorsFilter + + cors.allowed.origins + * + + + cors.allowed.methods + GET,POST,DELETE,PUT + + + cors.allowed.headers + Content-Type + @@ -94,7 +108,8 @@ - ApiOriginFilter + CorsFilter /* + \ No newline at end of file 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 1cbdb02a3f..144f8231ed 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 @@ -50,10 +50,10 @@ public class Application { private List tags; - private List subscriptions; - private Platform platform; + private List comments; + private Category category; private Map properties; @@ -64,21 +64,49 @@ public class Application { private Date modifiedAt; - private LifecycleState lifecycleState; + private Payment payment; - private Date lifecycleStateModifiedAt; + private Lifecycle currentLifecycle; - private Date getLifecycleStateModifiedBy; + private List releases; - private boolean freeApp; + private Visibility visibility; - private String paymentCurrency; + public int getId() { + return id; + } - private Float paymentPrice; + public List getReleases() { + return releases; + } + public void setReleases(List releases) { + this.releases = releases; + } - public int getId() { - return id; + + public List getComments() { + return comments; + } + + public void setComments(List comments) { + this.comments = comments; + } + + public Payment getPayment() { + return payment; + } + + public void setPayment(Payment payment) { + this.payment = payment; + } + + public Lifecycle getCurrentLifecycle() { + return currentLifecycle; + } + + public void setCurrentLifecycle(Lifecycle currentLifecycle) { + this.currentLifecycle = currentLifecycle; } public void setId(int id) { @@ -165,14 +193,6 @@ public class Application { this.tags = tags; } - public List getSubscriptions() { - return subscriptions; - } - - public void setSubscriptions(List subscriptions) { - this.subscriptions = subscriptions; - } - public Platform getPlatform() { return platform; } @@ -221,51 +241,11 @@ public class Application { this.modifiedAt = modifiedAt; } - 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 Visibility getVisibility() { + return visibility; } - public void setPaymentPrice(Float paymentPrice) { - this.paymentPrice = paymentPrice; + public void setVisibility(Visibility visibility) { + this.visibility = visibility; } } 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 077feedb82..a1cedc9882 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 @@ -23,7 +23,7 @@ import java.util.Map; public class ApplicationRelease { - private enum ReleaseChannel { + private enum Channel { PRODUCTION, ALPHA, BETA } @@ -35,7 +35,7 @@ public class ApplicationRelease { private String resource; - private ReleaseChannel releaseChannel; + private Channel releaseChannel; private String releaseDetails; @@ -83,11 +83,11 @@ public class ApplicationRelease { this.resource = resource; } - public ReleaseChannel getReleaseChannel() { + public Channel getReleaseChannel() { return releaseChannel; } - public void setReleaseChannel(ReleaseChannel releaseChannel) { + public void setReleaseChannel(Channel releaseChannel) { this.releaseChannel = releaseChannel; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java deleted file mode 100644 index 9c07db63c1..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java +++ /dev/null @@ -1,65 +0,0 @@ -/* - * 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; - -import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; - -public class ApplicationType { - - @Exclude - private int id; - - private String name; - - private String code; - - private String parameters; - - public int getId() { - return id; - } - - public void setId(int id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getCode() { - return code; - } - - public void setCode(String code) { - this.code = code; - } - - public String getParameters() { - return parameters; - } - - public void setParameters(String parameters) { - this.parameters = parameters; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java index 80dc6162db..bde0883491 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java @@ -26,6 +26,7 @@ public class Comment { private int rating; + //TODO: Pagination, comment ID for child private Comment parent; private String createdBy; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java index 5a83306ea0..bfdb5d3ab0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java @@ -31,6 +31,7 @@ public class Filter { private int offset; + //TODO: private String filter; private List filterProperties; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java index 5dc2b907ff..f9dfece8d6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java @@ -18,6 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.common; +//TODO public class FilterProperty { public enum Operator { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java new file mode 100644 index 0000000000..c8901af5bc --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifeCycle.java @@ -0,0 +1,53 @@ +/* +* 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; + +import java.util.Date; + +public class Lifecycle { + + private LifecycleState lifecycleState; + + private Date lifecycleStateModifiedAt; + + private Date getLifecycleStateModifiedBy; + + 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; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java new file mode 100644 index 0000000000..8eabdef644 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java @@ -0,0 +1,50 @@ +/* +* 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; + +public class Payment { + private boolean freeApp; + + private String paymentCurrency; + + private Float paymentPrice; + + 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/Platform.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java index bffc570e97..27550b9ecc 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java @@ -21,6 +21,7 @@ package org.wso2.carbon.device.application.mgt.common; import org.wso2.carbon.device.application.mgt.common.jaxrs.Exclude; import java.util.List; +import java.util.Map; public class Platform { @@ -37,9 +38,7 @@ public class Platform { private List tags; - private String properties; - - private List applications; + private Map properties; public int getId() { return id; @@ -81,11 +80,11 @@ public class Platform { this.iconName = iconName; } - public String getProperties() { + public Map getProperties() { return properties; } - public void setProperties(String properties) { + public void setProperties(Map properties) { this.properties = properties; } @@ -96,12 +95,4 @@ public class Platform { public void setTags(List tags) { this.tags = tags; } - - public List getApplications() { - return applications; - } - - public void setApplications(List applications) { - this.applications = applications; - } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java deleted file mode 100644 index 2856f6160e..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java +++ /dev/null @@ -1,52 +0,0 @@ -/* - * 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; - -public class ResourceType { - - private String id; - - private String name; - - private String description; - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java index f4bba93000..75c3fc57fa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java @@ -22,7 +22,7 @@ import java.util.Date; public class Subscription { - private ResourceType type; + private Visibility.Type type; private String value; @@ -40,11 +40,11 @@ public class Subscription { this.value = value; } - public ResourceType getType() { + public Visibility.Type getType() { return type; } - public void setType(ResourceType type) { + public void setType(Visibility.Type type) { this.type = type; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java index 672ab62f52..20ea959353 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java @@ -18,11 +18,10 @@ */ package org.wso2.carbon.device.application.mgt.common; -import java.util.Date; - +//TODO: move to app public class Visibility { - private ResourceType type; + private Type type; private String value; @@ -38,11 +37,11 @@ public class Visibility { this.value = value; } - public ResourceType getType() { + public Type getType() { return type; } - public void setType(ResourceType type) { + public void setType(Type type) { this.type = type; } @@ -61,4 +60,37 @@ public class Visibility { public void setApplicationRelease(ApplicationRelease applicationRelease) { this.applicationRelease = applicationRelease; } + + public class Type { + + private String id; + + private String name; + + private String description; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java deleted file mode 100644 index df281eb991..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementExtension.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * 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; - -import java.util.List; -import java.util.Map; - -public abstract class ApplicationManagementExtension { - - private Map parameters; - - - public Map getParameters() { - return parameters; - } - - public void setParameters(Map parameters) { - this.parameters = parameters; - } -} 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 098b3cbe3b..ae1752b8d8 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.ApplicationManagementException; -public interface ApplicationManager extends ApplicationManagementService { +public interface ApplicationManager{ void createApplication(Application application) throws ApplicationManagementException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java index 43a870d8cc..00c5855b6d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ApplicationReleaseManager extends ApplicationManagementService { +public interface ApplicationReleaseManager{ } 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/ApplicationUploadManager.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationUploadManager.java index 9fe5fe9996..027a87dfbf 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/ApplicationUploadManager.java @@ -18,5 +18,6 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ApplicationManagementService { +public interface ApplicationUploadManager { + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java index 462db94f5d..4781299677 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface CategoryManager extends ApplicationManagementService { +public interface CategoryManager{ } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java index 031e3fcf85..02403a03a6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface CommentsManager extends ApplicationManagementService { +public interface CommentsManager{ } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java index cfc84506a4..36e772f7e8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java @@ -18,6 +18,6 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface LifecycleStateManager extends ApplicationManagementService { +public interface LifecycleStateManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java index e006ad5697..fb57b924a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface PlatformManager extends ApplicationManagementService { +public interface PlatformManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java index 371fa93695..1067c3bcb9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface SubscriptionManager extends ApplicationManagementService { +public interface SubscriptionManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java index e2febced23..c45fbe3c47 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java @@ -1,22 +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. - * - */ +* 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 VisibilityManager extends ApplicationManagementService { +public interface VisibilityManager { + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java similarity index 90% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java index 87bff5dcac..5584cbd8f4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ResourceTypeManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityTypeManager.java @@ -18,5 +18,5 @@ */ package org.wso2.carbon.device.application.mgt.common.services; -public interface ResourceTypeManager extends ApplicationManagementService { +public interface VisibilityTypeManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java deleted file mode 100644 index 5f740cab67..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationConfigurationManager.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.config; - -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagerConstants; -import org.wso2.carbon.utils.CarbonUtils; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.Unmarshaller; -import java.io.File; - -public class ApplicationConfigurationManager { - - private final String applicationMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator + - ApplicationManagerConstants.APPLICATION_CONFIG_XML_FILE; - - private static final Log log = LogFactory.getLog(ApplicationConfigurationManager.class); - - private ApplicationManagementConfigurations applicationManagerConfiguration; - - - private static ApplicationConfigurationManager applicationConfigurationManager; - - private ApplicationConfigurationManager() { - - } - - public static ApplicationConfigurationManager getInstance() { - if (applicationConfigurationManager == null) { - applicationConfigurationManager = new ApplicationConfigurationManager(); - try { - applicationConfigurationManager.initConfig(); - } catch (ApplicationManagementException e) { - log.error(e); - } - } - - return applicationConfigurationManager; - } - - - public synchronized void initConfig() throws ApplicationManagementException { - try { - File appMgtConfig = new File(applicationMgtConfigXMLPath); - Document doc = ApplicationManagementUtil.convertToDocument(appMgtConfig); - - /* Un-marshaling Certificate Management configuration */ - JAXBContext jaxbContext = JAXBContext.newInstance(ApplicationManagementConfigurations.class); - Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - this.applicationManagerConfiguration = (ApplicationManagementConfigurations) unmarshaller.unmarshal(doc); - } catch (Exception e) { - log.error(e); - throw new InvalidConfigurationException("Error occurred while initializing application config", e); - } - } - - public ApplicationManagementConfigurations getApplicationManagerConfiguration() { - return applicationManagerConfiguration; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java deleted file mode 100644 index 52f257fd74..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementRepository.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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.config; - - -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "ManagementRepository") -public class ApplicationManagementRepository { - - private DataSourceConfig dataSourceConfig; - - @XmlElement(name = "DataSourceConfiguration", required = true) - public DataSourceConfig getDataSourceConfig() { - return dataSourceConfig; - } - - public void setDataSourceConfig(DataSourceConfig dataSourceConfig) { - this.dataSourceConfig = dataSourceConfig; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java new file mode 100644 index 0000000000..f1502021d1 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java @@ -0,0 +1,90 @@ +/* + * 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.config; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; +import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; +import org.wso2.carbon.device.application.mgt.core.util.Constants; +import org.wso2.carbon.utils.CarbonUtils; + +import javax.xml.bind.JAXBContext; +import javax.xml.bind.Unmarshaller; +import java.io.File; + +public class ConfigurationManager { + + private final String applicationMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator + + Constants.APPLICATION_CONFIG_XML_FILE; + + private static final Log log = LogFactory.getLog(ConfigurationManager.class); + + private Configurations configuration; + + + private static ConfigurationManager configurationManager; + + private ConfigurationManager() { + + } + + public static ConfigurationManager getInstance() { + if (configurationManager == null) { + synchronized (ConfigurationManager.class) { + if (configurationManager == null) { + configurationManager = new ConfigurationManager(); + try { + configurationManager.initConfig(); + } catch (ApplicationManagementException e) { + log.error(e); + } + } + } + } + return configurationManager; + } + + + private void initConfig() throws ApplicationManagementException { + try { + JAXBContext jaxbContext = JAXBContext.newInstance(Configurations.class); + Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); + this.configuration = (Configurations) unmarshaller.unmarshal(new File(applicationMgtConfigXMLPath)); + } catch (Exception e) { + log.error(e); + throw new InvalidConfigurationException("Error occurred while initializing application config: " + + applicationMgtConfigXMLPath, e); + } + } + + public Configurations getConfiguration() { + return configuration; + } + + public Extension getExtension(Extension.Name extName) throws InvalidConfigurationException { + for (Extension extension : configuration.getExtensions()) { + if (extension.getName().contentEquals(extName.toString())) { + return extension; + } + } + throw new InvalidConfigurationException("Expecting an extension with name - " + extName + " , but not found!"); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java similarity index 55% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java index 58f103c2c8..1fa2d87fb7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ApplicationManagementConfigurations.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java @@ -18,33 +18,33 @@ */ package org.wso2.carbon.device.application.mgt.core.config; -import org.wso2.carbon.device.application.mgt.core.config.extensions.ExtensionsConfig; - +import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; +import java.util.List; -@XmlRootElement(name = "ApplicationManagementConfigurations") -public class ApplicationManagementConfigurations { +@XmlRootElement(name = "ApplicationManagementConfiguration") +public class Configurations { - private ApplicationManagementRepository applicationManagerRepository; + private String datasourceName; - private ExtensionsConfig extensionsConfig; + private List extensionsConfig; - @XmlElement(name = "ManagementRepository", required = true) - public ApplicationManagementRepository getApplicationManagerRepository() { - return applicationManagerRepository; + @XmlElement(name = "DatasourceName", required = true) + public String getDatasourceName() { + return datasourceName; } - public void setApplicationManagerRepository(ApplicationManagementRepository applicationManagerRepository) { - this.applicationManagerRepository = applicationManagerRepository; + public void setDatasourceName(String datasourceName) { + this.datasourceName = datasourceName; } - @XmlElement(name = "ExtensionsConfig", required = false) - public ExtensionsConfig getExtensionsConfig() { + @XmlElement(name = "Extensions", required = false) + public List getExtensions() { return extensionsConfig; } - public void setExtensionsConfig(ExtensionsConfig extensionsConfig) { + public void setExtensionsConfig(List extensionsConfig) { this.extensionsConfig = extensionsConfig; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java deleted file mode 100644 index 6b6d9ff3e1..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/DataSourceConfig.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - * Copyright (c) 2014, 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.config.datasource; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -/** - * Class for holding data source configuration in cdm-config.xml at parsing with JAXB - */ -@XmlRootElement(name = "DataSourceConfiguration") -public class DataSourceConfig { - - private JNDILookupDefinition jndiLookupDefinition; - - @XmlElement(name = "JndiLookupDefinition", nillable = true) - public JNDILookupDefinition getJndiLookupDefinition() { - return jndiLookupDefinition; - } - - public void setJndiLookupDefinition(JNDILookupDefinition jndiLookupDefinition) { - this.jndiLookupDefinition = jndiLookupDefinition; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java deleted file mode 100644 index 2ae8125c79..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/datasource/JNDILookupDefinition.java +++ /dev/null @@ -1,79 +0,0 @@ -/* - * Copyright (c) 2014, 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.config.datasource; - -import javax.xml.bind.annotation.*; -import java.util.List; - -/** - * Class for hold JndiLookupDefinition of cdm-config.xml at parsing with JAXB - */ -@XmlRootElement(name = "JndiLookupDefinition") -public class JNDILookupDefinition { - - private String jndiName; - private List jndiProperties; - - @XmlElement(name = "Name", nillable = false) - public String getJndiName() { - return jndiName; - } - - public void setJndiName(String jndiName) { - this.jndiName = jndiName; - } - - @XmlElementWrapper(name = "Environment", nillable = false) - @XmlElement(name = "Parameters", nillable = false) - public List getJndiProperties() { - return jndiProperties; - } - - public void setJndiProperties(List jndiProperties) { - this.jndiProperties = jndiProperties; - } - - @XmlRootElement(name = "Parameters") - public static class JNDIProperty { - - private String name; - - private String value; - - @XmlAttribute(name = "Name") - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - @XmlValue - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - } - -} - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java index 862f2130f8..5429b8beac 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java @@ -22,6 +22,7 @@ import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlElement; import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import java.util.List; import java.util.Map; @XmlRootElement(name = "Extension") @@ -31,7 +32,7 @@ public class Extension { private String className; - private Map parameters; + private List parameters; @XmlAttribute(name = "name") public String getName() { @@ -42,7 +43,7 @@ public class Extension { this.name = name; } - @XmlElement(name = "ClassName", nillable = true) + @XmlElement(name = "ClassName", nillable = false) public String getClassName() { return className; } @@ -52,12 +53,35 @@ public class Extension { } @XmlElement(name = "Parameters", nillable = true) - @XmlJavaTypeAdapter(ParameterAdapter.class) - public Map getParameters() { + public List getParameters() { return parameters; } - public void setParameters(Map parameters) { + public void setParameters(List parameters) { this.parameters = parameters; } + + public boolean equals(Object anotherObj){ + if (anotherObj instanceof Extension){ + Extension anExt = (Extension) anotherObj; + if (anExt.getName().contentEquals(this.getName())){ + return true; + } + } + return false; + } + + public enum Name { + ApplicationManager, + ApplicationReleaseManager, + ApplicationUploadManager, + CategoryManager, + CommentsManager, + LifecycleStateManager, + PlatformManager, + VisibilityTypeManager, + SubscriptionManager, + VisibilityManager + } } + diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java deleted file mode 100644 index e686e8b9b4..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extensions.java +++ /dev/null @@ -1,49 +0,0 @@ -/* - * 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.config.extensions; - -import javax.xml.bind.annotation.*; -import java.util.List; - -@XmlRootElement(name = "Extensions") -public class Extensions { - - private List extensions; - - - @XmlElement(name = "Extension") - public List getExtensions() { - return extensions; - } - - public void setExtensions(List extensions) { - this.extensions = extensions; - } - - public Extension getExtensionByName(String extensionName) { - if (extensions != null) { - for (Extension extension : extensions) { - if(extension.getName().equals(extensionName)) { - return extension; - } - } - } - 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/config/extensions/ExtensionsConfig.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java deleted file mode 100644 index 75be478f2e..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ExtensionsConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * 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.config.extensions; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "ExtensionsConfig") -public class ExtensionsConfig { - - private Extensions extensions; - - @XmlElement(name = "Extensions", nillable = true) - public Extensions getExtensions() { - return extensions; - } - - public void setExtensions(Extensions extensions) { - this.extensions = extensions; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java index db3d22b8d8..dbea52df57 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java @@ -19,23 +19,16 @@ package org.wso2.carbon.device.application.mgt.core.config.extensions; import javax.xml.bind.annotation.XmlAttribute; +import javax.xml.bind.annotation.XmlRootElement; import javax.xml.bind.annotation.XmlValue; +@XmlRootElement(name = "Parameter") public class Parameter { private String name; private String value; - Parameter(String name, String value) { - this.name = name; - this.value = value; - } - - Parameter(){ - - } - @XmlAttribute(name = "name") public String getName() { return name; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java deleted file mode 100644 index ff0a4b2ac3..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/ParameterAdapter.java +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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.config.extensions; - -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlTransient; -import javax.xml.bind.annotation.XmlValue; -import javax.xml.bind.annotation.adapters.XmlAdapter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -class ParameterAdapter extends XmlAdapter> { - - @Override - public Map unmarshal(Parameters in) throws Exception { - HashMap hashMap = new HashMap<>(); - for (Parameter parameter : in.getParameters()) { - hashMap.put(parameter.getName(), parameter.getValue()); - } - return hashMap; - } - - @Override - public Parameters marshal(Map map) throws Exception { - Parameters parameters = new Parameters(); - for (Map.Entry entry : map.entrySet()) { - parameters.addEntry(new Parameter(entry.getKey(), entry.getValue())); - } - return parameters; - } - -} \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java deleted file mode 100644 index 280b9d516d..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameters.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * 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.config.extensions; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -@XmlRootElement(name = "Parameters") -public class Parameters { - - private List parameters = new ArrayList<>();; - - @XmlElement(name = "Parameter", nillable = true) - public List getParameters() { - return parameters; - } - - public void setParameters(List parameters) { - this.parameters = parameters; - } - - void addEntry(Parameter parameter) { - parameters.add(parameter); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java index ae07f81c58..8a4652c7ce 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationDAO.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.core.dao; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; 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; 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/ApplicationManagementDAOFactory.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java similarity index 76% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java index c8eb610ae8..71c3e675fa 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOFactory.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/DAOFactory.java @@ -21,11 +21,10 @@ package org.wso2.carbon.device.application.mgt.core.dao.common; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.exception.UnsupportedDatabaseEngineException; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.dao.ApplicationDAO; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.H2ApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.dao.impl.application.MySQLApplicationDAOImpl; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagerConstants; +import org.wso2.carbon.device.application.mgt.core.util.Constants; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import javax.sql.DataSource; @@ -37,27 +36,22 @@ import javax.sql.DataSource; * different data sources, connection acquisition mechanisms as well as different forms of DAO implementations to the * high-level implementations that require Application management related metadata persistence. */ -public class ApplicationManagementDAOFactory { +public class DAOFactory { private static String databaseEngine; - private static final Log log = LogFactory.getLog(ApplicationManagementDAOFactory.class); + private static final Log log = LogFactory.getLog(DAOFactory.class); - public static void init(DataSourceConfig config) { - ConnectionManagerUtil.resolveDataSource(config); - databaseEngine = ConnectionManagerUtil.getDatabaseType(); - } - - public static void init(DataSource dtSource) { - ConnectionManagerUtil.setDataSource(dtSource); + public static void init(String datasourceName) { + ConnectionManagerUtil.resolveDataSource(datasourceName); databaseEngine = ConnectionManagerUtil.getDatabaseType(); } public static ApplicationDAO getApplicationDAO(){ if (databaseEngine != null) { switch (databaseEngine) { - case ApplicationManagerConstants.DataBaseTypes.DB_TYPE_H2: + case Constants.DataBaseTypes.DB_TYPE_H2: return new H2ApplicationDAOImpl(); - case ApplicationManagerConstants.DataBaseTypes.DB_TYPE_MYSQL: + case Constants.DataBaseTypes.DB_TYPE_MYSQL: return new MySQLApplicationDAOImpl(); default: throw new UnsupportedDatabaseEngineException("Unsupported database engine : " + databaseEngine); 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/ApplicationManagementDAOUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java similarity index 90% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java index bdb8d4d744..19cb7da13a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/Util.java @@ -25,19 +25,15 @@ import org.json.JSONException; import org.wso2.carbon.device.application.mgt.common.Application; import org.wso2.carbon.device.application.mgt.common.Platform; import org.wso2.carbon.device.application.mgt.common.Category; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.application.mgt.core.config.datasource.JNDILookupDefinition; -import javax.naming.InitialContext; -import javax.sql.DataSource; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; import java.util.*; -public class ApplicationManagementDAOUtil { +public class Util { - private static final Log log = LogFactory.getLog(ApplicationManagementDAOUtil.class); + private static final Log log = LogFactory.getLog(Util.class); public static Application loadApplication(ResultSet rs, ResultSet rsProperties, ResultSet rsTags) throws SQLException, JSONException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java index b30a8f0d9b..ebc06a5dae 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/AbstractApplicationDAOImpl.java @@ -24,8 +24,8 @@ 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.exception.DBConnectionException; 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.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import java.sql.Connection; @@ -100,7 +100,7 @@ public abstract class AbstractApplicationDAOImpl implements ApplicationDAO { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return count; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java index 06e40c5fe7..9d9816f0cb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/H2ApplicationDAOImpl.java @@ -26,8 +26,8 @@ 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.Pagination; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -110,9 +110,9 @@ public class H2ApplicationDAOImpl extends AbstractApplicationDAOImpl { stmt.setInt(1, rs.getInt("ID")); ResultSet rsTags = stmt.executeQuery(); - applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties, rsTags)); - ApplicationManagementDAOUtil.cleanupResources(null, rsProperties); - ApplicationManagementDAOUtil.cleanupResources(null, rsTags); + applications.add(Util.loadApplication(rs, rsProperties, rsTags)); + Util.cleanupResources(null, rsProperties); + Util.cleanupResources(null, rsTags); length++; } @@ -128,7 +128,7 @@ public class H2ApplicationDAOImpl extends AbstractApplicationDAOImpl { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return applicationList; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java index 7e6e5358f9..c0f5697f56 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/application/MySQLApplicationDAOImpl.java @@ -26,8 +26,8 @@ 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.Pagination; import org.wso2.carbon.device.application.mgt.common.exception.DBConnectionException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOException; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOUtil; +import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; +import org.wso2.carbon.device.application.mgt.core.dao.common.Util; import org.wso2.carbon.device.application.mgt.core.dao.impl.AbstractApplicationDAOImpl; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; @@ -95,7 +95,7 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { rs = stmt.executeQuery(); int length = 0; - sql = "SELECT FOUND_ROWS() AS COUNT;"; + sql = "SELECT FOUND_ROWS() AS COUNT;"; //TODO: from which tables???? stmt = conn.prepareStatement(sql); ResultSet rsCount = stmt.executeQuery(); if (rsCount.next()) { @@ -116,9 +116,9 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { stmt.setInt(1, rs.getInt("ID")); ResultSet rsTags = stmt.executeQuery(); - applications.add(ApplicationManagementDAOUtil.loadApplication(rs, rsProperties, rsTags)); - ApplicationManagementDAOUtil.cleanupResources(null, rsProperties); - ApplicationManagementDAOUtil.cleanupResources(null, rsTags); + applications.add(Util.loadApplication(rs, rsProperties, rsTags)); + Util.cleanupResources(null, rsProperties); + Util.cleanupResources(null, rsTags); length++; } @@ -134,7 +134,7 @@ public class MySQLApplicationDAOImpl extends AbstractApplicationDAOImpl { } catch (DBConnectionException e) { throw new ApplicationManagementDAOException("Error occurred while obtaining the DB connection.", e); } finally { - ApplicationManagementDAOUtil.cleanupResources(stmt, rs); + Util.cleanupResources(stmt, rs); } return applicationList; } 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/ApplicationManagementDAOException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java index fa9808c1a3..d951b84c9d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAOException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagementDAOException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.dao.common; +package org.wso2.carbon.device.application.mgt.core.exception; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java deleted file mode 100644 index 15e1aec5bf..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/KeystoreException.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2015, 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.exception; - -public class KeystoreException extends Exception { - - private static final long serialVersionUID = -8935640983869122660L; - private String errorMessage; - - public String getErrorMessage() { - return errorMessage; - } - - public void setErrorMessage(String errorMessage) { - this.errorMessage = errorMessage; - } - - public KeystoreException(String msg, Exception nestedEx) { - super(msg, nestedEx); - setErrorMessage(msg); - } - - public KeystoreException(String message, Throwable cause) { - super(message, cause); - setErrorMessage(message); - } - - public KeystoreException(String msg) { - super(msg); - setErrorMessage(msg); - } - - public KeystoreException() { - super(); - } - - public KeystoreException(Throwable cause) { - super(cause); - } -} 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/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java similarity index 79% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index 850d972f04..baa915ee9c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -16,17 +16,15 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services.impl; +package org.wso2.carbon.device.application.mgt.core.impl; 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.ApplicationManagementException; -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.dao.common.DAOFactory; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; public class ApplicationManagerImpl implements ApplicationManager { @@ -39,7 +37,7 @@ public class ApplicationManagerImpl implements ApplicationManager { public ApplicationList getApplications(Filter filter) throws ApplicationManagementException { try { ConnectionManagerUtil.openConnection(); - ApplicationDAO applicationDAO = ApplicationManagementDAOFactory.getApplicationDAO(); + ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO(); return applicationDAO.getApplications(filter); } finally { ConnectionManagerUtil.closeConnection(); 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/ApplicationReleaseManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java similarity index 92% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java index 622c6d516e..874164efee 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationReleaseManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationReleaseManagerImpl.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services.impl; +package org.wso2.carbon.device.application.mgt.core.impl; import org.wso2.carbon.device.application.mgt.common.services.ApplicationReleaseManager; 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 deleted file mode 100644 index 73fd21660c..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementDataHolder.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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.internal; - -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 ApplicationManagementServiceFactory applicationManagementServiceFactory; - - private static final ApplicationManagementDataHolder applicationMgtDataHolder = new ApplicationManagementDataHolder(); - - private ApplicationManagementDataHolder() { - - } - - public static ApplicationManagementDataHolder getInstance() { - return applicationMgtDataHolder; - } - - public DeviceManagementProviderService getDeviceManagementService() { - return deviceManagementService; - } - - public void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) { - this.deviceManagementService = deviceManagementService; - } - - public ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { - return applicationManagementServiceFactory; - } - - 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 deleted file mode 100644 index 552a74effe..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * 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.internal; - -import org.apache.commons.logging.Log; -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.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; -import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; - -import javax.naming.NamingException; - -/** - * @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true" - * @scr.reference name="org.wso2.carbon.device.manager" - * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" - * cardinality="1..1" - * policy="dynamic" - * bind="setDeviceManagementService" - * unbind="unsetDeviceManagementService" - */ -public class ApplicationManagementServiceComponent { - - private static Log log = LogFactory.getLog(ApplicationManagementServiceComponent.class); - - - protected void activate(ComponentContext componentContext) throws NamingException { - BundleContext bundleContext = componentContext.getBundleContext(); - ApplicationManagementServiceFactory serviceFactory = new ApplicationManagementServiceFactory(); - ApplicationManagementDataHolder.getInstance().setApplicationManagementServiceFactory(serviceFactory); - bundleContext.registerService(ApplicationManagementServiceFactory.class.getName(), serviceFactory, null); - - DataSourceConfig dataSourceConfig = ApplicationConfigurationManager.getInstance() - .getApplicationManagerConfiguration().getApplicationManagerRepository().getDataSourceConfig(); - ApplicationManagementDAOFactory.init(dataSourceConfig); - - log.info("ApplicationManagement core bundle has been successfully initialized"); - - if (log.isDebugEnabled()) { - log.debug("ApplicationManagement core bundle has been successfully initialized"); - } - } - - protected void deactivate(ComponentContext componentContext) { - //do nothing - } - - protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { - if (log.isDebugEnabled()) { - log.debug("Setting Application Management OSGI Manager"); - } - ApplicationManagementDataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService); - } - - protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { - if (log.isDebugEnabled()) { - log.debug("Removing Application Management OSGI Manager"); - } - ApplicationManagementDataHolder.getInstance().setDeviceManagementService(null); - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java new file mode 100644 index 0000000000..948c143220 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java @@ -0,0 +1,146 @@ +/* + * 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.internal; + +import org.wso2.carbon.device.application.mgt.common.services.*; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; + +public class DataHolder { + //TODO move the osgi classes here. + + private DeviceManagementProviderService deviceManagementService; + + private ApplicationManager applicationManager; + + private ApplicationReleaseManager releaseManager; + + private CategoryManager categoryManager; + + private CommentsManager commentsManager; + + private LifecycleStateManager lifecycleStateManager; + + private PlatformManager platformManager; + + private VisibilityTypeManager visibilityTypeManager; + + private SubscriptionManager subscriptionManager; + + private VisibilityManager visibilityManager; + + private ApplicationUploadManager applicationUploadManager; + + private static final DataHolder applicationMgtDataHolder = new DataHolder(); + + private DataHolder() { + + } + + public static DataHolder getInstance() { + return applicationMgtDataHolder; + } + + public DeviceManagementProviderService getDeviceManagementService() { + return deviceManagementService; + } + + public void setDeviceManagementService(DeviceManagementProviderService deviceManagementService) { + this.deviceManagementService = deviceManagementService; + } + + public static DataHolder getApplicationMgtDataHolder() { + return applicationMgtDataHolder; + } + + public ApplicationManager getApplicationManager() { + return applicationManager; + } + + public void setApplicationManager(ApplicationManager applicationManager) { + this.applicationManager = applicationManager; + } + + public ApplicationReleaseManager getReleaseManager() { + return releaseManager; + } + + public void setReleaseManager(ApplicationReleaseManager releaseManager) { + this.releaseManager = releaseManager; + } + + public CategoryManager getCategoryManager() { + return categoryManager; + } + + public void setCategoryManager(CategoryManager categoryManager) { + this.categoryManager = categoryManager; + } + + public CommentsManager getCommentsManager() { + return commentsManager; + } + + public void setCommentsManager(CommentsManager commentsManager) { + this.commentsManager = commentsManager; + } + + public LifecycleStateManager getLifecycleStateManager() { + return lifecycleStateManager; + } + + public void setLifecycleStateManager(LifecycleStateManager lifecycleStateManager) { + this.lifecycleStateManager = lifecycleStateManager; + } + + public PlatformManager getPlatformManager() { + return platformManager; + } + + public void setPlatformManager(PlatformManager platformManager) { + this.platformManager = platformManager; + } + + public VisibilityTypeManager getVisibilityTypeManager() { + return visibilityTypeManager; + } + + public void setVisibilityTypeManager(VisibilityTypeManager visibilityTypeManager) { + this.visibilityTypeManager = visibilityTypeManager; + } + + public SubscriptionManager getSubscriptionManager() { + return subscriptionManager; + } + + public void setSubscriptionManager(SubscriptionManager subscriptionManager) { + this.subscriptionManager = subscriptionManager; + } + + public VisibilityManager getVisibilityManager() { + return visibilityManager; + } + + public void setVisibilityManager(VisibilityManager visibilityManager) { + this.visibilityManager = visibilityManager; + } + + public void setApplicationUploadManager(ApplicationUploadManager applicationUploadManager) { + this.applicationUploadManager = applicationUploadManager; + } +} 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/ServiceComponent.java new file mode 100644 index 0000000000..11a9957aa9 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ServiceComponent.java @@ -0,0 +1,122 @@ +/* + * 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.internal; + +import org.apache.commons.logging.Log; +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.exception.InvalidConfigurationException; +import org.wso2.carbon.device.application.mgt.common.services.*; +import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; +import org.wso2.carbon.device.application.mgt.core.dao.common.DAOFactory; +import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; +import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; + +import javax.naming.NamingException; + +/** + * @scr.component name="org.wso2.carbon.application.mgt.service" immediate="true" + * @scr.reference name="org.wso2.carbon.device.manager" + * interface="org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService" + * cardinality="1..1" + * policy="dynamic" + * bind="setDeviceManagementService" + * unbind="unsetDeviceManagementService" + */ +public class ServiceComponent { + + private static Log log = LogFactory.getLog(ServiceComponent.class); + + + protected void activate(ComponentContext componentContext) throws NamingException { + BundleContext bundleContext = componentContext.getBundleContext(); + try { + String datasourceName = ConfigurationManager.getInstance() + .getConfiguration().getDatasourceName(); + DAOFactory.init(datasourceName); + + ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagerInstance(); + DataHolder.getInstance().setApplicationManager(applicationManager); + bundleContext.registerService(ApplicationManager.class.getName(), applicationManager, null); + + ApplicationReleaseManager applicationReleaseManager = ApplicationManagementUtil.getApplicationReleaseManagerInstance(); + DataHolder.getInstance().setReleaseManager(applicationReleaseManager); + bundleContext.registerService(ApplicationReleaseManager.class.getName(), applicationReleaseManager, null); + + CategoryManager categoryManager = ApplicationManagementUtil.getCategoryManagerInstance(); + DataHolder.getInstance().setCategoryManager(categoryManager); + bundleContext.registerService(CategoryManager.class.getName(), categoryManager, null); + + CommentsManager commentsManager = ApplicationManagementUtil.getCommentsManagerInstance(); + DataHolder.getInstance().setCommentsManager(commentsManager); + bundleContext.registerService(CommentsManager.class.getName(), commentsManager, null); + + LifecycleStateManager lifecycleStateManager = ApplicationManagementUtil.getLifecycleStateManagerInstance(); + DataHolder.getInstance().setLifecycleStateManager(lifecycleStateManager); + bundleContext.registerService(LifecycleStateManager.class.getName(), lifecycleStateManager, null); + + PlatformManager platformManager = ApplicationManagementUtil.getPlatformManagerInstance(); + DataHolder.getInstance().setPlatformManager(platformManager); + bundleContext.registerService(PlatformManager.class.getName(), platformManager, null); + + SubscriptionManager subscriptionManager = ApplicationManagementUtil.getSubscriptionManagerInstance(); + DataHolder.getInstance().setSubscriptionManager(subscriptionManager); + bundleContext.registerService(SubscriptionManager.class.getName(), subscriptionManager, null); + + VisibilityManager visibilityManager = ApplicationManagementUtil.getVisibilityManagerInstance(); + DataHolder.getInstance().setVisibilityManager(visibilityManager); + bundleContext.registerService(VisibilityManager.class.getName(), visibilityManager, null); + + VisibilityTypeManager visibilityTypeManager = ApplicationManagementUtil.getVisibilityTypeManagerInstance(); + DataHolder.getInstance().setVisibilityTypeManager(visibilityTypeManager); + bundleContext.registerService(VisibilityTypeManager.class.getName(), visibilityTypeManager, null); + + ApplicationUploadManager uploadManager = ApplicationManagementUtil.getApplicationUploadManagerInstance(); + DataHolder.getInstance().setApplicationUploadManager(uploadManager); + bundleContext.registerService(ApplicationUploadManager.class.getName(), uploadManager, null); + + log.info("ApplicationManagement core bundle has been successfully initialized"); + + if (log.isDebugEnabled()) { + log.debug("ApplicationManagement core bundle has been successfully initialized"); + } + } catch (InvalidConfigurationException e) { + log.error("Error while activating Application Management core component. ", e); + } + } + + protected void deactivate(ComponentContext componentContext) { + //do nothing + } + + protected void setDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { + if (log.isDebugEnabled()) { + log.debug("Setting Application Management OSGI Manager"); + } + DataHolder.getInstance().setDeviceManagementService(deviceManagementProviderService); + } + + protected void unsetDeviceManagementService(DeviceManagementProviderService deviceManagementProviderService) { + if (log.isDebugEnabled()) { + log.debug("Removing Application Management OSGI Manager"); + } + DataHolder.getInstance().setDeviceManagementService(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/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 deleted file mode 100644 index 6715fab117..0000000000 --- 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 +++ /dev/null @@ -1,80 +0,0 @@ -/* - * 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.services.*; -import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager; -import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; -import org.wso2.carbon.device.application.mgt.core.config.extensions.ExtensionsConfig; - -public class ApplicationManagementServiceFactory { - - private static Log log = LogFactory.getLog(ApplicationManagementServiceFactory.class); - - public enum ManagerService { - APPLICATION_MANAGER, - APPLICATION_RELEASE_MANAGER, - CATEGORY_MANAGER, - COMMENTS_MANAGER, - LIFECYCLE_STATE_MANAGER, - PLATFORM_MANAGER, - RESOURCE_TYPE_MANAGER, - SUBSCRIPTION_MANAGER, - VISIBILITY_MANAGER - } - - public ApplicationManagementService getApplicationManagementService(ManagerService managerService) { - switch (managerService) { - case APPLICATION_MANAGER: - return new ApplicationManagerImpl(); - case APPLICATION_RELEASE_MANAGER: - return new ApplicationReleaseManagerImpl(); - default: - return null; - } - } - - public ApplicationManagementExtension applicationManagementExtensionsService(String extensionName) { - ApplicationConfigurationManager applicationConfigurationManager = ApplicationConfigurationManager.getInstance(); - - ExtensionsConfig extensionConfig = applicationConfigurationManager - .getApplicationManagerConfiguration().getExtensionsConfig(); - - Extension extension = extensionConfig.getExtensions().getExtensionByName(extensionName); - - try { - Class theClass = Class.forName(extension.getClassName()); - ApplicationManagementExtension appManagementExtension = (ApplicationManagementExtension) theClass.newInstance(); - appManagementExtension.setParameters(extension.getParameters()); - return appManagementExtension; - } catch (ClassNotFoundException e) { - log.error("Class not Found", e); - } catch (IllegalAccessException e) { - log.error("Illegal Access of Class", e); - } catch (InstantiationException e) { - log.error("Class instantiation exception", e); - } - - - 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/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 1afe85092a..842958ffb1 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 @@ -20,43 +20,90 @@ package org.wso2.carbon.device.application.mgt.core.util; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.w3c.dom.Document; -import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; -import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceFactory; - -import javax.xml.XMLConstants; -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import java.io.File; +import org.wso2.carbon.device.application.mgt.common.services.*; +import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; +import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; +import java.lang.reflect.Constructor; public class ApplicationManagementUtil { private static Log log = LogFactory.getLog(ApplicationManagementUtil.class); - public static ApplicationManagementServiceFactory getApplicationManagementServiceFactory() { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - 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 applicationManagerServiceFactory; + public static ApplicationManager getApplicationManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationManager); + return getInstance(extension, ApplicationManager.class); + } + + public static ApplicationReleaseManager getApplicationReleaseManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationReleaseManager); + return getInstance(extension, ApplicationReleaseManager.class); + } + + public static CategoryManager getCategoryManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.CategoryManager); + return getInstance(extension, CategoryManager.class); + } + + public static CommentsManager getCommentsManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.CommentsManager); + return getInstance(extension, CommentsManager.class); + } + + public static LifecycleStateManager getLifecycleStateManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.LifecycleStateManager); + return getInstance(extension, LifecycleStateManager.class); + } + + public static PlatformManager getPlatformManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.PlatformManager); + return getInstance(extension, PlatformManager.class); + } + + public static VisibilityTypeManager getVisibilityTypeManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.VisibilityTypeManager); + return getInstance(extension, VisibilityTypeManager.class); + } + + public static VisibilityManager getVisibilityManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.VisibilityManager); + return getInstance(extension, VisibilityManager.class); + } + + public static SubscriptionManager getSubscriptionManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.SubscriptionManager); + return getInstance(extension, SubscriptionManager.class); + } + + public static ApplicationUploadManager getApplicationUploadManagerInstance() throws InvalidConfigurationException { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Extension extension = configurationManager.getExtension(Extension.Name.ApplicationUploadManager); + return getInstance(extension, ApplicationUploadManager.class); } - public static Document convertToDocument(File file) throws ApplicationManagementException { - DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); - factory.setNamespaceAware(true); + private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException { try { - DocumentBuilder docBuilder = factory.newDocumentBuilder(); - factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true); - return docBuilder.parse(file); + Class theClass = Class.forName(extension.getClassName()); + Class[] types = new Class[extension.getParameters().size()]; + Object[] paramValues = new String[extension.getParameters().size()]; + for (int i = 0; i < extension.getParameters().size(); i++) { + types[i] = String.class; + paramValues[i] = extension.getParameters().get(i).getValue(); + } + Constructor constructor = theClass.getConstructor(types); + return constructor.newInstance(paramValues); } catch (Exception e) { - throw new InvalidConfigurationException("Error occurred while parsing file, while converting " + - "to a org.w3c.dom.Document : ", e); + throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName() + + " , for class - " + extension.getClassName(), 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/ConnectionManagerUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java index 61aad433c7..b7c7d4830b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ConnectionManagerUtil.java @@ -23,15 +23,11 @@ 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.IllegalTransactionStateException; import org.wso2.carbon.device.application.mgt.common.exception.TransactionManagementException; -import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; -import org.wso2.carbon.device.application.mgt.core.config.datasource.JNDILookupDefinition; import javax.naming.InitialContext; import javax.sql.DataSource; import java.sql.Connection; import java.sql.SQLException; -import java.util.Hashtable; -import java.util.List; public class ConnectionManagerUtil { @@ -45,10 +41,6 @@ public class ConnectionManagerUtil { private static ThreadLocal currentTxState = new ThreadLocal<>(); private static DataSource dataSource; - public static void setDataSource(DataSource dataSource) { - ConnectionManagerUtil.dataSource = dataSource; - } - public static ThreadLocal getCurrentConnection() { return currentConnection; } @@ -168,49 +160,17 @@ public class ConnectionManagerUtil { /** * Resolve data source from the data source definition. * - * @param config data source configuration - * + * @param dataSourceName data source name */ - public static void resolveDataSource(DataSourceConfig config) { - if (config == null) { - throw new RuntimeException( - "Application Management Repository data source configuration " + "is null and " + - "thus, is not initialized" - ); - } - JNDILookupDefinition jndiConfig = config.getJndiLookupDefinition(); - if (jndiConfig != null) { - if (log.isDebugEnabled()) { - log.debug("Initializing Application Management Repository data source using the JNDI " + - "Lookup Definition"); - } - List jndiPropertyList = - jndiConfig.getJndiProperties(); - if (jndiPropertyList != null) { - Hashtable jndiProperties = new Hashtable(); - for (JNDILookupDefinition.JNDIProperty prop : jndiPropertyList) { - jndiProperties.put(prop.getName(), prop.getValue()); - } - dataSource = lookupDataSource(jndiConfig.getJndiName(), jndiProperties); - } else { - dataSource = lookupDataSource(jndiConfig.getJndiName(), null); - } - } - } - - - public static DataSource lookupDataSource(String dataSourceName, final Hashtable jndiProperties) { + public static void resolveDataSource(String dataSourceName) { try { - if (jndiProperties == null || jndiProperties.isEmpty()) { - return (DataSource) InitialContext.doLookup(dataSourceName); - } - final InitialContext context = new InitialContext(jndiProperties); - return (DataSource) context.doLookup(dataSourceName); + dataSource = InitialContext.doLookup(dataSourceName); } catch (Exception e) { throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e); } } + public static String getDatabaseType() { try { return dataSource.getConnection().getMetaData().getDatabaseProductName(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java similarity index 96% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java index 053b3f8e96..27f3e763d9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagerConstants.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.core.util; -public class ApplicationManagerConstants { +public class Constants { public static final String APPLICATION_CONFIG_XML_FILE = "application-mgt.xml"; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml new file mode 100644 index 0000000000..eec845ef7e --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml @@ -0,0 +1,16 @@ + + + + + jdbc/APPM_DS + + + + org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl + + repository/resources/mobileapps + + + + + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java deleted file mode 100644 index c813a6af12..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManager.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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.appupload; - -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; - -public interface AppUploadManager { - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java index cd935e95d8..51fcbfaff6 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java @@ -18,8 +18,13 @@ */ package org.wso2.carbon.device.application.mgt.extensions.appupload; -import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementExtension; -public class AppUploadManagerImpl extends ApplicationManagementExtension implements AppUploadManager { +import org.wso2.carbon.device.application.mgt.common.services.ApplicationUploadManager; + +public class AppUploadManagerImpl implements ApplicationUploadManager { + + public AppUploadManagerImpl(String a, String b){ + //do a + } } 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 index 286d01f0c0..3aceaea044 100644 --- 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 @@ -80,7 +80,7 @@ p2-feature-gen - org.wso2.carbon.device.application.mgt.extensions + org.wso2.carbon.device.application.mgt.extensions.feature ../../../features/etc/feature.properties 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 d96620cf59..b39dededb9 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 @@ -49,6 +49,11 @@ org.wso2.carbon.device.application.mgt.api.feature zip + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.extensions.feature + zip + 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 539b5af3d5..bc148ab0d8 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 @@ -2,24 +2,15 @@ - - - - jdbc/APPM_DS - - - + jdbc/APPM_DS - - - - - org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl - - repository/resources/mobileapps - - - - + + + org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl + + repository/resources/mobileapps + + + \ No newline at end of file From fd18ab711cba14ae24479efd1c93bc9b726ca831 Mon Sep 17 00:00:00 2001 From: sinthuja Date: Wed, 31 May 2017 16:03:37 +0530 Subject: [PATCH 2/3] Fixing issues in resolving the configuration resolving. --- .../pom.xml | 23 ++++---- ...Configurations.java => Configuration.java} | 17 +++--- .../mgt/core/config/ConfigurationManager.java | 26 ++++++---- .../config/{extensions => }/Extension.java | 19 +++---- .../config/{extensions => }/Parameter.java | 2 +- .../impl/ApplicationUploadManagerImpl.java} | 9 ++-- .../mgt/core/impl/CategoryManagerImpl.java | 23 ++++++++ .../mgt/core/impl/CommentsManagerImpl.java | 23 ++++++++ .../core/impl/LifecycleStateManagerImpl.java | 23 ++++++++ .../mgt/core/impl/PlatformManagerImpl.java | 23 ++++++++ .../core/impl/SubscriptionManagerImpl.java | 23 ++++++++ .../mgt/core/impl/VisibilityManagerImpl.java | 23 ++++++++ .../core/impl/VisibilityTypeManagerImpl.java | 23 ++++++++ .../core/util/ApplicationManagementUtil.java | 22 +++++--- .../application/mgt/core/util/Constants.java | 10 +++- .../ConfigurationTest.java | 41 +++++++++++++++ .../src/test/resources/application-mgt.xml | 49 ++++++++++++++++- components/application-mgt/pom.xml | 3 +- .../main/resources/conf/application-mgt.xml | 52 +++++++++++++++++-- .../application-mgt-datasources.xml | 2 +- 20 files changed, 371 insertions(+), 65 deletions(-) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/{Configurations.java => Configuration.java} (75%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/{extensions => }/Extension.java (76%) rename components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/{extensions => }/Parameter.java (94%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java => org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java} (79%) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java 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 1f5bee530d..f40fb22813 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 @@ -80,19 +80,11 @@ - - org.apache.maven.plugins - maven-surefire-plugin - 2.18 - - - file:src/test/resources/log4j.properties - - - src/test/resources/testng.xml - - - + + + + + @@ -114,6 +106,11 @@ org.testng testng + + junit + junit + test + org.wso2.carbon org.wso2.carbon.logging diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java similarity index 75% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java index 1fa2d87fb7..b41501c7a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configurations.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Configuration.java @@ -18,17 +18,19 @@ */ package org.wso2.carbon.device.application.mgt.core.config; -import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; + import javax.xml.bind.annotation.XmlElement; +import javax.xml.bind.annotation.XmlElementWrapper; import javax.xml.bind.annotation.XmlRootElement; import java.util.List; @XmlRootElement(name = "ApplicationManagementConfiguration") -public class Configurations { +public class Configuration { private String datasourceName; - private List extensionsConfig; + private List extensions; @XmlElement(name = "DatasourceName", required = true) public String getDatasourceName() { @@ -39,13 +41,14 @@ public class Configurations { this.datasourceName = datasourceName; } - @XmlElement(name = "Extensions", required = false) + @XmlElementWrapper(name = "Extensions") + @XmlElement(name = "Extension") public List getExtensions() { - return extensionsConfig; + return extensions; } - public void setExtensionsConfig(List extensionsConfig) { - this.extensionsConfig = extensionsConfig; + public void setExtensions(List extensions) { + this.extensions = extensions; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java index f1502021d1..d81240e573 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/ConfigurationManager.java @@ -22,9 +22,7 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; -import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; import org.wso2.carbon.device.application.mgt.core.util.Constants; -import org.wso2.carbon.utils.CarbonUtils; import javax.xml.bind.JAXBContext; import javax.xml.bind.Unmarshaller; @@ -32,13 +30,11 @@ import java.io.File; public class ConfigurationManager { - private final String applicationMgtConfigXMLPath = CarbonUtils.getCarbonConfigDirPath() + File.separator + - Constants.APPLICATION_CONFIG_XML_FILE; - private static final Log log = LogFactory.getLog(ConfigurationManager.class); - private Configurations configuration; + private Configuration configuration; + private static String configPath; private static ConfigurationManager configurationManager; @@ -62,20 +58,30 @@ public class ConfigurationManager { return configurationManager; } + public static synchronized void setConfigLocation(String configPath) throws InvalidConfigurationException { + if (ConfigurationManager.configPath == null) { + ConfigurationManager.configPath = configPath; + } else { + throw new InvalidConfigurationException("Configuration path " + configPath + " is already defined"); + } + } private void initConfig() throws ApplicationManagementException { try { - JAXBContext jaxbContext = JAXBContext.newInstance(Configurations.class); + JAXBContext jaxbContext = JAXBContext.newInstance(Configuration.class); Unmarshaller unmarshaller = jaxbContext.createUnmarshaller(); - this.configuration = (Configurations) unmarshaller.unmarshal(new File(applicationMgtConfigXMLPath)); + if (configPath == null) { + configPath = Constants.DEFAULT_CONFIG_FILE_LOCATION; + } + this.configuration = (Configuration) unmarshaller.unmarshal(new File(configPath)); } catch (Exception e) { log.error(e); throw new InvalidConfigurationException("Error occurred while initializing application config: " - + applicationMgtConfigXMLPath, e); + + configPath, e); } } - public Configurations getConfiguration() { + public Configuration getConfiguration() { return configuration; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/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 similarity index 76% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Extension.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Extension.java index 5429b8beac..dc49eb60ba 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/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 @@ -16,14 +16,10 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.config.extensions; +package org.wso2.carbon.device.application.mgt.core.config; -import javax.xml.bind.annotation.XmlAttribute; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; -import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter; +import javax.xml.bind.annotation.*; import java.util.List; -import java.util.Map; @XmlRootElement(name = "Extension") public class Extension { @@ -43,7 +39,7 @@ public class Extension { this.name = name; } - @XmlElement(name = "ClassName", nillable = false) + @XmlElement(name = "ClassName") public String getClassName() { return className; } @@ -52,7 +48,8 @@ public class Extension { this.className = className; } - @XmlElement(name = "Parameters", nillable = true) + @XmlElementWrapper(name = "Parameters") + @XmlElement(name = "Parameter") public List getParameters() { return parameters; } @@ -61,10 +58,10 @@ public class Extension { this.parameters = parameters; } - public boolean equals(Object anotherObj){ - if (anotherObj instanceof Extension){ + public boolean equals(Object anotherObj) { + if (anotherObj instanceof Extension) { Extension anExt = (Extension) anotherObj; - if (anExt.getName().contentEquals(this.getName())){ + if (anExt.getName().contentEquals(this.getName())) { return true; } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java similarity index 94% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java index dbea52df57..12283e46a0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/extensions/Parameter.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/config/Parameter.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.config.extensions; +package org.wso2.carbon.device.application.mgt.core.config; import javax.xml.bind.annotation.XmlAttribute; import javax.xml.bind.annotation.XmlRootElement; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java similarity index 79% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java index 51fcbfaff6..38b908c00d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.extensions/src/main/java/org/wso2/carbon/device/application/mgt/extensions/appupload/AppUploadManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationUploadManagerImpl.java @@ -16,15 +16,14 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.extensions.appupload; +package org.wso2.carbon.device.application.mgt.core.impl; import org.wso2.carbon.device.application.mgt.common.services.ApplicationUploadManager; -public class AppUploadManagerImpl implements ApplicationUploadManager { +public class ApplicationUploadManagerImpl implements ApplicationUploadManager { - public AppUploadManagerImpl(String a, String b){ - //do a - } + public ApplicationUploadManagerImpl(String uploadPath){ + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java new file mode 100644 index 0000000000..e245186b1a --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.CategoryManager; + +public class CategoryManagerImpl implements CategoryManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.java new file mode 100644 index 0000000000..fbecc5a7eb --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CommentsManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.CommentsManager; + +public class CommentsManagerImpl implements CommentsManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.java new file mode 100644 index 0000000000..2c71738f40 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/LifecycleStateManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.LifecycleStateManager; + +public class LifecycleStateManagerImpl implements LifecycleStateManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.java new file mode 100644 index 0000000000..52c302fde6 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/PlatformManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.PlatformManager; + +public class PlatformManagerImpl implements PlatformManager { +} 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 new file mode 100644 index 0000000000..d0f3433fb6 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/SubscriptionManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; + +public class SubscriptionManagerImpl implements SubscriptionManager { +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.java new file mode 100644 index 0000000000..315d3c6122 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.VisibilityManager; + +public class VisibilityManagerImpl implements VisibilityManager{ +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.java new file mode 100644 index 0000000000..5396a67000 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/VisibilityTypeManagerImpl.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.core.impl; + +import org.wso2.carbon.device.application.mgt.common.services.VisibilityTypeManager; + +public class VisibilityTypeManagerImpl implements VisibilityTypeManager { +} 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 842958ffb1..070e57f1c8 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,7 +23,8 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; import org.wso2.carbon.device.application.mgt.common.services.*; import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; -import org.wso2.carbon.device.application.mgt.core.config.extensions.Extension; +import org.wso2.carbon.device.application.mgt.core.config.Extension; + import java.lang.reflect.Constructor; public class ApplicationManagementUtil { @@ -90,17 +91,22 @@ public class ApplicationManagementUtil { return getInstance(extension, ApplicationUploadManager.class); } - private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException { + private static T getInstance(Extension extension, Class cls) throws InvalidConfigurationException { try { - Class theClass = Class.forName(extension.getClassName()); + Class theClass = Class.forName(extension.getClassName()); Class[] types = new Class[extension.getParameters().size()]; Object[] paramValues = new String[extension.getParameters().size()]; - for (int i = 0; i < extension.getParameters().size(); i++) { - types[i] = String.class; - paramValues[i] = extension.getParameters().get(i).getValue(); + if (extension.getParameters() != null && extension.getParameters().size() > 0) { + for (int i = 0; i < extension.getParameters().size(); i++) { + types[i] = String.class; + paramValues[i] = extension.getParameters().get(i).getValue(); + } + Constructor constructor = theClass.getConstructor(types); + return constructor.newInstance(paramValues); + } else { + Constructor constructor = theClass.getConstructor(types); + return constructor.newInstance(); } - Constructor constructor = theClass.getConstructor(types); - return constructor.newInstance(paramValues); } catch (Exception e) { throw new InvalidConfigurationException("Unable to get instance of extension - " + extension.getName() + " , for class - " + extension.getClassName(), 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/Constants.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java index 27f3e763d9..6ed1fe951a 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/Constants.java @@ -18,14 +18,22 @@ */ package org.wso2.carbon.device.application.mgt.core.util; +import org.wso2.carbon.utils.CarbonUtils; + +import java.io.File; + public class Constants { public static final String APPLICATION_CONFIG_XML_FILE = "application-mgt.xml"; + public static final String DEFAULT_CONFIG_FILE_LOCATION = CarbonUtils.getCarbonConfigDirPath() + File.separator + + Constants.APPLICATION_CONFIG_XML_FILE; + public static final class DataBaseTypes { + private DataBaseTypes() { - throw new AssertionError(); } + public static final String DB_TYPE_MYSQL = "MySQL"; public static final String DB_TYPE_ORACLE = "Oracle"; public static final String DB_TYPE_MSSQL = "Microsoft SQL Server"; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java new file mode 100644 index 0000000000..4040237b07 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/java/org.wso2.carbon.device.application.mgt.core/ConfigurationTest.java @@ -0,0 +1,41 @@ +/* +* 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; + +import org.junit.BeforeClass; +import org.junit.Test; +import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; +import org.wso2.carbon.device.application.mgt.core.config.Configuration; +import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; + +import java.io.File; + +public class ConfigurationTest { + + @BeforeClass + public static void init() throws InvalidConfigurationException { + File configPath = new File("src/test/resources/application-mgt.xml"); + ConfigurationManager.setConfigLocation(configPath.getAbsolutePath()); + } + + @Test + public void validateConfiguration() { + ConfigurationManager configurationManager = ConfigurationManager.getInstance(); + Configuration configuration = configurationManager.getConfiguration(); + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml index eec845ef7e..c2cac41857 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml @@ -1,16 +1,61 @@ + + jdbc/APPM_DS - - org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl repository/resources/mobileapps + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl + + + 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.LifecycleStateManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl + \ No newline at end of file diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index 478fd3f5df..043f32a694 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -28,7 +28,6 @@ 4.0.0 application-mgt - org.wso2.carbon.devicemgt pom WSO2 Carbon - Application Management Component WSO2 Carbon - Application Management Component @@ -39,7 +38,7 @@ 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.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 bc148ab0d8..fd99ffe3de 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 @@ -1,16 +1,60 @@ - + + jdbc/APPM_DS - - org.wso2.carbon.device.application.mgt.extensions.appupload.AppUploadManagerImpl + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl repository/resources/mobileapps + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl + + + 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.LifecycleStateManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityManagerImpl + + + org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl + - \ No newline at end of file + \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml index e773738c3b..7038d24c55 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/datasources/application-mgt-datasources.xml @@ -1,5 +1,5 @@ org.wso2.carbon.device.application.mgt.server.feature \ No newline at end of file