hivemind-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael.Freri...@Sparkassen-Informatik.de
Subject Re: Provide runtime symbol source [Virus checked]
Date Fri, 04 Mar 2005 09:02:31 GMT
We solved this problem by implementing a RuntimeSymbolProvider:

The registry has to be build like this:

                ClassResolver resolver = new DefaultClassResolver();
                RegistryBuilder builder = new RegistryBuilder();

                        XmlModuleDescriptorProvider xmdp = new
XmlModuleDescriptorProvider(resolver);
                        builder.addModuleDescriptorProvider(xmdp);

                RuntimeSymbolProvider pmdp = new
RuntimeSymbolProvider(runtimeSymbols,
                        resolver);
                builder.addModuleDescriptorProvider(pmdp);

                _registry = builder.constructRegistry(Locale.getDefault());


where RuntimeSymbolProvider looks like:

package de.sparkasseninformatik.comserv.platform;

import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.Properties;
import org.apache.hivemind.ClassResolver;
import org.apache.hivemind.ErrorHandler;
import org.apache.hivemind.ModuleDescriptorProvider;
import org.apache.hivemind.impl.AttributeImpl;
import org.apache.hivemind.impl.ElementImpl;
import org.apache.hivemind.parse.ContributionDescriptor;
import org.apache.hivemind.parse.ModuleDescriptor;


/**
 * @author IE279
 */
public class RuntimeSymbolProvider implements ModuleDescriptorProvider
{
    private Properties _runtimeSymbols;
    private ClassResolver _resolver;

    /**
     *
     */
    public RuntimeSymbolProvider(Properties runtimeSymbols,
        ClassResolver resolver)
    {
        _runtimeSymbols = runtimeSymbols;
        _resolver = resolver;
    }

    /**
     * @see
org.apache.hivemind.ModuleDescriptorProvider#getModuleDescriptors(org.apache.hivemind.ErrorHandler)
     */
    public List getModuleDescriptors(ErrorHandler handler)
    {
        List result = new ArrayList();

        if ((_runtimeSymbols != null) && (_runtimeSymbols.size() > 0))
        {
            ModuleDescriptor md = new ModuleDescriptor(_resolver, handler);

md.setModuleId("de.sparkasseninformatik.comserv.platform.runtime");

            ContributionDescriptor cd = new ContributionDescriptor();

            cd.setConfigurationId("hivemind.ApplicationDefaults");

            for (Iterator iter = _runtimeSymbols.keySet().iterator();
                    iter.hasNext();)
            {
                String prop = (String) iter.next();
                ElementImpl element = new ElementImpl();
                element.setElementName("default");

                AttributeImpl symbol = new AttributeImpl("symbol", prop);
                AttributeImpl value = new AttributeImpl("value",
                        _runtimeSymbols.getProperty(prop));
                element.addAttribute(symbol);
                element.addAttribute(value);
                cd.addElement(element);
            }

            md.addContribution(cd);

            result.add(md);
        }

        return result;
    }
}

Mit freundlichen Grüßen

Michael Frericks
Internet/Homebanking MS/OF

Sparkassen Informatik GmbH & Co.KG
Nevinghoff 25
48147 Münster
Telefon: 0251/288-3489
Notes: Michael Frericks/4221/MS/SI/DE@Sparkassen-Informatik
E-Mail: michael.frericks@sparkassen-informatik.de


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


Mime
View raw message