|
18 | 18 |
|
19 | 19 | import com.google.gson.Gson;
|
20 | 20 | import org.apache.axis2.context.ConfigurationContext;
|
21 |
| -import org.apache.commons.io.FileUtils; |
22 | 21 | import org.apache.commons.lang3.ArrayUtils;
|
23 | 22 | import org.apache.commons.lang3.StringUtils;
|
24 | 23 | import org.apache.commons.logging.Log;
|
|
53 | 52 | import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
|
54 | 53 | import org.wso2.carbon.governance.api.util.GovernanceConstants;
|
55 | 54 | import org.wso2.carbon.governance.api.util.GovernanceUtils;
|
56 |
| -import org.wso2.carbon.governance.lcm.util.CommonUtil; |
57 | 55 | import org.wso2.carbon.registry.core.ActionConstants;
|
58 | 56 | import org.wso2.carbon.registry.core.Association;
|
59 | 57 | import org.wso2.carbon.registry.core.Registry;
|
|
76 | 74 | import org.wso2.carbon.utils.FileUtil;
|
77 | 75 | import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
|
78 | 76 |
|
79 |
| -import javax.xml.stream.XMLStreamException; |
80 | 77 | import java.io.File;
|
81 | 78 | import java.io.FilenameFilter;
|
82 | 79 | import java.io.IOException;
|
|
90 | 87 | import java.util.Properties;
|
91 | 88 | import java.util.Set;
|
92 | 89 |
|
93 |
| -import static org.wso2.carbon.apimgt.persistence.utils.PersistenceUtil.handleException; |
94 |
| - |
95 | 90 |
|
96 | 91 | public class RegistryPersistenceUtil {
|
97 | 92 | private static final Log log = LogFactory.getLog(RegistryPersistenceUtil.class);
|
@@ -1816,31 +1811,6 @@ private static TenantManager getTenantManager(){
|
1816 | 1811 | return ServiceReferenceHolder.getInstance().getRealmService().getTenantManager();
|
1817 | 1812 | }
|
1818 | 1813 |
|
1819 |
| - public static void addLifecycleIfNotExists(int tenantId) throws APIPersistenceException { |
1820 |
| - //Add default API LC if it is not there |
1821 |
| - try { |
1822 |
| - if (!CommonUtil.lifeCycleExists(APIConstants.API_LIFE_CYCLE, |
1823 |
| - getRegistryService().getConfigSystemRegistry(tenantId))) { |
1824 |
| - String defaultLifecyclePath = CommonUtil.getDefaltLifecycleConfigLocation() + File.separator |
1825 |
| - + APIConstants.API_LIFE_CYCLE + APIConstants.XML_EXTENSION; |
1826 |
| - File file = new File(defaultLifecyclePath); |
1827 |
| - String content = null; |
1828 |
| - if (file != null && file.exists()) { |
1829 |
| - content = FileUtils.readFileToString(file); |
1830 |
| - } |
1831 |
| - if (content != null) { |
1832 |
| - CommonUtil.addLifecycle(content, getRegistryService().getConfigSystemRegistry(tenantId), |
1833 |
| - CommonUtil.getRootSystemRegistry(tenantId)); |
1834 |
| - } |
1835 |
| - } |
1836 |
| - } catch (RegistryException e) { |
1837 |
| - throw new APIPersistenceException("Error occurred while adding default APILifeCycle.", e); |
1838 |
| - } catch (IOException e) { |
1839 |
| - throw new APIPersistenceException("Error occurred while loading APILifeCycle.xml.", e); |
1840 |
| - } catch (XMLStreamException e) { |
1841 |
| - throw new APIPersistenceException("Error occurred while adding default API LifeCycle.", e); |
1842 |
| - } |
1843 |
| - } |
1844 | 1814 |
|
1845 | 1815 | public static String extractProvider(String apiPath, String apiName) {
|
1846 | 1816 | int startIndex = apiPath.indexOf(APIConstants.API_PROVIDER_SUFFIX_SLASH) +
|
|
0 commit comments