Session Log
The Session Log extension provides an implementation of the SessionSubscriber SPI, logging each session as a SessionLogEntry
entity.
When a user logs on, a SessionLogEntry
instance is persisted; when they log off, the same instance is updated.
Setup
Dependency Management
In your application’s top level pom.xml
, add a dependency for this module’s own bill of materials (BOM):
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.causeway.extensions</groupId>
<artifactId>causeway-extensions-sessionlog</artifactId>
<scope>import</scope>
<type>pom</type>
<version>3.1.0</version>
</dependency>
</dependencies>
</dependencyManagement>
Dependencies / Imports
Your application may or may not need to interact with the audit trail directly. If it does, then add a dependency/import to the applib module wherever required:
-
add this dependency:
pom.xml<dependencies> <dependency> <groupId>org.apache.causeway.extensions</groupId> <artifactId>causeway-extensions-sessionlog-applib</artifactId> </dependency> </dependencies>
-
and
@Import
this module:MyModule.java@Configuration @Import({ CausewayModuleExtSessionLogApplib.class, // ... }) public class MyModule { ... }
In your application’s App Manifest, import the implementation modules of this extension. The exact modules to use will depend upon the persistence mechanism in use:
-
add this dependency to your webapp’s
pom.xml
:pom.xml<dependencies> <dependency> <groupId>org.apache.causeway.extensions</groupId> <artifactId>causeway-extensions-sessionlog-persistence-xxx</artifactId> (1) </dependency> </dependencies>
1 either: -
causeway-extensions-sessionlog-persistence-jpa
(JPA/Eclipselink) or -
causeway-extensions-sessionlog-persistence-jdo
(JDO/DataNucleus)
-
-
and
@Import
this module to your app manifest:MyAppManifest.java@Configuration @Import({ CausewayModuleExtSessionLogPersistenceXxx.class, (1) // ... }) public class MyAppManifest { ... }
1 either -
CausewayModuleExtSessionLogPersistenceJpa
(JPA/Eclipselink) or -
CausewayModuleExtSessionLogPersistenceJdo
(JDO/DataNucleus)
-
menubar.layout.xml
Once configured, the extension provides a number of menu actions.
You can use menubars.layout.xml
to arrange these as you see fit.
To get you started, the following fragment adds all of the actions to an "Activity" secondary menu:
<mb:secondary>
...
<mb:menu>
<mb:named>Activity</mb:named>
...
<mb:section>
<mb:named>Sessions</mb:named>
<mb:serviceAction id="activeSessions" objectType="causeway.ext.sessionLog.SessionLogMenu"/>
<mb:serviceAction id="findSessions" objectType="causeway.ext.sessionLog.SessionLogMenu"/>
</mb:section>
...
</mb:menu>
</mb:secondary>