« Return to Thread: Default value for symbol

Re: Default value for symbol

by Davor Hrg :: Rate this Message:

Reply to Author | View in Thread

contributing to ApplicationDefaults is the way to go,
you just need to make sure your symbolSource is called before ApplicationDefaults

for example
look at : http://hivemind.apache.org/hivemind1/hivedocs/config/hivemind.SymbolSources.html

<source before="hivemind.FactoryDefaults" name="hivemind.ApplicationDefaults" service-id="ApplicationDefaultsSymbolSource" />
<source name="hivemind.FactoryDefaults" service-id="FactoryDefaultsSymbolSource" />


add your symbol source like this
<source before="hivemind.ApplicationDefaults" name="MySource" service-id="MySymbolSource" />


Hrg

On 10/17/07, locutuz <Sebastian.Klein@...> wrote:

Hi everyone,

I have a contribution where an attribute is defined with a symbol, see
below:

<config myNewAttribute="${my.new.symbol}" ...


To fill this symbol with data at runtime, there is a properties file
(myProps.properties)
my.new.symbol=The value

So far this works fine.
But there are some cases, where this properties file doesn´t exist already,
so at runtime an error message appears, telling me that there is no value
for that symbol
(org.apache.hivemind.impl.SymbolExpander    : Error
at...META-INF/hivemodule.xml, line 146, column 7: No value available for
symbol 'my.new.symbol'.).

Off course not, because the properties file doesn´t exist where the value is
get from.
My question is, if there is a possibility to set a default-value for a
symbol, if it can´t be expanded by the SymbolExpander?

I tried to set the value with the <default> element.
      <contribution configuration-id="hivemind.ApplicationDefaults">
                <default symbol=" my.new.symbol" value="DEFAULT" />
        </contribution>

The problem here is, that at runtime the value for 'myNewAttribute' is
'DEFAULT' in any case, regardless if the value can be read from the
properties file. i.e. if the symbol should be expanded by the
SymbolExpander.

Thanks for your help in advance!

Regards,
Sebastian

--
View this message in context: http://www.nabble.com/Default-value-for-symbol-tf4639273.html#a13250295
Sent from the Hivemind - User mailing list archive at Nabble.com.


 « Return to Thread: Default value for symbol