Init commit of full project.

This commit is contained in:
Willem Cazander 2012-09-11 13:15:26 +02:00
parent 130d471bd9
commit 787b1174b0
286 changed files with 27010 additions and 1 deletions

View file

@ -0,0 +1,77 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.meta;
import java.util.Date;
import org.x4o.xml.core.config.X4OLanguagePropertyKeys;
import org.x4o.xml.meta.test.MTestParser;
import junit.framework.TestCase;
/**
* Tests a simple x4o meta xml language.
*
* @author Willem Cazander
* @version 1.0 Jul 24, 2006
*/
public class ReferenceStoreTest extends TestCase {
public void testMetaGeneric() throws Exception {
MTestParser parser = new MTestParser();
parser.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
parser.parseResource("tests/meta-generic.xml");
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
} finally {
parser.doReleasePhaseManual();
}
}
public void testLoadClass() throws Exception {
MTestParser parser = new MTestParser();
parser.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
parser.parseResource("tests/reference/store-ref.xml");
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
} finally {
parser.doReleasePhaseManual();
}
}
public void testStoreRef() throws Exception {
MTestParser parser = new MTestParser();
parser.setProperty(X4OLanguagePropertyKeys.PHASE_SKIP_RELEASE, true);
try {
parser.parseResource("tests/reference/store-ref.xml");
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(0).getElementObject().getClass().getName());
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(1).getElementObject().getClass().getName());
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(2).getElementObject().getClass().getName());
assertEquals(Date.class.getName(),parser.getElementLanguage().getRootElement().getChilderen().get(3).getElementObject().getClass().getName());
} finally {
parser.doReleasePhaseManual();
}
}
}

View file

@ -0,0 +1,43 @@
/*
* Copyright (c) 2004-2012, Willem Cazander
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are permitted provided
* that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this list of conditions and the
* following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
* the following disclaimer in the documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
* THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
* OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
* TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
package org.x4o.xml.meta.test;
import org.x4o.xml.core.X4ODriver;
import org.x4o.xml.core.X4OParser;
import org.x4o.xml.element.ElementLanguage;
public class MTestParser extends X4OParser {
public MTestParser() {
super("mtest");
}
public ElementLanguage getElementLanguage() {
return getDriver().getElementLanguage();
}
public X4ODriver getDriver() {
return super.getDriver();
}
}

View file

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<root:module
xmlns:root="http://eld.x4o.org/xml/ns/eld-root"
xmlns:eld="http://eld.x4o.org/xml/ns/eld-lang"
xmlns:conv="http://eld.x4o.org/xml/ns/eld-conv"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://eld.x4o.org/xml/ns/eld-root http://eld.x4o.org/xml/ns/eld-root-1.0.xsd"
providerName="mtest.x4o.org"
name="Meta Test Language"
id="mtest-lang"
>
<eld:namespace
uri="http://mtest.x4o.org/xml/ns/mtest-root"
schemaUri="http://mtest.x4o.org/xml/ns/mtest-root-1.0.xsd"
schemaResource="mtest-root-1.0.xsd"
schemaPrefix="mroot"
name="MTest Root Namespace"
languageRoot="true"
>
<!-- Root Element for nice namespace'ing -->
<eld:element tag="root" objectClass="java.lang.Object">
<eld:description>The test root element.</eld:description>
</eld:element>
</eld:namespace>
<eld:namespace
uri="http://mtest.x4o.org/xml/ns/mtest-lang"
schemaUri="http://mtest.x4o.org/xml/ns/mtest-lang-1.0.xsd"
schemaResource="mtest-lang-1.0.xsd"
schemaPrefix="mlang"
name="MTest Language Namespace"
>
<eld:element tag="date" objectClass="java.util.Date"/>
<eld:element tag="JFrame" objectClass="javax.swing.JFrame"/>
<eld:element tag="JLabel" objectClass="javax.swing.JLabel"/>
<eld:element tag="JPanel" objectClass="javax.swing.JPanel"/>
<eld:element tag="JTextField" objectClass="javax.swing.JTextField"/>
<eld:element tag="JTextArea" objectClass="javax.swing.JTextArea"/>
<eld:element tag="JScrollPane" objectClass="javax.swing.JScrollPane"/>
</eld:namespace>
</root:module>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<modules version="1.0"
xmlns="http://language.x4o.org/xml/ns/modules"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://language.x4o.org/xml/ns/modules http://language.x4o.org/xml/ns/modules-1.0.xsd"
>
<language version="1.0">
<eld-resource>mtest-lang.eld</eld-resource>
<sibling-loader>org.x4o.xml.meta.MetaLanguageSiblingLoader</sibling-loader>
</language>
</modules>

View file

@ -0,0 +1,39 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<tree:root
xmlns:tree="http://mtest.x4o.org/xml/ns/mtest-root"
xmlns:mt="http://mtest.x4o.org/xml/ns/mtest-lang"
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
>
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
<mt:JLabel>
<x4o:property name="text" value="label text"/>
<x4o:method method="validate"/>
<x4o:parentObject>
<x4o:property name="text" value="label text2"/>
</x4o:parentObject>
</mt:JLabel>
</tree:root>

View file

@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<tree:root
xmlns:tree="http://mtest.x4o.org/xml/ns/mtest-root"
xmlns:mt="http://mtest.x4o.org/xml/ns/mtest-lang"
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
>
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
<x4o:elReference el.id="date1" el.ref="date0"/>
<x4o:elReference el.id="date2" el.ref="date0"/>
<x4o:elReference el.id="date3" el.ref="date0"/>
</tree:root>

View file

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<x4o:root xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang">
<x4o:bean el.id="date0" bean.class="java.util.Date"/>
<x4o:template el.id="superBean">
<x4o:bean bean.class="org.x4o.xml.core.TestBean"
privateIntegerTypeField="333"
privateIntegerObjectField="333"
privateLongTypeField="333"
privateLongObjectField="333"
privateDoubleTypeField="333.333"
privateDoubleObjectField = "333.333"
privateFloatTypeField="333.333"
privateFloatObjectField="333.333"
privateByteTypeField="333"
privateByteObjectField="333"
privateBooleanTypeField="true"
privateBooleanObjectField="true"
privateCharTypeField="W"
privateCharObjectField="C"
privateStringObjectField="x4o"
privateDateObjectField="${date0}"
/>
</x4o:template>
<x4o:bean el.id="bean1" el.template="superBean" privateLongTypeField="444"/>
<x4o:bean el.id="bean2" el.template="superBean" privateBooleanTypeField="false"/>
<x4o:bean el.id="bean3" el.template="superBean" privateStringObjectField="testTemplate"/>
<x4o:forLoop var="item" value="">
<x4o:bean el.id="bean1" el.template="superBean" privateStringObjectField="${item}"/>
</x4o:forLoop>
<x4o:for start="0" stop="200" var="i">
<entry key="prop${i}" parent.template="${defaultProp}">value${i+250}</entry>
</x4o:for>
</x4o:root>

View file

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright (c) 2004-2012, Willem Cazander
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided
that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this list of conditions and the
following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
the following disclaimer in the documentation and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-->
<x4o:root xmlns:test="http://test.x4o.org/xml/ns/test"
xmlns:x4o="http://meta.x4o.org/xml/ns/meta-lang"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://meta.x4o.org/xml/ns/meta-lang http://meta.x4o.org/xml/xsd/meta-lang/1
http://test.x4o.org/xml/ns/test http://test.x4o.org/xml/ns/test-1.0.xsd"
>
<x4o:template el.id="master1">
<test:testObjectChild el.id="CHILD1" name="CHILD1" price="123" size="123.45"/>
</x4o:template>
<test:testObjectChild el.id="child1" size="123.99" x4o.template="master1"/>
<x4o:template el.id="master2">
<test:testObjectChild el.id="CHILD2" name="CHILD2" price="2323" size="23.24"/>
</x4o:template>
<x4o:elReference el.id="child2" el.ref="child2" x4o.template="master2"/>
<test:testObjectParent el.id="parent2">
<x4o:templateTag template="${master2}"/>
</test:testObjectParent>
</x4o:root>