You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@hivemind.apache.org by "Offiah Raymond, Slough" <Ra...@aniteps.com> on 2005/05/25 12:37:16 UTC

Problems with configuration map

Hi there.

 

I'm trying to set up a basic configuration set as a map, but cannot get it
to run. Here's what I have in the hivemodule.xml file:

 

    <configuration-point id="Configuration">

        <schema>

            <element name="configuration" key-attribute="key">

                <attribute name="key" required="true"/>

                <attribute name="value" required="true"/>

 

                <rules>

                    <push-attribute attribute="value"/>

                    <invoke-parent method="addElement"/>

                </rules>

            </element>

        </schema>

    </configuration-point>

 

    <contribution configuration-id="Configuration">

        <!-- security service configuration -->

        <configuration key="default"

            value="com.borris.services.crypto.impl.provider.JavaCrypt"/>

        <configuration key="unix"

            value="com.borris.services.crypto.impl.provider.UnixCrypt"/>

        <configuration key="clear"

            value="com.borris.services.crypto.impl.provider.ClearCrypt"/>

        <configuration key="java"

            value="com.borris.services.crypto.impl.provider.JavaCrypt"/>

        <configuration key="oldjava"

            value="com.borris.services.crypto.impl.provider.OldJavaCrypt"/>

        <configuration key="cipher" value="MD5"/>

        <configuration key="algorithm" value="java"/>

 

        <!-- XML binding configuration -->

        <configuration key="dateformat" value="dd/MM/yyyy"/>

 

        <!-- general parameters -->

        <configuration key="passwordExpiryTimeInDays" value="30"/>

 

    </contribution>

 

    <service-point id="ConfigurationService"
interface="com.borris.services.security.utils.ConfigurationService">

        <invoke-factory>

            <construct
class="com.borris.services.security.utils.ConfigurationServiceImpl">

                <set-configuration property="data"
configuration-id="configuration"/>

            </construct>

        </invoke-factory>

    </service-point>

 

 

The Java class for this is:

 

public class ConfigurationServiceImpl implements ConfigurationService {

 

 

    private Map data;

 

 

    public void setData(Map data) {

 

        this.data = data;

 

    }

 

    public Map getData() {

        return data;

    }

 

}

 

 

I'm not sure if Java is even correct, but my first problem is that HiveMind
doesn't seem to understand the key-attribute

 

When I start up, I get this error

 

DescriptorParser [ERROR] Error at
file:/C:/projects/workspace/borris/exploded/WEB-INF/classes/META-INF/hivemod
ule.xml, line 6, column 63: Unknown attribute 'key-attribute' in element
module/configuration-point/schema/element.

 

Not sure where the problem is though. Any ideas?

 

 

Thanks

 



Scanned for viruses by MessageLabs. The integrity and security of this message cannot be guaranteed. This email is intended for the named recipient only, and may contain confidential information and proprietary material. Any unauthorised use or disclosure is prohibited.

Re: Problems with configuration map

Posted by Knut Wannheden <kn...@gmail.com>.
Raymond,

The "key-attribute" attribute requires HiveMind 1.1. That being said I
have a few other comments:

 - IDs are case sensitive. In your <set-configuration> element you
should use "Configuration" as the value for the "configuration-id"
attribute.

 - The contribution elements to your configuration will be simple
String instances. You could use a translator to instruct HiveMind to
create some kind of corresponding Java objects (e.g. Class instances).
As you seem to be using the same configuration for different "kinds"
of configuration data you could use the "object" translator along with
various object providers. As a further possibility the <schema> can
also define multiple top-level <element> elements, all with their own
set of attributes and conversion rules. They will all have to define a
"key-attribute" if you want to use the configuration as a Map.

Regards,

--knut

---------------------------------------------------------------------
To unsubscribe, e-mail: hivemind-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: hivemind-user-help@jakarta.apache.org