Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,6 @@

<build>
<plugins>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,8 @@
<Export-Package>
org.wso2.micro.integrator.dataservices.common.*;version="${project.version}"
</Export-Package>
<Import-Package>
</Import-Package>
Comment on lines +47 to +48
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Empty Import-Package may cause missing dependencies.

The empty <Import-Package> block prevents automatic import calculation by the Maven Bundle Plugin. Unlike components/org.wso2.micro.integrator.ndatasource.common/pom.xml, this POM lacks a <DynamicImport-Package> fallback, which may lead to ClassNotFoundException at runtime.

Consider one of the following:

  • Remove the empty Import-Package block to enable automatic calculation
  • Add explicit package imports
  • Add <DynamicImport-Package>*</DynamicImport-Package> as a fallback (though this reduces build-time validation)
#!/bin/bash
# Description: Verify if the exported packages have external dependencies

# Find Java files in the source directory and check their imports
fd -e java . components/data/data-services/org.wso2.micro.integrator.dataservices.common/src/main/java/ \
  --exec grep -h '^import ' {} \; | \
  sort -u | \
  grep -v 'org.wso2.micro.integrator.dataservices.common'
🤖 Prompt for AI Agents
In
components/data/data-services/org.wso2.micro.integrator.dataservices.common/pom.xml
around lines 47-48 there is an empty <Import-Package> block which prevents the
Maven Bundle Plugin from calculating imports and may cause missing dependencies
at runtime; remove the empty <Import-Package> block to let imports be
auto-calculated, or alternatively replace it with explicit package import
entries listing required packages, or add a fallback
<DynamicImport-Package>*</DynamicImport-Package> if you need a broad runtime
import allowance—pick one of these fixes and update the POM accordingly.

</instructions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -418,11 +418,6 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import org.apache.olingo.server.api.etag.ServiceMetadataETagSupport;
import org.apache.olingo.server.api.serializer.SerializerException;
import org.apache.olingo.server.api.serializer.SerializerException.MessageKeys;
import org.apache.olingo.server.api.uri.UriHelper;;
import org.apache.olingo.server.api.uri.UriHelper;
import org.apache.olingo.server.core.ServiceMetadataImpl;
import org.apache.olingo.server.core.uri.UriHelperImpl;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,12 +150,6 @@ public <S> ServiceRegistration<S> registerService(Class<S> sClass, S s,
return null;
}

@Override
public <S> ServiceRegistration<S> registerService(Class<S> aClass, ServiceFactory<S> serviceFactory,
Dictionary<String, ?> dictionary) {
return null;
}

@Override
public ServiceReference<?>[] getServiceReferences(String s, String s2) throws InvalidSyntaxException {
return new ServiceReference<?>[0];
Expand Down Expand Up @@ -192,11 +186,6 @@ public boolean ungetService(ServiceReference<?> serviceReference) {
return false;
}

@Override
public <S> ServiceObjects<S> getServiceObjects(ServiceReference<S> serviceReference) {
return null;
}

@Override
public File getDataFile(String s) {
return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@
<description>WSO2 Data Services Core Bundle</description>

<dependencies>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>javax.servlet</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
<artifactId>org.wso2.micro.integrator.dataservices.core</artifactId>
Expand All @@ -63,10 +59,6 @@
<groupId>org.wso2.orbit.org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
</dependency>
<dependency>
<groupId>org.apache.ws.commons.axiom.wso2</groupId>
<artifactId>axiom</artifactId>
Expand Down Expand Up @@ -96,11 +88,9 @@
<Import-Package>
!org.wso2.micro.integrator.dataservices.odata.endpoint.*,
org.wso2.micro.integrator.dataservices.core.*;version="${project.version}",
javax.servlet.http;version="${javax.servlet.imp.pkg.version}",
org.apache.commons.logging;version="${carbon.commons.logging.imp.pkg.version}",
org.apache.axis2.*; version="${imp.pkg.version.axis2}",
org.apache.commons.collections4.*,
javax.servlet;version="${imp.pkg.version.javax.servlet}",
org.apache.axiom.*; version="${axiom.osgi.version.range}",
org.apache.synapse.*; version="${imp.pkg.version.synapse}",
org.apache.http.nio.*; version="${apache.http.nio.version}",
Expand All @@ -111,10 +101,6 @@
</configuration>
</plugin>

<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@
<artifactId>commons-logging</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
Expand Down Expand Up @@ -153,10 +155,6 @@
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-scr-plugin</artifactId>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.apache.axis2.clustering.ClusteringAgent;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.carbon.base.api.ServerConfigurationService;
import org.wso2.micro.integrator.core.services.ServerConfigurationService;

import javax.cache.spi.AnnotationProvider;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.osgi.framework.BundleContext;
import org.wso2.carbon.base.api.ServerConfigurationService;
import org.wso2.carbon.caching.impl.DataHolder;
import org.wso2.carbon.caching.impl.DistributedMapProvider;
import org.wso2.carbon.caching.impl.CachingAxisConfigurationObserver;
import org.wso2.carbon.utils.Axis2ConfigurationContextObserver;
import org.wso2.carbon.utils.ConfigurationContextService;
import org.wso2.micro.integrator.core.services.ServerConfigurationService;

@Component(name = "org.wso2.carbon.caching.impl.internal.CachingServiceComponent", immediate = true)
public class CachingServiceComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Bundle-Name>${project.artifactId}</Bundle-Name>
<Axis2Module>${project.artifactId}-${project.version}</Axis2Module>
<_contract>!*</_contract>
<Export-Package>
org.wso2.micro.integrator.observability.* ;version="${project.version}"
</Export-Package>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,14 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,14 @@
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<groupId>org.eclipse.platform</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
<exclusions>
<exclusion>
<groupId>org.eclipse.jetty.toolchain</groupId>
<artifactId>jetty-servlet</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@
<Export-Package>
org.wso2.carbon.mediator.cache.*,
</Export-Package>
<Import-Package>
</Import-Package>
Comment on lines +104 to +105
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check if other fragment bundles in the project use similar patterns
rg -A3 "Fragment-Host" --type xml -g "pom.xml" | rg -B1 -A2 "Import-Package"

Repository: wso2/product-micro-integrator

Length of output: 633


🏁 Script executed:

#!/bin/bash
# First, view the cache-mediator pom.xml around lines 104-105
echo "=== Cache-mediator pom.xml around lines 104-105 ==="
sed -n '100,110p' components/mediation/mediators/cache-mediator/org.wso2.carbon.mediator.cache/pom.xml

# Find all fragment bundles and their Import-Package patterns
echo -e "\n=== All fragment bundles with their instructions sections ==="
rg -B5 -A15 "Fragment-Host" --type xml -g "pom.xml" | grep -A15 "Fragment-Host"

Repository: wso2/product-micro-integrator

Length of output: 14876


Remove the explicitly empty <Import-Package> element or populate it with required packages.

The empty <Import-Package> element is inconsistent with other fragment bundles in the project. Most fragment bundles either omit Import-Package entirely (allowing bnd to auto-generate imports based on bytecode analysis) or explicitly list required packages. Combined with DynamicImport-Package:*, this configuration defers all package resolution to runtime, masking missing dependencies that would normally be caught at build time. Either remove the empty element to allow auto-generation, or explicitly list the packages this fragment actually imports.

🤖 Prompt for AI Agents
In
components/mediation/mediators/cache-mediator/org.wso2.carbon.mediator.cache/pom.xml
around lines 104-105, an explicitly empty <Import-Package> element is present;
remove this empty element (or alternatively replace it with an explicit
comma-separated list of the packages this fragment requires) so bnd can
auto-generate imports or so build-time package resolution is explicit; prefer
removing the empty element to match other fragments unless you know and can list
exact imports required.

<DynamicImport-Package>*</DynamicImport-Package>
<Fragment-Host>synapse-core</Fragment-Host>
</instructions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,6 @@

<dependencies>

<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.orbit.org.quartz-scheduler</groupId>
<artifactId>quartz</artifactId>
Expand Down Expand Up @@ -77,6 +73,9 @@
!org.wso2.micro.integrator.ntask.internal,
org.wso2.micro.integrator.ntask.core.*; version="${project.version}",
</Export-Package>
<Provide-Capability>
osgi.service;objectClass="org.wso2.micro.integrator.ntask.core.service.TaskService"
</Provide-Capability>
</instructions>
</configuration>
</plugin>
Expand Down
16 changes: 7 additions & 9 deletions components/org.wso2.micro.integrator.core/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,9 @@
<groupId>org.wso2.carbon.mediation</groupId>
<artifactId>org.wso2.carbon.sequences</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.osgi</groupId>
<artifactId>org.eclipse.osgi.services</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
<artifactId>org.eclipse.equinox.http.helper</artifactId>
<artifactId>javax.servlet</artifactId>
</dependency>
<dependency>
<groupId>org.eclipse.equinox</groupId>
Expand Down Expand Up @@ -156,6 +148,12 @@
org.apache.axis2.*; version="${imp.pkg.version.axis2}",
</Import-Package>
<DynamicImport-Package>*</DynamicImport-Package>
<Provide-Capability>
osgi.service;objectClass=org.wso2.micro.integrator.core.services.Axis2ConfigurationContextService,
osgi.service;objectClass=org.wso2.micro.integrator.core.UserStoreTemporaryService,
osgi.service;objectClass=org.wso2.micro.integrator.core.services.CarbonServerConfigurationService,
osgi.service;objectClass=org.wso2.micro.integrator.core.services.ServerConfigurationService
</Provide-Capability>
</instructions>
</configuration>
</plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.osgi.service.component.ComponentContext;
import org.osgi.service.component.annotations.Activate;
import org.osgi.service.component.annotations.Component;
import org.osgi.service.component.annotations.Deactivate;
import org.osgi.service.component.annotations.Reference;
import org.osgi.service.component.annotations.ReferenceCardinality;
import org.osgi.service.component.annotations.ReferencePolicy;
import org.wso2.micro.core.Constants;
Expand All @@ -36,8 +32,7 @@
import javax.transaction.TransactionManager;
import javax.transaction.UserTransaction;

@Component(name = "org.wso2.micro.integrator.transaction.manager.TransactionManagerComponent",
immediate = true)
//TODO: need a way to solve javax.transaction service dependency
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: TODO indicates incomplete refactoring.

The TODO comment acknowledges an unresolved dependency issue for javax.transaction services. This placeholder suggests the refactoring is incomplete and the transaction manager wiring needs to be addressed before merging.

public class TransactionManagerComponent {

private static Log log = LogFactory.getLog(TransactionManagerComponent.class);
Expand All @@ -49,23 +44,16 @@ public class TransactionManagerComponent {
/* class level lock for controlling synchronized access to static variables */
private static Object txManagerComponentLock = new Object();

@Activate
protected void activate(ComponentContext ctxt) {

bindTransactionManagerWithJNDI();
log.debug("Transaction Manager bundle is activated ");
}
Comment on lines 47 to 51
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Log Improvement Suggestion No: 1

Suggested change
protected void activate(ComponentContext ctxt) {
bindTransactionManagerWithJNDI();
log.debug("Transaction Manager bundle is activated ");
}
protected void activate(ComponentContext ctxt) {
bindTransactionManagerWithJNDI();
log.info("Transaction Manager component activated successfully");
log.debug("Transaction Manager bundle is activated ");


@Deactivate
protected void deactivate(ComponentContext ctxt) {
log.debug("Transaction Manager bundle is deactivated ");
}

@Reference(name = "transactionmanager",
service = TransactionManager.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetTransactionManager")
protected void setTransactionManager(TransactionManager txManager) {

synchronized (txManagerComponentLock) {
Expand All @@ -88,11 +76,6 @@ private static TransactionManager getTransactionManager() {
return txManager;
}

@Reference(name = "usertransaction",
service = UserTransaction.class,
cardinality = ReferenceCardinality.MANDATORY,
policy = ReferencePolicy.DYNAMIC,
unbind = "unsetUserTransaction")
protected void setUserTransaction(UserTransaction userTransaction) {

synchronized (txManagerComponentLock) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,6 @@
<packaging>bundle</packaging>

<dependencies>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-junit4</artifactId>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito2</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.ei</groupId>
<artifactId>org.wso2.micro.integrator.inbound.endpoint</artifactId>
Expand Down Expand Up @@ -64,6 +56,11 @@
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -84,7 +81,7 @@
com.nimbusds.jose.jwk;version="${nimbus-jose.orbit.imp.pkg.version}",
com.nimbusds.jose.crypto;version="${nimbus-jose.orbit.imp.pkg.version}",
com.nimbusds.jwt;version="${nimbus-jose.orbit.imp.pkg.version}",
org.osgi.service.cm;version="${version.eclipse.equinox.cm}",
org.osgi.service.cm;version=${osgi.service.cm.version},
org.apache.commons.configuration2;version="${commons.configuration2.imp.pkg.version}",
*;resolution:=optional
</Import-Package>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,16 @@
import org.apache.axiom.om.OMElement;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.PowerMockRunner;
import org.wso2.carbon.inbound.endpoint.internal.http.api.ConfigurationLoader;
import org.wso2.micro.core.util.CarbonException;
import org.wso2.micro.integrator.core.internal.MicroIntegratorBaseConstants;

import javax.xml.stream.XMLStreamException;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import static org.wso2.micro.integrator.management.apis.Constants.MGT_API_NAME;
import static org.wso2.micro.integrator.management.apis.Constants.NAME_ATTR;


@RunWith(PowerMockRunner.class)
@PrepareForTest(ConfigurationLoader.class)
@PowerMockIgnore({"javax.xml.*", "org.xml.*", "javax.management.*", "javax.xml.parsers.*", "javax.naming.spi.*", "javax.naming.*", "javax" +
".xml.stream.*", "org.apache.xerces.jaxp.*", "com.sun.org.apache.xerces.internal.jaxp.*", "org.w3c.dom.*"})
public class ManagementApiParserTest {

private void initializeConfDirectory() {
Expand Down
Loading