Announcement Announcement Module
No announcement yet.
1.0RC1 - property files Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 1.0RC1 - property files

    Hi there,

    first of, congratulations to the whole SAS team on the RC1 release, awesome work guys.

    When I started playing around with it in a fairly complex project of mine, I noticed several things:

    There's a race condition when loading placeholders from multiple property files.
    In 50% of all cases the PropertyPlaceholderConfigurer won't be able to satisfy the placeholder requirements of the object definitions, resulting in an error when ignoreUnresolvablePlaceholders is set to false (default):

    Exception fault: Error: Could not resolve placeholder '${username}'
    	at org.springextensions.actionscript.utils::PropertyPlaceholderResolver/replacePropertyPlaceholder()
    Some way around this might be to merge all properties from all PropertyPlaceholderConfigurers
    (POC code illustrating the basics):

    public interface IPropertyPlaceholderConfigurer extends IObjectFactoryPostProcessor 
    	function get properties():Properties;
    	function set ignoreUnresolvablePlaceholders(value:Boolean):void;
    protected function invokeObjectFactoryPostProcessors():void 
    	var propertyPostProcessors:Array = [];
    	var nonPropertyPostProcessors:Array = [];
    	for each (var postProcessor:IObjectFactoryPostProcessor in _objectFactoryPostProcessors)
    		if (postProcessor is IPropertyPlaceholderConfigurer)
    	var previousPropertyProcessor:IPropertyPlaceholderConfigurer;
    	while(propertyPostProcessors.length > 0)
    		var propertyPostProcessor:IPropertyPlaceholderConfigurer = propertyPostProcessors.shift();
    		LOGGER.debug("Post processing object factory with PROPERTY post-processor '{0}'", propertyPostProcessor);
    		if (propertyPostProcessors.length > 0)
    			// there are more PropertyPlaceholderConfigurers after this one
    			// so we can defer the failing part to the very last one
    			propertyPostProcessor.ignoreUnresolvablePlaceholders = true;
    			// this is the last one, so we'll set the ignoreUnresolvable explicitly to false
    			propertyPostProcessor.ignoreUnresolvablePlaceholders = false;
    		if (previousPropertyProcessor)
    			// merge the properties with the previous property preprocessor;
    		// do the actual postprocessing
    		// set the previousPropertyProcessor reference
    		previousPropertyProcessor = propertyPostProcessor;
    	// invoke the rest of the IObjectFactoryPostProcessors
    	for each (var nonPropertyPostProcessor:IObjectFactoryPostProcessor in nonPropertyPostProcessors)
    		LOGGER.debug("Post processing object factory with post-processor '{0}'", nonPropertyPostProcessor);
    Of course something like this does not allow a per-node definition of the ignoreUnresolvablePlaceholders, but that's fine for me since I usually only have external properties that are mandatory anyway.

    Walking through the code I noted some differences from the behaviour in the docs:
    a) currently the properties file is loaded from a path relative to the .swf instead of the context
    b) the xml preprocessor for external files (PropertyImportPreprocessor) does not allow switching off the caching mechanism by setting "prevent-cache=false", as this property is never handled and the loader operations don't support this property (will be invoked by default with true).

    I'll create some jira tickets later on for these.


    Last edited by herb; Mar 8th, 2010, 12:42 PM. Reason: src formatting

  • #2

    Hey Herb,

    these are some valuable observations, thanks for taking the time to create some JIRA tickets for these, we'll try and take a look at this as soon as possible.




    • #3
      confirm issues

      Hi Guys,

      Awesome work with the new release!

      Just wanted to let you know i run in the exact same issues with property files. So this post is just to confirm that in the new release:
      1. property files are no more relative to the context.xml but to the swf
      2. i cannot turn of the force refresh option. There is always a random number in the url when the property file is loaded.

      Also great to see in the source code that you guys checked the applicationDomains everywhere where reflection is involved. This makes the framework superusable for modules / subapplications with their own contexts without running into problems. Awesome guys!



      • #4
        Hi guys,

        the preventCache problem is now fixed. This options is now available on the PropertyPlaceHolderConfigurer and passed down to the operations that load the properties.

        I'm still looking into the other issues.