From b0520ac97680ebc035f1ca2dc883746e3558996b Mon Sep 17 00:00:00 2001 From: lasanthaDLPDS Date: Sat, 22 Sep 2018 10:28:52 +0530 Subject: [PATCH] Refactor the source: --- .../application/mgt/common/Application.java | 1 - .../mgt/common/ApplicationRelease.java | 1 - .../mgt/common/EnterpriseApplication.java | 2 - .../mgt/common/FilterProperty.java | 85 ------------- .../mgt/common/LifecycleStateTransition.java | 34 ----- .../application/mgt/common/Payment.java | 53 -------- .../application/mgt/common/Subscription.java | 77 ------------ .../application/mgt/common/Visibility.java | 54 -------- .../common/services/ApplicationManager.java | 2 - .../services/UnrestrictedRoleManager.java | 59 --------- .../impl/UnrestrictedRoleManagerImpl.java | 117 ------------------ ...ApplicationManagementServiceComponent.java | 8 -- .../mgt/core/internal/DataHolder.java | 11 -- .../core/lifecycle/LifecycleStateManger.java | 5 +- .../core/util/ApplicationManagementUtil.java | 7 -- .../src/test/resources/application-mgt.xml | 25 +--- .../mgt/publisher/api/APIUtil.java | 23 ---- .../main/resources/conf/application-mgt.xml | 20 +-- 18 files changed, 4 insertions(+), 580 deletions(-) delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleStateTransition.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/UnrestrictedRoleManager.java delete mode 100644 components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/UnrestrictedRoleManagerImpl.java diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java index eb08e78034..ed0864599d 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Application.java @@ -24,7 +24,6 @@ import io.swagger.annotations.ApiModelProperty; import java.util.List; - @ApiModel(value = "Application", description = "Application represents the an Application in Application Store") public class Application { diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java index 6f45126616..379ef0f691 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/ApplicationRelease.java @@ -177,7 +177,6 @@ public class ApplicationRelease { this.price = price; } - public String getAppHashValue() { return appHashValue; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/EnterpriseApplication.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/EnterpriseApplication.java index b1b3aac4c1..0cf6dfb554 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/EnterpriseApplication.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/EnterpriseApplication.java @@ -18,8 +18,6 @@ */ package org.wso2.carbon.device.application.mgt.common; -import com.google.gson.Gson; - import java.io.Serializable; /** diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java deleted file mode 100644 index 49d6f2d83f..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/FilterProperty.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.common; - -//TODO - -/** - * FilterProperty defines the property that can be used to filter the Application. - */ -public class FilterProperty { - - /** - * Operators that can be used in search. - */ - public enum Operator { - EQUALS ("="), - GRATER_THAN (">"), - GREATER_THAN_AND_EQUAL(">="), - LESS_THAN ("<"), - LESS_THAN_AND_EQUAL ("<="); - - private final String value; - - Operator(String value) { - this.value = value; - } - - public String getValue() { - return value; - } - } - - public FilterProperty(String key, Operator operator, String value) { - this.key = key; - this.operator = operator; - this.value = value; - } - - private String key; - - private Operator operator; - - private String value; - - public String getKey() { - return key; - } - - public void setKey(String key) { - this.key = key; - } - - public String getValue() { - return value; - } - - public void setValue(String value) { - this.value = value; - } - - public Operator getOperator() { - return operator; - } - - public void setOperator(Operator operator) { - this.operator = operator; - } - -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleStateTransition.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleStateTransition.java deleted file mode 100644 index 44382599a2..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/LifecycleStateTransition.java +++ /dev/null @@ -1,34 +0,0 @@ -package org.wso2.carbon.device.application.mgt.common; - -/** - * This represents the LifeCycleStateTransition from one state to next state. - */ -public class LifecycleStateTransition { - private String nextState; - private String permission; - private String description; - - public String getNextState() { - return nextState; - } - - public String getPermission() { - return permission; - } - - public String getDescription() { - return description; - } - - public void setNextState(String nextState) { - this.nextState = nextState; - } - - public void setPermission(String permission) { - this.permission = permission; - } - - 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/Payment.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java deleted file mode 100644 index bbb96fbb30..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Payment.java +++ /dev/null @@ -1,53 +0,0 @@ -/* -* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* WSO2 Inc. licenses this file to you under the Apache License, -* Version 2.0 (the "License"); you may not use this file except -* in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ -package org.wso2.carbon.device.application.mgt.common; - -/** - * Represents the payment related information for the {@link Application}. - */ -public class Payment { - private boolean freeApp; - - private String paymentCurrency; - - private float paymentPrice; - - public boolean isFreeApp() { - return freeApp; - } - - public void setFreeApp(boolean freeApp) { - this.freeApp = freeApp; - } - - public String getPaymentCurrency() { - return paymentCurrency; - } - - public void setPaymentCurrency(String paymentCurrency) { - this.paymentCurrency = paymentCurrency; - } - - public float getPaymentPrice() { - return paymentPrice; - } - - public void setPaymentPrice(float paymentPrice) { - this.paymentPrice = paymentPrice; - } -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/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 deleted file mode 100644 index 42d942664d..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Subscription.java +++ /dev/null @@ -1,77 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.common; - -import java.util.Date; - -/** - * Represents subscription of an {@link Application} - */ -public class Subscription { - - private Visibility.Type 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 Visibility.Type getType() { - return type; - } - - public void setType(Visibility.Type 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 deleted file mode 100644 index c2992aa670..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/Visibility.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. - * - * WSO2 Inc. licenses this file to you under the Apache License, - * Version 2.0 (the "License"); you may not use this file except - * in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - * - */ -package org.wso2.carbon.device.application.mgt.common; - -import java.util.List; - -/** - * This class represents the visibility details of an Application. - */ -public class Visibility { - - private Type type; - - private List allowedList; - - public Type getType() { - return type; - } - - public void setType(Type type) { - this.type = type; - } - - public List getAllowedList() { - return allowedList; - } - - public void setAllowedList(List allowedList) { - this.allowedList = allowedList; - } - - /** - * Type of the visibility of the application. - */ - public enum Type { - PUBLIC, ROLES, DEVICE_GROUPS - } -} 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 4df7b50d33..9eefd339ea 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/ApplicationManager.java @@ -23,10 +23,8 @@ import org.wso2.carbon.device.application.mgt.common.ApplicationList; import org.wso2.carbon.device.application.mgt.common.ApplicationRelease; import org.wso2.carbon.device.application.mgt.common.Filter; import org.wso2.carbon.device.application.mgt.common.LifecycleState; -import org.wso2.carbon.device.application.mgt.common.LifecycleStateTransition; import org.wso2.carbon.device.application.mgt.common.UnrestrictedRole; import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.LifecycleManagementException; import java.util.List; diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/UnrestrictedRoleManager.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/UnrestrictedRoleManager.java deleted file mode 100644 index 93b7b3a0c9..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.common/src/main/java/org/wso2/carbon/device/application/mgt/common/services/UnrestrictedRoleManager.java +++ /dev/null @@ -1,59 +0,0 @@ -/* -* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* WSO2 Inc. licenses this file to you under the Apache License, -* Version 2.0 (the "License"); you may not use this file except -* in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ - -package org.wso2.carbon.device.application.mgt.common.services; - -import org.wso2.carbon.device.application.mgt.common.UnrestrictedRole; -import org.wso2.carbon.device.application.mgt.common.Visibility; -import org.wso2.carbon.device.application.mgt.common.exception.VisibilityManagementException; - -import java.util.List; - -/** - * This interface manages all the operations related with Application Visibility. - * This will be invoking the necessary backend calls for the data bases layer - * and provide the functional implementation. - */ -public interface UnrestrictedRoleManager { - - /** - * Add (if there is no visibility configuration for the application) or - * Update (if there is already existing configuration for the application) - * the visibility related configuration for the application - * - * @param applicationID The ID of the application - * @param visibility The visibility configuration for the particular application. - */ - Visibility put(int applicationID, Visibility visibility) throws VisibilityManagementException; - - /** - * Returns the Visibility configuration of the provided applicationUUID. - * - * @param applicationID The ID of the application - * @param tenantId tenant Id - * @return Visibility configuration - */ - List getUnrestrictedRoles(int applicationID, int tenantId) throws VisibilityManagementException; - - /** - * Remove the visibility configuration mapping for the provided application. - * - * @param applicationID The ID of the application - */ - void remove(int applicationID) throws VisibilityManagementException; -} diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/UnrestrictedRoleManagerImpl.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/UnrestrictedRoleManagerImpl.java deleted file mode 100644 index 861246ec53..0000000000 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/impl/UnrestrictedRoleManagerImpl.java +++ /dev/null @@ -1,117 +0,0 @@ -/* -* Copyright (c) 2017, WSO2 Inc. (http://www.wso2.org) All Rights Reserved. -* WSO2 Inc. licenses this file to you under the Apache License, -* Version 2.0 (the "License"); you may not use this file except -* in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, -* software distributed under the License is distributed on an -* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY -* KIND, either express or implied. See the License for the -* specific language governing permissions and limitations -* under the License. -* -*/ -package org.wso2.carbon.device.application.mgt.core.impl; - -import org.wso2.carbon.device.application.mgt.common.UnrestrictedRole; -import org.wso2.carbon.device.application.mgt.common.Visibility; -import org.wso2.carbon.device.application.mgt.common.exception.ApplicationManagementException; -import org.wso2.carbon.device.application.mgt.common.exception.VisibilityManagementException; -import org.wso2.carbon.device.application.mgt.common.services.UnrestrictedRoleManager; -import org.wso2.carbon.device.application.mgt.core.dao.VisibilityDAO; -import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; -import org.wso2.carbon.device.application.mgt.core.util.ConnectionManagerUtil; - -import java.util.Collection; -import java.util.List; - -//todo need to work on business logic -/** - * This is the default implementation for the visibility manager. - */ -public class UnrestrictedRoleManagerImpl implements UnrestrictedRoleManager { - - @Override - public Visibility put(int applicationID, Visibility visibility) throws VisibilityManagementException { - return null; -// if (visibility == null) { -// visibility = new Visibility(); -// visibility.setType(Visibility.Type.PUBLIC); -// } -// if (visibility.getAllowedList() == null && !visibility.getType().equals(Visibility.Type.PUBLIC)) { -// throw new VisibilityManagementException("Visibility is configured for '" + visibility.getType() -// + "' but doesn't have any allowed list provided!"); -// } -// boolean isTransactionStarted = false; -// try { -// isTransactionStarted = ConnectionManagerUtil.isTransactionStarted(); -// if (!isTransactionStarted) { -// ConnectionManagerUtil.beginDBTransaction(); -// } -// VisibilityDAO visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO(); -// int visibilityTypeId = visibilityDAO.getVisibilityID(visibility.getType()); -// visibilityDAO.delete(applicationID); -// visibilityDAO.add(applicationID, visibilityTypeId, visibility.getAllowedList()); -// if (!isTransactionStarted) { -// ConnectionManagerUtil.commitDBTransaction(); -// } -// return visibility; -// } catch (ApplicationManagementException e) { -// if (!isTransactionStarted) { -// ConnectionManagerUtil.rollbackDBTransaction(); -// } -// throw new VisibilityManagementException("Problem occured when trying to fetch the application with ID - " -// + applicationID, e); -// } finally { -// if (!isTransactionStarted) { -// ConnectionManagerUtil.closeDBConnection(); -// } -// } - } - - @Override - public List getUnrestrictedRoles(int applicationID, int tenantId) throws VisibilityManagementException { - try { - VisibilityDAO visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO(); - List unrestrictedRoles = visibilityDAO.getUnrestrictedRoles(applicationID, tenantId); - if (unrestrictedRoles == null) { - return null; - } - return unrestrictedRoles; - } catch (ApplicationManagementException e) { - throw new VisibilityManagementException("Problem occured when trying to fetch the application with ID - " - + applicationID, e); - } - } - - @Override - public void remove(int applicationID) throws VisibilityManagementException { -// boolean isTransactionStarted = false; -// try { -// isTransactionStarted = ConnectionManagerUtil.isTransactionStarted(); -// if (!isTransactionStarted) { -// ConnectionManagerUtil.beginDBTransaction(); -// } -// VisibilityDAO visibilityDAO = ApplicationManagementDAOFactory.getVisibilityDAO(); -// visibilityDAO.delete(applicationID); -// if (!isTransactionStarted) { -// ConnectionManagerUtil.commitDBTransaction(); -// } -// } catch (ApplicationManagementException e) { -// if (!isTransactionStarted) { -// ConnectionManagerUtil.rollbackDBTransaction(); -// } -// throw new VisibilityManagementException("Problem occurred when trying to fetch the application with ID - " -// + applicationID, e); -// } finally { -// if (!isTransactionStarted) { -// ConnectionManagerUtil.closeDBConnection(); -// } -// } - } - -} 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 cf891d5d1c..a560884d46 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,15 +22,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.osgi.framework.BundleContext; import org.osgi.service.component.ComponentContext; -import org.wso2.carbon.device.application.mgt.common.exception.InvalidConfigurationException; import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager; import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.application.mgt.common.services.UnrestrictedRoleManager; import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; import org.wso2.carbon.device.application.mgt.core.dao.common.ApplicationManagementDAOFactory; -import org.wso2.carbon.device.application.mgt.core.exception.ApplicationManagementDAOException; import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger; import org.wso2.carbon.device.application.mgt.core.lifecycle.config.LifecycleState; import org.wso2.carbon.device.application.mgt.core.util.ApplicationManagementUtil; @@ -38,7 +35,6 @@ import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.ndatasource.core.DataSourceService; import org.wso2.carbon.user.core.service.RealmService; -import javax.naming.NamingException; import java.util.List; /** @@ -90,10 +86,6 @@ public class ApplicationManagementServiceComponent { DataHolder.getInstance().setSubscriptionManager(subscriptionManager); bundleContext.registerService(SubscriptionManager.class.getName(), subscriptionManager, null); - UnrestrictedRoleManager unrestrictedRoleManager = ApplicationManagementUtil.getVisibilityManagerInstance(); - DataHolder.getInstance().setVisibilityManager(unrestrictedRoleManager); - bundleContext.registerService(UnrestrictedRoleManager.class.getName(), unrestrictedRoleManager, null); - ApplicationStorageManager applicationStorageManager = ApplicationManagementUtil .getApplicationStorageManagerInstance(); DataHolder.getInstance().setApplicationStorageManager(applicationStorageManager); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java index 68cfce54cd..f8e16027d5 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/internal/DataHolder.java @@ -22,7 +22,6 @@ import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.application.mgt.common.services.UnrestrictedRoleManager; import org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger; import org.wso2.carbon.device.mgt.core.service.DeviceManagementProviderService; import org.wso2.carbon.user.core.service.RealmService; @@ -42,8 +41,6 @@ public class DataHolder { private SubscriptionManager subscriptionManager; - private UnrestrictedRoleManager unrestrictedRoleManager; - private ApplicationStorageManager applicationStorageManager; private LifecycleStateManger lifecycleStateManger; @@ -90,14 +87,6 @@ public class DataHolder { this.subscriptionManager = subscriptionManager; } - public UnrestrictedRoleManager getVisibilityManager() { - return unrestrictedRoleManager; - } - - public void setVisibilityManager(UnrestrictedRoleManager unrestrictedRoleManager) { - this.unrestrictedRoleManager = unrestrictedRoleManager; - } - public RealmService getRealmService() { return realmService; } diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java index 1a0218b20b..bf614e0799 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/main/java/org/wso2/carbon/device/application/mgt/core/lifecycle/LifecycleStateManger.java @@ -26,9 +26,6 @@ public class LifecycleStateManger { } public boolean isValidStateChange(String currentState, String nextState) { - if (lifecycleStates.get(currentState).getProceedingStates().contains(nextState)) { - return true; - } - return false; + return lifecycleStates.get(currentState).getProceedingStates().contains(nextState); } } 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 488f8147b5..a108886164 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 @@ -25,7 +25,6 @@ import org.wso2.carbon.device.application.mgt.common.services.ApplicationManager import org.wso2.carbon.device.application.mgt.common.services.ApplicationStorageManager; import org.wso2.carbon.device.application.mgt.common.services.ReviewManager; import org.wso2.carbon.device.application.mgt.common.services.SubscriptionManager; -import org.wso2.carbon.device.application.mgt.common.services.UnrestrictedRoleManager; import org.wso2.carbon.device.application.mgt.core.config.ConfigurationManager; import org.wso2.carbon.device.application.mgt.core.config.Extension; @@ -51,12 +50,6 @@ public class ApplicationManagementUtil { return getInstance(extension, ReviewManager.class); } - public static UnrestrictedRoleManager getVisibilityManagerInstance() throws InvalidConfigurationException { - ConfigurationManager configurationManager = ConfigurationManager.getInstance(); - Extension extension = configurationManager.getExtension(Extension.Name.VisibilityManager); - return getInstance(extension, UnrestrictedRoleManager.class); - } - public static SubscriptionManager getSubscriptionManagerInstance() throws InvalidConfigurationException { ConfigurationManager configurationManager = ConfigurationManager.getInstance(); Extension extension = configurationManager.getExtension(Extension.Name.SubscriptionManager); diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml index b764b9e53e..a896bf9739 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.core/src/test/resources/application-mgt.xml @@ -23,39 +23,18 @@ jdbc/APPM_DS - - org.wso2.carbon.device.application.mgt.core.impl.ApplicationUploadManagerImpl - - repository/resources/mobileapps - - org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl - - org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl - - - org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl - - + org.wso2.carbon.device.application.mgt.core.impl.ReviewManagerImpl - org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl - - - org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl - - org.wso2.carbon.device.application.mgt.core.impl.UnrestrictedRoleManagerImpl - - - org.wso2.carbon.device.application.mgt.core.impl.VisibilityTypeManagerImpl - diff --git a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java index b850d5c0c7..a62ba819be 100644 --- a/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java +++ b/components/application-mgt/org.wso2.carbon.device.application.mgt.publisher.api/src/main/java/org/wso2/carbon/device/application/mgt/publisher/api/APIUtil.java @@ -37,7 +37,6 @@ public class APIUtil { private static ApplicationManager applicationManager; private static ApplicationStorageManager applicationStorageManager; private static SubscriptionManager subscriptionManager; - private static UnrestrictedRoleManager unrestrictedRoleManager; public static ApplicationManager getApplicationManager() { if (applicationManager == null) { @@ -116,26 +115,4 @@ public class APIUtil { return subscriptionManager; } - /** - * To get the Unrestricted Role manager from the osgi context. - * @return Unrestricted Role manager instance in the current osgi context. - */ - public static UnrestrictedRoleManager getUnrestrictedRoleManager() { - if (unrestrictedRoleManager == null) { - synchronized (APIUtil.class) { - if (unrestrictedRoleManager == null) { - PrivilegedCarbonContext ctx = PrivilegedCarbonContext.getThreadLocalCarbonContext(); - unrestrictedRoleManager = - (UnrestrictedRoleManager) ctx.getOSGiService(UnrestrictedRoleManager.class, null); - if (unrestrictedRoleManager == null) { - String msg = "Subscription Manager service has not initialized."; - log.error(msg); - throw new IllegalStateException(msg); - } - } - } - } - - return unrestrictedRoleManager; - } } diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml index 9bcbcf4fa4..59ae25af09 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/conf/application-mgt.xml @@ -25,27 +25,15 @@ org.wso2.carbon.device.application.mgt.core.impl.ApplicationManagerImpl - - org.wso2.carbon.device.application.mgt.core.impl.ApplicationReleaseManagerImpl - - - org.wso2.carbon.device.application.mgt.core.impl.CategoryManagerImpl - org.wso2.carbon.device.application.mgt.core.impl.ReviewManagerImpl - org.wso2.carbon.device.application.mgt.core.impl.LifecycleStateManagerImpl - - - org.wso2.carbon.device.application.mgt.core.impl.PlatformManagerImpl + org.wso2.carbon.device.application.mgt.core.lifecycle.LifecycleStateManger org.wso2.carbon.device.application.mgt.core.impl.SubscriptionManagerImpl - - org.wso2.carbon.device.application.mgt.core.impl.UnrestrictedRoleManagerImpl - org.wso2.carbon.device.application.mgt.core.impl.ApplicationStorageManagerImpl @@ -53,12 +41,6 @@ 6 - - org.wso2.carbon.device.application.mgt.core.impl.PlatformStorageManagerImpl - - repository/resources/platforms - -