diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java index c9dfbb057ad..917c35bbf5b 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/APIUtil.java @@ -37,7 +37,8 @@ public class APIUtil { private static ApplicationManager applicationManager; - public static ApplicationManager getApplicationManagemer() { + public static ApplicationManager getApplicationManager() { + if (applicationManager == null) { synchronized (APIUtil.class) { if (applicationManager == null) { @@ -52,10 +53,12 @@ public class APIUtil { } } } + return applicationManager; } public static Response getResponse(ApplicationManagementException ex, Response.Status status) { + //TODO: check for exception type and set the response code. ErrorResponse errorMessage = new ErrorResponse(); errorMessage.setMessage(ex.getMessage()); @@ -64,5 +67,6 @@ public class APIUtil { } errorMessage.setCode(status.getStatusCode()); return Response.status(status).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/services/impl/ApplicationManagementAPIImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java index 06e95af7b04..f45883c46e9 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.api/src/main/java/org/wso2/carbon/device/application/mgt/api/services/impl/ApplicationManagementAPIImpl.java @@ -44,7 +44,7 @@ public class ApplicationManagementAPIImpl { @Path("applications") public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, @QueryParam("query") String searchQuery) { - ApplicationManager applicationManager = APIUtil.getApplicationManagemer(); + ApplicationManager applicationManager = APIUtil.getApplicationManager(); try { if (limit == 0) { limit = DEFAULT_LIMIT; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java index ae1752b8d8c..0642aef21cf 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java @@ -25,7 +25,11 @@ import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManage public interface ApplicationManager{ - void createApplication(Application application) throws ApplicationManagementException; + public Application createApplication(Application application) throws ApplicationManagementException; - ApplicationList getApplications(Filter filter) throws ApplicationManagementException; + public Application editApplication(int applicationId, Application application) throws ApplicationManagementException; + + public void deleteApplication(int applicationId) throws ApplicationManagementException; + + public ApplicationList getApplications(Filter filter) throws ApplicationManagementException; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java index 00c5855b6d8..7760d6205e5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationReleaseManager.java @@ -18,5 +18,11 @@ */ package org.wso2.carbon.device.application.mgt.common.services; +import org.wso2.carbon.device.application.mgt.common.Application; +import org.wso2.carbon.device.application.mgt.common.ApplicationList; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; + public interface ApplicationReleaseManager{ + } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java index 47812996775..32082c865bb 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/CategoryManager.java @@ -18,5 +18,19 @@ */ package org.wso2.carbon.device.application.mgt.common.services; +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.Category; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; + public interface CategoryManager{ + + public Category createCategory(Category application) throws ApplicationManagementException; + + public Category editCategory(int applicationId, Category category) throws ApplicationManagementException; + + public void deleteCategory(int applicationId) throws ApplicationManagementException; + + public Category getCategory(Filter filter) throws ApplicationManagementException; } 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 5fbb970ae97..57cd962539d 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 @@ -29,13 +29,25 @@ import org.wso2.carbon.device.application.mgt.core.dao.common.DAOFactory; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; public class ApplicationManagerImpl implements ApplicationManager { + @Override - public void createApplication(Application application) throws ApplicationManagementException { + public Application createApplication(Application application) throws ApplicationManagementException { + return null; + } + + @Override + public Application editApplication(int applicationId, Application application) throws ApplicationManagementException { + return null; + } + + @Override + public void deleteApplication(int applicationId) throws ApplicationManagementException { } @Override public ApplicationList getApplications(Filter filter) throws ApplicationManagementException { + try { ConnectionManagerUtil.openConnection(); ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO(); @@ -43,5 +55,6 @@ public class ApplicationManagerImpl implements ApplicationManager { } finally { ConnectionManagerUtil.closeConnection(); } + } } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java index e245186b1a2..c165a58fc0e 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/CategoryManagerImpl.java @@ -17,7 +17,30 @@ */ package org.wso2.carbon.device.application.mgt.core.impl; +import org.wso2.carbon.device.application.mgt.common.Category; +import org.wso2.carbon.device.application.mgt.common.Filter; +import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; import org.wso2.carbon.device.application.mgt.common.services.CategoryManager; public class CategoryManagerImpl implements CategoryManager { + + @Override + public Category createCategory(Category application) throws ApplicationManagementException { + return null; + } + + @Override + public Category editCategory(int applicationId, Category category) throws ApplicationManagementException { + return null; + } + + @Override + public void deleteCategory(int applicationId) throws ApplicationManagementException { + + } + + @Override + public Category getCategory(Filter filter) throws ApplicationManagementException { + return null; + } }