Merge remote-tracking branch 'wso2/application-mgt' into wso2-application-mgt

feature/appm-store/pbac
sinthuja 8 years ago
commit b183ec3e89

@ -37,7 +37,8 @@ public class APIUtil {
private static ApplicationManager applicationManager; private static ApplicationManager applicationManager;
public static ApplicationManager getApplicationManagemer() { public static ApplicationManager getApplicationManager() {
if (applicationManager == null) { if (applicationManager == null) {
synchronized (APIUtil.class) { synchronized (APIUtil.class) {
if (applicationManager == null) { if (applicationManager == null) {
@ -52,10 +53,12 @@ public class APIUtil {
} }
} }
} }
return applicationManager; return applicationManager;
} }
public static Response getResponse(ApplicationManagementException ex, Response.Status status) { public static Response getResponse(ApplicationManagementException ex, Response.Status status) {
//TODO: check for exception type and set the response code. //TODO: check for exception type and set the response code.
ErrorResponse errorMessage = new ErrorResponse(); ErrorResponse errorMessage = new ErrorResponse();
errorMessage.setMessage(ex.getMessage()); errorMessage.setMessage(ex.getMessage());
@ -64,5 +67,6 @@ public class APIUtil {
} }
errorMessage.setCode(status.getStatusCode()); errorMessage.setCode(status.getStatusCode());
return Response.status(status).entity(errorMessage).build(); return Response.status(status).entity(errorMessage).build();
} }
} }

@ -44,7 +44,7 @@ public class ApplicationManagementAPIImpl {
@Path("applications") @Path("applications")
public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit, public Response getApplications(@QueryParam("offset") int offset, @QueryParam("limit") int limit,
@QueryParam("query") String searchQuery) { @QueryParam("query") String searchQuery) {
ApplicationManager applicationManager = APIUtil.getApplicationManagemer(); ApplicationManager applicationManager = APIUtil.getApplicationManager();
try { try {
if (limit == 0) { if (limit == 0) {
limit = DEFAULT_LIMIT; limit = DEFAULT_LIMIT;

@ -25,7 +25,11 @@ import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManage
public interface ApplicationManager{ 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;
} }

@ -18,5 +18,11 @@
*/ */
package org.wso2.carbon.device.application.mgt.common.services; 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{ public interface ApplicationReleaseManager{
} }

@ -18,5 +18,19 @@
*/ */
package org.wso2.carbon.device.application.mgt.common.services; 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 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;
} }

@ -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; import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil;
public class ApplicationManagerImpl implements ApplicationManager { public class ApplicationManagerImpl implements ApplicationManager {
@Override @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 @Override
public ApplicationList getApplications(Filter filter) throws ApplicationManagementException { public ApplicationList getApplications(Filter filter) throws ApplicationManagementException {
try { try {
ConnectionManagerUtil.openConnection(); ConnectionManagerUtil.openConnection();
ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO(); ApplicationDAO applicationDAO = DAOFactory.getApplicationDAO();
@ -43,5 +55,6 @@ public class ApplicationManagerImpl implements ApplicationManager {
} finally { } finally {
ConnectionManagerUtil.closeConnection(); ConnectionManagerUtil.closeConnection();
} }
} }
} }

@ -17,7 +17,30 @@
*/ */
package org.wso2.carbon.device.application.mgt.core.impl; 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; import org.wso2.carbon.device.application.mgt.common.services.CategoryManager;
public class CategoryManagerImpl implements 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;
}
} }

Loading…
Cancel
Save