Package org.jdom.input

Examples of org.jdom.input.DefaultJDOMFactory


        String filename = "/home/pcameron/repository1902.mdpr";
        DeviceRepositoryAccessorManager dram = null;
        try {
            dram = new DeviceRepositoryAccessorManager(
                    filename, new JAXPTransformerMetaFactory(),
                    new DefaultJDOMFactory(), false);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (RepositoryException e) {
            e.printStackTrace();
        }
View Full Code Here


        String filename = "/tmp/devices.mdpr";
        try {
            deviceRAM = new DeviceRepositoryAccessorManager(
                    filename, new JAXPTransformerMetaFactory(),
                    new DefaultJDOMFactory(), false);
        } catch (IOException e) {
            e.printStackTrace();
        } catch (RepositoryException e) {
            e.printStackTrace();
        }
View Full Code Here

    private void addMultiTypeElementTest(PolicyTypeComposition composition,
                                         PolicyType policyType,
                                         String expectedElementName,
                                         String expectedSubElementName) {

        JDOMFactory factory = new DefaultJDOMFactory();
        Element policy = factory.element("policy");
        composition.addTypeElement(policy, policyType, factory);
        assertEquals("There should be a single child element of policy.",
                1, policy.getChildren().size());
        Element type = (Element) policy.getChildren().get(0);
        assertEquals("Expected a " +
View Full Code Here

     * single valued PolicyType to be added.
     */
    private void addSingleTypeElementTest(PolicyType policyType,
                                          String expectedElementName) {

        JDOMFactory factory = new DefaultJDOMFactory();
        Element policy = factory.element("policy");
        PolicyTypeComposition.SINGLE.addTypeElement(policy, policyType,
                factory);
        assertEquals("There should be a single child element of policy.",
                1, policy.getChildren().size());
        Element type = (Element) policy.getChildren().get(0);
View Full Code Here

    /**
     * The that addTypeElement works with a STRUCTURE PolicyTypeComposition.
     */
    public void testAddTypeElementStructure() {

        JDOMFactory factory = new DefaultJDOMFactory();
        Element policy = factory.element("policy");
        PolicyTypeComposition.STRUCTURE.addTypeElement(policy,
                PolicyType.EMULATE_EMPHASIS_TAG, factory);
        assertEquals("There should be a single child element of policy.",
                1, policy.getChildren().size());
        Element type = (Element) policy.getChildren().get(0);
View Full Code Here

    /**
     * TestPolicyTypeComposition.ORDERED_SET#canHandleType(Element).
     */
    public void testOrderedSetCanHandleTypeElement() throws Exception {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element type = factory.element(DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_TYPE_ELEMENT_NAME);
        Element orderedSet = factory.element(
                DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_ORDEREDSET_ELEMENT_NAME);
        type.addContent(orderedSet);

        assertTrue("Should be able to handle an " +
View Full Code Here

    /**
     * TestPolicyTypeComposition.UNORDERED_SET#canHandleType(Element).
     */
    public void testUnorderedSetCanHandleTypeElement() throws Exception {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element type = factory.element(DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_TYPE_ELEMENT_NAME);
        Element orderedSet = factory.element(
                DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_UNORDEREDSET_ELEMENT_NAME);
        type.addContent(orderedSet);

        assertTrue("Should be able to handle an " +
View Full Code Here

     * Helper method that creates the type element for the given policy type.
     * @param policyType the policy type
     * @return the type element
     */
    private Element createTypeElement(PolicyType policyType) {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element type = factory.element(DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_TYPE_ELEMENT_NAME);
        // this is a bit clumsy
        if (policyType == PolicyType.EMULATE_EMPHASIS_TAG) {
            type.setAttribute(DeviceRepositorySchemaConstants.
                                POLICY_DEFINITION_TYPE_NAME_ATTRIBUTE_NAME,
                              PolicyType.EMULATE_EMPHASIS_TAG.getName());
        }
        Element element = factory.element(
                policyType.getName());
        type.addContent(element);
        return type;
    }
View Full Code Here

    /**
     * Test canHandleType(Element) with a StuctureComposition.
     */
    public void testCanHandleTypeElementStructure() {
        JDOMFactory factory = new DefaultJDOMFactory();
        Element type = factory.element(DeviceRepositorySchemaConstants.
                POLICY_DEFINITION_TYPE_ELEMENT_NAME);
        Element range = factory.element("range");
        type.addContent(range);
        assertFalse("Should not be able handle type with no name attribute",
                PolicyTypeComposition.STRUCTURE.canHandleType(type));

        range.detach();
View Full Code Here

                DeviceRepositoryAccessorManager deviceRAM =
                        new DeviceRepositoryAccessorManager(
                                repository.getPath(),
                                new TestTransformerMetaFactory(),
                                new DefaultJDOMFactory(), false);

                PolicyValueModifier pvMod = composition.
                        createPolicyValueModifier(SHELL, SWT.NONE,
                                policyName, deviceRAM);
View Full Code Here

TOP

Related Classes of org.jdom.input.DefaultJDOMFactory

Copyright © 2018 www.massapicom. 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.