100 likes | 223 Views
The SwapBox: a Test Container and a Framework for Hot-swappable JavaBeans. Lei Tan Babak Esfandiari Bernard Pagurek Carleton University Ottawa, Ontario, Canada babak@sce.carleton.ca. Hot-swapping Problematics. Granularity Referential Transparency State Transfer Interface Mismatch
E N D
The SwapBox: a Test Container and a Framework for Hot-swappable JavaBeans Lei Tan Babak Esfandiari Bernard Pagurek Carleton University Ottawa, Ontario, Canada babak@sce.carleton.ca
Hot-swapping Problematics • Granularity • Referential Transparency • State Transfer • Interface Mismatch • Busy State Problem 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
Hot-swapping ProblematicsThe Case for JavaBeans • Granularity • component-level • Referential Transparency • event model provides loose coupling • State Transfer • serialization can (could…) make the beans responsible • Interface Mismatch • some idioms help • Busy State Problem 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
The SwapBox • An extension to Sun’s Beanbox • a test container for hot-swapping • a hot-swapping framework 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
Adapted Adapters • Queuing/blocking of events • The Adapter Center does the bookkeeping for each wiring: • source bean • target bean • the outgoing event • the target method • a reference to the adapter 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
More on State Transfer • The problem with serialization • XML as a replacement? • JXML/COINS/… require a schema • Sun’s promise • For now: direct use of getters/setters 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
Interface Mismatch • State variables • Methods currently involved in hook-ups • Currently active method • We let the user/manager decide… • mapping rules saved in an XML file 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
Mapping rules: example <?xml version='1.0' encoding='us-ascii'?> <swap> <swap_type>Default</swap_type> <pre_process> <time>123456</time> </pre_process> <post_process> <swap_method>swapMethod</swap_method> </post_process> <state_policy> <state newName="Dim" oldName="Dimension"></state> <state newName="Width" oldName="Width"></state> </state_policy> <interaction_policy> <change_TargetMethod> <event_source>Start Button</event_source> <event_name>button push</event_name> <old_method> <method_name>start</method_name> </old_method> <new_method> <method_name>newStart</method_name> </new_method> </change_TargetMethod> </interaction_policy> </swap> 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
SwapBox Snapshots 6th International Workshop on Component-Oriented Programming, Budapest, Hungary, June 18th 2001
Conclusion • No specific development required for hot-swappability other than Beans specs • Ongoing & future work: • dealing with “busy” beans • XSLT for mapping rules • genericity of the approach: COM, Corba… • real life application • Download: http://www.scs.carleton.ca/~ltan2/swapbox.html