.NET Attributes in WebORB 2.1
The 2.1 release will have a new extensible framework for applying method and class attributes to remotable .NET objects to control object activation, auto-update and potentially many other things. Historically, object activation in WebORB has been controlled by the client side through gateway URL - for example, flash remoting and AJAX client have to add "activation=session" to the WebORB URL in order to request session activation for the retrieved object. This approach has worked quite well, but conceptually, the decision (and any related configuration) on how to activate a particular object should be done on the server-side. The 2.1 release will take care of it through class attributes. So now a developer can place the [SessionActivation()] attribute into the class declaration and when an invocation request arrives for the class, WebORB will try to retrieve an instance from the current session.
Another example of using .NET attributes in WebORB is the AutoUpdate feature (I blogged about it in the previous post). We strived to make the feature as least intrusive as possible and the attributes appear to do the job quite well. For example, the method below retrieves a Car object through a method invocation.
[EnableAutoUpdate()]
public Car RentACar()
{
// ... method logic
}
The framework for applying method attributes in WebORB provides a way to handle pre- and post-invoke events. Suppose you created a .NET attribute and applied it to a method invoked from Flex, Flash or an AJAX client. If your attribute class implements the Weborb.IWebORBAttribute interface (see below), the product will execute the HandlePreInvoke method before the invocation of the method takes place and then will call the HandlePostInvoke method.
namespace Weborb
{
public interface IWebORBAttribute
{
void HandlePreInvoke( MethodInfo method,
object obj,
object[] arguments );
Hashtable HandlePostInvoke( MethodInfo method,
object obj,
object[] arguments,
object returnType );
}
}
The post-invoke method can return a map of key-value pairs (Hashtable). These values will be delivered to your client application along with the return type as metadata. I think this is quite a powerful framework. I am very curious to see how people will use it in their applications.







0 Comments:
Post a Comment
<< Home