[flexcoders] Re: Programmatically managing BlazeDS ServerConfig

2008-12-21 Thread Michael Slinn
Cornel,

You are doing the opposite of what I am doing.  Instead of letting the
compiler generate the code to read the XML configuration files, and
then examining the variables, I am attempting to set the XML directly
and configure BlazeDS that way, without using data files bound into
the SWF.  The following comment in the ServerConfig source code led me
to believe that this should be possible: The XML source is provided
during the compilation process. However, there is currently no
internal restriction preventing the acquisition of this XML data by
other means, such as network, local file system, or shared object at
runtime. (Second paragraph of
http://opensource.adobe.com/svn/opensource/flex/sdk/trunk/frameworks/projects/rpc/src/mx/messaging/config/ServerConfig.as)

Here is a related bug: http://bugs.adobe.com/jira/browse/SDK-16073



[flexcoders] Re: Programmatically managing BlazeDS ServerConfig

2008-12-17 Thread cornelcreanga
I've tested using SDK 3.1.0 and the following XML is obtained from
ServerConfig.serverConfigData 

services
  service id=remoting-service/
  service id=proxy-service
destination id=DefaultHTTP
  channels
channel ref=my-amf/
  /channels
/destination
  /service
  service id=message-service/
  channels
channel id=my-amf type=mx.messaging.channels.AMFChannel
  endpoint
uri=http://{server.name}:{server.port}/WebContent/messagebroker/amf/
  properties/
/channel
channel id=my-polling-amf type=mx.messaging.channels.AMFChannel
  endpoint
uri=http://{server.name}:{server.port}/WebContent/messagebroker/amfpolling/
  properties
polling-enabled
  true
/polling-enabled
polling-interval-seconds
  4
/polling-interval-seconds
  /properties
/channel
channel id=my-secure-amf
type=mx.messaging.channels.SecureAMFChannel
  endpoint
uri=https://{server.name}:{server.port}/WebContent/messagebroker/amfsecure/
  properties/
/channel
  /channels
/services

So in my case when using channel instead of channel-definition the
E4X expression works. Can you take a look on the XML object
ServerConfig.serverConfigData and see what is the structure?



[flexcoders] Re: Programmatically managing BlazeDS ServerConfig

2008-12-16 Thread cornelcreanga
Try with
ServerConfig.serverConfigData.channels.elements(channel)@[id]

instead of

ServerConfig.serverConfigData.channels.elements(channel-definition)@[id]



[flexcoders] Re: Programmatically managing BlazeDS ServerConfig

2008-12-16 Thread Michael Slinn
That produces a null result, as it should.  The problem seems to be
with the call to ServerConfig.getChannel(channelName).  As I trace
through the call, I see a call to ServerConfig.createChannel('my-amf').

It evaluates xml.channels.channel.(@id == channelId); which of course
returns nothing because the appropriate E4X expression for the
supplied data should be
xml.channels.elements(channel-definition).(@id == channelId).

The only way I could imagine this working is if the XML were
rewritten, converting all 'channel-definition' elements to 'channel'
elements - or perhaps something along the call chain discards the
remainder of the element name when it encounters a dash.

I tested this out by renaming the channel-definition elements to
channel, and modifying the E4X expression to suit, but createChannel()
fails due to an empty string returned from the call to
channelConfig.attribute(CLASS_ATTR).toString().  CLASS_ATTR is defined
as type, and an attribute with that name is optional.

What's the secret?