Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Cleanup Dependencies to rely on Spring Dependencies Tree - Meeds-io/MIPs#57 #61

Merged
merged 1 commit into from
Jan 11, 2024
Merged
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
4 changes: 2 additions & 2 deletions exo.kernel.component.cache/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,8 @@
<artifactId>exo.kernel.component.common</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
</dependency>
<dependency>
<groupId>org.exoplatform.kernel</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
*/
package org.exoplatform.services.cache.impl;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.exoplatform.commons.utils.ClassLoading;
import org.exoplatform.container.component.ComponentPlugin;
import org.exoplatform.container.xml.InitParams;
Expand Down
10 changes: 0 additions & 10 deletions exo.kernel.component.common/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,6 @@
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
</exclusion>
<exclusion>
<groupId>commons-pool</groupId>
<artifactId>commons-pool</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>commons-pool</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,10 @@ public CloseableDataSource(DataSource ds)
this.ds = ds;
}

public DataSource getDataSource() {
return ds;
}

/**
* {@inheritDoc}
*/
Expand Down
4 changes: 0 additions & 4 deletions exo.kernel.component.ext.cache.impl.infinispan.v8/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -88,10 +88,6 @@
<groupId>org.exoplatform.kernel</groupId>
<artifactId>exo.kernel.container</artifactId>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,11 @@ public ComponentAdapter<?> unregisterComponent(Object componentKey)
return delegate.unregisterComponent(componentKey);
}

@Override
public <T> void registerComponentAdapter(ComponentAdapter<T> componentAdapter) {
delegate.registerComponentAdapter(componentAdapter);
}

/**
* {@inheritDoc}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,15 @@ public <T> List<ComponentAdapter<T>> getComponentAdaptersOfType(Class<T> compone
return found;
}

@Override
public <T> void registerComponentAdapter(ComponentAdapter<T> componentAdapter) {
Object componentKey = componentAdapter.getComponentKey();
if (componentKeyToAdapterCache.putIfAbsent(componentKey, componentAdapter) != null) {
throw new ContainerException("Key " + componentKey + " duplicated");
}
componentAdapters.add(componentAdapter);
}

/**
* Register a component via a ComponentAdapter. Use this if you need fine grained control over what
* ComponentAdapter to use for a specific component.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
package org.exoplatform.container.component;

import org.exoplatform.container.ExoContainer;
import org.exoplatform.container.ExoContainerContext;

import java.util.IdentityHashMap;
import java.util.List;
Expand Down Expand Up @@ -168,6 +169,29 @@ public static Map<Object, Throwable> end() throws IllegalStateException
return result;
}

protected void restartTransaction() {
restartTransaction(ExoContainerContext.getCurrentContainer());
}

protected void restartTransaction(ExoContainer container) {
int i = 0;
// Close transactions until no encapsulated transaction
boolean success = true;
do {
try {
end();
i++;
} catch (IllegalStateException e) {
success = false;
}
} while (success);

// Restart transactions with the same number of encapsulations
for (int j = 0; j < i; j++) {
begin(container);
}
}

/**
* Check Component Request Lifecycle status
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,13 @@ <T> ComponentAdapter<T> registerComponentInstance(Object componentKey, T compone
*/
ComponentAdapter<?> unregisterComponent(Object componentKey);

/**
* Register a component adapter.
*
* @param componentAdapter ComponentAdapter to register.
*/
<T> void registerComponentAdapter(ComponentAdapter<T> componentAdapter);

/**
* Gives the corresponding {@link ManagementContext}
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ public interface Startable
/**
* Start this component. Called initially at the begin of the lifecycle. It can be called again after a stop.
*/
void start();
default void start() {}

/**
* Stop this component. Called near the end of the lifecycle. It can be called again after a further start. Implement
* {@link Disposable} if you need a single call at the definite end of the lifecycle.
*/
void stop();
default void stop() {}
}