Bug 1258

Summary: Add Multiple JNI/Native to Java Callback Generation Techniques
Product: [JogAmp] Gluegen Reporter: Sven Gothel <sgothel>
Component: coreAssignee: Sven Gothel <sgothel>
Status: CONFIRMED ---    
Severity: enhancement    
Priority: P4    
Version: tbd   
Hardware: All   
OS: all   
Type: FEATURE SCM Refs:
Workaround: ---

Description Sven Gothel 2015-10-23 14:47:32 CEST
As it is for now, we used manual injected code to implement 
a callback from native code back to Java.

Use Case A)
  - Register a java callback method (Class instance or static) [T1]
    to be issued by a native toolkit callback method [T2].
    
  - The native toolkit callback method [T2] has to be registered
    to a toolkit register function [T3]
    
  - User has to mark (configure) the toolkit register function [T3]
    as well as the native toolkit callback method [T2]
    to be used for java callback.

  - User further needs to define the identity of
    the native toolkit callback method [T2]. I.e. multiple such 
    instances may need to exist for different callbacks and their
    respective registries.
    Since only callback where a caller instance is being passed
    would allow using a callback dispatch table.

  Note: This use case is currently manually utilized by JOGL's 
  OpenGL debug callbacks, see GLDebugMessageHandler

Use Case B)
  - Register a java callback method (Class instance or static) [T1]
    to be issued by another JNI API method [T4] as a 
    pre- or post-call.

    This allows an implementation to properly track events
    and/or trigger certain resource functionality.

  Note: This use case is currently manually utilized by JOGL's
  GPU side memory [re-]allocation / mapping, 
  see GLBufferObjectTracker/GLBufferStorage.