From 5361ad20252cdd0253148cccdb425a5c747de979 Mon Sep 17 00:00:00 2001 From: Harshan Liyanage Date: Tue, 16 May 2017 15:20:08 +0530 Subject: [PATCH] Refactored Application-Mgt code. --- .../pom.xml | 91 +------- ...n.java => ApplicationMgtAPIException.java} | 14 +- .../mgt/api/common/ErrorHandler.java | 4 +- .../api/common/GsonMessageBodyHandler.java | 2 +- .../ApplicationManagementServiceImpl.java | 10 +- .../mgt/api/util/ApplicationMgtAPIUtil.java | 45 ++++ .../src/main/webapp/WEB-INF/cxf-servlet.xml | 22 +- .../src/main/webapp/WEB-INF/web.xml | 37 ++- .../pom.xml | 113 ++++++++++ .../application/mgt/common/Application.java | 211 ++++++++++++++++++ .../mgt/common/ApplicationList.java | 44 ++++ .../mgt/common/ApplicationRelease.java | 149 +++++++++++++ .../mgt/common/ApplicationType.java | 65 ++++++ .../application/mgt/common/Category.java | 55 +++++ .../application/mgt/common/Comment.java | 102 +++++++++ .../device/application/mgt/common/Filter.java | 107 +++++++++ .../mgt/common/LifecycleState.java | 52 +++++ .../application/mgt/common/Pagination.java | 62 +++++ .../application/mgt/common/Platform.java | 107 +++++++++ .../application/mgt/common/ResourceType.java | 52 +++++ .../application/mgt/common/Subscription.java | 74 ++++++ .../application/mgt/common/Visibility.java | 64 ++++++ .../ApplicationManagerException.java | 2 +- .../IllegalTransactionStateException.java | 2 +- .../TransactionManagementException.java | 2 +- .../UnsupportedDatabaseEngineException.java | 2 +- .../jaxrs/AnnotationExclusionStrategy.java | 35 +++ .../application/mgt/common/jaxrs/Exclude.java | 29 +++ .../ApplicationManagementService.java | 7 +- .../common}/services/ApplicationManager.java | 10 +- .../services/ApplicationReleaseManager.java | 2 +- .../mgt/common}/services/CategoryManager.java | 2 +- .../mgt/common}/services/CommentsManager.java | 2 +- .../services/LifecycleStateManager.java | 2 +- .../mgt/common}/services/PlatformManager.java | 2 +- .../common}/services/ResourceTypeManager.java | 2 +- .../common}/services/SubscriptionManager.java | 2 +- .../common}/services/VisibilityManager.java | 2 +- .../pom.xml | 87 ++------ .../ApplicationConfigurationManager.java | 2 +- .../mgt/core/dao/ApplicationsDAO.java | 6 +- .../dao/common/ApplicationManagementDAO.java | 3 +- .../ApplicationManagementDAOException.java | 2 +- .../ApplicationManagementDAOFactory.java | 147 ++++++++++++ .../common/ApplicationManagementDAOUtil.java | 26 ++- .../dao/impl/GenericAppManagementDAO.java | 8 +- ...ApplicationManagementServiceComponent.java | 2 +- .../ApplicationManagementServiceImpl.java | 10 +- .../core/util/ApplicationManagementUtil.java | 4 +- .../mgt/core/util/ConnectionManagerUtil.java | 4 +- components/application-mgt/pom.xml | 1 + .../pom.xml | 7 + .../main/resources/conf/application-mgt.xml | 13 ++ .../src/main/resources/p2.inf | 1 + pom.xml | 5 + 55 files changed, 1697 insertions(+), 218 deletions(-) rename components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/{MDMAPIException.java => ApplicationMgtAPIException.java} (74%) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationList.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java create 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/Category.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleState.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Pagination.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/exception/ApplicationManagerException.java (94%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/exception/IllegalTransactionStateException.java (95%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/exception/TransactionManagementException.java (95%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/exception/UnsupportedDatabaseEngineException.java (95%) create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java create mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/ApplicationManagementService.java (72%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/ApplicationManager.java (71%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/ApplicationReleaseManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/CategoryManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/CommentsManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/LifecycleStateManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/PlatformManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/ResourceTypeManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/SubscriptionManager.java (92%) rename components/application-mgt/{org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core => org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common}/services/VisibilityManager.java (92%) create mode 100644 features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml index 40747d1341..dbf36b10b0 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/pom.xml @@ -30,8 +30,8 @@ org.wso2.carbon.device.application.mgt.api 2.0.63-SNAPSHOT war - WSO2 Carbon - Mobile Application Management API - WSO2 Carbon - Mobile Application Management API + WSO2 Carbon - Application Management API + WSO2 Carbon - Application Management API http://wso2.org @@ -128,11 +128,6 @@ junit test - - commons-httpclient.wso2 - commons-httpclient - provided - org.codehaus.jackson jackson-jaxrs @@ -147,64 +142,11 @@ org.wso2.carbon.utils provided - - org.wso2.carbon.identity.framework - org.wso2.carbon.user.mgt - provided - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - - - org.wso2.carbon org.wso2.carbon.logging provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - provided - - - org.apache.axis2.wso2 - axis2-client - - - - - org.wso2.carbon.devicemgt - org.wso2.carbon.policy.mgt.core - provided - - - org.apache.axis2.wso2 - axis2-client - - - - - org.wso2.carbon.identity.inbound.auth.oauth2 - org.wso2.carbon.identity.oauth.stub - provided - - - org.apache.axis2.wso2 - axis2-client - - - org.json.wso2 json @@ -216,12 +158,12 @@ org.wso2.carbon.devicemgt - org.wso2.carbon.certificate.mgt.core + org.wso2.carbon.device.application.mgt.core provided org.wso2.carbon.devicemgt - org.wso2.carbon.device.application.mgt.core + org.wso2.carbon.device.application.mgt.common provided @@ -274,11 +216,6 @@ org.wso2.carbon.apimgt.annotations provided - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.analytics.dashboard - provided - org.wso2.orbit.com.fasterxml.jackson.core jackson-annotations @@ -291,23 +228,5 @@ javax.ws.rs javax.ws.rs-api - - org.wso2.carbon.commons - org.wso2.carbon.application.mgt.stub - provided - - - org.wso2.carbon.devicemgt - org.wso2.carbon.identity.jwt.client.extension - provided - - - org.wso2.carbon.identity.framework - org.wso2.carbon.identity.user.store.count - ${carbon.identity.framework.version} - provided - - - - + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ApplicationMgtAPIException.java similarity index 74% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ApplicationMgtAPIException.java index 4637c6f3ec..d072229517 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/MDMAPIException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ApplicationMgtAPIException.java @@ -19,9 +19,9 @@ package org.wso2.carbon.device.application.mgt.api.common; /** - * Custom exception class for handling CDM API related exceptions. + * Custom exception class for handling Application-Mgt API related exceptions. */ -public class MDMAPIException extends Exception { +public class ApplicationMgtAPIException extends Exception { private static final long serialVersionUID = 7950151650447893900L; private String errorMessage; @@ -34,26 +34,26 @@ public class MDMAPIException extends Exception { this.errorMessage = errorMessage; } - public MDMAPIException(String msg, Exception e) { + public ApplicationMgtAPIException(String msg, Exception e) { super(msg, e); setErrorMessage(msg); } - public MDMAPIException(String msg, Throwable cause) { + public ApplicationMgtAPIException(String msg, Throwable cause) { super(msg, cause); setErrorMessage(msg); } - public MDMAPIException(String msg) { + public ApplicationMgtAPIException(String msg) { super(msg); setErrorMessage(msg); } - public MDMAPIException() { + public ApplicationMgtAPIException() { super(); } - public MDMAPIException(Throwable cause) { + public ApplicationMgtAPIException(Throwable cause) { super(cause); } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java index 0b921d5ec1..d44ab48b9e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/ErrorHandler.java @@ -23,9 +23,9 @@ import javax.ws.rs.core.Response; import javax.ws.rs.ext.ExceptionMapper; @Produces({ "application/json", "application/xml" }) -public class ErrorHandler implements ExceptionMapper { +public class ErrorHandler implements ExceptionMapper { - public Response toResponse(MDMAPIException exception) { + public Response toResponse(ApplicationMgtAPIException exception) { ErrorMessage errorMessage = new ErrorMessage(); errorMessage.setErrorMessage(exception.getErrorMessage()); return Response.status(Response.Status.INTERNAL_SERVER_ERROR).entity(errorMessage).build(); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java index 8789e25a3d..ddb186d833 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/common/GsonMessageBodyHandler.java @@ -21,7 +21,7 @@ package org.wso2.carbon.device.application.mgt.api.common; import com.google.gson.Gson; import com.google.gson.GsonBuilder; -import org.wso2.carbon.device.application.mgt.core.jaxrs.AnnotationExclusionStrategy; +import org.wso2.carbon.device.application.mgt.common.jaxrs.AnnotationExclusionStrategy; import javax.ws.rs.Consumes; import javax.ws.rs.Produces; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java index bf86b93a48..f973274b52 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementServiceImpl.java @@ -20,10 +20,10 @@ package org.wso2.carbon.device.application.mgt.api.services.impl; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; -import org.wso2.carbon.device.application.mgt.core.services.ApplicationManager; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; +import org.wso2.carbon.device.application.mgt.api.util.ApplicationMgtAPIUtil; import javax.ws.rs.*; import javax.ws.rs.core.Response; @@ -42,7 +42,7 @@ public class ApplicationManagementServiceImpl { @Path("applications") public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, @QueryParam("q") String searchQuery) { - ApplicationManager applicationManager = ApplicationManagementUtil.getApplicationManagementService(); + ApplicationManager applicationManager = ApplicationMgtAPIUtil.getApplicationManagementService(); try { if(limit == 0){ diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java new file mode 100644 index 0000000000..7ef89a21ae --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/util/ApplicationMgtAPIUtil.java @@ -0,0 +1,45 @@ +/* + * 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.util; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.wso2.carbon.context.CarbonContext; +import org.wso2.carbon.context.PrivilegedCarbonContext; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; + +/** + * Holds util methods required for Application-Mgt API component. + */ +public class ApplicationMgtAPIUtil { + + private static Log log = LogFactory.getLog(ApplicationMgtAPIUtil.class); + + public static ApplicationManagementService getApplicationManagementService() { + PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); + ApplicationManagementService applicationManager = + (ApplicationManagementService) ctx.getOSGiService(ApplicationManagementService.class, null); + if (applicationManager == null) { + String msg = "Application Management provider service has not initialized."; + log.error(msg); + throw new IllegalStateException(msg); + } + return applicationManager; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml index 65b5a921e7..c7aeccc348 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/webapp/WEB-INF/cxf-servlet.xml @@ -1,5 +1,21 @@ - - + + - \ No newline at end of file + 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 984ef89837..9bd5dfac58 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 @@ -52,4 +52,39 @@ true - + + HttpHeaderSecurityFilter + org.apache.catalina.filters.HttpHeaderSecurityFilter + + hstsEnabled + false + + + + + ContentTypeBasedCachePreventionFilter + org.wso2.carbon.ui.filters.cache.ContentTypeBasedCachePreventionFilter + + patterns + text/html" ,application/json" ,text/plain + + + filterAction + enforce + + + httpHeaders + Cache-Control: no-store, no-cache, must-revalidate, private + + + + + HttpHeaderSecurityFilter + /* + + + + ContentTypeBasedCachePreventionFilter + /* + + \ No newline at end of file diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml new file mode 100644 index 0000000000..eae9703673 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/pom.xml @@ -0,0 +1,113 @@ + + + + + + org.wso2.carbon.devicemgt + application-mgt + 2.0.63-SNAPSHOT + ../pom.xml + + + 4.0.0 + org.wso2.carbon.device.application.mgt.common + 2.0.63-SNAPSHOT + bundle + WSO2 Carbon - Application Management Common + WSO2 Carbon - Application Management Common + http://wso2.org + + + + + org.apache.felix + maven-scr-plugin + + + org.apache.felix + maven-bundle-plugin + 1.4.0 + true + + + ${project.artifactId} + ${project.artifactId} + ${carbon.device.mgt.version} + Application Management Common Bundle + + org.osgi.framework, + org.osgi.service.component, + org.apache.commons.logging, + javax.xml.*, + org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", + org.w3c.dom, + org.json, + org.xml.sax, + com.google.gson, + javax.naming, + javax.xml.bind.annotation, + javax.xml.bind, + io.swagger.annotations.*;resolution:=optional + + + org.wso2.carbon.device.application.mgt.common.* + + + + + + + + + + org.eclipse.osgi + org.eclipse.osgi + + + org.eclipse.equinox + org.eclipse.equinox.common + + + org.wso2.carbon + org.wso2.carbon.logging + + + commons-codec.wso2 + commons-codec + + + commons-io.wso2 + commons-io + + + io.swagger + swagger-annotations + provided + + + org.json.wso2 + json + + + com.google.code.gson + gson + + + + 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 new file mode 100644 index 0000000000..1935617b08 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -0,0 +1,211 @@ +/* + * 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; + +import java.util.Date; +import java.util.List; +import java.util.Map; + +public class Application { + + @Exclude + private int id; + + private String uuid; + + private String name; + + private String shortDescription; + + private String description; + + private String iconName; + + private String bannerName; + + private String videoName; + + private List screenshots; + + private List tags; + + private List subscriptions; + + private Platform platform; + + private Category category; + + private Map properties; + + private String createdBy; + + private Date createdAt; + + private Date modifiedAt; + + private boolean published; + + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public String getUuid() { + return uuid; + } + + public void setUuid(String uuid) { + this.uuid = uuid; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getShortDescription() { + return shortDescription; + } + + public void setShortDescription(String shortDescription) { + this.shortDescription = shortDescription; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getIconName() { + return iconName; + } + + public void setIconName(String iconName) { + this.iconName = iconName; + } + + public String getBannerName() { + return bannerName; + } + + public void setBannerName(String bannerName) { + this.bannerName = bannerName; + } + + public String getVideoName() { + return videoName; + } + + public void setVideoName(String videoName) { + this.videoName = videoName; + } + + public List getScreenshots() { + return screenshots; + } + + public void setScreenshots(List screenshots) { + this.screenshots = screenshots; + } + + public List getTags() { + return tags; + } + + public void setTags(List tags) { + this.tags = tags; + } + + public List getSubscriptions() { + return subscriptions; + } + + public void setSubscriptions(List subscriptions) { + this.subscriptions = subscriptions; + } + + public Platform getPlatform() { + return platform; + } + + public void setPlatform(Platform platform) { + this.platform = platform; + } + + public Category getCategory() { + return category; + } + + public void setCategory(Category category) { + this.category = category; + } + + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(Date modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public boolean isPublished() { + return published; + } + + public void setPublished(boolean published) { + this.published = published; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationList.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationList.java new file mode 100644 index 0000000000..6b01563899 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationList.java @@ -0,0 +1,44 @@ +/* + * 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.List; + +public class ApplicationList { + + private List applications; + + private Pagination pagination; + + public List getApplications() { + return applications; + } + + public void setApplications(List applications) { + this.applications = applications; + } + + public Pagination getPagination() { + return pagination; + } + + public void setPagination(Pagination pagination) { + this.pagination = pagination; + } +} 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 new file mode 100644 index 0000000000..d6bd130c8b --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java @@ -0,0 +1,149 @@ +/* + * 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; +import java.util.Map; + +public class ApplicationRelease { + + private enum ReleaseChannel { + PRODUCTION, ALPHA, BETA + } + + private int id; + + private int versionId; + + private String versionName; + + private String resource; + + private ReleaseChannel releaseChannel; + + private String releaseDetails; + + private Date createdAt; + + private Application application; + + private LifecycleState lifecycleState; + + private Date lifecycleStateModifiedAt; + + private String lifecycleStateModifiedBy; + + private Map properties; + + public int getId() { + return id; + } + + public void setId(int id) { + this.id = id; + } + + public int getVersionId() { + return versionId; + } + + public void setVersionId(int versionId) { + this.versionId = versionId; + } + + public String getVersionName() { + return versionName; + } + + public void setVersionName(String versionName) { + this.versionName = versionName; + } + + public String getResource() { + return resource; + } + + public void setResource(String resource) { + this.resource = resource; + } + + public ReleaseChannel getReleaseChannel() { + return releaseChannel; + } + + public void setReleaseChannel(ReleaseChannel releaseChannel) { + this.releaseChannel = releaseChannel; + } + + public String getReleaseDetails() { + return releaseDetails; + } + + public void setReleaseDetails(String releaseDetails) { + this.releaseDetails = releaseDetails; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + 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 String getLifecycleStateModifiedBy() { + return lifecycleStateModifiedBy; + } + + public void setLifecycleStateModifiedBy(String lifecycleStateModifiedBy) { + this.lifecycleStateModifiedBy = lifecycleStateModifiedBy; + } + + public Map getProperties() { + return properties; + } + + public void setProperties(Map properties) { + this.properties = properties; + } +} 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 new file mode 100644 index 0000000000..9c07db63c1 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationType.java @@ -0,0 +1,65 @@ +/* + * 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/Category.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Category.java new file mode 100644 index 0000000000..19f63c8ee8 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Category.java @@ -0,0 +1,55 @@ +/* + * 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 Category { + + @Exclude + private int id; + + private String name; + + private String description; + + 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 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/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 new file mode 100644 index 0000000000..80dc6162db --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Comment.java @@ -0,0 +1,102 @@ +/* + * 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 Comment { + + private String id; + + private String comment; + + private int rating; + + private Comment parent; + + private String createdBy; + + private String createdAt; + + private String modifiedAt; + + private Application application; + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getComment() { + return comment; + } + + public void setComment(String comment) { + this.comment = comment; + } + + public int getRating() { + return rating; + } + + public void setRating(int rating) { + this.rating = rating; + } + + public Comment getParent() { + return parent; + } + + public void setParent(Comment parent) { + this.parent = parent; + } + + public String getCreatedBy() { + return createdBy; + } + + public void setCreatedBy(String createdBy) { + this.createdBy = createdBy; + } + + public String getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(String createdAt) { + this.createdAt = createdAt; + } + + public String getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(String modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } +} 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 new file mode 100644 index 0000000000..a72dfe3120 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Filter.java @@ -0,0 +1,107 @@ +/* + * 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.Map; + +public class Filter { + + public enum SortingOrder { + ASC, DESC + } + + private int limit; + + private int offset; + + private String filter; + + private Map filterProperties; + + private String searchQuery; + + private SortingOrder sortingOrder; + + private String sortBy; + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public String getFilter() { + return filter; + } + + public void setFilter(String filter) { + this.filter = filter; + } + + public Map getFilterProperties() { + return filterProperties; + } + + public void setFilterProperties(Map filterProperties) { + this.filterProperties = filterProperties; + } + + public String getSearchQuery() { + return searchQuery; + } + + public void setSearchQuery(String searchQuery) { + this.searchQuery = searchQuery; + } + + public SortingOrder getSortingOrder() { + return sortingOrder; + } + + public void setSortingOrder(SortingOrder sortingOrder) { + this.sortingOrder = sortingOrder; + } + + public String getSortBy() { + return sortBy; + } + + public void setSortBy(String sortBy) { + this.sortBy = sortBy; + } + + public boolean hasCondition() { + if (filterProperties != null || searchQuery != null || filter != null) { + return true; + } + return false; + } + + +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleState.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleState.java new file mode 100644 index 0000000000..4037c99400 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleState.java @@ -0,0 +1,52 @@ +/* + * 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 LifecycleState { + + 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/Pagination.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Pagination.java new file mode 100644 index 0000000000..a21a9915cf --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Pagination.java @@ -0,0 +1,62 @@ +/* + * 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 Pagination { + + private int offset; + + private int limit; + + private int size; + + private int count; + + public int getOffset() { + return offset; + } + + public void setOffset(int offset) { + this.offset = offset; + } + + public int getLimit() { + return limit; + } + + public void setLimit(int limit) { + this.limit = limit; + } + + public int getSize() { + return size; + } + + public void setSize(int size) { + this.size = size; + } + + public int getCount() { + return count; + } + + public void setCount(int count) { + this.count = count; + } +} 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 new file mode 100644 index 0000000000..bffc570e97 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Platform.java @@ -0,0 +1,107 @@ +/* + * 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; + +import java.util.List; + +public class Platform { + + @Exclude + private int id; + + private String name; + + private String description; + + private String code; + + private String iconName; + + private List tags; + + private String properties; + + private List applications; + + 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 getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getIconName() { + return iconName; + } + + public void setIconName(String iconName) { + this.iconName = iconName; + } + + public String getProperties() { + return properties; + } + + public void setProperties(String properties) { + this.properties = properties; + } + + public List getTags() { + return tags; + } + + 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 new file mode 100644 index 0000000000..2856f6160e --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ResourceType.java @@ -0,0 +1,52 @@ +/* + * 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 new file mode 100644 index 0000000000..f4bba93000 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java @@ -0,0 +1,74 @@ +/* + * 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 Subscription { + + private ResourceType type; + + private String value; + + private Date createdAt; + + private Application application; + + private ApplicationRelease applicationRelease; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ResourceType getType() { + return type; + } + + public void setType(ResourceType type) { + this.type = type; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public ApplicationRelease getApplicationRelease() { + return applicationRelease; + } + + public void setApplicationRelease(ApplicationRelease applicationRelease) { + this.applicationRelease = applicationRelease; + } +} 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 new file mode 100644 index 0000000000..672ab62f52 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java @@ -0,0 +1,64 @@ +/* + * 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 Visibility { + + private ResourceType type; + + private String value; + + private Application application; + + private ApplicationRelease applicationRelease; + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + + public ResourceType getType() { + return type; + } + + public void setType(ResourceType type) { + this.type = type; + } + + public Application getApplication() { + return application; + } + + public void setApplication(Application application) { + this.application = application; + } + + public ApplicationRelease getApplicationRelease() { + return applicationRelease; + } + + public void setApplicationRelease(ApplicationRelease applicationRelease) { + this.applicationRelease = applicationRelease; + } +} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagerException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/ApplicationManagerException.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/exception/ApplicationManagerException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/ApplicationManagerException.java index e937b86a5e..884193878c 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/ApplicationManagerException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/ApplicationManagerException.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.exception; +package org.wso2.carbon.device.application.mgt.common.exception; public class ApplicationManagerException extends Exception { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/IllegalTransactionStateException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/IllegalTransactionStateException.java similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/IllegalTransactionStateException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/IllegalTransactionStateException.java index 3cbb7f0f3e..e7a1d05c8d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/IllegalTransactionStateException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/IllegalTransactionStateException.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.core.exception; +package org.wso2.carbon.device.application.mgt.common.exception; public class IllegalTransactionStateException extends RuntimeException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/TransactionManagementException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/TransactionManagementException.java similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/TransactionManagementException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/TransactionManagementException.java index bd5a6b503b..44b28f6367 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/TransactionManagementException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/TransactionManagementException.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.core.exception; +package org.wso2.carbon.device.application.mgt.common.exception; public class TransactionManagementException extends Exception { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/UnsupportedDatabaseEngineException.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/UnsupportedDatabaseEngineException.java similarity index 95% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/UnsupportedDatabaseEngineException.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/UnsupportedDatabaseEngineException.java index 3ffff94290..22c23b0d10 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/exception/UnsupportedDatabaseEngineException.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/exception/UnsupportedDatabaseEngineException.java @@ -16,7 +16,7 @@ * under the License. */ -package org.wso2.carbon.device.application.mgt.core.exception; +package org.wso2.carbon.device.application.mgt.common.exception; /** * This runtime exception will be thrown if the server has configured with unsupported DB engine. diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java new file mode 100644 index 0000000000..c2f151b552 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/AnnotationExclusionStrategy.java @@ -0,0 +1,35 @@ +/* + * 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.jaxrs; + +import com.google.gson.ExclusionStrategy; +import com.google.gson.FieldAttributes; + +public class AnnotationExclusionStrategy implements ExclusionStrategy { + + @Override + public boolean shouldSkipField(FieldAttributes f) { + return f.getAnnotation(Exclude.class) != null; + } + + @Override + public boolean shouldSkipClass(Class clazz) { + return false; + } +} \ 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/jaxrs/Exclude.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java new file mode 100644 index 0000000000..2f36acb4c8 --- /dev/null +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/jaxrs/Exclude.java @@ -0,0 +1,29 @@ +/* + * 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.jaxrs; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Retention(RetentionPolicy.RUNTIME) +@Target(ElementType.FIELD) +public @interface Exclude { +} \ 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/services/ApplicationManagementService.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java similarity index 72% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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/ApplicationManagementService.java index c6e890a7c2..8b459383f2 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/ApplicationManagementService.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManagementService.java @@ -16,12 +16,9 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; -import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; public interface ApplicationManagementService extends ApplicationReleaseManager, ApplicationManager, CategoryManager, CommentsManager, LifecycleStateManager, PlatformManager, ResourceTypeManager, SubscriptionManager, diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 similarity index 71% rename from components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/ApplicationManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java index dbb57801b1..bc591c36a4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,12 +16,12 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; -import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.Application; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; public interface ApplicationManager { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/ApplicationReleaseManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java index 5d30f29fa6..628f2c1ed8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface ApplicationReleaseManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/CategoryManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java index 08621f19fe..6a2197a0d4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface CategoryManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/CommentsManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CommentsManager.java index d0c04cfc7c..5dd3db83c7 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface CommentsManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/LifecycleStateManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/LifecycleStateManager.java index a09d7475b4..36e772f7e8 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface LifecycleStateManager { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/PlatformManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/PlatformManager.java index 9b90516d56..fb57b924a3 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface PlatformManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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/ResourceTypeManager.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/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/ResourceTypeManager.java index 582e2b30b7..8f05c6bba9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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/ResourceTypeManager.java @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface ResourceTypeManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/SubscriptionManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/SubscriptionManager.java index 074292d031..1067c3bcb9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface SubscriptionManager { } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 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/VisibilityManager.java rename to components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/VisibilityManager.java index a83435cec2..409f8e571f 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/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 @@ -16,7 +16,7 @@ * under the License. * */ -package org.wso2.carbon.device.application.mgt.core.services; +package org.wso2.carbon.device.application.mgt.common.services; public interface VisibilityManager { } 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 46a9c6e7dc..1f5bee530d 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 @@ -49,7 +49,7 @@ ${project.artifactId} ${project.artifactId} ${carbon.device.mgt.version} - Device Management Core Bundle + Application Management Core Bundle org.wso2.carbon.device.application.mgt.core.internal @@ -57,46 +57,20 @@ org.osgi.framework, org.osgi.service.component, org.apache.commons.logging, - javax.security.auth.x500, javax.xml.*, javax.xml.parsers;version="${javax.xml.parsers.import.pkg.version}";resolution:=optional, - org.apache.commons.codec.binary;version="${commons-codec.wso2.osgi.version.range}", - org.bouncycastle.asn1, - org.bouncycastle.asn1.x500, - org.bouncycastle.asn1.x509, - org.bouncycastle.asn1.pkcs, - org.bouncycastle.cert; version="${bcprov.wso2.version.range}", - org.bouncycastle.cert.jcajce; version="${bcprov.wso2.version.range}", - org.bouncycastle.cms, - org.bouncycastle.jce.provider, - org.bouncycastle.operator, - org.bouncycastle.operator.jcajce, - org.bouncycastle.asn1.x500.style, - org.bouncycastle.pkcs, - org.wso2.carbon.user.core.tenant, - org.wso2.carbon.user.api, - org.wso2.carbon.user.core.service, - - org.bouncycastle.util, - org.jscep.message, - org.wso2.carbon.context, - org.jscep.transaction, + org.wso2.carbon.context.*, + org.wso2.carbon.utils.*, org.w3c.dom, org.json, - org.xml.sax, javax.sql, com.google.gson, - javax.naming, javax.xml.bind.annotation, javax.xml.bind, - org.wso2.carbon.utils.*, - org.wso2.carbon.device.mgt.common.*, - io.swagger.annotations.*;resolution:=optional, + org.wso2.carbon.device.application.mgt.common.*, org.wso2.carbon.device.mgt.core.*, - org.wso2.carbon.device.mgt.core.utils.*, - org.wso2.carbon.registry.indexing.*, - + org.wso2.carbon.device.mgt.common.*, !org.wso2.carbon.device.application.mgt.core.internal.*, @@ -128,6 +102,10 @@ org.eclipse.osgi org.eclipse.osgi + + org.eclipse.osgi + org.eclipse.osgi.services + org.eclipse.equinox org.eclipse.equinox.common @@ -141,16 +119,8 @@ org.wso2.carbon.logging - org.wso2.orbit.org.bouncycastle - bcprov-jdk15on - - - org.wso2.orbit.org.bouncycastle - bcpkix-jdk15on - - - org.wso2.orbit.com.google.code.jscep - jscep + org.wso2.carbon + org.wso2.carbon.utils commons-codec.wso2 @@ -161,38 +131,29 @@ commons-io - org.wso2.carbon - org.wso2.carbon.utils - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.core - - - org.wso2.carbon.devicemgt - org.wso2.carbon.device.mgt.common + org.slf4j + slf4j-simple + test - io.swagger - swagger-annotations - provided + org.json.wso2 + json - org.wso2.carbon - org.wso2.carbon.user.core + com.google.code.gson + gson - org.wso2.carbon.registry - org.wso2.carbon.registry.indexing + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common - org.slf4j - slf4j-simple - test + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.common - org.json.wso2 - json + org.wso2.carbon.devicemgt + org.wso2.carbon.device.mgt.core 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 index a0c6007dfd..046f2ed6b3 100644 --- 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 @@ -21,7 +21,7 @@ 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.core.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; 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; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java index 3353b5cebb..d3a4fd9617 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/ApplicationsDAO.java @@ -19,9 +19,9 @@ 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.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; +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; public interface ApplicationsDAO { 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/ApplicationManagementDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java index 4962a481ad..b5ade36c35 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/ApplicationManagementDAO.java @@ -18,9 +18,8 @@ */ package org.wso2.carbon.device.application.mgt.core.dao.common; -import org.apache.abdera.model.Categories; import org.wso2.carbon.device.application.mgt.core.dao.*; -import org.wso2.carbon.device.application.mgt.core.dto.LifecycleState; +import org.wso2.carbon.device.application.mgt.common.LifecycleState; public interface ApplicationManagementDAO extends ApplicationReleasesDAO, ApplicationsDAO, CategoriesDAO, CommentsDAO, LifecycleStatesDAO, PlatformsDAO, ResourceTypesDAO, SubscriptionsDAO, VisibilitiesDAO { 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/dao/common/ApplicationManagementDAOException.java index b4401ae410..543f82a860 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/dao/common/ApplicationManagementDAOException.java @@ -18,7 +18,7 @@ */ package org.wso2.carbon.device.application.mgt.core.dao.common; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; public class ApplicationManagementDAOException extends ApplicationManagerException { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/common/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/ApplicationManagementDAOFactory.java index fca7134e50..0503e6abad 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/ApplicationManagementDAOFactory.java @@ -20,19 +20,29 @@ 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.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 org.wso2.carbon.device.application.mgt.core.dao.impl.GenericAppManagementDAO; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil.DatabaseType; import javax.sql.DataSource; +import java.sql.Connection; import java.sql.SQLException; +import java.util.Hashtable; +import java.util.List; public class ApplicationManagementDAOFactory { public static final String H2 = "H2"; private DatabaseType databaseType; private static DataSource dataSource; + private static String databaseEngine; + + private static ThreadLocal currentConnection = new ThreadLocal(); + private static final Log log = LogFactory.getLog(ApplicationManagementDAOFactory.class); @@ -54,4 +64,141 @@ public class ApplicationManagementDAOFactory { return new GenericAppManagementDAO(); } } + + + public static void init(DataSourceConfig config) { + dataSource = resolveDataSource(config); + try { + databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName(); + } catch (SQLException e) { + log.error("Error occurred while retrieving config.datasource connection", e); + } + } + + public static void init(DataSource dtSource) { + dataSource = dtSource; + try { + databaseEngine = dataSource.getConnection().getMetaData().getDatabaseProductName(); + } catch (SQLException e) { + log.error("Error occurred while retrieving config.datasource connection", e); + } + } + + public static void beginTransaction() throws TransactionManagementException { + Connection conn = currentConnection.get(); + if (conn != null) { + throw new IllegalTransactionStateException("A transaction is already active within the context of " + + "this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " + + "transaction is already active is a sign of improper transaction handling"); + } + try { + conn = dataSource.getConnection(); + conn.setAutoCommit(false); + currentConnection.set(conn); + } catch (SQLException e) { + throw new TransactionManagementException("Error occurred while retrieving config.datasource connection", e); + } + } + + public static void openConnection() throws SQLException { + Connection conn = currentConnection.get(); + if (conn != null) { + throw new IllegalTransactionStateException("A transaction is already active within the context of " + + "this particular thread. Therefore, calling 'beginTransaction/openConnection' while another " + + "transaction is already active is a sign of improper transaction handling"); + } + conn = dataSource.getConnection(); + currentConnection.set(conn); + } + + public static Connection getConnection() throws SQLException { + Connection conn = currentConnection.get(); + if (conn == null) { + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + + "This might have ideally been caused by not properly initiating the transaction via " + + "'beginTransaction'/'openConnection' methods"); + } + return conn; + } + + public static void commitTransaction() { + Connection conn = currentConnection.get(); + if (conn == null) { + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + + "This might have ideally been caused by not properly initiating the transaction via " + + "'beginTransaction'/'openConnection' methods"); + } + try { + conn.commit(); + } catch (SQLException e) { + log.error("Error occurred while committing the transaction", e); + } + } + + public static void rollbackTransaction() { + Connection conn = currentConnection.get(); + if (conn == null) { + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + + "This might have ideally been caused by not properly initiating the transaction via " + + "'beginTransaction'/'openConnection' methods"); + } + try { + conn.rollback(); + } catch (SQLException e) { + log.warn("Error occurred while roll-backing the transaction", e); + } + } + + public static void closeConnection() { + Connection conn = currentConnection.get(); + if (conn == null) { + throw new IllegalTransactionStateException("No connection is associated with the current transaction. " + + "This might have ideally been caused by not properly initiating the transaction via " + + "'beginTransaction'/'openConnection' methods"); + } + try { + conn.close(); + } catch (SQLException e) { + log.warn("Error occurred while close the connection"); + } + currentConnection.remove(); + } + + + /** + * Resolve data source from the data source definition + * + * @param config data source configuration + * @return data source resolved from the data source definition + */ + private static DataSource resolveDataSource(DataSourceConfig config) { + DataSource dataSource = null; + if (config == null) { + throw new RuntimeException( + "Device 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 Device 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 = ApplicationManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), jndiProperties); + } else { + dataSource = ApplicationManagementDAOUtil.lookupDataSource(jndiConfig.getJndiName(), null); + } + } + return dataSource; + } + + + } 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/ApplicationManagementDAOUtil.java index 863549f7ac..6ff727fc78 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/ApplicationManagementDAOUtil.java @@ -22,17 +22,16 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.json.JSONArray; import org.json.JSONException; -import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.Platform; -import org.wso2.carbon.device.application.mgt.core.dto.Category; +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 javax.naming.InitialContext; +import javax.sql.DataSource; import java.sql.PreparedStatement; import java.sql.ResultSet; import java.sql.SQLException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; public class ApplicationManagementDAOUtil { @@ -104,4 +103,17 @@ public class ApplicationManagementDAOUtil { } return list; } + + public static DataSource lookupDataSource(String dataSourceName, + final Hashtable jndiProperties) { + try { + if (jndiProperties == null || jndiProperties.isEmpty()) { + return (DataSource) InitialContext.doLookup(dataSourceName); + } + final InitialContext context = new InitialContext(jndiProperties); + return (DataSource) context.lookup(dataSourceName); + } catch (Exception e) { + throw new RuntimeException("Error in looking up data source: " + e.getMessage(), e); + } + } } 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/GenericAppManagementDAO.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java index 65416d12ce..5a0358b6ed 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/dao/impl/GenericAppManagementDAO.java @@ -24,10 +24,10 @@ import org.json.JSONException; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; 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.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.dto.Pagination; +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.Pagination; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; import java.sql.Connection; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java index 5501e90fd2..329c08900e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/ApplicationManagementServiceComponent.java @@ -22,7 +22,7 @@ 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.core.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; import org.wso2.carbon.device.application.mgt.core.services.impl.ApplicationManagementServiceImpl; import org.wso2.carbon.device.application.mgt.core.config.ApplicationConfigurationManager; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java index a4ab9f7e20..90921f9038 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/services/impl/ApplicationManagementServiceImpl.java @@ -20,12 +20,12 @@ 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.core.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.Application; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAO; -import org.wso2.carbon.device.application.mgt.core.dto.Application; -import org.wso2.carbon.device.application.mgt.core.dto.lists.ApplicationList; -import org.wso2.carbon.device.application.mgt.core.dto.Filter; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; import org.wso2.carbon.device.application.mgt.core.internal.ApplicationManagementDataHolder; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; 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 55626599b2..1258488566 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/util/ApplicationManagementUtil.java @@ -23,8 +23,8 @@ import org.apache.commons.logging.LogFactory; import org.w3c.dom.Document; import org.wso2.carbon.context.CarbonContext; import org.wso2.carbon.context.PrivilegedCarbonContext; -import org.wso2.carbon.device.application.mgt.core.services.ApplicationManagementService; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.services.ApplicationManagementService; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; import javax.xml.XMLConstants; import javax.xml.parsers.DocumentBuilder; 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 dd0718cfbf..1cdf26b903 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 @@ -22,8 +22,8 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.core.config.datasource.DataSourceConfig; import org.wso2.carbon.device.application.mgt.core.config.datasource.JNDILookupDefinition; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagerException; -import org.wso2.carbon.device.application.mgt.core.exception.IllegalTransactionStateException; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagerException; +import org.wso2.carbon.device.application.mgt.common.exception.IllegalTransactionStateException; import javax.naming.InitialContext; import javax.sql.DataSource; diff --git a/components/application-mgt/pom.xml b/components/application-mgt/pom.xml index c47acd992d..3c350b2243 100644 --- a/components/application-mgt/pom.xml +++ b/components/application-mgt/pom.xml @@ -36,6 +36,7 @@ org.wso2.carbon.device.application.mgt.core + org.wso2.carbon.device.application.mgt.common org.wso2.carbon.device.application.mgt.api org.wso2.carbon.device.application.mgt.ui 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 28f574a743..87e8f0c203 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 @@ -36,6 +36,10 @@ + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.core @@ -98,6 +102,9 @@ org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.api.feature:${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.common:${carbon.device.mgt.version} + org.wso2.carbon.devicemgt:org.wso2.carbon.device.application.mgt.core:${carbon.device.mgt.version} 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 new file mode 100644 index 0000000000..8bdf6b95e6 --- /dev/null +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -0,0 +1,13 @@ + + + + + + + + jdbc/APPM_DS + + + + + \ No newline at end of file diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf index a51ce36e56..a12c244131 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/p2.inf @@ -1,4 +1,5 @@ instructions.configure = \ +org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/conf/application-mgt.xml,target:${installFolder}/../../conf/application-mgt.xml,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/conf/datasources/application-mgt-datasources.xml,target:${installFolder}/../../conf/datasources/application-mgt-datasources.xml,overwrite:true);\ org.eclipse.equinox.p2.touchpoint.natives.copy(source:${installFolder}/../features/org.wso2.carbon.device.application.mgt.server_${feature.version}/dbscripts/cdm/application-mgt,target:${installFolder}/../../../dbscripts/cdm/application-mgt,overwrite:true);\ diff --git a/pom.xml b/pom.xml index 79372fd903..cb15d5e12b 100644 --- a/pom.xml +++ b/pom.xml @@ -177,6 +177,11 @@ org.wso2.carbon.device.application.mgt.core ${carbon.device.mgt.version} + + org.wso2.carbon.devicemgt + org.wso2.carbon.device.application.mgt.common + ${carbon.device.mgt.version} + org.wso2.carbon.devicemgt org.wso2.carbon.device.application.mgt.api