The WebDSL built-in module defines the following code using a type SessionManager, without declaring that type either as a native class or as a type. Further, it seems that in order to use a type in a HQL query it needs to be declared as an entity. Apparently we need an ‘external entity’?


// section session management

invoke internalCleanupSessionManagerEntities() every 10 minutes

function internalUpdateSessionManagerTimeout(){
var n : DateTime := now().addMinutes(-30); // update lastUse after 30 minutes to avoid unnecessary db writes, also sets minimum timeout to 30 minutes
var man := getSessionManager();
if(man.lastUse == null || man.lastUse.before(n)){
man.lastUse := now();
}
}

function internalCleanupSessionManagerEntities(){
var sessiontimeout := 10000; //minutes
var n : DateTime := now().addMinutes(-1*(sessiontimeout));
var ses := from SessionManager as sc where sc.lastUse is null or sc.lastUse < ~n limit 25; //use limit to avoid loading all obsolete entities in one transaction
for(s : SessionManager in ses){
s.delete();
}
}

Submitted by Eelco Visser on 5 May 2013 at 15:47

On 5 May 2013 at 15:48 Eelco Visser tagged @dannygroenewegen

On 5 May 2013 at 17:09 Danny Groenewegen commented:

SessionManager is a built-in in the compiler https://svn.strategoxt.org/repos/WebDSL/webdsls/trunk/src/org/webdsl/dsl/languages/data-model/session-entity-extra.str. The reason it’s a compiler built-in is because it gets a reference to the securitycontext (principal) and other session entities, which are not known in advance. We can include it in the extra built-ins file with just the static properties for now.


On 6 May 2013 at 10:54 Danny Groenewegen commented:

added to extra-built-in.app


On 6 May 2013 at 10:54 Danny Groenewegen closed this issue.

Log in to post comments