From 20096f22239da3b825f7ad5cab24846ae6cc2256 Mon Sep 17 00:00:00 2001 From: Boubaker Khanfir Date: Fri, 15 Nov 2024 17:39:59 +0100 Subject: [PATCH] feat: Drop usage of ISPN, Database and Transaction Service - MEED-7742 - Meeds-io/meeds#2537 (#1003) This change will drop usage of ISPN and a useless dependency to core.database artifact. --- component/api/pom.xml | 26 - .../commons/InitialContextInitializer2.java | 11 +- component/common/pom.xml | 10 - .../JTAUserTransactionLifecycleListener.java | 45 -- .../JTAUserTransactionLifecycleService.java | 57 -- ...TAUserTransactionLifecycleServiceImpl.java | 157 ------ .../infinispan/cluster/cache-async-config.xml | 61 -- .../cache/infinispan/cluster/cache-config.xml | 54 -- .../cache/infinispan/local/cache-config.xml | 45 -- .../conf/jgroups/jgroups-service-tcp.xml | 106 ---- .../conf/jgroups/jgroups-service-udp.xml | 108 ---- .../common/transaction/CounterListener.java | 55 -- .../transaction/JTAUserTransactionTest.java | 106 ---- ...onent.settings-configuration-local-jta.xml | 72 --- component/identity/pom.xml | 10 - .../organization/idm/AbstractDAOImpl.java | 21 +- .../services/organization/idm/Config.java | 10 - .../idm/IDMTransactionSyncListener.java | 56 -- ...viceImpl.java => IdmHibernateService.java} | 21 +- .../PicketLinkIDMOrganizationServiceImpl.java | 523 ++++++++---------- .../idm/PicketLinkIDMServiceImpl.java | 207 ++++--- .../services/organization/TestBootstrap.java | 6 +- .../TestOrganizationServiceJTA.java | 42 -- ...cketLinkIDMOrganizationServiceWrapper.java | 47 -- .../test/resources/conf/cache/infinispan.xml | 41 -- ...component.identity-configuration-local.xml | 6 +- ...tity-external-ldap-store-configuration.xml | 6 +- ....component.identity-ldap-configuration.xml | 6 +- ...ntity-ldap-parameterized-configuration.xml | 6 +- ....identity-ldap-user-only-configuration.xml | 6 +- .../portal/cache-configuration-template.xml | 41 -- .../standalone/test-tck-configuration.xml | 1 - .../src/test/resources/ldap/infinispan.xml | 38 -- .../resources/ldap/test-identity-config.xml | 8 - .../TestOrganizationService-configuration.xml | 2 +- ...tOrganizationService-jta-configuration.xml | 57 -- component/portal/pom.xml | 10 - .../portal/mop/storage/TestDataStorage.java | 28 - .../portal/mop/storage/TestModelStorage.java | 1 - component/test/core/pom.xml | 6 + .../conf/base-portal-configuration.xml | 2 - .../component/test/BootstrapTestCase.java | 7 +- .../conf/test-jdbc-configuration.xml | 2 +- .../controller/resource/ScriptLoader.java | 3 +- .../conf/common/common-configuration.xml | 79 +-- .../conf/organization/idm-configuration.xml | 102 +--- .../conf/portal/portal-configuration.xml | 125 ----- 47 files changed, 368 insertions(+), 2071 deletions(-) delete mode 100644 component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleListener.java delete mode 100644 component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleService.java delete mode 100644 component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleServiceImpl.java delete mode 100644 component/common/src/main/resources/conf/cache/infinispan/cluster/cache-async-config.xml delete mode 100644 component/common/src/main/resources/conf/cache/infinispan/cluster/cache-config.xml delete mode 100644 component/common/src/main/resources/conf/cache/infinispan/local/cache-config.xml delete mode 100644 component/common/src/main/resources/conf/jgroups/jgroups-service-tcp.xml delete mode 100644 component/common/src/main/resources/conf/jgroups/jgroups-service-udp.xml delete mode 100644 component/common/src/test/java/org/gatein/common/transaction/CounterListener.java delete mode 100644 component/common/src/test/java/org/gatein/common/transaction/JTAUserTransactionTest.java delete mode 100644 component/common/src/test/resources/conf/exo.portal.component.settings-configuration-local-jta.xml delete mode 100644 component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMTransactionSyncListener.java rename component/identity/src/main/java/org/exoplatform/services/organization/idm/{CustomHibernateServiceImpl.java => IdmHibernateService.java} (90%) delete mode 100644 component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationServiceJTA.java delete mode 100644 component/identity/src/test/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceWrapper.java delete mode 100644 component/identity/src/test/resources/conf/cache/infinispan.xml delete mode 100644 component/identity/src/test/resources/conf/portal/cache-configuration-template.xml delete mode 100644 component/identity/src/test/resources/ldap/infinispan.xml delete mode 100644 component/identity/src/test/resources/org/exoplatform/services/organization/TestOrganizationService-jta-configuration.xml diff --git a/component/api/pom.xml b/component/api/pom.xml index 3005792c15..3b2e09546c 100644 --- a/component/api/pom.xml +++ b/component/api/pom.xml @@ -57,14 +57,6 @@ io.meeds.kernel exo.kernel.component.cache - - io.meeds.kernel - exo.kernel.component.command - - - io.meeds.core - exo.core.component.database - io.meeds.core exo.core.component.organization.api @@ -198,24 +190,6 @@ org.hibernate.orm hibernate-core - - - org.slf4j - slf4j-api - - - org.jboss.spec.javax.transaction - jboss-transaction-api_1.1_spec - - - org.jboss.logging - jboss-logging - - - org.javassist - javassist - - org.liquibase diff --git a/component/api/src/main/java/org/exoplatform/commons/InitialContextInitializer2.java b/component/api/src/main/java/org/exoplatform/commons/InitialContextInitializer2.java index e981c6640a..cc91938029 100644 --- a/component/api/src/main/java/org/exoplatform/commons/InitialContextInitializer2.java +++ b/component/api/src/main/java/org/exoplatform/commons/InitialContextInitializer2.java @@ -28,6 +28,7 @@ import org.exoplatform.container.xml.InitParams; import org.exoplatform.services.naming.BindReferencePlugin; import org.exoplatform.services.naming.InitialContextInitializer; +import org.exoplatform.services.naming.SimpleContextFactory; /** * This code should be moved in the core, for now it is here as it is needed here. It extends the @@ -42,6 +43,7 @@ public class InitialContextInitializer2 extends InitialContextInitializer implem public InitialContextInitializer2(InitParams params) throws Exception { // NOSONAR super(params); + System.setProperty("java.naming.factory.initial", SimpleContextFactory.class.getName()); } @Override @@ -58,13 +60,4 @@ public void addPlugin(ComponentPlugin plugin) { } } - @Override - public void start() { - // Nothing to start - } - - @Override - public void stop() { - // Nothing to stop - } } diff --git a/component/common/pom.xml b/component/common/pom.xml index 3e5bf4e63f..14660b5f63 100644 --- a/component/common/pom.xml +++ b/component/common/pom.xml @@ -52,16 +52,6 @@ lombok provided - - - io.meeds.kernel - exo.kernel.component.ext.cache.impl.infinispan.v8 - - test - diff --git a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleListener.java b/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleListener.java deleted file mode 100644 index eb1102fa64..0000000000 --- a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleListener.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.gatein.common.transaction; - -/** - * Listener for perform some actions at the specified point of JTA transaction lifecycle.
- * Transaction lifecycle needs to be managed through {@link JTAUserTransactionLifecycleService} to have listeners executed.
- * - * For now, we have shared instance of one registered listener for all transactions, so listener implementations need to be - * thread-safe - * - * @author Marek Posolda - */ -public interface JTAUserTransactionLifecycleListener { - /** - * Callback method to be executed before start of JTA transaction - */ - void beforeBegin(); - - /** - * Callback method to be executed after start of JTA transaction - */ - void afterBegin(); -} diff --git a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleService.java b/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleService.java deleted file mode 100644 index 8365f5ef55..0000000000 --- a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleService.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.gatein.common.transaction; - -import javax.transaction.UserTransaction; - - -/** - * Service provides methods for managing lifecycle of JTA transaction - * - * @author Marek Posolda - */ -public interface JTAUserTransactionLifecycleService { - - /** - * @return instance of UserTransaction - */ - UserTransaction getUserTransaction(); - - /** - * Commit or Rollback JTA transaction according to it's current status - */ - void finishJTATransaction(); - - /** - * Starts JTA transaction if not already started - */ - void beginJTATransaction(); - - /** - * Register listener to perform some operations during transaction lifecycle - * - * @param listener to be registered - */ - void registerListener(JTAUserTransactionLifecycleListener listener); -} diff --git a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleServiceImpl.java b/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleServiceImpl.java deleted file mode 100644 index f73d4a0d55..0000000000 --- a/component/common/src/main/java/org/gatein/common/transaction/JTAUserTransactionLifecycleServiceImpl.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.gatein.common.transaction; - -import java.util.LinkedList; -import java.util.List; - -import javax.naming.InitialContext; -import javax.naming.NamingException; -import javax.transaction.Status; -import javax.transaction.UserTransaction; - -import org.exoplatform.services.transaction.TransactionService; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; - -/** - * Base implementation of {@link JTAUserTransactionLifecycleService} . - * - * @author Marek Posolda - */ -public class JTAUserTransactionLifecycleServiceImpl implements JTAUserTransactionLifecycleService { - private static final Log log = ExoLogger.getLogger(JTAUserTransactionLifecycleServiceImpl.class); - - private UserTransaction userTransaction; - - private TransactionService transactionService; - - // For now, we have one listener instance for all transactions - private List listeners = new LinkedList<>(); - - public JTAUserTransactionLifecycleServiceImpl(TransactionService transactionService) { - this.transactionService = transactionService; - } - - public JTAUserTransactionLifecycleServiceImpl() { - } - - /** - * {@inheritDoc} - */ - public void beginJTATransaction() { - UserTransaction tx = getUserTransaction(); - - try { - if (tx == null) { - // for test scope, this may happen - log.debug("UserTransaction is null, ignore transactional behavior"); - } else if (tx.getStatus() == Status.STATUS_NO_TRANSACTION) { - executeListenersBeforeBegin(); - tx.begin(); - executeListenersAfterBegin(); - } else { - log.warn("UserTransaction not started as it's in state " + tx.getStatus()); - } - } catch (Exception e) { - throw new IllegalStateException("Error when starting transaction", e); - } - } - - /** - * {@inheritDoc} - */ - public void finishJTATransaction() { - UserTransaction tx = getUserTransaction(); - - try { - if (tx == null) { - // for test scope, this may happen - log.debug("UserTransaction is null, ignore transactional behavior"); - } else { - int txStatus = tx.getStatus(); - if (txStatus == Status.STATUS_NO_TRANSACTION) { - log.warn("UserTransaction can't be finished as it wasn't started"); - } else if (txStatus == Status.STATUS_MARKED_ROLLBACK || txStatus == Status.STATUS_ROLLEDBACK - || txStatus == Status.STATUS_ROLLING_BACK) { - log.warn("Going to rollback UserTransaction as it's status is " + txStatus); - tx.rollback(); - } else { - tx.commit(); - } - } - } catch (Exception e) { - throw new IllegalStateException("Error when committing transaction", e); - } - } - - /** - * Obtain {@link UserTransaction} via JNDI call or via {@link TransactionService} if that fails - * - * @return transaction - */ - public UserTransaction getUserTransaction() { - // It's fine to reuse same instance of UserTransaction as UserTransaction is singleton in JBoss and most other AS. - // And new InitialContext().lookup("java:comp/UserTransaction") is quite expensive operation - if (userTransaction == null) { - synchronized (this) { - if (userTransaction == null) { - try { - userTransaction = (UserTransaction) new InitialContext().lookup("java:comp/UserTransaction"); - } catch (NamingException ne) { - log.debug("UserTransaction not found via JNDI. Trying TransactionService"); - userTransaction = transactionService.getUserTransaction(); - } - } - } - } - return userTransaction; - } - - /** - * {@inheritDoc} - */ - public void registerListener(JTAUserTransactionLifecycleListener listener) { - log.info("Registered listener " + listener); - listeners.add(listener); - } - - protected void executeListenersBeforeBegin() { - for (JTAUserTransactionLifecycleListener listener : listeners) { - if (log.isTraceEnabled()) { - log.trace("Execute listener " + listener + " before begin of JTA transaction"); - } - listener.beforeBegin(); - } - } - - protected void executeListenersAfterBegin() { - for (JTAUserTransactionLifecycleListener listener : listeners) { - if (log.isTraceEnabled()) { - log.trace("Execute listener " + listener + " after begin of JTA transaction"); - } - listener.afterBegin(); - } - } -} diff --git a/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-async-config.xml b/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-async-config.xml deleted file mode 100644 index b4d9b064f3..0000000000 --- a/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-async-config.xml +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-config.xml b/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-config.xml deleted file mode 100644 index 4278133f8b..0000000000 --- a/component/common/src/main/resources/conf/cache/infinispan/cluster/cache-config.xml +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/common/src/main/resources/conf/cache/infinispan/local/cache-config.xml b/component/common/src/main/resources/conf/cache/infinispan/local/cache-config.xml deleted file mode 100644 index b3b78ded8e..0000000000 --- a/component/common/src/main/resources/conf/cache/infinispan/local/cache-config.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/common/src/main/resources/conf/jgroups/jgroups-service-tcp.xml b/component/common/src/main/resources/conf/jgroups/jgroups-service-tcp.xml deleted file mode 100644 index 791e709f6d..0000000000 --- a/component/common/src/main/resources/conf/jgroups/jgroups-service-tcp.xml +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/component/common/src/main/resources/conf/jgroups/jgroups-service-udp.xml b/component/common/src/main/resources/conf/jgroups/jgroups-service-udp.xml deleted file mode 100644 index 780adc67e9..0000000000 --- a/component/common/src/main/resources/conf/jgroups/jgroups-service-udp.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - - - - - - - - diff --git a/component/common/src/test/java/org/gatein/common/transaction/CounterListener.java b/component/common/src/test/java/org/gatein/common/transaction/CounterListener.java deleted file mode 100644 index 09f30e7d6a..0000000000 --- a/component/common/src/test/java/org/gatein/common/transaction/CounterListener.java +++ /dev/null @@ -1,55 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.gatein.common.transaction; - -import java.util.concurrent.atomic.AtomicInteger; - - -/** - * Mock listener - * - * @author Marek Posolda - */ -public class CounterListener implements JTAUserTransactionLifecycleListener { - private AtomicInteger beforeBeginCounter = new AtomicInteger(0); - private AtomicInteger afterBeginCounter = new AtomicInteger(0); - - @Override - public void beforeBegin() { - beforeBeginCounter.incrementAndGet(); - } - - @Override - public void afterBegin() { - afterBeginCounter.incrementAndGet(); - } - - int getBeforeBeginCounter() { - return beforeBeginCounter.get(); - } - - int getAfterBeginCounter() { - return afterBeginCounter.get(); - } -} diff --git a/component/common/src/test/java/org/gatein/common/transaction/JTAUserTransactionTest.java b/component/common/src/test/java/org/gatein/common/transaction/JTAUserTransactionTest.java deleted file mode 100644 index b00b88db59..0000000000 --- a/component/common/src/test/java/org/gatein/common/transaction/JTAUserTransactionTest.java +++ /dev/null @@ -1,106 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.gatein.common.transaction; - -import javax.transaction.Status; -import javax.transaction.UserTransaction; - -import org.exoplatform.component.test.AbstractKernelTest; -import org.exoplatform.component.test.ConfigurationUnit; -import org.exoplatform.component.test.ConfiguredBy; -import org.exoplatform.component.test.ContainerScope; -import org.exoplatform.container.PortalContainer; - -/** - * test for {@link JTAUserTransactionLifecycleService} - * - * @author Marek Posolda - */ -@ConfiguredBy({ - @ConfigurationUnit(scope = ContainerScope.ROOT, path = "conf/configuration.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/configuration.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.settings-configuration-local-jta.xml"), -}) -public class JTAUserTransactionTest extends AbstractKernelTest { - - private JTAUserTransactionLifecycleService jtaUserTransactionLifecycleService; - - @Override - protected void setUp() throws Exception { - PortalContainer container = PortalContainer.getInstance(); - jtaUserTransactionLifecycleService = (JTAUserTransactionLifecycleService) container - .getComponentInstanceOfType(JTAUserTransactionLifecycleService.class); - } - - public void testTransactionLifecycle() throws Exception { - UserTransaction tx = jtaUserTransactionLifecycleService.getUserTransaction(); - assertNotNull(tx); - - // Test normal workflow with begin/commit - assertStatus(Status.STATUS_NO_TRANSACTION); - - jtaUserTransactionLifecycleService.beginJTATransaction(); - assertStatus(Status.STATUS_ACTIVE); - - jtaUserTransactionLifecycleService.finishJTATransaction(); - assertStatus(Status.STATUS_NO_TRANSACTION); - - // Test workflow with setRollBackOnly - jtaUserTransactionLifecycleService.beginJTATransaction(); - assertStatus(Status.STATUS_ACTIVE); - - tx.setRollbackOnly(); - jtaUserTransactionLifecycleService.finishJTATransaction(); - assertStatus(Status.STATUS_NO_TRANSACTION); - } - - public void testListener() throws Exception { - CounterListener counterListener = new CounterListener(); - jtaUserTransactionLifecycleService.registerListener(counterListener); - - UserTransaction tx = jtaUserTransactionLifecycleService.getUserTransaction(); - assertNotNull(tx); - - assertEquals(counterListener.getBeforeBeginCounter(), 0); - assertEquals(counterListener.getAfterBeginCounter(), 0); - - jtaUserTransactionLifecycleService.beginJTATransaction(); - assertEquals(counterListener.getBeforeBeginCounter(), 1); - assertEquals(counterListener.getAfterBeginCounter(), 1); - - jtaUserTransactionLifecycleService.finishJTATransaction(); - jtaUserTransactionLifecycleService.beginJTATransaction(); - assertEquals(counterListener.getBeforeBeginCounter(), 2); - assertEquals(counterListener.getAfterBeginCounter(), 2); - - jtaUserTransactionLifecycleService.finishJTATransaction(); - assertEquals(counterListener.getBeforeBeginCounter(), 2); - assertEquals(counterListener.getAfterBeginCounter(), 2); - } - - private void assertStatus(int expectedStatus) throws Exception { - int status = jtaUserTransactionLifecycleService.getUserTransaction().getStatus(); - assertEquals(expectedStatus, status); - } -} diff --git a/component/common/src/test/resources/conf/exo.portal.component.settings-configuration-local-jta.xml b/component/common/src/test/resources/conf/exo.portal.component.settings-configuration-local-jta.xml deleted file mode 100644 index e0a6c613ab..0000000000 --- a/component/common/src/test/resources/conf/exo.portal.component.settings-configuration-local-jta.xml +++ /dev/null @@ -1,72 +0,0 @@ - - - - - - org.gatein.common.transaction.JTAUserTransactionLifecycleService - org.gatein.common.transaction.JTAUserTransactionLifecycleServiceImpl - - - - org.infinispan.transaction.lookup.TransactionManagerLookup - org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup - - - - org.exoplatform.services.transaction.TransactionService - org.exoplatform.services.transaction.infinispan.JBossTransactionsService - - - timeout - 300 - - - - - - org.exoplatform.services.cache.CacheService - cache:type=CacheService - org.exoplatform.services.cache.impl.CacheServiceImpl - - - cache.config.default - - - default - - - 30000 - - - 120000 - - - org.exoplatform.services.cache.concurrent.ConcurrentFIFOExoCache - - - - - - - diff --git a/component/identity/pom.xml b/component/identity/pom.xml index 8ff63dd99c..e91f6bc50a 100644 --- a/component/identity/pom.xml +++ b/component/identity/pom.xml @@ -53,16 +53,6 @@ picketlink-idm-ldap
- - io.meeds.kernel - exo.kernel.component.ext.cache.impl.infinispan.v8 - - provided - - ${project.groupId} diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java index c21ef091fc..1bc9ee0b37 100644 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java +++ b/component/identity/src/main/java/org/exoplatform/services/organization/idm/AbstractDAOImpl.java @@ -15,13 +15,8 @@ */ package org.exoplatform.services.organization.idm; -import javax.transaction.Status; -import javax.transaction.UserTransaction; - -import org.exoplatform.container.ExoContainerContext; import org.exoplatform.services.log.ExoLogger; import org.exoplatform.services.log.Log; -import org.gatein.common.transaction.JTAUserTransactionLifecycleService; import org.picketlink.idm.api.IdentitySession; /** @@ -43,21 +38,7 @@ public AbstractDAOImpl(PicketLinkIDMOrganizationServiceImpl orgService, PicketLi public void handleException(String messageToLog, Exception e) { try { - // Mark JTA transaction to rollback-only if JTA setup is enabled - if (orgService.getConfiguration().isUseJTA()) { - try { - JTAUserTransactionLifecycleService transactionLfService = (JTAUserTransactionLifecycleService) ExoContainerContext - .getCurrentContainer().getComponentInstanceOfType(JTAUserTransactionLifecycleService.class); - UserTransaction tx = transactionLfService.getUserTransaction(); - if (tx.getStatus() == Status.STATUS_ACTIVE) { - tx.setRollbackOnly(); - } - } catch (Exception tre) { - log.warn("Unable to set Transaction status to be rollback only", tre); - } - } else { - orgService.recoverFromIDMError(); - } + orgService.recoverFromIDMError(); // Always throw the original exception to make sure that top layer services // are triggered about the error throw new IllegalStateException(messageToLog, e); diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java index cfcf4e6055..13c9b1f67a 100644 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java +++ b/component/identity/src/main/java/org/exoplatform/services/organization/idm/Config.java @@ -56,8 +56,6 @@ public class Config { private boolean useCache = true; - private boolean useJTA = false; - private boolean sortGroups = true; private boolean sortMemberships = true; @@ -300,14 +298,6 @@ public void setIgnoreMappedMembershipTypeGroupList(List ignoreMappedMemb this.ignoreMappedMembershipTypeGroupList = ignoreMappedMembershipTypeGroupList; } - public boolean isUseJTA() { - return useJTA; - } - - public void setUseJTA(boolean useJTA) { - this.useJTA = useJTA; - } - public String getSlashReplacement() { return slashReplacement; } diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMTransactionSyncListener.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMTransactionSyncListener.java deleted file mode 100644 index eef3b200f7..0000000000 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/IDMTransactionSyncListener.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * JBoss, a division of Red Hat - * Copyright 2012, Red Hat Middleware, LLC, and individual - * contributors as indicated by the @authors tag. See the - * copyright.txt in the distribution for a full listing of - * individual contributors. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.exoplatform.services.organization.idm; - -import org.gatein.common.transaction.JTAUserTransactionLifecycleListener; - -/** - * Listener used for sync global JTA transaction and underlying IDM (Hibernate) transaction - * - * @author Marek Posolda - */ -class IDMTransactionSyncListener implements JTAUserTransactionLifecycleListener { - private PicketLinkIDMService idmService; - - public IDMTransactionSyncListener(PicketLinkIDMService idmService) { - this.idmService = idmService; - } - - @Override - public void beforeBegin() { - } - - @Override - public void afterBegin() { - try { - // We need this as from Hibernate4 and with JTATransactionFactory, there is need to separately start IDM (Hibernate) - // transaction as well even if JTA transaction is started - if (!idmService.getIdentitySession().getTransaction().isActive()) { - idmService.getIdentitySession().beginTransaction(); - } - } catch (Exception e) { - throw new RuntimeException(e); - } - } -} diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/CustomHibernateServiceImpl.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/IdmHibernateService.java similarity index 90% rename from component/identity/src/main/java/org/exoplatform/services/organization/idm/CustomHibernateServiceImpl.java rename to component/identity/src/main/java/org/exoplatform/services/organization/idm/IdmHibernateService.java index 5be8f82954..0ccf2747b5 100644 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/CustomHibernateServiceImpl.java +++ b/component/identity/src/main/java/org/exoplatform/services/organization/idm/IdmHibernateService.java @@ -24,7 +24,6 @@ package org.exoplatform.services.organization.idm; import java.io.Serializable; -import java.security.PrivilegedAction; import java.util.Collection; import java.util.Iterator; import java.util.List; @@ -40,14 +39,12 @@ import org.exoplatform.container.xml.InitParams; import org.exoplatform.container.xml.PropertiesParam; import org.exoplatform.container.xml.Property; -import org.exoplatform.services.database.HibernateService; -import org.exoplatform.services.database.ObjectQuery; import org.exoplatform.services.log.ExoLogger; import org.exoplatform.services.log.Log; -public class CustomHibernateServiceImpl implements HibernateService, ComponentRequestLifecycle { +public class IdmHibernateService implements ComponentRequestLifecycle { - private static final Log LOG = ExoLogger.getLogger(CustomHibernateServiceImpl.class); + private static final Log LOG = ExoLogger.getLogger(IdmHibernateService.class); public static final String AUTO_DIALECT = "AUTO"; @@ -57,7 +54,7 @@ public class CustomHibernateServiceImpl implements HibernateService, ComponentRe private SessionFactory sessionFactory_; - public CustomHibernateServiceImpl(InitParams initParams) { + public IdmHibernateService(InitParams initParams) { threadLocal_ = new ThreadLocal(); PropertiesParam param = initParams.getPropertiesParam("hibernate.properties"); conf_ = new IdmHibernateConfiguration(); @@ -169,18 +166,6 @@ public Object findOne(Class clazz, Serializable id) throws Exception { return obj; } - public Object findOne(ObjectQuery q) throws Exception { - Session session = openSession(); - List l = session.createQuery(q.getHibernateQuery()).list(); - if (l.size() == 0) { - return null; - } else if (l.size() > 1) { - throw new Exception("Expect only one object but found" + l.size()); - } else { - return l.get(0); - } - } - public Object create(Object obj) throws Exception { Session session = openSession(); session.save(obj); diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java index 3431f815c6..678cfb1f70 100644 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java +++ b/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceImpl.java @@ -22,11 +22,8 @@ import java.util.Collections; import java.util.List; -import javax.transaction.Status; - import org.exoplatform.services.log.ExoLogger; import org.exoplatform.services.log.Log; -import org.gatein.common.transaction.JTAUserTransactionLifecycleService; import org.gatein.portal.idm.impl.repository.ExoFallbackIdentityStoreRepository; import org.gatein.portal.idm.impl.repository.ExoLegacyFallbackIdentityStoreRepository; import org.picketlink.idm.api.Transaction; @@ -52,336 +49,290 @@ * OrganizationService implementation using PicketLink */ public class PicketLinkIDMOrganizationServiceImpl extends BaseOrganizationService implements Startable, - ComponentRequestLifecycle { - - // We may have several portal containers thus we need one PicketLinkIDMService per portal container - private PicketLinkIDMServiceImpl idmService_; + ComponentRequestLifecycle { - public static final String CONFIGURATION_OPTION = "configuration"; + // We may have several portal containers thus we need one PicketLinkIDMService + // per portal container + private PicketLinkIDMServiceImpl idmService_; - private Config configuration = new Config(); + public static final String CONFIGURATION_OPTION = "configuration"; - private JTAUserTransactionLifecycleService jtaTransactionLifecycleService; + private Config configuration = new Config(); - private OrganizationCacheHandler organizationCacheHandler; + private OrganizationCacheHandler organizationCacheHandler; - private static final Log log = + private static final Log log = ExoLogger.getLogger(PicketLinkIDMOrganizationServiceImpl.class); - private static final boolean traceLoggingEnabled = log.isTraceEnabled(); - - // Indicates whether any call to startRequest and endRequest is accepted - private volatile boolean acceptComponentRequestCall; - - public PicketLinkIDMOrganizationServiceImpl(InitParams params, PicketLinkIDMService idmService, - JTAUserTransactionLifecycleService jtaTransactionLifecycleService, OrganizationCacheHandler organizationCacheHandler) throws Exception { - this.idmService_ = (PicketLinkIDMServiceImpl) idmService; - this.jtaTransactionLifecycleService = jtaTransactionLifecycleService; - this.organizationCacheHandler = organizationCacheHandler; - - if (params != null) { - // Options - ObjectParameter configurationParam = params.getObjectParam(CONFIGURATION_OPTION); - - if (configurationParam != null) { - this.configuration = (Config) configurationParam.getObject(); - initConfiguration(params); - } - } - if(organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { - groupDAO_ = new CacheableGroupHandlerImpl(organizationCacheHandler, this, idmService, this.configuration.isCountPaginatedUsers()); - userDAO_ = new CacheableUserHandlerImpl(organizationCacheHandler, this, idmService); - userProfileDAO_ = new CacheableUserProfileHandlerImpl(organizationCacheHandler, this, idmService); - membershipDAO_ = new CacheableMembershipHandlerImpl(organizationCacheHandler, this, idmService, true); - membershipTypeDAO_ = new CacheableMembershipTypeHandlerImpl(organizationCacheHandler, this, idmService); - } else { - groupDAO_ = new GroupDAOImpl(this, idmService); - userDAO_ = new UserDAOImpl(this, idmService); - userProfileDAO_ = new UserProfileDAOImpl(this, idmService); - membershipDAO_ = new MembershipDAOImpl(this, idmService); - membershipTypeDAO_ = new MembershipTypeDAOImpl(this, idmService); - } + private static final boolean traceLoggingEnabled = log.isTraceEnabled(); + + // Indicates whether any call to startRequest and endRequest is accepted + private volatile boolean acceptComponentRequestCall; + public PicketLinkIDMOrganizationServiceImpl(InitParams params, + PicketLinkIDMService idmService, + OrganizationCacheHandler organizationCacheHandler) + throws Exception { + this.idmService_ = (PicketLinkIDMServiceImpl) idmService; + this.organizationCacheHandler = organizationCacheHandler; + + if (params != null) { + // Options + ObjectParameter configurationParam = params.getObjectParam(CONFIGURATION_OPTION); + + if (configurationParam != null) { + this.configuration = (Config) configurationParam.getObject(); + initConfiguration(params); + } } - public PicketLinkIDMOrganizationServiceImpl(InitParams params, PicketLinkIDMService idmService, - JTAUserTransactionLifecycleService jtaTransactionLifecycleService) throws Exception { - this(params, idmService, jtaTransactionLifecycleService, null); + if (organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { + groupDAO_ = new CacheableGroupHandlerImpl(organizationCacheHandler, + this, + idmService, + this.configuration.isCountPaginatedUsers()); + userDAO_ = new CacheableUserHandlerImpl(organizationCacheHandler, this, idmService); + userProfileDAO_ = new CacheableUserProfileHandlerImpl(organizationCacheHandler, this, idmService); + membershipDAO_ = new CacheableMembershipHandlerImpl(organizationCacheHandler, this, idmService, true); + membershipTypeDAO_ = new CacheableMembershipTypeHandlerImpl(organizationCacheHandler, this, idmService); + } else { + groupDAO_ = new GroupDAOImpl(this, idmService); + userDAO_ = new UserDAOImpl(this, idmService); + userProfileDAO_ = new UserProfileDAOImpl(this, idmService); + membershipDAO_ = new MembershipDAOImpl(this, idmService); + membershipTypeDAO_ = new MembershipTypeDAOImpl(this, idmService); } - public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws Exception { - String[] ids = groupId.split("/"); - String name = ids[ids.length - 1]; - String parentId = null; - if (groupId.contains("/")) { - parentId = groupId.substring(0, groupId.lastIndexOf("/")); - } + } - String plGroupName = configuration.getPLIDMGroupName(name); + public PicketLinkIDMOrganizationServiceImpl(InitParams params, PicketLinkIDMService idmService) + throws Exception { + this(params, idmService, null); + } - return idmService_.getIdentitySession().getPersistenceManager() - .findGroup(plGroupName, getConfiguration().getGroupType(parentId)); + public final org.picketlink.idm.api.Group getJBIDMGroup(String groupId) throws Exception { + String[] ids = groupId.split("/"); + String name = ids[ids.length - 1]; + String parentId = null; + if (groupId.contains("/")) { + parentId = groupId.substring(0, groupId.lastIndexOf("/")); } - @Override - public void start() { - if (configuration.isUseJTA()) { - jtaTransactionLifecycleService.registerListener(new IDMTransactionSyncListener(idmService_)); - } - acceptComponentRequestCall = true; - RequestLifeCycle.begin(this); - try { - super.start(); - } catch (Exception e) { - log.error("Error Starting IDM Service", e); - } finally { - RequestLifeCycle.end(); - } + String plGroupName = configuration.getPLIDMGroupName(name); + + return idmService_.getIdentitySession() + .getPersistenceManager() + .findGroup(plGroupName, getConfiguration().getGroupType(parentId)); + } + + @Override + public void start() { + acceptComponentRequestCall = true; + RequestLifeCycle.begin(this); + try { + super.start(); + } catch (Exception e) { + log.error("Error Starting IDM Service", e); + } finally { + RequestLifeCycle.end(); } + } - @Override - public void stop() { - // do nothing - } + @Override + public void stop() { + // do nothing + } - public void startRequest(ExoContainer container) { - if (!acceptComponentRequestCall) { - return; - } - try { - if (configuration.isUseJTA()) { - if (traceLoggingEnabled) { - log.trace("Starting UserTransaction in method startRequest"); - } - - try { - if(jtaTransactionLifecycleService.getUserTransaction().getStatus() != Status.STATUS_NO_TRANSACTION && - jtaTransactionLifecycleService.getUserTransaction().getStatus() != Status.STATUS_ACTIVE){ - //Commit or Rollback JTA transaction according to it's current status - jtaTransactionLifecycleService.finishJTATransaction(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - jtaTransactionLifecycleService.beginJTATransaction(); - } else { - - if (!idmService_.getIdentitySession().getTransaction().isActive()) { - idmService_.getIdentitySession().beginTransaction(); - } - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } + public void startRequest(ExoContainer container) { + if (!acceptComponentRequestCall) { + return; } + try { + if (!idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().beginTransaction(); + } + } catch (Exception e) { + log.error("Error while starting IDM Transaction", e); + } + } - public void flush() { - if (configuration.isUseJTA()) { - if (traceLoggingEnabled) { - log.trace("Flushing UserTransaction in method flush"); - } - // Complete restart of JTA transaction don't have good performance. So we will only sync identitySession (same - // as for non-jta environment) - // finishJTATransaction(); - // beginJTATransaction(); - try { - if (jtaTransactionLifecycleService.getUserTransaction().getStatus() == Status.STATUS_ACTIVE) { - idmService_.getIdentitySession().save(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } else { - try { - if (idmService_.getIdentitySession().getTransaction().isActive()) { - idmService_.getIdentitySession().save(); - } - } catch (Exception e) { - log.error("Error while saving transaction", e); - recoverFromIDMError(); - } - } + public void flush() { + try { + if (idmService_.getIdentitySession().getTransaction().isActive()) { + idmService_.getIdentitySession().save(); + } + } catch (Exception e) { + log.error("Error while saving transaction", e); + recoverFromIDMError(); } + } - public void endRequest(ExoContainer container) { - if (!acceptComponentRequestCall) { - return; - } - if (configuration.isUseJTA()) { - if (traceLoggingEnabled) { - log.trace("Finishing UserTransaction in method endRequest"); - } - try { - jtaTransactionLifecycleService.finishJTATransaction(); - } catch (Exception e) { - log.error(e.getMessage(), e); - } - } else { - try { - Transaction transaction = idmService_.getIdentitySession().getTransaction(); - if (transaction.isActive()) { - transaction.commit(); - } - } catch (Exception e) { - log.error(e.getMessage(), e); - recoverFromIDMError(); - } - } + public void endRequest(ExoContainer container) { + if (!acceptComponentRequestCall) { + return; } + try { + Transaction transaction = idmService_.getIdentitySession().getTransaction(); + if (transaction.isActive()) { + transaction.commit(); + } + } catch (Exception e) { + log.error("Error while committing IDM transaction", e); + recoverFromIDMError(); + } + } - public boolean isStarted(ExoContainer container) { - if(!acceptComponentRequestCall) { - return false; - } + public boolean isStarted(ExoContainer container) { + if (!acceptComponentRequestCall) { + return false; + } + try { + return idmService_.getIdentitySession() != null + && idmService_.getIdentitySession().getTransaction() != null + && idmService_.getIdentitySession() + .getTransaction() + .isActive(); + } catch (Exception e) { + log.error("Error while checking on Transaction status : ", e); + } + return false; + } + + /** + * Recover from an IDM error + */ + public void recoverFromIDMError() { + try { + // We need to restart Hibernate transaction if it's available. First + // rollback old one and then start new one + Transaction idmTransaction = idmService_.getIdentitySession().getTransaction(); + if (idmTransaction != null && idmTransaction.isActive()) { try { - if (configuration.isUseJTA()) { - return jtaTransactionLifecycleService.getUserTransaction() == null ? false : - jtaTransactionLifecycleService.getUserTransaction().getStatus()== Status.STATUS_ACTIVE; - } else { - return (idmService_.getIdentitySession() == null || idmService_.getIdentitySession().getTransaction() == null) ? false : - idmService_.getIdentitySession().getTransaction().isActive(); - } - } catch (Exception e) { - log.error("Error while checking on Transaction status : ", e); + idmTransaction.rollback(); + log.warn("IDM Transaction has been rolled-backed"); + } catch (Exception e1) { + log.warn("Error during IDM Transaction rollback.", e1); } - return false; - } - - /** - * Recover from an IDM error - * Should be used only for non-JTA environment. - */ - public void recoverFromIDMError() { try { - // We need to restart Hibernate transaction if it's available. First rollback old one and then start new one - Transaction idmTransaction = idmService_.getIdentitySession().getTransaction(); - if (idmTransaction != null && idmTransaction.isActive()) { - try { - idmTransaction.rollback(); - log.warn("IDM Transaction has been rolled-backed"); - } catch (Exception e1) { - log.warn("Error during IDM Transaction rollback.", e1); - } - try { - idmTransaction.start(); - log.warn("IDM Transaction restarted"); - } catch (Exception e1) { - log.warn("Error during IDM Transaction restart, a new transaction will be started", e1); - idmService_.getIdentitySession().beginTransaction(); - } - } else { - idmService_.getIdentitySession().beginTransaction(); - log.warn("New IDM Transaction started"); - } + idmTransaction.start(); + log.warn("IDM Transaction restarted"); } catch (Exception e1) { - log.warn("Error during recovery of old error", e1); + log.warn("Error during IDM Transaction restart, a new transaction will be started", e1); + idmService_.getIdentitySession().beginTransaction(); } + } else { + idmService_.getIdentitySession().beginTransaction(); + log.warn("New IDM Transaction started"); + } + } catch (Exception e1) { + log.warn("Error during recovery of old error", e1); } + } - public Config getConfiguration() { - return configuration; - } + public Config getConfiguration() { + return configuration; + } - public void clearCaches(){ - if(organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { - if(groupDAO_ != null && groupDAO_ instanceof CacheableGroupHandlerImpl){ - ((CacheableGroupHandlerImpl) groupDAO_).clearCache(); - } - if(userDAO_ != null && userDAO_ instanceof CacheableUserHandlerImpl){ - ((CacheableUserHandlerImpl) userDAO_).clearCache(); - } - if(userProfileDAO_ != null && userProfileDAO_ instanceof CacheableUserProfileHandlerImpl){ - ((CacheableUserProfileHandlerImpl) userProfileDAO_).clearCache(); - } - if(membershipDAO_ != null && membershipDAO_ instanceof CacheableMembershipHandlerImpl){ - ((CacheableMembershipHandlerImpl) membershipDAO_).clearCache(); - } - if(membershipTypeDAO_ != null && membershipTypeDAO_ instanceof CacheableMembershipTypeHandlerImpl){ - ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).clearCache(); - } - } + public void clearCaches() { + if (organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { + if (groupDAO_ != null && groupDAO_ instanceof CacheableGroupHandlerImpl) { + ((CacheableGroupHandlerImpl) groupDAO_).clearCache(); + } + if (userDAO_ != null && userDAO_ instanceof CacheableUserHandlerImpl) { + ((CacheableUserHandlerImpl) userDAO_).clearCache(); + } + if (userProfileDAO_ != null && userProfileDAO_ instanceof CacheableUserProfileHandlerImpl) { + ((CacheableUserProfileHandlerImpl) userProfileDAO_).clearCache(); + } + if (membershipDAO_ != null && membershipDAO_ instanceof CacheableMembershipHandlerImpl) { + ((CacheableMembershipHandlerImpl) membershipDAO_).clearCache(); + } + if (membershipTypeDAO_ != null && membershipTypeDAO_ instanceof CacheableMembershipTypeHandlerImpl) { + ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).clearCache(); + } } + } - public void setEnableCache(boolean enable) { - if (organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { - if (groupDAO_ != null && groupDAO_ instanceof CacheableGroupHandlerImpl) { - if (enable) { - ((CacheableGroupHandlerImpl) groupDAO_).enableCache(); - } else { - ((CacheableGroupHandlerImpl) groupDAO_).disableCache(); - } + public void setEnableCache(boolean enable) { + if (organizationCacheHandler != null && (this.configuration == null || this.configuration.isUseCache())) { + if (groupDAO_ != null && groupDAO_ instanceof CacheableGroupHandlerImpl) { + if (enable) { + ((CacheableGroupHandlerImpl) groupDAO_).enableCache(); + } else { + ((CacheableGroupHandlerImpl) groupDAO_).disableCache(); } - if (userDAO_ != null && userDAO_ instanceof CacheableUserHandlerImpl) { - if (enable) { - ((CacheableUserHandlerImpl) userDAO_).enableCache(); - } else { - ((CacheableUserHandlerImpl) userDAO_).disableCache(); - } + } + if (userDAO_ != null && userDAO_ instanceof CacheableUserHandlerImpl) { + if (enable) { + ((CacheableUserHandlerImpl) userDAO_).enableCache(); + } else { + ((CacheableUserHandlerImpl) userDAO_).disableCache(); } - if (userProfileDAO_ != null && userProfileDAO_ instanceof CacheableUserProfileHandlerImpl) { - if (enable) { - ((CacheableUserProfileHandlerImpl) userProfileDAO_).enableCache(); - } else { - ((CacheableUserProfileHandlerImpl) userProfileDAO_).disableCache(); - } + } + if (userProfileDAO_ != null && userProfileDAO_ instanceof CacheableUserProfileHandlerImpl) { + if (enable) { + ((CacheableUserProfileHandlerImpl) userProfileDAO_).enableCache(); + } else { + ((CacheableUserProfileHandlerImpl) userProfileDAO_).disableCache(); } - if (membershipDAO_ != null && membershipDAO_ instanceof CacheableMembershipHandlerImpl) { - if (enable) { - ((CacheableMembershipHandlerImpl) membershipDAO_).enableCache(); - } else { - ((CacheableMembershipHandlerImpl) membershipDAO_).disableCache(); - } + } + if (membershipDAO_ != null && membershipDAO_ instanceof CacheableMembershipHandlerImpl) { + if (enable) { + ((CacheableMembershipHandlerImpl) membershipDAO_).enableCache(); + } else { + ((CacheableMembershipHandlerImpl) membershipDAO_).disableCache(); } - if (membershipTypeDAO_ != null && membershipTypeDAO_ instanceof CacheableMembershipTypeHandlerImpl) { - if (enable) { - ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).enableCache(); - } else { - ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).disableCache(); - } + } + if (membershipTypeDAO_ != null && membershipTypeDAO_ instanceof CacheableMembershipTypeHandlerImpl) { + if (enable) { + ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).enableCache(); + } else { + ((CacheableMembershipTypeHandlerImpl) membershipTypeDAO_).disableCache(); } } } + } + + public void setConfiguration(Config configuration) { + this.configuration = configuration; + } - public void setConfiguration(Config configuration) { - this.configuration = configuration; + private void initConfiguration(InitParams params) { + /* Default settings - DB Only */ + this.configuration.setCountPaginatedUsers(true); + this.configuration.setSkipPaginationInMembershipQuery(false); + + IdentityConfigurationMetaData configMD = ((PicketLinkIDMServiceImpl) this.idmService_).getConfigMD(); + if (configMD == null) { + return; } - private void initConfiguration(InitParams params) { - /* Default settings - DB Only */ - this.configuration.setCountPaginatedUsers(true); - this.configuration.setSkipPaginationInMembershipQuery(false); - - IdentityConfigurationMetaData configMD = ((PicketLinkIDMServiceImpl) this.idmService_).getConfigMD(); - if (configMD == null) { - return; - } - - // Use DB Default settings if External Store API is used, else if Legacy - // LDAP Store was used, disable paginations - List repositories = configMD.getRepositories(); - for (IdentityRepositoryConfigurationMetaData identityRepositoryConfigurationMetaData : repositories) { - if (identityRepositoryConfigurationMetaData.getClassName() - .equals(ExoLegacyFallbackIdentityStoreRepository.class.getName())) { - List identityStoreMappings = - identityRepositoryConfigurationMetaData.getIdentityStoreToIdentityObjectTypeMappings(); - if (identityStoreMappings != null && identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() != null - && !identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() - .equals(identityStoreMappings.get(0).getIdentityStoreId())) { - this.configuration.setCountPaginatedUsers(false); - this.configuration.setSkipPaginationInMembershipQuery(true); - } - } else if (identityRepositoryConfigurationMetaData.getClassName() - .equals(ExoFallbackIdentityStoreRepository.class.getName())) { - List identityStoreMappings = - identityRepositoryConfigurationMetaData.getIdentityStoreToIdentityObjectTypeMappings(); - if (identityStoreMappings != null && identityStoreMappings.size() > 0 - && !identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() - .equals(identityStoreMappings.get(0).getIdentityStoreId())) { - IdentityStoreMappingMetaData mappingMetaData = identityStoreMappings.get(0); - mappingMetaData.getOptions().put("readOnly", Collections.singletonList("true")); - } + // Use DB Default settings if External Store API is used, else if Legacy + // LDAP Store was used, disable paginations + List repositories = configMD.getRepositories(); + for (IdentityRepositoryConfigurationMetaData identityRepositoryConfigurationMetaData : repositories) { + if (identityRepositoryConfigurationMetaData.getClassName() + .equals(ExoLegacyFallbackIdentityStoreRepository.class.getName())) { + List identityStoreMappings = + identityRepositoryConfigurationMetaData.getIdentityStoreToIdentityObjectTypeMappings(); + if (identityStoreMappings != null && identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() != null + && !identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() + .equals(identityStoreMappings.get(0).getIdentityStoreId())) { + this.configuration.setCountPaginatedUsers(false); + this.configuration.setSkipPaginationInMembershipQuery(true); + } + } else if (identityRepositoryConfigurationMetaData.getClassName() + .equals(ExoFallbackIdentityStoreRepository.class.getName())) { + List identityStoreMappings = + identityRepositoryConfigurationMetaData.getIdentityStoreToIdentityObjectTypeMappings(); + if (identityStoreMappings != null && identityStoreMappings.size() > 0 + && !identityRepositoryConfigurationMetaData.getDefaultIdentityStoreId() + .equals(identityStoreMappings.get(0).getIdentityStoreId())) { + IdentityStoreMappingMetaData mappingMetaData = identityStoreMappings.get(0); + mappingMetaData.getOptions().put("readOnly", Collections.singletonList("true")); } } } + } } diff --git a/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java b/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java index 8f1da3e7a0..ec13292e50 100644 --- a/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java +++ b/component/identity/src/main/java/org/exoplatform/services/organization/idm/PicketLinkIDMServiceImpl.java @@ -16,7 +16,6 @@ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA * 02110-1301 USA, or see the FSF site: http://www.fsf.org. */ - package org.exoplatform.services.organization.idm; import java.io.InputStream; @@ -25,31 +24,26 @@ import javax.naming.InitialContext; import org.apache.commons.lang3.StringUtils; -import org.exoplatform.commons.utils.PropertyManager; -import org.exoplatform.container.ExoContainerContext; -import org.exoplatform.container.configuration.ConfigurationManager; -import org.exoplatform.container.xml.InitParams; -import org.exoplatform.container.xml.ValueParam; -import org.exoplatform.services.database.HibernateService; -import org.exoplatform.services.log.ExoLogger; -import org.exoplatform.services.log.Log; -import org.exoplatform.services.naming.InitialContextInitializer; import org.gatein.portal.idm.impl.store.attribute.ExtendedAttributeManager; -import org.infinispan.Cache; import org.picketlink.idm.api.IdentitySession; import org.picketlink.idm.api.IdentitySessionFactory; import org.picketlink.idm.api.SecureRandomProvider; import org.picketlink.idm.api.cfg.IdentityConfiguration; -import org.picketlink.idm.cache.APICacheProvider; import org.picketlink.idm.common.exception.IdentityConfigurationException; import org.picketlink.idm.impl.api.session.IdentitySessionImpl; import org.picketlink.idm.impl.configuration.IdentityConfigurationImpl; import org.picketlink.idm.impl.configuration.jaxb2.JAXB2IdentityConfiguration; import org.picketlink.idm.impl.credential.DatabaseReadingSaltEncoder; -import org.picketlink.idm.spi.cache.IdentityStoreCacheProvider; import org.picketlink.idm.spi.configuration.metadata.IdentityConfigurationMetaData; import org.picocontainer.Startable; +import org.exoplatform.container.ExoContainerContext; +import org.exoplatform.container.configuration.ConfigurationManager; +import org.exoplatform.container.xml.InitParams; +import org.exoplatform.container.xml.ValueParam; +import org.exoplatform.services.log.ExoLogger; +import org.exoplatform.services.log.Log; + /** * @author Boleslaw Dawidowicz */ @@ -61,12 +55,8 @@ public class PicketLinkIDMServiceImpl implements PicketLinkIDMService, Startable public static final String PARAM_JNDI_NAME_OPTION = "jndiName"; - public static final String PARAM_SKIP_EXPIRATION_STRUCTURE_CACHE_ENTRIES = "skipExpirationOfStructureCacheEntries"; - public static final String PARAM_USE_SECURE_RANDOM_SERVICE = "useSecureRandomService"; - public static final String PARAM_STALE_CACHE_NODES_LINKS_CLEANER_DELAY = "staleCacheNodesLinksCleanerDelay"; - public static final int DEFAULT_STALE_CACHE_NODES_LINKS_CLEANER_DELAY = 120000; public static final String REALM_NAME_OPTION = "portalRealm"; @@ -75,129 +65,120 @@ public class PicketLinkIDMServiceImpl implements PicketLinkIDMService, Startable public static final String CACHE_CONFIG_STORE_OPTION = "storeCacheConfig"; - private IdentitySessionFactory identitySessionFactory; + private IdentitySessionFactory identitySessionFactory; - private String config; + private String config; - private String realmName = "idm_realm"; + private String realmName = "idm_realm"; - private IdentityConfiguration identityConfiguration; + private IdentityConfiguration identityConfiguration; private IdentityConfigurationMetaData configMD; - private HibernateService hibernateService; - private ExtendedAttributeManager extendedAttributeManager; + private IdmHibernateService idmHibernateService; - public PicketLinkIDMServiceImpl(ExoContainerContext exoContainerContext, InitParams initParams, - HibernateService hibernateService, ConfigurationManager confManager, - InitialContextInitializer dependency) throws Exception { + private ExtendedAttributeManager extendedAttributeManager; - ValueParam config = null; + public PicketLinkIDMServiceImpl(IdmHibernateService hibernateService, + ConfigurationManager confManager, + InitParams initParams) + throws Exception { + ValueParam configValueParam = null; - ValueParam directoryTypeValueParam = initParams.getValueParam("ldap.type"); - String directoryType = null; - if(directoryTypeValueParam != null) { - directoryType = directoryTypeValueParam.getValue(); - } - if(StringUtils.isNotBlank(directoryType)) { - config = initParams.getValueParam(PARAM_CONFIG_OPTION + "." + directoryType); - } - - if(config == null) { - config = initParams.getValueParam(PARAM_CONFIG_OPTION); - } - - ValueParam jndiName = initParams.getValueParam(PARAM_JNDI_NAME_OPTION); - ValueParam canExpireStructureCacheEntriesParam = initParams - .getValueParam(PARAM_SKIP_EXPIRATION_STRUCTURE_CACHE_ENTRIES); - ValueParam staleCacheNodesLinksCleanerDelayParam = initParams - .getValueParam(PARAM_STALE_CACHE_NODES_LINKS_CLEANER_DELAY); - ValueParam realmName = initParams.getValueParam(REALM_NAME_OPTION); - ValueParam apiCacheConfig = initParams.getValueParam(CACHE_CONFIG_API_OPTION); - ValueParam storeCacheConfig = initParams.getValueParam(CACHE_CONFIG_STORE_OPTION); - ValueParam useSecureRandomService = initParams.getValueParam(PARAM_USE_SECURE_RANDOM_SERVICE); - - this.hibernateService = hibernateService; - - if (config == null && jndiName == null) { - throw new IllegalStateException("Either '" + PARAM_CONFIG_OPTION + "' or '" + PARAM_JNDI_NAME_OPTION - + "' parameter must " + "be specified"); - } - if (realmName != null) { - this.realmName = realmName.getValue(); - } - - long staleCacheNodesLinksCleanerDelay = staleCacheNodesLinksCleanerDelayParam == null ? DEFAULT_STALE_CACHE_NODES_LINKS_CLEANER_DELAY - : Long.parseLong(staleCacheNodesLinksCleanerDelayParam.getValue()); - - boolean skipExpirationOfStructureCacheEntries = canExpireStructureCacheEntriesParam != null - && "true".equals(canExpireStructureCacheEntriesParam.getValue()); + ValueParam directoryTypeValueParam = initParams.getValueParam("ldap.type"); + String directoryType = null; + if (directoryTypeValueParam != null) { + directoryType = directoryTypeValueParam.getValue(); + } + if (StringUtils.isNotBlank(directoryType)) { + configValueParam = initParams.getValueParam(PARAM_CONFIG_OPTION + "." + directoryType); + } - if (config != null) { - this.config = config.getValue(); - URL configURL = confManager.getURL(this.config); + if (configValueParam == null) { + configValueParam = initParams.getValueParam(PARAM_CONFIG_OPTION); + } - if (configURL == null) { - throw new IllegalStateException("Cannot fine resource: " + this.config); - } + ValueParam jndiName = initParams.getValueParam(PARAM_JNDI_NAME_OPTION); + ValueParam realmNameValueParam = initParams.getValueParam(REALM_NAME_OPTION); + ValueParam apiCacheConfig = initParams.getValueParam(CACHE_CONFIG_API_OPTION); + ValueParam storeCacheConfig = initParams.getValueParam(CACHE_CONFIG_STORE_OPTION); + ValueParam useSecureRandomService = initParams.getValueParam(PARAM_USE_SECURE_RANDOM_SERVICE); - this.configMD = JAXB2IdentityConfiguration.createConfigurationMetaData(confManager - .getInputStream(this.config)); + this.idmHibernateService = hibernateService; - identityConfiguration = new IdentityConfigurationImpl().configure(this.configMD); + if (configValueParam == null && jndiName == null) { + throw new IllegalStateException("Either '" + PARAM_CONFIG_OPTION + "' or '" + PARAM_JNDI_NAME_OPTION + + "' parameter must " + "be specified"); + } + if (realmNameValueParam != null) { + this.realmName = realmNameValueParam.getValue(); + } - identityConfiguration.getIdentityConfigurationRegistry().register(hibernateService.getSessionFactory(), - "hibernateSessionFactory"); + if (configValueParam != null) { + this.config = configValueParam.getValue(); + URL configURL = confManager.getURL(this.config); - if (apiCacheConfig != null) { - log.warn("The parameter 'apiCacheProvider' has been deprecated. It has been replaced by caches in Organization Service top layer. Thus, the parameter should be removed."); + if (configURL == null) { + throw new IllegalStateException("Cannot fine resource: " + this.config); + } - InputStream configStream = confManager.getInputStream(apiCacheConfig.getValue()); + this.configMD = JAXB2IdentityConfiguration.createConfigurationMetaData(confManager.getInputStream(this.config)); + identityConfiguration = new IdentityConfigurationImpl().configure(this.configMD); + identityConfiguration.getIdentityConfigurationRegistry() + .register(hibernateService.getSessionFactory(), + "hibernateSessionFactory"); - if (configStream == null) { - throw new IllegalArgumentException("Infinispan configuration InputStream is null"); - } + if (apiCacheConfig != null) { + log.warn("The parameter 'apiCacheProvider' has been deprecated. It has been replaced by caches in Organization Service top layer. Thus, the parameter should be removed."); - configStream.close(); - } + InputStream configStream = confManager.getInputStream(apiCacheConfig.getValue()); - if (storeCacheConfig != null) { - log.warn("The parameter 'storeCacheProvider' has been deprecated. It has been replaced by caches in Organization Service top layer. Thus, the parameter should be removed."); + if (configStream == null) { + throw new IllegalArgumentException("Infinispan configuration InputStream is null"); + } + configStream.close(); + } - InputStream configStream = confManager.getInputStream(storeCacheConfig.getValue()); + if (storeCacheConfig != null) { + log.warn("The parameter 'storeCacheProvider' has been deprecated. It has been replaced by caches in Organization Service top layer. Thus, the parameter should be removed."); - if (configStream == null) { - throw new IllegalArgumentException("Infinispan configuration InputStream is null"); - } - } + InputStream configStream = confManager.getInputStream(storeCacheConfig.getValue()); - if (useSecureRandomService != null && "true".equals(useSecureRandomService.getValue())) { - SecureRandomProvider secureRandomProvider = (SecureRandomProvider)exoContainerContext.getContainer().getComponentInstanceOfType(SecureRandomProvider.class); - identityConfiguration.getIdentityConfigurationRegistry().register(secureRandomProvider, DatabaseReadingSaltEncoder.DEFAULT_SECURE_RANDOM_PROVIDER_REGISTRY_NAME); - } - } else { - identitySessionFactory = (IdentitySessionFactory) new InitialContext().lookup(jndiName.getValue()); + if (configStream == null) { + throw new IllegalArgumentException("Infinispan configuration InputStream is null"); + } } + if (useSecureRandomService != null && "true".equals(useSecureRandomService.getValue())) { + SecureRandomProvider secureRandomProvider = ExoContainerContext.getService(SecureRandomProvider.class); + if (secureRandomProvider != null) { + identityConfiguration.getIdentityConfigurationRegistry() + .register(secureRandomProvider, + DatabaseReadingSaltEncoder.DEFAULT_SECURE_RANDOM_PROVIDER_REGISTRY_NAME); + } + } + } else { + identitySessionFactory = (IdentitySessionFactory) new InitialContext().lookup(jndiName.getValue()); + } } + @Override public void start() { - if (identitySessionFactory == null) { - try { - identitySessionFactory = identityConfiguration.buildIdentitySessionFactory(); - } catch (IdentityConfigurationException e) { - throw new RuntimeException(e); - } + if (identitySessionFactory == null) { + try { + identitySessionFactory = identityConfiguration.buildIdentitySessionFactory(); + } catch (IdentityConfigurationException e) { + throw new IllegalStateException(String.format("Error building configuration: %s", this.config), e); } + } } - public void stop() { - } - + @Override public IdentitySessionFactory getIdentitySessionFactory() { return identitySessionFactory; } + @Override public IdentitySession getIdentitySession() throws Exception { if(getIdentitySessionFactory() != null) { return getIdentitySessionFactory().getCurrentIdentitySession(realmName); @@ -206,6 +187,7 @@ public IdentitySession getIdentitySession() throws Exception { } } + @Override public IdentitySession getIdentitySession(String realm) throws Exception { if (realm == null) { throw new IllegalArgumentException("Realm name cannot be null"); @@ -226,16 +208,17 @@ public ExtendedAttributeManager getExtendedAttributeManager() throws Exception { return this.extendedAttributeManager; } - public String getRealmName() { - return realmName; + @Override + public IdentityConfigurationMetaData getConfigMD() { + return this.configMD; } - public HibernateService getHibernateService() { - return hibernateService; + public String getRealmName() { + return realmName; } - public IdentityConfigurationMetaData getConfigMD() { - return this.configMD; + public IdmHibernateService getHibernateService() { + return idmHibernateService; } public void setConfigMD(IdentityConfigurationMetaData configMD) { diff --git a/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java b/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java index ca696e982f..81171f6f53 100644 --- a/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java +++ b/component/identity/src/test/java/org/exoplatform/services/organization/TestBootstrap.java @@ -24,15 +24,15 @@ import org.exoplatform.component.test.ConfiguredBy; import org.exoplatform.component.test.ContainerScope; import org.exoplatform.container.PortalContainer; -import org.exoplatform.services.database.HibernateService; +import org.exoplatform.services.organization.idm.IdmHibernateService; @ConfiguredBy({ @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.identity-configuration-local.xml") }) public class TestBootstrap extends AbstractKernelTest { public void testWorkspace() throws Exception { PortalContainer container = PortalContainer.getInstance(); - HibernateService hibernate = (HibernateService) container.getComponentInstanceOfType(HibernateService.class); - assertNotNull(hibernate); + IdmHibernateService idmHibernateService = container.getComponentInstanceOfType(IdmHibernateService.class); + assertNotNull(idmHibernateService); OrganizationService organization = (OrganizationService) container .getComponentInstanceOfType(OrganizationService.class); assertNotNull(organization); diff --git a/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationServiceJTA.java b/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationServiceJTA.java deleted file mode 100644 index f3ea0cf95f..0000000000 --- a/component/identity/src/test/java/org/exoplatform/services/organization/TestOrganizationServiceJTA.java +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2012 eXo Platform SAS. - * - * This is free software; you can redistribute it and/or modify it - * under the terms of the GNU Lesser General Public License as - * published by the Free Software Foundation; either version 2.1 of - * the License, or (at your option) any later version. - * - * This software is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this software; if not, write to the Free - * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA - * 02110-1301 USA, or see the FSF site: http://www.fsf.org. - */ - -package org.exoplatform.services.organization; - -import org.exoplatform.component.test.ConfigurationUnit; -import org.exoplatform.component.test.ConfiguredBy; -import org.exoplatform.component.test.ContainerScope; -import org.exoplatform.component.test.KernelLifeCycle; -import org.junit.ClassRule; - -/** - * Test of OrganizationService with enabled JTA setup for Hibernate - * - * @author Marek Posolda - */ -@ConfiguredBy({ - @ConfigurationUnit(scope = ContainerScope.ROOT, path = "conf/configuration.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/services/organization/TestOrganizationService-configuration.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/services/organization/TestOrganizationService-jta-configuration.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.identity-configuration-new-user-listener.xml"), -}) -public class TestOrganizationServiceJTA extends AbstractTestOrganizationService { - @ClassRule - public static KernelLifeCycle kernel = new KernelLifeCycle(); -} diff --git a/component/identity/src/test/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceWrapper.java b/component/identity/src/test/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceWrapper.java deleted file mode 100644 index 0402660ba0..0000000000 --- a/component/identity/src/test/java/org/exoplatform/services/organization/idm/PicketLinkIDMOrganizationServiceWrapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * This file is part of the Meeds project (https://meeds.io/). - * Copyright (C) 2020 - 2022 Meeds Association contact@meeds.io - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -package org.exoplatform.services.organization.idm; - -import org.gatein.common.transaction.JTAUserTransactionLifecycleService; - -import org.exoplatform.container.xml.InitParams; -import org.exoplatform.services.naming.InitialContextInitializer; -import org.exoplatform.services.organization.cache.OrganizationCacheHandler; - -public class PicketLinkIDMOrganizationServiceWrapper extends PicketLinkIDMOrganizationServiceImpl { - - public PicketLinkIDMOrganizationServiceWrapper(InitParams params, - PicketLinkIDMService idmService, - JTAUserTransactionLifecycleService jtaTransactionLifecycleService, - OrganizationCacheHandler organizationCacheHandler, - InitialContextInitializer initialContextInitializer) - throws Exception { - super(params, idmService, jtaTransactionLifecycleService, organizationCacheHandler); - } - - public PicketLinkIDMOrganizationServiceWrapper(InitParams params, - PicketLinkIDMService idmService, - OrganizationCacheHandler organizationCacheHandler, - InitialContextInitializer initialContextInitializer) - throws Exception { - super(params, idmService, null, organizationCacheHandler); - } - - @Override - public void start() {// NOSONAR - super.start(); - } -} diff --git a/component/identity/src/test/resources/conf/cache/infinispan.xml b/component/identity/src/test/resources/conf/cache/infinispan.xml deleted file mode 100644 index facd1f365d..0000000000 --- a/component/identity/src/test/resources/conf/cache/infinispan.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration-local.xml b/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration-local.xml index 7c5cc9c5fa..f2c1e966e2 100644 --- a/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration-local.xml +++ b/component/identity/src/test/resources/conf/exo.portal.component.identity-configuration-local.xml @@ -38,7 +38,7 @@ org.exoplatform.services.organization.OrganizationService - org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceWrapper + org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl init.service.listener @@ -572,9 +572,7 @@ - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties diff --git a/component/identity/src/test/resources/conf/exo.portal.component.identity-external-ldap-store-configuration.xml b/component/identity/src/test/resources/conf/exo.portal.component.identity-external-ldap-store-configuration.xml index a218c11c71..9ae0ca779a 100644 --- a/component/identity/src/test/resources/conf/exo.portal.component.identity-external-ldap-store-configuration.xml +++ b/component/identity/src/test/resources/conf/exo.portal.component.identity-external-ldap-store-configuration.xml @@ -93,7 +93,7 @@ org.exoplatform.services.organization.OrganizationService - org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceWrapper + org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl init.service.listener @@ -200,9 +200,7 @@ - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties diff --git a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-configuration.xml b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-configuration.xml index 1b42d5c52c..73329e3b84 100644 --- a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-configuration.xml +++ b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-configuration.xml @@ -33,7 +33,7 @@ org.exoplatform.services.organization.OrganizationService - org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceWrapper + org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl configuration @@ -77,9 +77,7 @@ - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties diff --git a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-parameterized-configuration.xml b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-parameterized-configuration.xml index 3f5b068c91..ff2223fe8b 100644 --- a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-parameterized-configuration.xml +++ b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-parameterized-configuration.xml @@ -93,7 +93,7 @@ org.exoplatform.services.organization.OrganizationService - org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceWrapper + org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl init.service.listener @@ -189,9 +189,7 @@ - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties diff --git a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-user-only-configuration.xml b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-user-only-configuration.xml index 0160421321..d86857045b 100644 --- a/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-user-only-configuration.xml +++ b/component/identity/src/test/resources/conf/exo.portal.component.identity-ldap-user-only-configuration.xml @@ -33,7 +33,7 @@ org.exoplatform.services.organization.OrganizationService - org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceWrapper + org.exoplatform.services.organization.idm.PicketLinkIDMOrganizationServiceImpl configuration @@ -66,9 +66,7 @@ - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties diff --git a/component/identity/src/test/resources/conf/portal/cache-configuration-template.xml b/component/identity/src/test/resources/conf/portal/cache-configuration-template.xml deleted file mode 100644 index 90d12e81d7..0000000000 --- a/component/identity/src/test/resources/conf/portal/cache-configuration-template.xml +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/identity/src/test/resources/conf/standalone/test-tck-configuration.xml b/component/identity/src/test/resources/conf/standalone/test-tck-configuration.xml index c5ea965850..109083eb1e 100644 --- a/component/identity/src/test/resources/conf/standalone/test-tck-configuration.xml +++ b/component/identity/src/test/resources/conf/standalone/test-tck-configuration.xml @@ -29,7 +29,6 @@ jar:/conf/base-root-configuration.xml jar:/conf/base-portal-configuration.xml jar:/conf/exo.portal.component.settings-configuration.xml - jar:/conf/exo.portal.component.settings-configuration-local-jta.xml jar:/conf/exo.portal.component.identity-configuration-local.xml diff --git a/component/identity/src/test/resources/ldap/infinispan.xml b/component/identity/src/test/resources/ldap/infinispan.xml deleted file mode 100644 index dcd57cee4a..0000000000 --- a/component/identity/src/test/resources/ldap/infinispan.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/component/identity/src/test/resources/ldap/test-identity-config.xml b/component/identity/src/test/resources/ldap/test-identity-config.xml index bae4494b9d..7c66245456 100644 --- a/component/identity/src/test/resources/ldap/test-identity-config.xml +++ b/component/identity/src/test/resources/ldap/test-identity-config.xml @@ -885,14 +885,6 @@ - - - - - io.meeds.kernel - exo.kernel.component.ext.cache.impl.infinispan.v8 - - test - diff --git a/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestDataStorage.java b/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestDataStorage.java index 774b81c6a7..1aa6d9c54a 100644 --- a/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestDataStorage.java +++ b/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestDataStorage.java @@ -26,8 +26,6 @@ import java.util.LinkedList; import java.util.Random; -import org.gatein.common.transaction.JTAUserTransactionLifecycleService; - import org.exoplatform.commons.exception.ObjectNotFoundException; import org.exoplatform.component.test.AbstractKernelTest; import org.exoplatform.component.test.ConfigurationUnit; @@ -67,8 +65,6 @@ import org.exoplatform.services.organization.Group; import org.exoplatform.services.organization.GroupHandler; import org.exoplatform.services.organization.OrganizationService; -import org.exoplatform.services.organization.User; -import org.exoplatform.services.organization.UserHandler; /** * Created by The eXo Platform SARL Author : Tung Pham thanhtungty@gmail.com Nov @@ -77,7 +73,6 @@ @ConfiguredBy({ @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/configuration.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.portal-configuration-local.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.settings-configuration-local-jta.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/portal/mop/navigation/configuration.xml"), }) public class TestDataStorage extends AbstractKernelTest { @@ -103,8 +98,6 @@ public class TestDataStorage extends AbstractKernelTest { /** . */ private OrganizationService org; - private JTAUserTransactionLifecycleService jtaUserTransactionLifecycleService; - public TestDataStorage(String name) { super(name); } @@ -127,7 +120,6 @@ public void onEvent(Event event) throws Exception { events = new LinkedList(); listenerService = (ListenerService) container.getComponentInstanceOfType(ListenerService.class); org = container.getComponentInstanceOfType(OrganizationService.class); - jtaUserTransactionLifecycleService = container.getComponentInstanceOfType(JTAUserTransactionLifecycleService.class); // listenerService.addListener(EventType.PAGE_CREATED, listener); @@ -743,26 +735,6 @@ public void testGroupLayout() throws Exception { assertNull(group); } - public void testJTA() throws Exception { - jtaUserTransactionLifecycleService.beginJTATransaction(); - - Page page = new Page(); - page.setPageId("portal::test::searchedpage2"); - pageService.savePage(new PageContext(page.getPageKey(), null)); - - PageContext pageContext = pageService.loadPage(page.getPageKey()); - pageContext.setState(pageContext.getState().builder().displayName("Juuu2 Ziii2").build()); - pageService.savePage(pageContext); - - assertPageFound(0, 10, null, null, null, "Juuu2 Ziii2", "portal::test::searchedpage2"); - jtaUserTransactionLifecycleService.finishJTATransaction(); - - jtaUserTransactionLifecycleService.beginJTATransaction(); - pageService.destroyPage(pageContext.getKey()); - assertPageNotFound(0, 10, null, null, null, "Juuu2 Ziii2"); - jtaUserTransactionLifecycleService.finishJTATransaction(); - } - protected void createSite(SiteType type, String siteName) throws Exception { ContainerData container = new ContainerData(null, "testcontainer_" + siteName, diff --git a/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestModelStorage.java b/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestModelStorage.java index 4ffcc3e8f5..e799dc6605 100644 --- a/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestModelStorage.java +++ b/component/portal/src/test/java/org/exoplatform/portal/mop/storage/TestModelStorage.java @@ -25,7 +25,6 @@ @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/configuration.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/standalone/portal-configuration.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.portal-configuration-local.xml"), - @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/exo.portal.component.settings-configuration-local-jta.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/portal/mop/navigation/configuration.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "org/exoplatform/portal/config/conf/configuration.xml"), @ConfigurationUnit(scope = ContainerScope.PORTAL, path = "conf/portal/test.mop.portal.configuration.xml") diff --git a/component/test/core/pom.xml b/component/test/core/pom.xml index edcaf5f3d9..a68741dd02 100644 --- a/component/test/core/pom.xml +++ b/component/test/core/pom.xml @@ -92,6 +92,12 @@ org.hsqldb hsqldb + + commons-dbcp + commons-dbcp + + compile + diff --git a/component/test/core/src/main/resources/conf/base-portal-configuration.xml b/component/test/core/src/main/resources/conf/base-portal-configuration.xml index 864b065dfb..bb07018560 100644 --- a/component/test/core/src/main/resources/conf/base-portal-configuration.xml +++ b/component/test/core/src/main/resources/conf/base-portal-configuration.xml @@ -37,6 +37,4 @@ - org.exoplatform.services.cache.ExoCacheFactory - diff --git a/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java b/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java index 9f141a1e3e..468a8e594d 100644 --- a/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java +++ b/component/test/core/src/test/java/org/exoplatform/component/test/BootstrapTestCase.java @@ -26,6 +26,7 @@ import javax.naming.InitialContext; import javax.sql.DataSource; +import org.exoplatform.commons.InitialContextInitializer2; import org.exoplatform.container.PortalContainer; import org.exoplatform.container.component.RequestLifeCycle; import org.exoplatform.services.naming.InitialContextInitializer; @@ -52,8 +53,10 @@ public void testRequestLifeCycle() { } public void testDataSource() throws Exception { - PortalContainer container = PortalContainer.getInstance(); - container.getComponentInstanceOfType(InitialContextInitializer.class); + InitialContextInitializer initialContextInitializer = PortalContainer.getInstance().getComponentInstanceOfType(InitialContextInitializer.class); + if (initialContextInitializer instanceof InitialContextInitializer2 startable) { + startable.start(); + } DataSource ds = (DataSource) new InitialContext().lookup("jdbcexo"); assertNotNull(ds); Connection conn = ds.getConnection(); diff --git a/component/test/core/src/test/resources/conf/test-jdbc-configuration.xml b/component/test/core/src/test/resources/conf/test-jdbc-configuration.xml index 85b59c4f8a..3c9b133d04 100644 --- a/component/test/core/src/test/resources/conf/test-jdbc-configuration.xml +++ b/component/test/core/src/test/resources/conf/test-jdbc-configuration.xml @@ -28,7 +28,7 @@ org.exoplatform.services.naming.InitialContextInitializer - org.exoplatform.services.naming.InitialContextInitializer + org.exoplatform.commons.InitialContextInitializer2 default-properties diff --git a/component/web/resources/src/main/java/org/gatein/portal/controller/resource/ScriptLoader.java b/component/web/resources/src/main/java/org/gatein/portal/controller/resource/ScriptLoader.java index d50e789e37..86590ee1d8 100644 --- a/component/web/resources/src/main/java/org/gatein/portal/controller/resource/ScriptLoader.java +++ b/component/web/resources/src/main/java/org/gatein/portal/controller/resource/ScriptLoader.java @@ -178,8 +178,7 @@ private String minify(String sourceName, Reader reader, List minifiedRea SourceFile[] inputs = new SourceFile[] { SourceFile.fromCode(sourceName, code.toString()) }; com.google.javascript.jscomp.Compiler compiler = new Compiler(); - compiler.setErrorManager(new LoggerErrorManager(java.util.logging.Logger.getLogger(ResourceRequestHandler.class - .getName()))); + compiler.setErrorManager(new LoggerErrorManager(java.util.logging.Logger.getLogger(ScriptLoader.class.getName()))); Result res = compiler.compile(AbstractCommandLineRunner.getBuiltinExterns(CompilerOptions.Environment.BROWSER), Arrays.asList(inputs), options); diff --git a/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml b/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml index 4876c6b08b..3dd781622a 100644 --- a/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml +++ b/web/portal/src/main/webapp/WEB-INF/conf/common/common-configuration.xml @@ -25,25 +25,9 @@ xsi:schemaLocation="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd http://www.exoplatform.org/xml/ns/kernel_1_2.xsd" xmlns="http://www.exoplatform.org/xml/ns/kernel_1_2.xsd"> - - org.exoplatform.services.listener.ListenerService - org.exoplatform.services.listener.ListenerService - - - org.infinispan.transaction.lookup.TransactionManagerLookup - org.exoplatform.services.transaction.infinispan.JBossStandaloneJTAManagerLookup - - - - org.exoplatform.services.transaction.TransactionService - org.exoplatform.services.transaction.infinispan.JBossTransactionsService - - - timeout - ${gatein.jcr.transaction.timeout:420} - - + org.exoplatform.services.listener.ListenerService + org.exoplatform.services.listener.ListenerService @@ -248,25 +232,6 @@ - - org.exoplatform.services.cache.ExoCacheFactory - org.exoplatform.services.cache.impl.infinispan.ExoCacheFactoryImpl - - - cache.config.template - ${exo.cache.config.template:jar:/conf/cache/infinispan/local/cache-config.xml} - - - cache.config.template - ${exo.cache.config.template:jar:/conf/cache/infinispan/cluster/cache-config.xml} - - - cache.async.config.template - ${exo.cache.async.config.template:jar:/conf/cache/infinispan/cluster/cache-async-config.xml} - - - - org.exoplatform.portal.resource.SkinService org.exoplatform.portal.resource.SkinService @@ -323,44 +288,4 @@ org.exoplatform.web.security.AuthenticationRegistryImpl - - org.exoplatform.services.cache.ExoCacheFactory - - addCreator - addCreator - org.exoplatform.services.cache.impl.infinispan.ExoCacheCreatorPlugin - add Exo Cache Creator - - - Generic-insp-cacheCreator - The generic cache creator - - - - - NONE - - - LRU - - - UNORDERED - - - MANUAL - - - LIRS - - - - ${exo.cache.eviction.defaultStrategy:LIRS} - ${exo.cache.expiration.defaultMaxIdle:-1} - ${exo.cache.expiration.defaultWakeUpInterval:5000} - - - - - - diff --git a/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml b/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml index 8977fed665..19529de90a 100644 --- a/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml +++ b/web/portal/src/main/webapp/WEB-INF/conf/organization/idm-configuration.xml @@ -29,13 +29,7 @@ - org.gatein.common.transaction.JTAUserTransactionLifecycleService - org.gatein.common.transaction.JTAUserTransactionLifecycleServiceImpl - - - org.exoplatform.services.database.HibernateService - database:type=HibernateService - org.exoplatform.services.organization.idm.CustomHibernateServiceImpl + org.exoplatform.services.organization.idm.IdmHibernateService hibernate.properties @@ -45,28 +39,9 @@ - - - - - - - - - - - - - - - @@ -196,10 +171,6 @@ --> - - - false - @@ -261,75 +232,4 @@ - - org.exoplatform.services.cache.CacheService - - addExoCacheConfig - addExoCacheConfig - org.exoplatform.services.cache.ExoCacheConfigPlugin - add Exo Cache Config - - - portal.User - Exo Cache cluster configuration for IDM User entity - - portal.User - ${exo.cache.portal.user.strategy:LIRS} - ${exo.cache.portal.user.MaxNodes:5000} - ${exo.cache.portal.user.TimeToLive:3600} - ${exo.cache.portal.user.cacheMode:replication} - - - - - portal.Profile - Exo Cache cluster configuration for IDM User Profile entity - - portal.Profile - ${exo.cache.portal.profile.strategy:LIRS} - ${exo.cache.portal.profile.MaxNodes:5000} - ${exo.cache.portal.profile.TimeToLive:3600} - ${exo.cache.portal.profile.cacheMode:replication} - - - - - portal.Membership - Exo Cache cluster configuration for IDM Membership entity - - portal.Membership - ${exo.cache.portal.membership:LIRS} - ${exo.cache.portal.membership.MaxNodes:5000} - ${exo.cache.portal.membership.TimeToLive:86400} - ${exo.cache.portal.membership.cacheMode:replication} - - - - - portal.Role - Exo Cache cluster configuration for IDM Membership Type entity - - portal.Role - ${exo.cache.portal.role.strategy:LIRS} - ${exo.cache.portal.role.MaxNodes:5000} - ${exo.cache.portal.role.TimeToLive:-1} - ${exo.cache.portal.role.cacheMode:replication} - - - - - portal.Group - Exo Cache cluster configuration for IDM Group entity - - portal.Group - ${exo.cache.portal.group.strategy:LIRS} - ${exo.cache.portal.group.MaxNodes:5000} - ${exo.cache.portal.group.TimeToLive:-1} - ${exo.cache.portal.group.cacheMode:replication} - - - - - - diff --git a/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml b/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml index a35cf2477d..8bfc6ace98 100644 --- a/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml +++ b/web/portal/src/main/webapp/WEB-INF/conf/portal/portal-configuration.xml @@ -49,131 +49,6 @@ - - org.exoplatform.services.cache.CacheService - - - - addExoCacheConfig - addExoCacheConfig - org.exoplatform.services.cache.ExoCacheConfigPlugin - add Exo Cache Config - - - - commons.SettingService - The Cache configuration for the setting service - - commons.SettingService - ${exo.cache.commons.SettingService.MaxNodes:100000} - ${exo.cache.commons.SettingService.TimeToLive:86400} - ${exo.cache.commons.SettingService:replication} - ${exo.cache.commons.SettingService.strategy:LIRS} - - - - - portal.PortletPreferences - The cache configuration for Portlet Preferences - - portal.PortletPreferences - ${exo.cache.portal.preferences.strategy:LIRS} - ${exo.cache.portal.preferences.MaxNodes:10000} - ${exo.cache.portal.preferences.TimeToLive:86400} - ${exo.cache.portal.preferences.cacheMode:invalidation} - - - - portal.NavigationNode - The Cache configuration for the MOP session Manager - - portal.NavigationNode - ${exo.cache.portal.mop.strategy:LIRS} - ${exo.cache.portal.mop.MaxNodes:5000} - ${exo.cache.portal.mop.TimeToLive:86400} - ${exo.cache.portal.mop.cacheMode:invalidation} - - - - portal.NavigationService - The cache configuration for the navigation Trees service - - portal.NavigationService - ${exo.cache.portal.navigation.strategy:LIRS} - ${exo.cache.portal.navigation.MaxNodes:1000} - ${exo.cache.portal.navigation.TimeToLive:86400} - ${exo.cache.portal.navigation.cacheMode:invalidation} - - - - portal.SiteService - The cache configuration for Site layout service - - portal.SiteService - ${exo.cache.portal.site.strategy:LIRS} - ${exo.cache.portal.site.MaxNodes:1000} - ${exo.cache.portal.site.TimeToLive:86400} - ${exo.cache.portal.site.cacheMode:invalidation} - - - - portal.SiteKeysByFilterService - The cache configuration for Site layout service - - portal.SiteKeysByFilterService - ${exo.cache.portal.site.strategy:LIRS} - ${exo.cache.portal.site.MaxNodes:1000} - ${exo.cache.portal.site.TimeToLive:86400} - ${exo.cache.portal.site.cacheMode:invalidation} - - - - portal.DescriptionService - The Cache configuration for the description service - - portal.DescriptionService - ${exo.cache.portal.description.strategy:LIRS} - ${exo.cache.portal.description.MaxNodes:10000} - ${exo.cache.portal.description.TimeToLive:86400} - ${exo.cache.portal.description.cacheMode:invalidation} - - - - portal.PageService - The Cache configuration for the page service - - portal.PageService - ${exo.cache.portal.page.strategy:LIRS} - ${exo.cache.portal.page.MaxNodes:1000} - ${exo.cache.portal.page.TimeToLive:86400} - ${exo.cache.portal.page.cacheMode:invalidation} - - - - - portal.TemplateService - The Cache configuration for the template service - - portal.TemplateService - ${exo.cache.portal.template.strategy:LIRS} - ${exo.cache.portal.template.MaxNodes:5000} - ${exo.cache.portal.template.TimeToLive:-1} - ${exo.cache.portal.template.cacheMode:invalidation} - - - - portal.ResourceBundleData - - - portal.ResourceBundleData - ${exo.cache.portal.ResourceBundleData.MaxNodes:1000} - ${exo.cache.portal.ResourceBundleData.TimeToLive:-1} - - - - - - org.exoplatform.services.listener.ListenerService