This may be a bit of an abstract question. Is there a way to assign a HANDLE to a Progress.Lang.Object or vice versa? Is there any built-in boxing classes that allows one to contain the other?
For example I'm wondering if there is some way to define a generic API that may use one or the other in the declaration, but still support both types of references in the implementation. For example, lets say I build a generic interface with a method like so:
METHOD PUBLIC VOID DoAction(INPUT p_Object AS Progress.Lang.Object ).
Would there be a way to send a HANDLE thru that parameter (without building my own custom boxing class)? Or if I defined DoAction(INPUT p_Handle AS HANDLE) then could I somehow send an Object as the input ?
"HANDLES" are the legacy way that OE allows you to pass around references to system components. It would be nice if there was some compatibility between those legacy handles and regular OO object references. Sometimes it seems that they are two different types of memory references that live in their own separate worlds.
Any ideas would be appreciated.
Have you tried just defining method for both in your class?
DoAction(INPUT p_Handle AS HANDLE)
DoAction(INPUT p_Object AS Progress.Lang.Object )
I know that would work but it seemed redundant, if there was some compatibility between the two. Eg a built-in method like GET-HANDLE(p_Object) or GET-OBJECT(p_Handle).
Even a built-in boxing class would do the trick if it existed (eg NEW Progress.Lang.HandleBox(p_Handle).
Also, my question is not really about a class, it's about a generic interface that would be implemented by classes. It would be unfortunate if all implementations had to be cluttered with the two variations of DoAction, even though 99% would be working with the p_Object and only 1% would ever care about the p_Handle.
Thanks for the reply. Will look into your handle holder. Sounds a lot like the boxing class that I was looking for. Please be patient for this post, since it seems like all my stuff is going thru moderation today and is taking a while to show up in the community forums.
Thanks for pointing me to OpenEdge.Core.WidgetHandle. It is what I was looking for. It seems to be working thus far. No point in writing my own.
I considered having the two methods but that appeared a bit redundant since the question is about a generic interface. It would be unfortunate if all classes that implemented the interface needed to be cluttered with the TWO variations of DoAction even though 99% of them interacted with objects and only 1% would ever care about working with HANDLES.
(Again, sorry for any delays due to forum moderation)
I had a bit of trouble with WidgetHandle in that one of our deployment environments was only running 11.3. (We really need to get up-to-date on our technology.) Fortunately I was able to port that stuff back into my own namespace, and it seems to be fairly compatible with OE 11.3.
I was a bit confused how the Ccs namespace is introduced into the client session. Does that come from some pl library? Or from some deeper magic? Using the namespace works fine for me on 11.7.3, but I can't figure out which PROPATH component is allowing those interfaces to be available.
The Ccs.* Namespaces where added in 11.7.2 only.
The interfaces are located in OpenEdge.BusinessLogic.pl
or here:
github.com/.../businesscomponents
or here:
community.progress.com/.../2951.ade-openedge-11-7-3-development-tools-source-code