Results 1 to 5 of 5

Thread: PropertyPlaceholderConfigurer?

Hybrid View

  1. #1

    Default PropertyPlaceholderConfigurer?

    Does Prana support any concept like Spring's PropertyPlaceholderConfigurer? Also what about ResourceLoaders?
    Last edited by borfnorton; Dec 8th, 2008 at 03:49 PM.

  2. #2
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi,

    we support loading properties from a .properties file referenced in an application context xml file.

    Here's an example:
    Code:
    <objects xmlns="http://www.pranaframework.org/objects"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://www.pranaframework.org/objects http://www.pranaframework.org/schema...bjects-0.7.xsd ">
    
        <property file="application-context.properties.txt"/>
    
        <object id="remoteObject" class="mx.rpc.remoting.mxml.RemoteObject" abstract="true">
            <property name="endpoint" value="http://${host}:${port}/${context-root}/messagebroker/amf"/>
            <property name="showBusyCursor" value="true"/>
        </object>
    </objects>
    In application-context.properties.txt:

    Code:
    host=172.16.44.21
    port=8081
    context-root=server-web
    This is not implemented as a PropertyPlaceholderConfigurer though. The loading happens in the XMLObjectFactory. The parsing is implemented as an IXMLObjectDefinitionsPreprocessor. Check the PropertiesPreprocessor class for that.

    We currently don't support ResourceLoader, but I think we might refactor the XMLObjectFactory to use this.

    Do you have any specific use case where this functionality could be used?

    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

  3. #3

    Default

    Chris,
    My flex app is being used within MDM Zinc and Adobe AIR, so I am not loading the app via a webpage. Currently I load the context via an embedded XML file and passing that into the Prana context via "addConfig".

    My question is will the property file you mentioned above still work in this scenario? How will the context attempt to locate <property file="application-context.properties.txt"/>?

    Regarding ResourceLoaders, i already created my own use for this. My need stems from the ability to make it easier to embed and access things in an app. I created an EmbeddedResourceService, which takes a custom class that implements an IEmbedder interface. You then call embeddedResourceService.getResource([key]) and it yields a ByteArray of the data.

    The developer must simply create a custom class in the project that uses my library and he defines all the Embeds for his entire project there in one place, keying them by a unique name. This class must just implement the IEmbedder interface which defines an "getResource(key:String)" method.

    It helps to keep the overall app cleaner by centrally locating all Embeds for an application.

  4. #4
    Join Date
    Dec 2008
    Posts
    18

    Default

    I tried to move my my configuration data into a property file assuming that they follow the usual Java syntax until I found out that comments (lines starting with #) do not work at all. It would be desirable to be able to add comments for documentation purpose and to play with settings (like URLs) by commenting/uncommenting while debugging or testing.

    Thanks,
    Peter

  5. #5
    Join Date
    Oct 2008
    Location
    Belgium
    Posts
    160

    Default

    Hi Peter,

    I just committed a fix for this problem in the SVN repo. Thanks for reporting.

    Don't hesitate to add bugs and feature requests to the Jira. http://jira.springframework.org/brow...ACTIONSCRIPTAS

    regards,
    Christophe
    Christophe Herreman
    Spring ActionScript Founder
    http://www.herrodius.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •