Examples of ElementModelImpl


Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        // <element> is recursive ... possible, but tricky, if using Digester.

        if (elementName.equals("element"))
        {
            ElementModelImpl elementModel = (ElementModelImpl) peekObject();

            elementModel.addElementModel(enterElement(elementName));
            return;
        }

        unexpectedElement(elementName);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        element.setContent(peekContent());
    }

    private void enterAttribute(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        AttributeModelImpl attributeModel = new AttributeModelImpl();

        push(elementName, attributeModel, STATE_NO_CONTENT);

        checkAttributes();

        attributeModel.setName(getAttribute("name"));
        attributeModel.setRequired(getBooleanAttribute("required", false));
        attributeModel.setUnique(getBooleanAttribute("unique", false));
        attributeModel.setTranslator(getAttribute("translator", "smart"));

        elementModel.addAttributeModel(attributeModel);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        md.addContribution(cd);
    }

    private void enterConversion(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        ConversionDescriptor cd = new ConversionDescriptor(_errorHandler, elementModel);

        push(elementName, cd, STATE_CONVERSION);

        checkAttributes();

        cd.setClassName(getAttribute("class"));

        String methodName = getAttribute("parent-method");

        if (methodName != null)
            cd.setParentMethodName(methodName);

        elementModel.addRule(cd);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

    }

    private void enterCreateObject(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();
        CreateObjectRule rule = new CreateObjectRule();
        push(elementName, rule, STATE_NO_CONTENT);

        checkAttributes();

        rule.setClassName(getAttribute("class"));

        elementModel.addRule(rule);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        elementModel.addRule(rule);
    }

    private void enterCustom(String elementName)
    {
        ElementModelImpl elementModel = (ElementModelImpl) peekObject();

        // Don't know what it is going to be, yet.

        push(elementName, null, STATE_NO_CONTENT);

        checkAttributes();

        String ruleClassName = getAttribute("class");

        Rule rule = getCustomRule(ruleClassName);

        elementModel.addRule(rule);
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

     * Pushes STATE_ELEMENT onto the stack and creates and returns the {@link ElementModelImpl} it
     * creates.
     */
    private ElementModel enterElement(String elementName)
    {
        ElementModelImpl result = new ElementModelImpl();

        push(elementName, result, STATE_ELEMENT);

        checkAttributes();

        result.setElementName(getAttribute("name"));
        result.setKeyAttribute(getAttribute("key-attribute"));
        result.setContentTranslator(getAttribute("content-translator"));

        return result;
    }
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

public class TestSchemaProcessor extends HiveMindTestCase
{

    public void testGetContentTranslator()
    {
        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("fred");
        em.setContentTranslator("smart");

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        verifyControls();
    }

    public void testGetContentTranslatorUnspecified()
    {
        ElementModelImpl em = new ElementModelImpl();

        em.setElementName("fred");
        // No content handler specified

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadContentRule rule = new ReadContentRule();
        rule.setPropertyName("value");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        verifyControls();
    }

    public void testGetAttributeTranslator()
    {
        ElementModelImpl em = new ElementModelImpl();

        AttributeModelImpl am = new AttributeModelImpl();
        am.setName("wife");
        am.setTranslator("service");

        em.setElementName("fred");
        em.addAttributeModel(am);

        em.addRule(new CreateObjectRule(StringHolderImpl.class.getName()));

        ReadAttributeRule rule = new ReadAttributeRule();
        rule.setPropertyName("value");
        rule.setAttributeName("wife");

        em.addRule(rule);

        em.addRule(new InvokeParentRule("addElement"));

        SchemaImpl schema = new SchemaImpl();
        schema.addElementModel(em);

        SchemaProcessorImpl p = new SchemaProcessorImpl(null, schema);
View Full Code Here

Examples of org.apache.hivemind.schema.impl.ElementModelImpl

        // <element> is recursive ... possible, but tricky, if using Digester.

        if (elementName.equals("element"))
        {
            ElementModelImpl elementModel = (ElementModelImpl) peekObject();

            elementModel.addElementModel(enterElement(elementName));
            return;
        }

        unexpectedElement(elementName);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.