Expressions in Config XML Files?

4 views
Skip to first unread message

Brian Klaas

unread,
May 27, 2009, 4:36:38 PM5/27/09
to Mach-II for CFML
I've looked through the wiki/Trac to try to figure out if the
Expression Language support in 1.8 allows us to do the following, and
my tests seem to indicate "no," but I thought I'd ask:

Can we use expressions inside of XML configuration files that are
parsed by the framework?

Example:

I've encapsulated my logging configuration in to an XML file that is
included in my application XML config file:

<includes>
<include file="config/environmentConfig.xml" />
<include file="config/coldspringProperty.xml" />
<include file="config/appGlobalsConfig.xml" />
<include file="config/loggingConfig.xml" />
</includes>

The appGlobalsConfig.xml file is really simple:

<mach-ii version="1.0">
<properties>
<property name="appGlobals" type="appRoot.properties.appGlobals" />
</properties>
</mach-ii>

In the loggingConfig.xml file, I have an email logger set up. What I'd
like to do is pull the value for a property established in the
appGlobal.cfc (referenced by the appGlobalsConfig.xml file) and use
that in my loggingConfig.xml file. For example, if I'd like to define
my email logger as follows:

<mach-ii version="1.0">
<properties>
<property name="Logging" type="MachII.logging.LoggingProperty">
<parameters>
<parameter name="MachIIEmailLog">
<struct>
<key name="type" value="MachII.logging.loggers.EmailLog.Logger" /
>
<key name="loggingEnabled">
<struct>
<key name="development,staging,production" value="true"/
>
</struct>
</key>
<key name="loggingLevel" value="fatal" />
<key name="to" value="${properties.adminEmail}" />
<key name="from" value="${properties.supportEmail}" />
<key name="subject" value="Fatal Exception Logged" />
</struct>
</parameter>
</parameters>
</property>
</properties>
</mach-ii>

The globalVars.adminEmail and globalVars.supportEmail do exist and are
created by the appGlobals property CFC referenced in the
appGlobalsConfig.xml file. However, running this code results in the
following error:

The required property is not defined to bind to a parameter named
'to'.

So are expressions not supported in the config XML files, or am I mis-
referencing the properties in my config XML?

Peter J. Farrell

unread,
May 27, 2009, 5:13:29 PM5/27/09
to mach-ii-for...@googlegroups.com
There is an inconsistency with expressions and where they can be used exactly.  The bindable property placeholder support came in 1.5 (which it is *not* expressions) and when used in listener/property/filter/plugin parameters it does *not* use the "properties." name space (anyways, event. cannot be used during configuration time).  Try just using ${nameOfProperty} here Brian.

Anyways, could you please file a ticket regarding this exception (meaning that you cannot use namespacing)?  There is an issue of backward compatibility here that needs to be addressed, but in general we should support "properties."

http://greatbiztoolsllc.trac.cvsdude.com/mach-ii/newticket

The issue is the EE and bindable property placeholder support is actually two different subsystems that both use ${} as keyword while EE uses namespaces and bindable property placeholders does not.  Just need to figure out how to merge them without breaking BC.

Best,
.Peter

Brian Klaas said the following on 05/27/2009 03:36 PM:

Brian Klaas

unread,
May 28, 2009, 10:10:37 AM5/28/09
to Mach-II for CFML
I've filed the ticket. My apologies for confusing bindable property
placeholders with expressions.

I tried using <key name="to" value="${adminEmail}" /> (adminEmail is a
property) in my loggingConfig.xml file and I still received the

The required property is not defined to bind to a parameter named
'to'.

error.

So it looks like I'll wait for the fix, or am I doing something else
wrong?

Thanks!
Reply all
Reply to author
Forward
0 new messages