Project

General

Profile

Feature #1636

implement peristent trigger support

Added by Greg Shah over 11 years ago. Updated over 7 years ago.

Status:
Closed
Priority:
Normal
Start date:
01/31/2013
Due date:
% Done:

100%

Estimated time:
24.00 h
billable:
No
vendor_id:
GCD

ca_upd20130131c.zip (95.5 KB) Constantin Asofiei, 01/31/2013 08:52 AM

ca_upd20130201a.zip - P2J sources (100 KB) Constantin Asofiei, 02/01/2013 07:50 AM

ca_upd20130201b.zip - testcases (1.78 KB) Constantin Asofiei, 02/01/2013 07:50 AM

History

#1 Updated by Greg Shah over 11 years ago

  • Target version set to Milestone 7

#2 Updated by Greg Shah about 11 years ago

  • Assignee set to Constantin Asofiei

Just implement the conversion support for now, unless it is trivial to do the runtime too.

#3 Updated by Constantin Asofiei about 11 years ago

The conversion support is done, and a major part of the runtime (i.e. trigger invocation). The only runtime problem remaining is the fact that the trigger must survive the procedure where it was defined (i.e. they need to be added to a global scope) - is there such a global scope in LogicalTerminal (and I guess on ThinClient too) where I can add them ?

Also, I've looked in the documentation and I've tried deleting them using the ON ... REVERT, and I don't understand if these kind of triggers can be deleted or they remain active until the user session ends.

#4 Updated by Constantin Asofiei about 11 years ago

Adds conversion support; runtime support is missing implementation for the "persistent" nature of these triggers. Built using bzr revision 10158.

#5 Updated by Greg Shah about 11 years ago

In regard to the global scope question for LT and TC:

1. The TriggerManager is scope-aware, but it currently has no concept of the global scope. This could be added easily.
2. The LogicalTerminal is aware of the global scope, but it doesn't do anything special related to triggers. See LT.scopeStart() and look for TransactionManager.isGlobalBlock().
3. The TC is barely scope aware. It gets scope notifications (see markFrames() and look for MarkEntry.OPEN_SCOPE and MarkEntry.CLOSE_SCOPE) which are used to do some frame-related maintenance. But as a whole, the TC doesn't keep its own scope or really do much in that regard. And I don't think you will need to add such in this case. The triggers that are active are managed on the server and when a call is made down to the client, the active trigger events are listed and sent down. For the lifetime of that primitive UI operation (e.g. UPDATE), that set of events cannot be changed, unless there is a nested trigger and recursive call down to the client, in which case a new set of active events can be sent down. But the call stack naturally unwinds all this as we return back up. Unless you find something different, it should be enough to manage this server-side.

#6 Updated by Greg Shah about 11 years ago

Code feedback:

In registerTriggerPersistent() it says:

    * @param    params
    *           The parameters to be passed to the procedure (INPUT only).
...
   // each parameter is evaluated at runtime

Both of these comments need some clarification. The key point here is that the original parameters list is fully evaluated in the caller and is not re-evaluated at the time the trigger is called. The already-evaluated values are passed unchanged to the procedure.

Otherwise it is good.

#7 Updated by Constantin Asofiei about 11 years ago

Some other notes related to scoping:
  1. if there is a non-persistent and a persistent trigger for the same event, the local one will be executed
  2. after the non-persistent trigger gets out-of-scope, the non-persistent trigger is "reactivated"

The persistent triggers I think will need to be maintained in the same ScopedDictionary as the normal ones, because we need to preserve the order in which the triggers were defined. What I think we should do is to put the persistent triggers on the scope where they are defined, and when that scope is finished, we move them one level down instead of discarding them.

#8 Updated by Constantin Asofiei about 11 years ago

  • Status changed from New to WIP

#9 Updated by Constantin Asofiei about 11 years ago

  • Start date set to 01/31/2013

#10 Updated by Greg Shah about 11 years ago

Our ScopedSymbolDictionary has a global scope facility that should do most of the work here. The only question I have is this: is there ever a case where the persistent trigger registration is treated as if it is BOTH in the local scope and in the global scope? If so, then it may be solved by adding it to both the local scope as well as the global scope. Then the natural scoping behaviors of the dictionary should take care of the rest.

#11 Updated by Constantin Asofiei about 11 years ago

I don't think that would do the job, as a non-persistent trigger can hide a persistent trigger; the persistent trigger will be active again only when the non-persistent trigger gets out of scope. Thus, proper chaining of trigger definitions is required (regardless of how the trigger is, persistent or non-persistent). At this time, I think the best place to keep the persistent triggers is the same dictionary as the normal triggers, with the notes that persistent triggers defined in current scope will be moved to previous scope, when current scope ends and that we will have a global set where the id's of all persistent triggers are kept.

#12 Updated by Constantin Asofiei about 11 years ago

PS for 11: and there is no need to save them in a global scope too, because when a persistent trigger is defined for the same events as an existing persistent trigger, the existing one gets deleted. so, saving them in the global scope will be of no help, as we will still have to walk the local scopes to remove any existing trigger for the same events.

#13 Updated by Constantin Asofiei about 11 years ago

Attached are testcases and P2J sources which implement both conversion and runtime support for persistent triggers.

#14 Updated by Constantin Asofiei about 11 years ago

  • Status changed from WIP to Review

#15 Updated by Constantin Asofiei about 11 years ago

Conversion regression testing has passed (no changes in the generated sources).

#16 Updated by Constantin Asofiei about 11 years ago

Regression testing has passed, applied to bzr revision 10162.

#17 Updated by Constantin Asofiei about 11 years ago

  • % Done changed from 0 to 100

#18 Updated by Greg Shah about 11 years ago

  • Status changed from Review to Closed

#19 Updated by Greg Shah over 7 years ago

  • Target version changed from Milestone 7 to Runtime Support for Server Features

Also available in: Atom PDF