FLEX的.NET开源库FluorineFX

FluorineFX开源库 下载
关于FluorineFX
FluorineFX是一个开源库,提供了一种在.NET framework下对Flex/Flash的远程过程调用,Flex数据服务和实时数据的使用技术。

能被.NET frameworks支持的FluorineFx有:

  • Microsoft .NET Framework 1.1 (1.1.4322)
  • Microsoft .NET Framework 2.0 (2.0.50727)
  • Microsoft .NET Framework 3.5 (3.5.21022.8)
  • Mono 1.2.4
  • .NET frameworks 支持向下兼容,所以新版本的框架将运行的二进制集会被定位到先前版本的框架
   特性
  • Flex, Flash Remoting (RPC)
  • Flex Messaging (partial)
  • Flex Data Services (partial)
  • Supports AMF0, AMF3 and RTMP protocols
  • Service Browser
  • Template based code generator (ASP.NET like syntax)
  • Easily integrate rich Internet applications with .NET backend
  • Easily integrate with Adobe Integrated Runtime (Adobe AIR?)

FluorineFx的配置

使用“FluorineFx ASP.net Web site”向导生成的项目结构如下:


除了根目录下的web.config文件(asp.net网站的标准配置文件外),WEB-INF/flex目录下还有四个配置文件(.xml)。
由于FluorineFx是Flex Data Service的.net替代品(如果你用Java写服务器端程序,则可以直接用Flex Data Service),FluorineFx提供了和Flex Data Service相同的功能—即在services-config.xml配置文件的<services>部分配置Remoting Service, Message Service ,Data Management Service。
此外,除了把所有配置都放在services-config.xml一个文件中,还可以把Service配置信息分散到多个配置文件里,然后包含进来以达到简化的效果。如下:



下表是这四个配置文件的作用:


看上去这些配置文件和Flex Data Service保持一致。没错,FluorineFx 配置文件与Flex/Flash保持了统一。
在这些配置部分,有些针对于所有的全部的Service(在services-config.xml设置),有些则专用于特定的Service(在remoting-config.xml/ messaging-config.xml/ data-management-config.xml中设置)。
先看看services-config.xml中的全局设置部分:
1.配置message channelFluorineFx 使用Flex messaging system 中的message channel传输消息。一个channel可以让多个Service通信。FluorineFx目前不支持AMF polling channels 。在services-config.xml配置文件中可以设置AMF Channel 或者RTMP Channel。如下:

这里用<channel-definition>定义的channel,每个都有唯一的id。<endpoint>的uri设置的是一个接受用户请求的网关(Gateway.aspx)程序。打开这个网关程序,你可以发现程序中没有任何代码。
Flex调用远程对象的流程大概如下:
<!--[if !supportLists]-->l         <!--[endif]-->Flex发出调用远程对象的请求,这个请求会被Flash Player编码成AMF;
<!--[if !supportLists]-->l         <!--[endif]-->Flex代码中定义了 Service组件,通过该组件的id,找到对应配置文件中定义的destination。
<!--[if !supportLists]-->l         <!--[endif]-->destination通过它的channel 的 id找到对应的channel定义。
<!--[if !supportLists]-->l         <!--[endif]-->根据channel的定义,将请求发送给指定的gateway;
<!--[if !supportLists]-->l         <!--[endif]-->gateway将请求发送给gateway的后台类,将消息转换成.net格式,调用服务器上正确的类;
接下来,针对Remoting Service, Message Service ,Data Management Service的配置分别进行详细说明。
一、配置 RPC(remoting-config.xml)
定义Remoting Service destination就是定义需要访问的remote object。Remoting service destination就是一个对象,Flex使用<mx:RemoteObject>或 ActionScript代码连接这个远程对象。
例如:





对上面配置的说明:1.<security>的安全设置 定义了远程对象,可以使用security constraint来限制用户访问访问这个destination (只支持custom authentication)。
Security constraints 可以在destination中定义,也可以在destination外面 定义,然后在destination中通过Security constraints的 id引用。
2.Destination adapterAdapters是服务器上的一个组件,利用Adapter,客户端才能访问远程服务器上的 service object。 Adapter 定义不是必需的, gateway 将自动配置它。默认的Remoting Adapter是flex.messaging.services.RemotingService。
3.Remote object 的<properties>


4.Web service properties(还不支持)5.默认设置
如果没有service配置文件,则gateway会使用下面的默认配置:






二、配置 Message ServiceMessage Service destination 是就是消息传输的终端(endpoint)。在这台终端机上封装有服务器端代码,处理传输过来的消息 。使用 Producer 和Consumer 组件或ActionScript API可以连接到message service destination。
例如:



对上面配置的说明:1.Message channels当前版本的FluorineFx 只支持通过Realtime Message Protocol (RTMP) channel传输消息。
2.Message Service adapter在FluorineFx中,默认的 Message Service adapter就是 FluorineFx.Messaging.Services.Messaging.MessagingAdapter 类。所以配置文件如下设置:


如果编写MessagingAdapter类的子类,你就可以自己定义Adapter 。
3.Network properties

4.Server properties


三、配置 Data Management ServiceData Management Service destination 是一个终端。这个终端可以接收数据,或者发送数据到客户机。它提供了将数据分布到多个Data Management Service destination和 在这些destination之间进行同步(synchronization)的能力。 在Flex中使用DataService 组件或ActionScript API可以连接到Data Management Service destination。
例子:



对上面配置的说明:1.Message channel的选择:当前的FluorineFx 只支持使用Realtime Message Protocol (RTMP) channel 传输Data Management Services。
2.Data adapter的设置:FluorineFx中的 Data adapter是由 FluorineFx.DotNetAdapter 类实现的:


 

你可能感兴趣的:(.net,properties,Microsoft,Flex,service,actionscript)