bluemagicsource / magic-config

bluemagic properties library
9 stars 6 forks source link

Implement a way to describe different decoration schemes #18

Open jackrod opened 12 years ago

jackrod commented 12 years ago

Currently we are supporting XML that will look for the following: abc.foo in testProperties.xml

We don't have a good way to represent: foo in abc.testProperties.xml

We need to research the most intuitive way to represent these two ideas in XML magic.xml file.

jackrod commented 12 years ago

As discussed earlier with Sean, it would be nice to collapse the XML structure ->

FROM:

<fileLocation file="testProperties.xml">
    <list>
        <location>
            <decorator method="prefix">
                <!-- CHECK ABC SPECIFIC FILE -->
                <hostnameTag />
            </decorator>
        </location>
        <location>
            <decorator method="prefix">
                <!-- CHECK HOST SPECIFIC FILE -->
                <singleTag>abc</singleTag>
            </decorator>
        </location>
    </list>
</fileLocation>

TO:

<fileLocation file="testProperties.xml">
    <list>
        <location>
            <locationDecorators>
                <hostnameTag method="prefix" />
            </locationDecorators>
            <keyDecorators>
                <singleTag method="prefix">abc</singleTag>
            </keyDecorators>
        </location>
    </list>
</fileLocation>

Magic-Config will evaluate above like so:

(1) Try location myserver.com.testProperties.xml for a key abc.database-url (2) MissingProperty

Open to new ideas and suggestions. ~Jack

sdobberstein commented 12 years ago
<magic>
    <commandLineLocation />

    <fileLocation folder="/home/me/properties/" />

    <fileLocation file="testProperties.xml">
        <attempt>
            <locationDecorators>
                <hostnameTag method="prefix" />
            </locationDecorators>

            <keyDecorators>
                <singleTag method="prefix">abc</singleTag>
                <singleTag method="prefix">def</singleTag>
            </keyDecorators>
        </attempt>
    </fileLocation>

    <webLocation uri="https://www.bluemagic.org/magic/property/">

        <attempt>
            <keyDecorators>
                <doubleTag method="suffix" key="version">1</doubleTag>
                <hostnameTag method="suffix" />
            </keyDecorators>
        </attempt>

        <attempt>
            <keyDecorators>
                <doubleTag method="suffix" key="version">1</doubleTag>
            </keyDecorators>
         </attempt>

    </webLocation>
</magic>
jackrod commented 12 years ago

The Attempt Class might be discouraged...