From c7956b7af19a527491d7a0b3e7176114d0b48085 Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Sun, 23 Sep 2018 20:08:52 +0530 Subject: [PATCH] Fix service registering issue --- .../mgt/core/impl/ApplicationManagerImpl.java | 9 +++++---- .../services/ApplicationManagementAPI.java | 19 ++++++------------- .../services/SubscriptionManagementAPI.java | 2 +- .../impl/SubscriptionManagementAPIImpl.java | 4 +--- 4 files changed, 13 insertions(+), 21 deletions(-) diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java index ce7b68229d..a9da364714 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/ApplicationManagerImpl.java @@ -96,8 +96,7 @@ public class ApplicationManagerImpl implements ApplicationManager { String userName = PrivilegedCarbonContext.getThreadLocalCarbonContext().getUsername(); application.setUser(new User(userName, tenantId)); if (log.isDebugEnabled()) { - log.debug("Create Application received for the tenant : " + application.getUser().getTenantId() + " From" - + " the user : " + application.getUser().getUserName()); + log.debug("Create Application received for the tenant : " + tenantId + " From" + " the user : " + userName); } validateAppCreatingRequest(application); @@ -161,11 +160,13 @@ public class ApplicationManagerImpl implements ApplicationManager { ConnectionManagerUtil.rollbackDBTransaction(); throw new ApplicationManagementException(msg, e); } catch (DeviceManagementException e) { - e.printStackTrace(); + String msg = "Error occurred while getting device type id of " + application.getType(); + log.error(msg, e); + ConnectionManagerUtil.rollbackDBTransaction(); + throw new ApplicationManagementException(msg, e); } finally { //ConnectionManagerUtil.closeDBConnection(); //todo: check this again } - return null; } @Override diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java index cf907d4e18..b2068ec6be 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/ApplicationManagementAPI.java @@ -28,23 +28,16 @@ import io.swagger.annotations.ExtensionProperty; import io.swagger.annotations.Info; import io.swagger.annotations.SwaggerDefinition; import io.swagger.annotations.Tag; -import org.apache.cxf.jaxrs.ext.multipart.Attachment; -import org.apache.cxf.jaxrs.ext.multipart.Multipart; import org.wso2.carbon.apimgt.annotations.api.Scope; import org.wso2.carbon.apimgt.annotations.api.Scopes; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.publisher.api.beans.ErrorResponse; 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.ApplicationRelease; -import java.util.List; import javax.validation.Valid; import javax.ws.rs.Consumes; -import javax.ws.rs.DELETE; import javax.ws.rs.GET; -import javax.ws.rs.POST; -import javax.ws.rs.PUT; import javax.ws.rs.Path; import javax.ws.rs.PathParam; import javax.ws.rs.Produces; @@ -53,22 +46,22 @@ import javax.ws.rs.core.MediaType; import javax.ws.rs.core.Response; /** - * APIs to handle application management related tasks. + * APIs to handle application storage management related tasks. */ @SwaggerDefinition( info = @Info( version = "1.0.0", - title = "Application Management Service", + title = "Application Storage Management Service", extensions = { @Extension(properties = { - @ExtensionProperty(name = "name", value = "ApplicationManagementService"), - @ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/applications"), + @ExtensionProperty(name = "name", value = "ApplicationStorageManagementService"), + @ExtensionProperty(name = "context", value = "/api/application-mgt/v1.0/store-applications"), }) } ), tags = { - @Tag(name = "application_management, device_management", description = "Application Management related " - + "APIs") + @Tag(name = "application_management, device_management", description = "Application Storage Management " + + "related APIs") } ) @Scopes( diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java index 8449da1cf5..ea945b8f35 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/SubscriptionManagementAPI.java @@ -15,7 +15,7 @@ * specific language governing permissions and limitations * under the License. */ -package org.wso2.carbon.device.application.mgt.publisher.api.services; +package org.wso2.carbon.device.application.mgt.store.api.services; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java index 558400b39c..716f40f4a4 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.store.api/src/main/java/org/wso2/carbon/device/application/mgt/store/api/services/impl/SubscriptionManagementAPIImpl.java @@ -23,18 +23,16 @@ import org.apache.commons.logging.LogFactory; import org.wso2.carbon.device.application.mgt.common.ApplicationInstallResponse; import org.wso2.carbon.device.application.mgt.common.EnterpriseInstallationDetails; import org.wso2.carbon.device.application.mgt.store.api.APIUtil; -import org.wso2.carbon.device.application.mgt.publisher.api.services.SubscriptionManagementAPI; +import org.wso2.carbon.device.application.mgt.store.api.services.SubscriptionManagementAPI; import org.wso2.carbon.device.application.mgt.common.InstallationDetails; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.mgt.common.DeviceIdentifier; import javax.validation.Valid; import javax.ws.rs.POST; import javax.ws.rs.Path; import javax.ws.rs.Produces; import javax.ws.rs.core.Response; -import java.util.HashMap; import java.util.List; /**