I am working on a ColdFusion app to send Push Notifications via Apple's APNS service. I am using the notnoop apns java library. I have successfully sent push notifications using this, but, recently have run into some issues. I want to use the ApnsDelegate Interface that is provided in order to help debug the issue, but, I do not know how to implement a Java interface in ColdFusion. I am not a Java programmer. Please help.
Update: So far, I've actually written a Java class to implement the interface, but, I cannot figure out how to "bubble" the events to ColdFusion. I've tried logging within the java methods (using log4j), but that's not working either.
I really just need a way to capture when these java methods are called, and to log some info from the arguments being passed.
(Expanded from comments)
For CF8, it can be done with the JavaLoader's CFCDynamicProxy. It is a fantastic feature Mark Mandel added a while back. Essentially it lets you use a CFC, as if it were a concrete java class. Note, it only applies to interfaces. (CF10+ contains a rip of the JavaLoader, so the proxy feature is baked in. See Creating a Dynamic Proxy example.).
To use the dynamic proxy, just create a CFC that implements all of the methods defined in the interface. It is important that the function signatures match the methods in the interface (types, access, etcetera). Looking over the API, something like this should work.
Then use the dynamic proxy to create an instance of it. You can then use the instance anywhere that expects an
ApnsDelegate
object, just as if it were a concrete class you wrote in java.