diff --git a/Dockerfile b/Dockerfile index 17a3dabf71..dfa1d348bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -11,8 +11,9 @@ CMD ["./bin/standalone.sh", "-b", "0.0.0.0", "--debug", "8787", "-bmanagement", COPY src/main/docker/bin/standalone.conf ./standalone-custom.conf COPY src/main/docker/standalone/configuration/ standalone/configuration/ COPY src/main/docker/domain/configuration/ domain/configuration/ -COPY src/main/docker/modules/system/layers/base/com/informix/jdbc/ modules/system/layers/base/com/informix/jdbc/ +COPY src/main/docker/modules/system/layers/base/org/postgresql/postgresql/ modules/system/layers/base/org/postgresql/postgresql/ COPY src/main/docker/modules/system/layers/base/com/oracle/jdbc/ modules/system/layers/base/com/oracle/jdbc/ +COPY src/main/docker/modules/system/layers/base/com/informix/jdbc/ modules/system/layers/base/com/informix/jdbc/ COPY src/main/docker/modules/system/layers/base/it/cnr/sigla/configuration/main/ modules/system/layers/base/it/cnr/sigla/configuration/main/ EXPOSE 9990 diff --git a/SIGLA/pom.xml b/SIGLA/pom.xml index f6f60d6ec0..25e0ef1954 100644 --- a/SIGLA/pom.xml +++ b/SIGLA/pom.xml @@ -138,7 +138,9 @@ - com.oracle.jdbc, org.apache.xerces, + com.oracle.jdbc, + org.postgresql.postgresql, + org.apache.xerces, org.apache.commons.collections, org.codehaus.jackson.jackson-mapper-asl, com.fasterxml.jackson.core.jackson-annotations, diff --git a/pom.xml b/pom.xml index 6149a793e3..750509ce6d 100644 --- a/pom.xml +++ b/pom.xml @@ -24,7 +24,7 @@ true 1.8 4.3.3.RELEASE - 5.0.58 + 5.0.59 ISO-8859-1 ${maven.build.timestamp} 1.7.21 diff --git a/sigla-ejb/src/main/java/it/cnr/contab/utente00/nav/comp/GestioneLoginComponent.java b/sigla-ejb/src/main/java/it/cnr/contab/utente00/nav/comp/GestioneLoginComponent.java index d1498b06ce..eb09734544 100644 --- a/sigla-ejb/src/main/java/it/cnr/contab/utente00/nav/comp/GestioneLoginComponent.java +++ b/sigla-ejb/src/main/java/it/cnr/contab/utente00/nav/comp/GestioneLoginComponent.java @@ -65,6 +65,7 @@ import it.cnr.jada.persistency.sql.LoggableStatement; import it.cnr.jada.persistency.sql.PersistentHome; import it.cnr.jada.persistency.sql.SQLBuilder; +import it.cnr.jada.util.PropertyNames; import it.cnr.jada.util.RemoteIterator; import it.cnr.jada.util.ejb.EJBCommonServices; @@ -405,7 +406,7 @@ public List sessionList(UserContext userContext, String cdUten public void registerUser(UserContext userContext,String id_clone) throws it.cnr.jada.comp.ComponentException { unregisterUser(userContext); try { - java.sql.CallableStatement stm = getConnection(userContext).prepareCall("{ call CNRCTB850.register(?,?,?,?,?) }"); + java.sql.CallableStatement stm = getConnection(userContext).prepareCall(PropertyNames.getProperty("package.cnrctb850.register")); stm.setString(1,CNRUserContext.getCd_cds(userContext)); stm.setInt(2,CNRUserContext.getEsercizio(userContext).intValue()); stm.setString(3,CNRUserContext.getUser(userContext)); @@ -422,7 +423,7 @@ public void registerUser(UserContext userContext,String id_clone) throws it.cnr. } public void unregisterUser(UserContext userContext) throws it.cnr.jada.comp.ComponentException { try { - java.sql.CallableStatement stm = getConnection(userContext).prepareCall("{ call CNRCTB850.unregister(?) }"); + java.sql.CallableStatement stm = getConnection(userContext).prepareCall(PropertyNames.getProperty("package.cnrctb850.unregister")); stm.setString(1,userContext.getSessionId()); try { stm.execute(); @@ -436,7 +437,7 @@ public void unregisterUser(UserContext userContext) throws it.cnr.jada.comp.Comp public void unregisterUsers(String id_clone) throws it.cnr.jada.comp.ComponentException { try { Connection conn = it.cnr.jada.util.ejb.EJBCommonServices.getConnection(); - java.sql.CallableStatement stm = conn.prepareCall("{ call CNRCTB850.unregisterAll(?) }"); + java.sql.CallableStatement stm = conn.prepareCall(PropertyNames.getProperty("package.cnrctb850.unregisterall")); stm.setString(1,id_clone); try { stm.execute(); diff --git a/sigla-ejb/src/main/resources/it/cnr/jada/util/oracle.properties b/sigla-ejb/src/main/resources/it/cnr/jada/util/oracle.properties new file mode 100644 index 0000000000..50c966caff --- /dev/null +++ b/sigla-ejb/src/main/resources/it/cnr/jada/util/oracle.properties @@ -0,0 +1,13 @@ +### PACKAGE +package.lock.transaction={ call IBMUTL001.LOCK_TRANSACTION() } +package.unlock.transaction={ call IBMUTL001.UNLOCK_TRANSACTION() } +package.trace.user.connection={ call IBMUTL001.TRACE_USER_CONNECTION(?,?,?)} +package.getdbrefreshdate={? = call IBMUTL001.getDBRefreshDate} +package.cnrctb850.register={ call CNRCTB850.register(?,?,?,?,?) } +package.cnrctb850.unregister={ call CNRCTB850.unregister(?) } +package.cnrctb850.unregisterall={ call CNRCTB850.unregisterAll(?) } + +#QUERY SYNTAX +query.date=SELECT TRUNC(SYSDATE) FROM DUAL +query.exists=SELECT 1 FROM DUAL WHERE EXISTS ( +query.count.end=) \ No newline at end of file diff --git a/sigla-ejb/src/main/resources/it/cnr/jada/util/postgres.properties b/sigla-ejb/src/main/resources/it/cnr/jada/util/postgres.properties new file mode 100644 index 0000000000..3c80523f06 --- /dev/null +++ b/sigla-ejb/src/main/resources/it/cnr/jada/util/postgres.properties @@ -0,0 +1,13 @@ +### PACKAGE +package.lock.transaction={ call IBMUTL001_LOCK_TRANSACTION() } +package.unlock.transaction={ call IBMUTL001_UNLOCK_TRANSACTION() } +package.trace.user.connection={ call IBMUTL001_TRACE_USER_CONNECTION(?,?,?)} +package.getdbrefreshdate={? = call IBMUTL001_getDBRefreshDate() } +package.cnrctb850.register={ call CNRCTB850_register(?,?,?,?,?) } +package.cnrctb850.unregister={ call CNRCTB850_unregister(?) } +package.cnrctb850.unregisterall={ call CNRCTB850_unregisterAll(?) } + +#QUERY SYNTAX +query.date=SELECT NOW() +query.exists=SELECT 1 WHERE EXISTS ( +query.count.end=) AS COUNT \ No newline at end of file diff --git a/sigla-web/src/main/java/it/cnr/contab/util/servlet/ExpireSessionServlet.java b/sigla-web/src/main/java/it/cnr/contab/util/servlet/ExpireSessionServlet.java index 4d3fb93a97..f7b18f5d05 100644 --- a/sigla-web/src/main/java/it/cnr/contab/util/servlet/ExpireSessionServlet.java +++ b/sigla-web/src/main/java/it/cnr/contab/util/servlet/ExpireSessionServlet.java @@ -1,5 +1,6 @@ package it.cnr.contab.util.servlet; +import it.cnr.contab.utente00.nav.ejb.GestioneLoginComponentSession; import it.cnr.contab.utenze00.bp.CNRUserContext; import it.cnr.contab.utenze00.bulk.SessionTraceBulk; import it.cnr.jada.UserContext; @@ -15,6 +16,7 @@ import java.util.Date; import java.util.Enumeration; import java.util.Hashtable; +import java.util.Optional; import javax.ejb.EJBException; import javax.servlet.ServletException; @@ -145,16 +147,23 @@ public void sessionCreated(HttpSessionEvent se) { } public void sessionDestroyed(HttpSessionEvent se) { UserContext userContext = (UserContext) se.getSession().getAttribute("UserContext"); - if (userContext != null){ - StringBuffer infoUser = new StringBuffer(); - infoUser.append("LogOut User:"+userContext.getUser()); - log.warn(infoUser.toString()); - } try { + Optional.ofNullable(userContext) + .ifPresent(userContext1 -> { + try { + StringBuffer infoUser = new StringBuffer(); + infoUser.append("LogOut User:"+userContext1.getUser()); + log.warn(infoUser.toString()); + createGestioneLoginComponentSession().unregisterUser(userContext1); + } catch (ComponentException|RemoteException e) { + log.error("", e); + } + }); SessionTraceBulk sessionTrace = (SessionTraceBulk)createCRUDComponentSession().inizializzaBulkPerModifica(new CNRUserContext("SESSIONTRACE",se.getSession().getId(),null,null,null,null), new SessionTraceBulk(se.getSession().getId())); sessionTrace.setToBeDeleted(); createCRUDComponentSession().eliminaConBulk(new CNRUserContext("SESSIONTRACE",se.getSession().getId(),null,null,null,null), sessionTrace); } catch (Exception e) { + log.error("", e); } HttpEJBCleaner httpejbcleaner = (HttpEJBCleaner)se.getSession().getAttribute("it.cnr.jada.util.ejb.HttpEJBCleaner"); if (httpejbcleaner != null) @@ -164,5 +173,8 @@ public void sessionDestroyed(HttpSessionEvent se) { public CRUDComponentSession createCRUDComponentSession() throws javax.ejb.EJBException,java.rmi.RemoteException { return (CRUDComponentSession)it.cnr.jada.util.ejb.EJBCommonServices.createEJB("JADAEJB_CRUDComponentSession"); } - + + public GestioneLoginComponentSession createGestioneLoginComponentSession() throws javax.ejb.EJBException,java.rmi.RemoteException { + return (GestioneLoginComponentSession)it.cnr.jada.util.ejb.EJBCommonServices.createEJB("CNRUTENZE00_NAV_EJB_GestioneLoginComponentSession"); + } } diff --git a/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/module.xml b/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/module.xml new file mode 100644 index 0000000000..e288e99192 --- /dev/null +++ b/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/module.xml @@ -0,0 +1,12 @@ + + + + + + + + + + + + diff --git a/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/postgresql-9.2-1004.jdbc41.jar b/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/postgresql-9.2-1004.jdbc41.jar new file mode 100644 index 0000000000..0bd27b3770 Binary files /dev/null and b/src/main/docker/modules/system/layers/base/org/postgresql/postgresql/main/postgresql-9.2-1004.jdbc41.jar differ diff --git a/src/main/docker/standalone/configuration/standalone.xml b/src/main/docker/standalone/configuration/standalone.xml index e1f794d78c..92b7b6a62c 100644 --- a/src/main/docker/standalone/configuration/standalone.xml +++ b/src/main/docker/standalone/configuration/standalone.xml @@ -142,7 +142,33 @@ sa - + + ${env.SIGLA_CONNECTION_URL:jdbc:postgresql://localhost:5432/mydb?schema=public} + postgres + select 1; + + 5 + 20 + + + ${env.SIGLA_CONNECTION_USERNAME:sigla} + ${env.SIGLA_CONNECTION_PASSWORD:siglapw} + + + false + false + + + false + 0 + 0 + 0 + 0 + 0 + 0 + + + ${env.SIGLA_CONNECTION_URL:jdbc:oracle:thin:@dbtest.cedrc.cnr.it:1521:SIGLAF} ojdbc @@ -189,6 +215,9 @@ com.informix.jdbc.IfxDriver + + org.postgresql.Driver +