Skip to content

Commit 403a941

Browse files
committed
remove registry.lcmm
1 parent 42c59d0 commit 403a941

File tree

7 files changed

+24
-81
lines changed

7 files changed

+24
-81
lines changed

components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml

+1-4
Original file line numberDiff line numberDiff line change
@@ -237,10 +237,7 @@
237237
<groupId>org.apache.pdfbox</groupId>
238238
<artifactId>pdfbox</artifactId>
239239
</dependency>
240-
<dependency>
241-
<groupId>org.wso2.carbon.governance</groupId>
242-
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
243-
</dependency>
240+
244241
<dependency>
245242
<groupId>org.wso2.carbon.event-processing</groupId>
246243
<artifactId>org.wso2.carbon.event.processor.stub</artifactId>

components/apimgt/org.wso2.carbon.apimgt.impl/src/main/java/org/wso2/carbon/apimgt/impl/observers/CommonConfigDeployer.java

-18
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,10 @@
2929
import org.wso2.carbon.apimgt.impl.dto.ThrottleProperties;
3030
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
3131
import org.wso2.carbon.apimgt.impl.loader.KeyManagerConfigurationDataRetriever;
32-
import org.wso2.carbon.apimgt.impl.service.KeyMgtRegistrationService;
3332
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
3433
import org.wso2.carbon.context.PrivilegedCarbonContext;
35-
import org.wso2.carbon.governance.lcm.util.CommonUtil;
36-
import org.wso2.carbon.registry.core.exceptions.RegistryException;
3734
import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver;
3835

39-
import java.io.FileNotFoundException;
40-
41-
import javax.xml.stream.XMLStreamException;
42-
4336
/**
4437
* This task provisions mandatory configs & Artifacts needed by any tenant. The reason for introducing this task is
4538
* to prevent {@link org.wso2.carbon.apimgt.impl.observers.TenantServiceCreator} class being run on None-synapse
@@ -124,17 +117,6 @@ public void run() {
124117
} catch (Exception e) { // The generic Exception is handled explicitly so execution does not stop during config deployment
125118
log.error("Exception when creating default roles for tenant " + tenantDomain, e);
126119
}
127-
try {
128-
CommonUtil.addDefaultLifecyclesIfNotAvailable(ServiceReferenceHolder.getInstance().getRegistryService()
129-
.getConfigSystemRegistry(tenantId), CommonUtil
130-
.getRootSystemRegistry(tenantId));
131-
} catch (RegistryException e) {
132-
log.error("Error while accessing registry", e);
133-
} catch (FileNotFoundException e) {
134-
log.error("Error while find lifecycle.xml", e);
135-
} catch (XMLStreamException e) {
136-
log.error("Error while parsing Lifecycle.xml", e);
137-
}
138120
KeyManagerConfigurationDataRetriever keyManagerConfigurationDataRetriever =
139121
new KeyManagerConfigurationDataRetriever(tenantDomain);
140122
keyManagerConfigurationDataRetriever.startLoadKeyManagerConfigurations();

components/apimgt/org.wso2.carbon.apimgt.impl/src/test/java/org/wso2/carbon/apimgt/impl/observers/CommonConfigDeployerTestCase.java

+1-8
Original file line numberDiff line numberDiff line change
@@ -30,22 +30,20 @@
3030
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
3131
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
3232
import org.wso2.carbon.context.PrivilegedCarbonContext;
33-
import org.wso2.carbon.governance.lcm.util.CommonUtil;
3433
import org.wso2.carbon.registry.core.service.RegistryService;
3534

3635
import static org.wso2.carbon.base.CarbonBaseConstants.CARBON_HOME;
3736

3837

3938
@RunWith(PowerMockRunner.class)
40-
@PrepareForTest({APIUtil.class, PrivilegedCarbonContext.class, ServiceReferenceHolder.class, CommonUtil.class})
39+
@PrepareForTest({APIUtil.class, PrivilegedCarbonContext.class, ServiceReferenceHolder.class})
4140
public class CommonConfigDeployerTestCase {
4241

4342
private final int TENANT_ID = 1234;
4443
private final String TENANT_DOMAIN = "foo.com";
4544

4645
@Test
4746
public void testCreatedConfigurationContext() throws APIManagementException {
48-
PowerMockito.mockStatic(CommonUtil.class);
4947
System.setProperty(CARBON_HOME, "");
5048
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
5149
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
@@ -84,16 +82,12 @@ public void testCreatedConfigurationContext() throws APIManagementException {
8482

8583
PowerMockito.verifyStatic(APIUtil.class);
8684
APIUtil.loadAndSyncTenantConf(TENANT_DOMAIN);
87-
88-
//PowerMockito.verifyStatic(APIUtil.class);
89-
//APIUtil.addDefaultTenantAdvancedThrottlePolicies(TENANT_DOMAIN, TENANT_ID);
9085
}
9186

9287

9388
@Test
9489
public void testExceptions() throws Exception {
9590
PowerMockito.mockStatic(APIUtil.class);
96-
PowerMockito.mockStatic(CommonUtil.class);
9791
System.setProperty(CARBON_HOME, "");
9892
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
9993
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
@@ -144,7 +138,6 @@ public void testExceptions() throws Exception {
144138
@Test
145139
public void testCreatedConfigurationContextRuntimeException() throws APIManagementException {
146140
System.setProperty(CARBON_HOME, "");
147-
PowerMockito.mockStatic(CommonUtil.class);
148141
PrivilegedCarbonContext privilegedCarbonContext = Mockito.mock(PrivilegedCarbonContext.class);
149142
PowerMockito.mockStatic(PrivilegedCarbonContext.class);
150143
PowerMockito.when(PrivilegedCarbonContext.getThreadLocalCarbonContext()).thenReturn(privilegedCarbonContext);

components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml

+16-12
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@
3737
<Import-Package>
3838
org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
3939
org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}",
40-
org.wso2.carbon.governance.lcm.* version="${carbon.governance.version}",
4140
org.apache.cxf.jaxrs.ext.multipart.* version="${cxf.version}"
4241
</Import-Package>
4342
<DynamicImport-Package>*</DynamicImport-Package>
@@ -100,17 +99,22 @@
10099
<groupId>org.wso2.carbon</groupId>
101100
<artifactId>org.wso2.carbon.registry.core</artifactId>
102101
</dependency>
103-
<dependency>
104-
<groupId>org.wso2.carbon.governance</groupId>
105-
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
106-
<exclusions>
107-
<exclusion>
108-
<groupId>jboss</groupId>
109-
<artifactId>javassist</artifactId>
110-
</exclusion>
111-
</exclusions>
112-
</dependency>
113-
102+
<dependency>
103+
<groupId>org.wso2.carbon.governance</groupId>
104+
<artifactId>org.wso2.carbon.governance.api</artifactId>
105+
</dependency>
106+
<dependency>
107+
<groupId>org.wso2.carbon</groupId>
108+
<artifactId>org.wso2.carbon.core</artifactId>
109+
</dependency>
110+
<dependency>
111+
<groupId>org.wso2.carbon.registry</groupId>
112+
<artifactId>org.wso2.carbon.registry.indexing</artifactId>
113+
</dependency>
114+
<dependency>
115+
<groupId>javassist</groupId>
116+
<artifactId>javassist</artifactId>
117+
</dependency>
114118
<dependency>
115119
<groupId>org.wso2.carbon.apimgt</groupId>
116120
<artifactId>org.wso2.carbon.apimgt.api</artifactId>

components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/RegistryPersistenceImpl.java

-3
Original file line numberDiff line numberDiff line change
@@ -3080,7 +3080,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
30803080
loadTenantRegistry(tenantId);
30813081
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
30823082
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
3083-
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
30843083
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
30853084
holder.setTenantId(tenantId);
30863085
}
@@ -3089,7 +3088,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
30893088
loadTenantRegistry(tenantId);
30903089
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
30913090
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
3092-
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
30933091
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
30943092
holder.setTenantId(tenantId);
30953093
}
@@ -3151,7 +3149,6 @@ protected RegistryHolder getRegistry(String username, String requestedTenantDoma
31513149
holder.setTenantId(tenantId);
31523150
}
31533151
RegistryPersistenceUtil.registerCustomQueries(configRegistry, username, userTenantDomain);
3154-
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
31553152
} catch (RegistryException | UserStoreException | PersistenceException e) {
31563153
String msg = "Failed to get API";
31573154
throw new APIPersistenceException(msg, e);

components/apimgt/org.wso2.carbon.apimgt.persistence/src/main/java/org/wso2/carbon/apimgt/persistence/utils/RegistryPersistenceUtil.java

-30
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818

1919
import com.google.gson.Gson;
2020
import org.apache.axis2.context.ConfigurationContext;
21-
import org.apache.commons.io.FileUtils;
2221
import org.apache.commons.lang3.ArrayUtils;
2322
import org.apache.commons.lang3.StringUtils;
2423
import org.apache.commons.logging.Log;
@@ -53,7 +52,6 @@
5352
import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
5453
import org.wso2.carbon.governance.api.util.GovernanceConstants;
5554
import org.wso2.carbon.governance.api.util.GovernanceUtils;
56-
import org.wso2.carbon.governance.lcm.util.CommonUtil;
5755
import org.wso2.carbon.registry.core.ActionConstants;
5856
import org.wso2.carbon.registry.core.Association;
5957
import org.wso2.carbon.registry.core.Registry;
@@ -76,7 +74,6 @@
7674
import org.wso2.carbon.utils.FileUtil;
7775
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;
7876

79-
import javax.xml.stream.XMLStreamException;
8077
import java.io.File;
8178
import java.io.FilenameFilter;
8279
import java.io.IOException;
@@ -90,8 +87,6 @@
9087
import java.util.Properties;
9188
import java.util.Set;
9289

93-
import static org.wso2.carbon.apimgt.persistence.utils.PersistenceUtil.handleException;
94-
9590

9691
public class RegistryPersistenceUtil {
9792
private static final Log log = LogFactory.getLog(RegistryPersistenceUtil.class);
@@ -1816,31 +1811,6 @@ private static TenantManager getTenantManager(){
18161811
return ServiceReferenceHolder.getInstance().getRealmService().getTenantManager();
18171812
}
18181813

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-
}
18441814

18451815
public static String extractProvider(String apiPath, String apiName) {
18461816
int startIndex = apiPath.indexOf(APIConstants.API_PROVIDER_SUFFIX_SLASH) +

pom.xml

+6-6
Original file line numberDiff line numberDiff line change
@@ -930,12 +930,6 @@
930930
<version>${carbon.governance.version}</version>
931931
</dependency>
932932

933-
<dependency>
934-
<groupId>org.wso2.carbon.governance</groupId>
935-
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
936-
<version>${carbon.governance.version}</version>
937-
</dependency>
938-
939933

940934
<dependency>
941935
<groupId>org.wso2.carbon.governance</groupId>
@@ -2003,6 +1997,12 @@
20031997
<artifactId>spotbugs-annotations</artifactId>
20041998
<version>${spotbugs.annotations.version}</version>
20051999
</dependency>
2000+
<dependency>
2001+
<groupId>javassist</groupId>
2002+
<artifactId>javassist</artifactId>
2003+
<version>3.3.GA</version>
2004+
<scope>test</scope>
2005+
</dependency>
20062006
</dependencies>
20072007
</dependencyManagement>
20082008

0 commit comments

Comments
 (0)