Skip to content

Commit

Permalink
remove registry.lcmm
Browse files Browse the repository at this point in the history
  • Loading branch information
tharindu1st committed Mar 21, 2024
1 parent 633f719 commit 8386187
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 74 deletions.
5 changes: 1 addition & 4 deletions components/apimgt/org.wso2.carbon.apimgt.impl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -237,10 +237,7 @@
<groupId>org.apache.pdfbox</groupId>
<artifactId>pdfbox</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
</dependency>

<dependency>
<groupId>org.wso2.carbon.event-processing</groupId>
<artifactId>org.wso2.carbon.event.processor.stub</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,10 @@
import org.wso2.carbon.apimgt.impl.dto.ThrottleProperties;
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.loader.KeyManagerConfigurationDataRetriever;
import org.wso2.carbon.apimgt.impl.service.KeyMgtRegistrationService;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.governance.lcm.util.CommonUtil;
import org.wso2.carbon.registry.core.exceptions.RegistryException;
import org.wso2.carbon.utils.AbstractAxis2ConfigurationContextObserver;

import java.io.FileNotFoundException;

import javax.xml.stream.XMLStreamException;

/**
* This task provisions mandatory configs & Artifacts needed by any tenant. The reason for introducing this task is
* to prevent {@link org.wso2.carbon.apimgt.impl.observers.TenantServiceCreator} class being run on None-synapse
Expand Down Expand Up @@ -124,17 +117,6 @@ public void run() {
} catch (Exception e) { // The generic Exception is handled explicitly so execution does not stop during config deployment
log.error("Exception when creating default roles for tenant " + tenantDomain, e);
}
try {
CommonUtil.addDefaultLifecyclesIfNotAvailable(ServiceReferenceHolder.getInstance().getRegistryService()
.getConfigSystemRegistry(tenantId), CommonUtil
.getRootSystemRegistry(tenantId));
} catch (RegistryException e) {
log.error("Error while accessing registry", e);
} catch (FileNotFoundException e) {
log.error("Error while find lifecycle.xml", e);
} catch (XMLStreamException e) {
log.error("Error while parsing Lifecycle.xml", e);
}
KeyManagerConfigurationDataRetriever keyManagerConfigurationDataRetriever =
new KeyManagerConfigurationDataRetriever(tenantDomain);
keyManagerConfigurationDataRetriever.startLoadKeyManagerConfigurations();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import org.wso2.carbon.apimgt.impl.internal.ServiceReferenceHolder;
import org.wso2.carbon.apimgt.impl.utils.APIUtil;
import org.wso2.carbon.context.PrivilegedCarbonContext;
import org.wso2.carbon.governance.lcm.util.CommonUtil;
import org.wso2.carbon.registry.core.service.RegistryService;

import static org.wso2.carbon.base.CarbonBaseConstants.CARBON_HOME;
Expand Down
28 changes: 16 additions & 12 deletions components/apimgt/org.wso2.carbon.apimgt.persistence/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
<Import-Package>
org.apache.commons.logging.*; version="${import.package.version.commons.logging}",
org.wso2.carbon.registry.core.*; version="${carbon.registry.imp.pkg.version}",
org.wso2.carbon.governance.lcm.* version="${carbon.governance.version}",
org.apache.cxf.jaxrs.ext.multipart.* version="${cxf.version}"
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
Expand Down Expand Up @@ -100,17 +99,22 @@
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.registry.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
<exclusions>
<exclusion>
<groupId>jboss</groupId>
<artifactId>javassist</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.api</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon</groupId>
<artifactId>org.wso2.carbon.core</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.registry</groupId>
<artifactId>org.wso2.carbon.registry.indexing</artifactId>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.apimgt</groupId>
<artifactId>org.wso2.carbon.apimgt.api</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3080,7 +3080,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
loadTenantRegistry(tenantId);
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
holder.setTenantId(tenantId);
}
Expand All @@ -3089,7 +3088,6 @@ protected RegistryHolder getRegistry(String requestedTenantDomain) throws APIPer
loadTenantRegistry(tenantId);
registry = getRegistryService().getGovernanceSystemRegistry(tenantId);
RegistryPersistenceUtil.loadloadTenantAPIRXT(null, tenantId);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
RegistryPersistenceUtil.registerCustomQueries(registry, null, userTenantDomain);
holder.setTenantId(tenantId);
}
Expand Down Expand Up @@ -3151,7 +3149,6 @@ protected RegistryHolder getRegistry(String username, String requestedTenantDoma
holder.setTenantId(tenantId);
}
RegistryPersistenceUtil.registerCustomQueries(configRegistry, username, userTenantDomain);
RegistryPersistenceUtil.addLifecycleIfNotExists(tenantId);
} catch (RegistryException | UserStoreException | PersistenceException e) {
String msg = "Failed to get API";
throw new APIPersistenceException(msg, e);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@

import com.google.gson.Gson;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.commons.io.FileUtils;
import org.apache.commons.lang3.ArrayUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log;
Expand Down Expand Up @@ -53,7 +52,6 @@
import org.wso2.carbon.governance.api.generic.dataobjects.GenericArtifact;
import org.wso2.carbon.governance.api.util.GovernanceConstants;
import org.wso2.carbon.governance.api.util.GovernanceUtils;
import org.wso2.carbon.governance.lcm.util.CommonUtil;
import org.wso2.carbon.registry.core.ActionConstants;
import org.wso2.carbon.registry.core.Association;
import org.wso2.carbon.registry.core.Registry;
Expand All @@ -76,7 +74,6 @@
import org.wso2.carbon.utils.FileUtil;
import org.wso2.carbon.utils.multitenancy.MultitenantUtils;

import javax.xml.stream.XMLStreamException;
import java.io.File;
import java.io.FilenameFilter;
import java.io.IOException;
Expand All @@ -90,8 +87,6 @@
import java.util.Properties;
import java.util.Set;

import static org.wso2.carbon.apimgt.persistence.utils.PersistenceUtil.handleException;


public class RegistryPersistenceUtil {
private static final Log log = LogFactory.getLog(RegistryPersistenceUtil.class);
Expand Down Expand Up @@ -1816,31 +1811,6 @@ private static TenantManager getTenantManager(){
return ServiceReferenceHolder.getInstance().getRealmService().getTenantManager();
}

public static void addLifecycleIfNotExists(int tenantId) throws APIPersistenceException {
//Add default API LC if it is not there
try {
if (!CommonUtil.lifeCycleExists(APIConstants.API_LIFE_CYCLE,
getRegistryService().getConfigSystemRegistry(tenantId))) {
String defaultLifecyclePath = CommonUtil.getDefaltLifecycleConfigLocation() + File.separator
+ APIConstants.API_LIFE_CYCLE + APIConstants.XML_EXTENSION;
File file = new File(defaultLifecyclePath);
String content = null;
if (file != null && file.exists()) {
content = FileUtils.readFileToString(file);
}
if (content != null) {
CommonUtil.addLifecycle(content, getRegistryService().getConfigSystemRegistry(tenantId),
CommonUtil.getRootSystemRegistry(tenantId));
}
}
} catch (RegistryException e) {
throw new APIPersistenceException("Error occurred while adding default APILifeCycle.", e);
} catch (IOException e) {
throw new APIPersistenceException("Error occurred while loading APILifeCycle.xml.", e);
} catch (XMLStreamException e) {
throw new APIPersistenceException("Error occurred while adding default API LifeCycle.", e);
}
}

public static String extractProvider(String apiPath, String apiName) {
int startIndex = apiPath.indexOf(APIConstants.API_PROVIDER_SUFFIX_SLASH) +
Expand Down
12 changes: 6 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -930,12 +930,6 @@
<version>${carbon.governance.version}</version>
</dependency>

<dependency>
<groupId>org.wso2.carbon.governance</groupId>
<artifactId>org.wso2.carbon.governance.lcm</artifactId>
<version>${carbon.governance.version}</version>
</dependency>


<dependency>
<groupId>org.wso2.carbon.governance</groupId>
Expand Down Expand Up @@ -2003,6 +1997,12 @@
<artifactId>spotbugs-annotations</artifactId>
<version>${spotbugs.annotations.version}</version>
</dependency>
<dependency>
<groupId>javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.3.GA</version>
<scope>test</scope>
</dependency>
</dependencies>
</dependencyManagement>

Expand Down

0 comments on commit 8386187

Please sign in to comment.