Small code donation
David Delbecq <[email protected]> Thu, 8 Sep 2005 12:34:06 +0200
| Newsgroups | gmane.comp.java.enhydra.shark |
|---|---|
| Organization | Institut Royal Météorologique |
| Message-ID | <[email protected]> |
Hello, Am sending this small code as i think it might be useful to shark-CORBA. It's a simple code generator which explore the shark client CORBA interfaces and creates wrappers around each of them (as long as they can be reached by a trail of calls coming from the initial. The wrappers are created using the decorator design pattern. They automatically unwrap parameters if needed and wrap results. The added functionnality for decorator is to catch null values on returns. CORBA does not support nulls so instead of sending nulls, the sun corba layer sends a BAD_PARAM exception with a 201 minor code (see http://java.sun.com/j2se/1.4.2/docs/guide/idl/jidlExceptions.html#minorcodemeanings) This will help developers using the shark client api as in current implementation, catching manually all those exceptions because the shark engine sends lots of null when dealing with description process (process description, activity description) or auditEvents (the activity() might be null, resulting in one of those exceptions client-side) To execute, ensure all shark libs are in classpath and run org.enhydra.shark.wrapper.tool.WrapperMaker First argument must be configuration properties file (provided) and second is destination path for generated .java Using the wrappers after is easy, replace SharkInterface interface= SharkInterfaceHelper.narrow(ncRef.resolve(path)); by SharkInterface interface= new SharkInterfaceWrapper(SharkInterfaceHelper.narrow(ncRef.resolve(path))); After use as usual, all returned interfaces from call will be wrapper where needed. Then you don't have to worry anymore about this null return values throwing exceptions. I think generation of wrappers could be included in the shark build process. Regards. -- David Delbecq Royal Meteorological Institute of Belgium - Is there life after /sbin/halt -p?
shark_wrapper.tar.gz
(application/x-tgz, 5.5 KB) - not displayed
message-footer.txt
(text/plain, 271 B)
-- You receive this message as a subscriber of the [email protected] mailing list. To unsubscribe: mailto:[email protected] For general help: mailto:[email protected]?subject=help ObjectWeb mailing lists service home page: http://www.objectweb.org/wws