The Castle FlexBridge project offers remoting and data services interoperation with Adobe Flex (tm). It should not be confused with Adobe's Flex (tm)-Ajax Bridge project or other official Adobe products.
The project aims to provide a lightweight, fast, robust and well-tested Open Source implementation of Adobe Flex (tm) remoting, data and media services for .Net. It also includes powerful client-side components such as an Inversion of Control container with Constructor Dependency Injection similar to Castle MicroKernel. The client and server components can be used together or independently as you wish.
At this time, there are several other third party solutions available with some or all of these features. This project aims to differentiate itself by achieving a higher standard of quality.
The implementation should make efficient use of resources, scale out to handle heavy concurrent load, be robust in the face of errors, and yield consistent and correct results. Furthermore, the API and internal architecture should leverage .Net idioms and features to ease integration, and provide many opportunities for extension and customization.
It is not the purpose of this project to provide a standalone and fully-featured "media server" component in the same manner as Adobe Flex Data Services (tm),
Adobe Media Server (tm), WebOrb (tm) and similar products. Rather it is intended to provide components that can be seamlessly integrated into existing applications to solve specific concerns. While a "media server" could be constructed using these components, it is beyond the scope of the project to provide one.
Server-Side Components
Current Features
- Flex Remoting using the AMF0 and AMF3 binary protocols.
- Automatic mapping between ActionScript and .Net types during object serialization and deserialization. The mapping is guided by optional custom .Net attributes that specify the name and properties of the ActionScript counterpart for each class and member. It also supports dynamic classes and IExternalizable.
- Built-in support for mapping common .Net types including generic lists and dictionaries. Custom mappers may also be supplied to handle user-defined types.
- Gateway HttpHandler for integration with existing ASP.Net applications.
Planned Features
- Windows Communication Foundation integration.
- Push-style messaging.
- Media streaming.
Client-Side Components
Current Features
- Inversion of Control container for ActionScript 3 similar to the Castle MicroKernel:
- Supports Constructor Dependency Injection.
- Supports Singleton, Transient and External Instance component lifestyles.
- Framework code:
- AsyncTask: An implementation of a Future that simplifies writing code for long-running background operations using Continuation-Passing Style.
- Helpers:
- ArrayUtils, CollectionUtils, ListUtils: Collection manipulation utilities.
- Base64: A Base64 codec for ByteArrays. (Useful until Adobe finally opens up their own internal one...)
- HtmlUtils: HTML-encoding utilities.
- ReflectionUtils: Takes the pain out of describeType() by providing wrappers for reflected code elements and working around Flash Player bugs.
- Datatypes:
- LazyList: A lazily-populated IList.
- Set: A set collection.
- TimeInterval: A datatype with a start time and end time.
- Uri and UriBuilder: A URI datatype with better support than what's offered by URIUtil.
- MXML components:
- ActiveText and ActiveTextArea: Extensions of Text and TextArea with robust support for embedding arbitrary controls within the body of the text field and with additional link click and roll-over related events.
- AsyncTaskStatusOverlay: A simple container that displays a "loading" banner over its children why an AsyncTask is executing. The overlay also handles error conditions by displaying an "error" banner with a button for displaying error details in an ErrorDialog.
- Dialog: A base class for easily implementing pop-up dialogs.
- ErrorDialog: A simple dialog for reporting errors.
- SizeableTitleWindow: A resizable TitleWindow.
- SmartRepeater: A highly optimized version of Repeater that performs the minimum necessary updates when its underlying data source changes.
Planned Features
- Dependency injection and component configuration via properties.
- Type converters.
Requirements
Installation
To install from source:
- svn co https://svn.castleproject.org/svn/castlecontrib/flexbridge/trunk/
FlexBridge - cd FlexBridge
- Build.bat
The binaries will be placed into the build\bin folder. The MbUnit tests will also run automatically.
Note: You may wish to replace the supplied pre-built Castle Windsor libraries with your own version.
Usage
More Information
Refer to the XML document comments in the FlexBridge API. Most of the components should be quite easy to use. If you need more assistance, feel free to contact me via email at: jeff(dot)brown(at)gmail(dot)com.
Motivation
I wrote this library after realizing how painfully slow and CPU-intensive SOAP remoting can be when a lot of data needs to be pushed around. My application was spending a huge amount of time deserializing SOAP responses during which it was unresponsive to the user. Moreover, I wanted to be able to push data to the client as it became available rather than constantly polling for it.
I looked at existing solutions to these problems but none satisfied. I didn't trust the implementations and at the time none of them provided strong support
for .Net 2.0 features. I also wanted drop-in integration with Castle core services such as logging because my application was already using Windsor everywhere.
It didn't seem that hard and I had a little free time...
Thanks
Many thanks to the contributors of the OS Flash project for reverse-engineering and publishing the AMF protocol. Also thanks to the implementors of the many other Open Source Flex Remoting libraries which provided some good reference code and ideas.
The protocol data at http://osflash.org/documentation/amf3
and http://osflash.org/documentation/amf
were valuable resources.
The RemoteObjectAMF0 adapter for AMF0 based RemoteObject access used for integration testing was written by Renaun Erickson and is available at http://renaun.com/blog/flex-components/remoteobjectamf0/![]()
